qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
313,124
<p>For my wordpress website plain permalinks are not working. The post url is changing but when we click on the post its not redirecting to the post page. It will be in the home page itself.</p> <p>For example:</p> <pre><code>http://example.com/?p=14523 </code></pre> <p>If I change the permalinks to other custom for...
[ { "answer_id": 313131, "author": "MrWhite", "author_id": 8259, "author_profile": "https://wordpress.stackexchange.com/users/8259", "pm_score": 2, "selected": true, "text": "<p>Plain permalinks of the form <code>/?p=14523</code> (or <code>/index.php?p=14523</code>) don't necessarily need ...
2018/09/02
[ "https://wordpress.stackexchange.com/questions/313124", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149810/" ]
For my wordpress website plain permalinks are not working. The post url is changing but when we click on the post its not redirecting to the post page. It will be in the home page itself. For example: ``` http://example.com/?p=14523 ``` If I change the permalinks to other custom formats, it works correctly and show...
Plain permalinks of the form `/?p=14523` (or `/index.php?p=14523`) don't necessarily need any `.htaccess` file since they don't require mod\_rewrite to rewrite the URL (unlike the the *custom permalinks* you mention). However, for a URL of the form `/?p=14523` (as opposed to `/index.php?p=14523`), where you don't expl...
313,180
<p>The goal is to make my hidden Wordpress site go from <a href="http://example.com/subdir" rel="nofollow noreferrer">http://example.com/subdir</a> (which I have now) to replace the olde site at <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> (which is what I want when I take my WP site li...
[ { "answer_id": 313181, "author": "Petr Cibulka", "author_id": 28718, "author_profile": "https://wordpress.stackexchange.com/users/28718", "pm_score": 2, "selected": true, "text": "<p>You can search and replace every occurence of \"<a href=\"http://example.com/subdir\" rel=\"nofollow nore...
2018/09/03
[ "https://wordpress.stackexchange.com/questions/313180", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147934/" ]
The goal is to make my hidden Wordpress site go from <http://example.com/subdir> (which I have now) to replace the olde site at <http://example.com> (which is what I want when I take my WP site live). In previous questions this article came up in regard to changing the URLs: <https://codex.wordpress.org/Giving_WordPres...
You can search and replace every occurence of "<http://example.com/subdir>" in the database with "<http://example.com>". If you're comfortable with [WP-CLI](https://wp-cli.org/), [there is command for that](https://developer.wordpress.org/cli/commands/search-replace/): ``` $ wp search-replace 'http://example.com/sub...
313,234
<p>As the title says, I want to create a different permalink structure for posts belonging to a certain category, in my case, the name is "ICO". I've found this piece of code on StackExchange, but it doesn't really do anything for me, contrary to the OPs feedback.</p> <p>The code is:</p> <pre><code>//Rewrite URLs for...
[ { "answer_id": 354491, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 1, "selected": false, "text": "<p>(I know this is a late answer, so the original poster has probably moved on from this. But I am posting an...
2018/09/03
[ "https://wordpress.stackexchange.com/questions/313234", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/146931/" ]
As the title says, I want to create a different permalink structure for posts belonging to a certain category, in my case, the name is "ICO". I've found this piece of code on StackExchange, but it doesn't really do anything for me, contrary to the OPs feedback. The code is: ``` //Rewrite URLs for "ICO" category add_f...
(I know this is a late answer, so the original poster has probably moved on from this. But I am posting an answer to this in hopes that it will help later users solve their issue, should they happen along to this question.) The first step is understanding how email works in WordPress. WP will use `wp_mail()` to send m...
313,245
<p>I've a query like this:</p> <pre><code>&lt;ul&gt; &lt;?php $the_query = new WP_Query( array( 'cat' =&gt; '1', 'posts_per_page' =&gt; 5 ) ); ?&gt; &lt;?php while ($the_query -&gt; have_posts()) : $the_query -&gt; the_post(); ?&gt; &lt;li&gt; &lt;?php if ( has_post_thumbnail()) : ?&gt; &lt;?php the_post_thumbnail...
[ { "answer_id": 354491, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 1, "selected": false, "text": "<p>(I know this is a late answer, so the original poster has probably moved on from this. But I am posting an...
2018/09/03
[ "https://wordpress.stackexchange.com/questions/313245", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149891/" ]
I've a query like this: ``` <ul> <?php $the_query = new WP_Query( array( 'cat' => '1', 'posts_per_page' => 5 ) ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <li> <?php if ( has_post_thumbnail()) : ?> <?php the_post_thumbnail(array(230,163)); ?> <?php endif; ?> <a href="<?php the_pe...
(I know this is a late answer, so the original poster has probably moved on from this. But I am posting an answer to this in hopes that it will help later users solve their issue, should they happen along to this question.) The first step is understanding how email works in WordPress. WP will use `wp_mail()` to send m...
313,247
<p>I have added a custom post status of rejected, working just fine.</p> <p>I want to add the post status to the body of the post when it is being previewed. In order to style a front end information box seen by the admin.</p>
[ { "answer_id": 313248, "author": "Scott", "author_id": 111485, "author_profile": "https://wordpress.stackexchange.com/users/111485", "pm_score": 2, "selected": true, "text": "<p>You'll have to use the <code>body_class</code> hook in the <code>functions.php</code> file of your theme in co...
2018/09/03
[ "https://wordpress.stackexchange.com/questions/313247", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125332/" ]
I have added a custom post status of rejected, working just fine. I want to add the post status to the body of the post when it is being previewed. In order to style a front end information box seen by the admin.
You'll have to use the `body_class` hook in the `functions.php` file of your theme in combination with `get_post_status()` function. Like the following: ``` add_filter( 'body_class', 'custom_class' ); function custom_class( $classes ) { if ( get_post_status() == 'rejected' ) { $classes[] = 'rejected'; ...
313,290
<p>I'd like to enable this plugin <a href="https://responsivevoice.com/wordpress-text-to-speech-plugin/" rel="nofollow noreferrer">https://responsivevoice.com/wordpress-text-to-speech-plugin/</a> as default for every article's body in my wordpress site.</p> <p>I need to edit my article template and the final result sh...
[ { "answer_id": 313307, "author": "SmurfXXX", "author_id": 149929, "author_profile": "https://wordpress.stackexchange.com/users/149929", "pm_score": 1, "selected": false, "text": "<p>Thanks to @kero I have implemented this code:</p>\n\n<pre><code>&lt;?php echo do_shortcode('[responsivevoi...
2018/09/04
[ "https://wordpress.stackexchange.com/questions/313290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149929/" ]
I'd like to enable this plugin <https://responsivevoice.com/wordpress-text-to-speech-plugin/> as default for every article's body in my wordpress site. I need to edit my article template and the final result should be ``` [responsivevoice voice="UK English Female" buttontext="Listen to this"] The body article [/resp...
Thanks to @kero I have implemented this code: ``` <?php echo do_shortcode('[responsivevoice voice="Italian Female" buttontext="Ascolta"]'.'<br>'.$bodyContent.'[/responsivevoice]'); ?> ``` The $bodyContent variable contains the HTML value of the article's body, obtained using this function: <http://www.web-templates....
313,294
<p>I've setup the multisite on a fresh installation of WordPress.</p> <p>Then I created some other websites, so, in the end, I have something like this</p> <ul> <li><a href="http://example.com" rel="nofollow noreferrer">http://example.com</a></li> <li><a href="http://site1.example.com" rel="nofollow noreferrer">http:...
[ { "answer_id": 313384, "author": "D. Dan", "author_id": 133528, "author_profile": "https://wordpress.stackexchange.com/users/133528", "pm_score": 2, "selected": true, "text": "<p>I would suggest editing the <code>wp-config.php</code> file, and adding:</p>\n\n<pre><code>define('WP_HOME','...
2018/09/04
[ "https://wordpress.stackexchange.com/questions/313294", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57145/" ]
I've setup the multisite on a fresh installation of WordPress. Then I created some other websites, so, in the end, I have something like this * <http://example.com> * <http://site1.example.com> * <http://site2.example.com> * <http://site3.example.com> I have then installed an SSL digital certificate, so I changed th...
I would suggest editing the `wp-config.php` file, and adding: ``` define('WP_HOME','https://example.com'); define('WP_SITEURL','https://example.com'); ``` **However for multisite** [here](https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite) it says you should edit `DOMAIN_CURRENT_SITE` and `PATH_...
313,419
<p>I'd like to get it so that all of my sites have a different color admin bar. Dev Staging and Production. I use Git to push my code.</p> <p>Any help would be appreciated.</p>
[ { "answer_id": 313420, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 2, "selected": false, "text": "<p>You can use a filter to set the admin color scheme, which includes colors for the admin bar:</p>\n\n<pre>...
2018/09/05
[ "https://wordpress.stackexchange.com/questions/313419", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65294/" ]
I'd like to get it so that all of my sites have a different color admin bar. Dev Staging and Production. I use Git to push my code. Any help would be appreciated.
You can use a filter to set the admin color scheme, which includes colors for the admin bar: ``` <?php // add a filter add_filter('get_user_option_admin_color', 'wpse_313419_conditional_admin_color'); // function wpse_313419_conditional_admin_color($result) { // Dev: use 'light' color scheme if(get_site_url()...
313,424
<p>I have setup wordpress on my server, and after some time I've changed the domain name of the installation. However, all of the old urls within the site point to the old domain. <strong>How can I change old urls to match the new domain without breaking the database?</strong></p> <p>Here's what I did: I went to setti...
[ { "answer_id": 313426, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 1, "selected": false, "text": "<p>You could use CLI. No reason to have any references to the old domain.</p>\n\n<p>Another option I recommend i...
2018/09/05
[ "https://wordpress.stackexchange.com/questions/313424", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140043/" ]
I have setup wordpress on my server, and after some time I've changed the domain name of the installation. However, all of the old urls within the site point to the old domain. **How can I change old urls to match the new domain without breaking the database?** Here's what I did: I went to settings -> general I've cha...
Two possible easy ways to replace Old website URL to New Website URL: **1/ Directly replace in SQL file:** Export the database and open SQL file. Manually find and replace old website URL with new website URL. Once replace is done, save and import database again. **2/ Use Migrate DB plugin:** Use the third-party Word...
313,442
<p>I am having a search result page for custom post type. I want to have a ajax sorting feature. Eg sort the post by taxonomy without reloading the page. A very basic example will help. Thanks <a href="https://i.stack.imgur.com/gdk1Y.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/gdk1Y.jpg" alt="enter image ...
[ { "answer_id": 313426, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 1, "selected": false, "text": "<p>You could use CLI. No reason to have any references to the old domain.</p>\n\n<p>Another option I recommend i...
2018/09/05
[ "https://wordpress.stackexchange.com/questions/313442", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am having a search result page for custom post type. I want to have a ajax sorting feature. Eg sort the post by taxonomy without reloading the page. A very basic example will help. Thanks [![enter image description here](https://i.stack.imgur.com/gdk1Y.jpg)](https://i.stack.imgur.com/gdk1Y.jpg) The Search Form : ``...
Two possible easy ways to replace Old website URL to New Website URL: **1/ Directly replace in SQL file:** Export the database and open SQL file. Manually find and replace old website URL with new website URL. Once replace is done, save and import database again. **2/ Use Migrate DB plugin:** Use the third-party Word...
313,453
<p>I want to display list of custom taxonomies as a dropdown list.</p> <p>I've found the solution here, @alexufo 's answer</p> <p><a href="https://wordpress.stackexchange.com/questions/50077/display-a-custom-taxonomy-as-a-dropdown-on-the-edit-posts-page/148965#148965">Display a custom taxonomy as a dropdown on the ed...
[ { "answer_id": 313468, "author": "dhirenpatel22", "author_id": 124380, "author_profile": "https://wordpress.stackexchange.com/users/124380", "pm_score": 2, "selected": false, "text": "<p>Below is the easiest solution I use for displaying custom taxonomy as the dropdown instead of checkbo...
2018/09/05
[ "https://wordpress.stackexchange.com/questions/313453", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/148290/" ]
I want to display list of custom taxonomies as a dropdown list. I've found the solution here, @alexufo 's answer [Display a custom taxonomy as a dropdown on the edit posts page](https://wordpress.stackexchange.com/questions/50077/display-a-custom-taxonomy-as-a-dropdown-on-the-edit-posts-page/148965#148965) But the p...
Finally I found the solution after some trials and error. In the registering taxonomy arguments, I just had to set `'hierarchical' => true` for it to stop incrementing taxonomy and keep adding taxonomy automatically. I'm not sure as to why that was causing the problem after going through documents, If anyone knows th...
313,520
<p>I am trying to get the page title to show up inside various h1, h2 and p tags that i have part of the page template - so that when the template is applied to a page it will make the current page's page title appear wherever I add a shortcode or whatever is needed to pull the page title. When I add the following i am...
[ { "answer_id": 313521, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 3, "selected": true, "text": "<p><code>get_the_title()</code> does not output anything - it's meant for being saved to a variable. Use just...
2018/09/06
[ "https://wordpress.stackexchange.com/questions/313520", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150112/" ]
I am trying to get the page title to show up inside various h1, h2 and p tags that i have part of the page template - so that when the template is applied to a page it will make the current page's page title appear wherever I add a shortcode or whatever is needed to pull the page title. When I add the following i am ge...
`get_the_title()` does not output anything - it's meant for being saved to a variable. Use just `the_title();` in its place - that way it will be output. :)
313,553
<p>I'm using the PODS WordPress Framework which is amazing.</p> <p>I created a template with one of the fields publishing the date of an event which is done through a simple 'magic tag' like this </p> <pre><code>{@date_of_event} </code></pre> <p>This publishes the date in this format: <strong>September, 15th 2018</...
[ { "answer_id": 313561, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": true, "text": "<p>You can use the PHP's <a href=\"http://php.net/manual/en/function.strtotime.php\" rel=\"nofollow noreferrer...
2018/09/07
[ "https://wordpress.stackexchange.com/questions/313553", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93691/" ]
I'm using the PODS WordPress Framework which is amazing. I created a template with one of the fields publishing the date of an event which is done through a simple 'magic tag' like this ``` {@date_of_event} ``` This publishes the date in this format: **September, 15th 2018** What I need to do is change the format...
You can use the PHP's [`strtotime()`](http://php.net/manual/en/function.strtotime.php) and WordPress's [`date_i18n()`](http://developer.wordpress.org/reference/functions/date_i18n/) functions: ``` function MY_FUNCTION( $input ) { // Removes commas so that we'll get the proper timestamp. Otherwise, the // strto...
313,619
<p>I've inherited a theme and am trying to get my head around a plugin failure.</p> <p>There is an index.php file in the root of the theme, is that the first file wordpress will look at when it attempts to resolve the homepage or maybe it is something else? </p> <p>All files in the the root are as follows:</p> <pre>...
[ { "answer_id": 313625, "author": "Andy P", "author_id": 150184, "author_profile": "https://wordpress.stackexchange.com/users/150184", "pm_score": 4, "selected": true, "text": "<p>If it's the home page, WordPress will look for the following files in this order and use the first one it fin...
2018/09/07
[ "https://wordpress.stackexchange.com/questions/313619", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71456/" ]
I've inherited a theme and am trying to get my head around a plugin failure. There is an index.php file in the root of the theme, is that the first file wordpress will look at when it attempts to resolve the homepage or maybe it is something else? All files in the the root are as follows: ``` 404.php archive-jetpac...
If it's the home page, WordPress will look for the following files in this order and use the first one it finds: ``` 1. front-page.php 2. home.php 3. index.php ``` WordPress template hierarchy is described in detail here: <https://developer.wordpress.org/themes/basics/template-hierarchy/> > > This article explain...
313,630
<p>I am following this <a href="https://codex.wordpress.org/Function_Reference/register_taxonomy" rel="nofollow noreferrer">link</a> and copy pasted the below code in my functions.php file</p> <pre><code>&lt;?php // hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_boo...
[ { "answer_id": 313625, "author": "Andy P", "author_id": 150184, "author_profile": "https://wordpress.stackexchange.com/users/150184", "pm_score": 4, "selected": true, "text": "<p>If it's the home page, WordPress will look for the following files in this order and use the first one it fin...
2018/09/07
[ "https://wordpress.stackexchange.com/questions/313630", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131473/" ]
I am following this [link](https://codex.wordpress.org/Function_Reference/register_taxonomy) and copy pasted the below code in my functions.php file ``` <?php // hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_book_taxonomies' ); // create two taxonomies, genres and...
If it's the home page, WordPress will look for the following files in this order and use the first one it finds: ``` 1. front-page.php 2. home.php 3. index.php ``` WordPress template hierarchy is described in detail here: <https://developer.wordpress.org/themes/basics/template-hierarchy/> > > This article explain...
313,663
<p>For the default taxonomy i.e category , I want custom permalinks with </p> <pre><code>i) base = "post/c" and ii) without any parent slug </code></pre> <p>For eg: if I have categories </p> <pre><code>cat-a subcat-a1 subcat-a2 cat-b subcat-a2 subcat-a2 </code></pre> <p>so I want permalinks like </...
[ { "answer_id": 314075, "author": "David Corp", "author_id": 129246, "author_profile": "https://wordpress.stackexchange.com/users/129246", "pm_score": -1, "selected": false, "text": "<p>if you will add post id in url anywhere then it will easy otherwise your post title must be unique. So ...
2018/09/08
[ "https://wordpress.stackexchange.com/questions/313663", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/55034/" ]
For the default taxonomy i.e category , I want custom permalinks with ``` i) base = "post/c" and ii) without any parent slug ``` For eg: if I have categories ``` cat-a subcat-a1 subcat-a2 cat-b subcat-a2 subcat-a2 ``` so I want permalinks like example.com/post/c/cat-a example.com/post/c/subcat-a...
All you have to do to achieve this is to modify the `category` taxonomy arguments by using `register_taxonomy()` again at the `init` hook after the `category` taxonomy has been registered. This can be done with any taxonomy as in the following snippet. **Code for Taxonomies in General (Code for this use case below):**...
313,726
<p>I'm creating a plugin and I've put:</p> <pre><code>define ('WPLANG', 'it_IT'); </code></pre> <p>into <code>wp-config.php</code> file.</p> <p>After plugin Name in the Header of the Plugin declaration:</p> <pre><code>* Text Domain: endpoint * Domain Path: /languages/ </code></pre> <p>For the load domain:</p> <pr...
[ { "answer_id": 313743, "author": "Salvio", "author_id": 106644, "author_profile": "https://wordpress.stackexchange.com/users/106644", "pm_score": 0, "selected": false, "text": "<p>Ok I made a mistake with dirname (<strong>FILE</strong>) . /languages/ and the fact that debuggin via load_p...
2018/09/09
[ "https://wordpress.stackexchange.com/questions/313726", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106644/" ]
I'm creating a plugin and I've put: ``` define ('WPLANG', 'it_IT'); ``` into `wp-config.php` file. After plugin Name in the Header of the Plugin declaration: ``` * Text Domain: endpoint * Domain Path: /languages/ ``` For the load domain: ``` add_action( 'plugins_loaded', 'myplugin_load_textdomain' ); function ...
1) Presuming you're running WordPress 4.x. The `WPLANG` constant does nothing. WordPress 3 and below defined the default language in `wp-config.php` but since WordPress 4 setting your site language is done via the General Settings page in your admin area. Go to *Settings > General* and scroll to the bottom where is say...
313,795
<p>I am trying to extend the Gutenberg <code>core/gallery</code> block to add some new functionality to my image gallery on the frontend. I have created a separate plugin to handle this task. I have registered my script with the following code:</p> <pre><code>function mt_enqueue_gutenberg(){ wp_enqueue_script( ...
[ { "answer_id": 313969, "author": "Andreas", "author_id": 150311, "author_profile": "https://wordpress.stackexchange.com/users/150311", "pm_score": 5, "selected": true, "text": "<p><strong>Answering my own question:</strong></p>\n\n<p>As suggested by <a href=\"https://wordpress.stackexcha...
2018/09/10
[ "https://wordpress.stackexchange.com/questions/313795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150311/" ]
I am trying to extend the Gutenberg `core/gallery` block to add some new functionality to my image gallery on the frontend. I have created a separate plugin to handle this task. I have registered my script with the following code: ``` function mt_enqueue_gutenberg(){ wp_enqueue_script( 'mt-gallery-block', ...
**Answering my own question:** As suggested by [WebElaine](https://wordpress.stackexchange.com/users/102815/webelaine) I created a completely new block to fix the problem. To make this task easier, I used [create-guten-block by Ahmad Awais](https://github.com/ahmadawais/create-guten-block), which is pretty easy to se...
313,818
<p>I am experiencing a small problem and I have tried several solutions, but none of them has worked unfortunately. Perhaps somebody has a clue why :-)</p> <p>I am using the Syntax theme from Automattic which has its own language file, but it also uses the default Wordpress core language file to display some words in ...
[ { "answer_id": 313820, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": -1, "selected": false, "text": "<p>This will help:</p>\n\n<pre><code>&lt;?php\nadd_filter( 'gettext', 'added_translation', 20, 3 );\n\nfuncti...
2018/09/10
[ "https://wordpress.stackexchange.com/questions/313818", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150132/" ]
I am experiencing a small problem and I have tried several solutions, but none of them has worked unfortunately. Perhaps somebody has a clue why :-) I am using the Syntax theme from Automattic which has its own language file, but it also uses the default Wordpress core language file to display some words in the fronte...
Correcting the answer given by Max. To use this approach, the filter you need is [gettext\_with\_context](https://developer.wordpress.org/reference/hooks/gettext_with_context/) because your string is translated via `_x()` not `__()`. Note that the filtered argument passed is the **translation**, so you should check th...
313,824
<p>I would like to add a pagination to my wordpress theme. However, for me it is not so easy because my theme is built from the plugin "<em>AT Posts Column</em>", which displays the latest posts on the main page. I would like to add pagination to this plugin :).</p> <p>I tried to insert a pagination plugin and paste t...
[ { "answer_id": 313820, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": -1, "selected": false, "text": "<p>This will help:</p>\n\n<pre><code>&lt;?php\nadd_filter( 'gettext', 'added_translation', 20, 3 );\n\nfuncti...
2018/09/10
[ "https://wordpress.stackexchange.com/questions/313824", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150377/" ]
I would like to add a pagination to my wordpress theme. However, for me it is not so easy because my theme is built from the plugin "*AT Posts Column*", which displays the latest posts on the main page. I would like to add pagination to this plugin :). I tried to insert a pagination plugin and paste the code for displ...
Correcting the answer given by Max. To use this approach, the filter you need is [gettext\_with\_context](https://developer.wordpress.org/reference/hooks/gettext_with_context/) because your string is translated via `_x()` not `__()`. Note that the filtered argument passed is the **translation**, so you should check th...
313,848
<p>Please I have a very slow query on my wordpress search, checking the processes it takes upto 40sec to execute using <code>SHOW FULL PROCESSLIST;</code> below is a sample of query</p> <pre><code>SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%Industreet%') OR (wp_p...
[ { "answer_id": 320315, "author": "markdwhite", "author_id": 106523, "author_profile": "https://wordpress.stackexchange.com/users/106523", "pm_score": 2, "selected": true, "text": "<p>This is the query generated by the internal search function on Wordpress.</p>\n\n<p>It is criticised for ...
2018/09/11
[ "https://wordpress.stackexchange.com/questions/313848", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128519/" ]
Please I have a very slow query on my wordpress search, checking the processes it takes upto 40sec to execute using `SHOW FULL PROCESSLIST;` below is a sample of query ``` SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%Industreet%') OR (wp_posts.post_excerpt LIKE '%...
This is the query generated by the internal search function on Wordpress. It is criticised for being inefficient, and there are a few drop-in replacements available as plugins. You may be able to find something that helps you by doing more research around these. For example: <https://themeisle.com/blog/improve-intern...
313,884
<p>I am having an issue with my WordPress nav menu. It is currently looking like this : <a href="https://i.stack.imgur.com/lvxTm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lvxTm.png" alt="Wordpress Problem"></a></p> <p>I am trying to make my bootstrap 3.3.7 (think that's the right version) menu...
[ { "answer_id": 313891, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>You have implemented the menu in wrong way, that's why it's not working.</p>\n\n<p>WordPress has provided a detai...
2018/09/11
[ "https://wordpress.stackexchange.com/questions/313884", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150429/" ]
I am having an issue with my WordPress nav menu. It is currently looking like this : [![Wordpress Problem](https://i.stack.imgur.com/lvxTm.png)](https://i.stack.imgur.com/lvxTm.png) I am trying to make my bootstrap 3.3.7 (think that's the right version) menu work and that is the error. The line of code i am using is: ...
You can try this way: ``` <nav class="navbar navbar-default" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only"...
313,902
<p>I tried to develop a simple Wordpress plugin which shows a bootstrap modal and unfortunately I failed.</p> <p>The modal opens shortly but disappears directly again. This happens because the template Avada already loads something similar to Bootstrap. This leads to the conflict because Bootstrap is loaded multiple t...
[ { "answer_id": 313891, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>You have implemented the menu in wrong way, that's why it's not working.</p>\n\n<p>WordPress has provided a detai...
2018/09/11
[ "https://wordpress.stackexchange.com/questions/313902", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150443/" ]
I tried to develop a simple Wordpress plugin which shows a bootstrap modal and unfortunately I failed. The modal opens shortly but disappears directly again. This happens because the template Avada already loads something similar to Bootstrap. This leads to the conflict because Bootstrap is loaded multiple times. I h...
You can try this way: ``` <nav class="navbar navbar-default" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only"...
313,934
<p>Please see my shortcode script below (which is intended to print the next 15 minute time interval, eg if the current time is 9:01pm, it would print 9:15pm).</p> <p>I have managed to produce the correct output, however because I am <code>echo</code>ing the <code>&lt;span id="webinartime"&gt;&lt;/span&gt;</code> HTML...
[ { "answer_id": 313935, "author": "Jazibobs", "author_id": 37192, "author_profile": "https://wordpress.stackexchange.com/users/37192", "pm_score": 3, "selected": true, "text": "<p>What you should do is create a variable to store all of the HTML data you wish to output with your shortcode ...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/313934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10663/" ]
Please see my shortcode script below (which is intended to print the next 15 minute time interval, eg if the current time is 9:01pm, it would print 9:15pm). I have managed to produce the correct output, however because I am `echo`ing the `<span id="webinartime"></span>` HTML, the dynamic content is showing up at the t...
What you should do is create a variable to store all of the HTML data you wish to output with your shortcode then use `return`. Your code would look something like this: ``` <?php // insert HTML which will be later affected by javascript // this part is the issue! I need to return this, not echo... // but returning e...
313,951
<p>I tried uploading after installing different plugins. Even added a filter to functions.php file.</p> <pre><code> function add_svg_to_upload_mimes( $upload_mimes ) { $upload_mimes['svg'] = 'image/svg+xml'; $upload_mimes['svgz'] = 'image/svg+xml'; return $upload_mimes; } add_filter( 'uploa...
[ { "answer_id": 314050, "author": "Tedinoz", "author_id": 24711, "author_profile": "https://wordpress.stackexchange.com/users/24711", "pm_score": 4, "selected": true, "text": "<p>This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I fo...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/313951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101809/" ]
I tried uploading after installing different plugins. Even added a filter to functions.php file. ``` function add_svg_to_upload_mimes( $upload_mimes ) { $upload_mimes['svg'] = 'image/svg+xml'; $upload_mimes['svgz'] = 'image/svg+xml'; return $upload_mimes; } add_filter( 'upload_mimes', 'add...
This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I found out. You asked how to upload SVG in WordPress 4.9.8 (the current version at the time of writing). You mention that you "tried uploading after installing different plugins". You don't say which plugins, no...
313,967
<p>I have a save post hook that looks like this, it should download youtube thumbnail to wp-includes/uploads base on video id provided. But it doesnt save anything.</p> <pre><code> add_filter( 'save_post', function () { $video_id = 'VSB4wGIdDwo'; $path_to_save_thumbnails = '/wp-includes/upload/'; $ch = curl_in...
[ { "answer_id": 314050, "author": "Tedinoz", "author_id": 24711, "author_profile": "https://wordpress.stackexchange.com/users/24711", "pm_score": 4, "selected": true, "text": "<p>This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I fo...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/313967", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150431/" ]
I have a save post hook that looks like this, it should download youtube thumbnail to wp-includes/uploads base on video id provided. But it doesnt save anything. ``` add_filter( 'save_post', function () { $video_id = 'VSB4wGIdDwo'; $path_to_save_thumbnails = '/wp-includes/upload/'; $ch = curl_init(); $thubnail_...
This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I found out. You asked how to upload SVG in WordPress 4.9.8 (the current version at the time of writing). You mention that you "tried uploading after installing different plugins". You don't say which plugins, no...
313,975
<p>I have this mail notification for new post.</p> <p>All the new post contain arround 100 words and no pictures, so I would like to include in the notification the post content and if is possible, the number of words in the post.</p> <p>Anybody could help me? </p> <p>Thanks for all</p> <pre><code> /* avisar al ...
[ { "answer_id": 314050, "author": "Tedinoz", "author_id": 24711, "author_profile": "https://wordpress.stackexchange.com/users/24711", "pm_score": 4, "selected": true, "text": "<p>This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I fo...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/313975", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150466/" ]
I have this mail notification for new post. All the new post contain arround 100 words and no pictures, so I would like to include in the notification the post content and if is possible, the number of words in the post. Anybody could help me? Thanks for all ``` /* avisar al admin*/ function submit_send_email ...
This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I found out. You asked how to upload SVG in WordPress 4.9.8 (the current version at the time of writing). You mention that you "tried uploading after installing different plugins". You don't say which plugins, no...
313,993
<p>I have a membership site. I need to disable the admin bar for the subscribers.</p> <p>I have used this code below:</p> <pre><code>add_action('after_setup_theme', 'remove_admin_bar'); function remove_admin_bar() { if (!current_user_can('administrator') &amp;&amp; !is_admin()) { show_admin_bar(false); } } </code>...
[ { "answer_id": 314000, "author": "Gonçalo Figueiredo", "author_id": 150305, "author_profile": "https://wordpress.stackexchange.com/users/150305", "pm_score": -1, "selected": true, "text": "<p>I did a quick research on this and I don't think you can with a function, as said in the <a href...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/313993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/126766/" ]
I have a membership site. I need to disable the admin bar for the subscribers. I have used this code below: ``` add_action('after_setup_theme', 'remove_admin_bar'); function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } } ``` which removes the admin bar fr...
I did a quick research on this and I don't think you can with a function, as said in the [codex](https://codex.wordpress.org/Administration_Screens#Toolbar). > > Note: It is no longer possible to hide the Toolbar when viewing the Administration Screens, but users can disable it on the front-end of the site in their P...
313,995
<p>I am building a static landing page on WordPress root folder, and I need to import some shortcodes from an existing page located in <code>wp-content</code> directory.</p> <p>What I do is import with <code>$post = get_post($post_id)</code> the post containing my shortcode, then I extract it -></p> <blockquote> <p...
[ { "answer_id": 314000, "author": "Gonçalo Figueiredo", "author_id": 150305, "author_profile": "https://wordpress.stackexchange.com/users/150305", "pm_score": -1, "selected": true, "text": "<p>I did a quick research on this and I don't think you can with a function, as said in the <a href...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/313995", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150510/" ]
I am building a static landing page on WordPress root folder, and I need to import some shortcodes from an existing page located in `wp-content` directory. What I do is import with `$post = get_post($post_id)` the post containing my shortcode, then I extract it -> > > $output = apply\_filters( 'the\_content', $post-...
I did a quick research on this and I don't think you can with a function, as said in the [codex](https://codex.wordpress.org/Administration_Screens#Toolbar). > > Note: It is no longer possible to hide the Toolbar when viewing the Administration Screens, but users can disable it on the front-end of the site in their P...
314,011
<p>I used to have a working custom query for location on this <strong>local</strong> link:</p> <pre><code>http://website.local/catalogue/?location=968&amp;floor=1 </code></pre> <p>but, the server that I had to move to (Linux) it appears that is not supporting Permalinks->Post name (<a href="http://10.8.10.9/sample-po...
[ { "answer_id": 314012, "author": "Marc", "author_id": 71657, "author_profile": "https://wordpress.stackexchange.com/users/71657", "pm_score": 0, "selected": false, "text": "<p>Your link needs to be <code>http://10.8.10.9/?page_id=1774&amp;location=968&amp;floor=1</code> having multiple <...
2018/09/12
[ "https://wordpress.stackexchange.com/questions/314011", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150200/" ]
I used to have a working custom query for location on this **local** link: ``` http://website.local/catalogue/?location=968&floor=1 ``` but, the server that I had to move to (Linux) it appears that is not supporting Permalinks->Post name (<http://10.8.10.9/sample-post/>) only the default Plain (<http://10.8.10.9/?p=...
I think you should really try to make the permalinks work on your server. It seldom fails. Have you checked all your server settings are correct, and have you visited the permalink page after updating, so that the cache is flushed? Otherwise you would have to have `http://10.8.10.9/?page_id=1774&location=968&floor=1` ...
314,064
<p>I use the Theme Twenty Seventeen in WordPress to create my website. Here all pages are one below the other seen on the frontpage. Now I added a new page, but this is not listed on the frontpage. I can only reach it by clicking on it on the menu.</p> <p>How can I also list that page on the frontpage? Please explain ...
[ { "answer_id": 314082, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 0, "selected": false, "text": "<p>On the frontpage (and on other archives) only posts are listed by default. If you want to add new art...
2018/09/13
[ "https://wordpress.stackexchange.com/questions/314064", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150554/" ]
I use the Theme Twenty Seventeen in WordPress to create my website. Here all pages are one below the other seen on the frontpage. Now I added a new page, but this is not listed on the frontpage. I can only reach it by clicking on it on the menu. How can I also list that page on the frontpage? Please explain step by st...
In Twenty Seventeen you can only add 4 page in front-page section. see image below [![enter image description here](https://i.stack.imgur.com/Crfqj.png)](https://i.stack.imgur.com/Crfqj.png) See `Appearance`=> `Customize` => `Theme Options` **Update** You can add extra section with filter `twentyseventeen_front_p...
314,083
<p>I have get the following array from my database using mysql query in PHP. What is way to print the specific item (e.g: <code>staff_name</code> and <code>coupon</code>)? </p> <pre><code>{"items":[{"ca_id":1,"appointment_date":"2018-07-02 08:00:00","service_name":"Eye check-up","service_price":50,"service_tax":0,"wai...
[ { "answer_id": 314085, "author": "David Corp", "author_id": 129246, "author_profile": "https://wordpress.stackexchange.com/users/129246", "pm_score": -1, "selected": false, "text": "<pre><code>&lt;?php\n$results = '{\"items\":[{\"ca_id\":1,\"appointment_date\":\"2018-07-02 08:00:00\",\"s...
2018/09/13
[ "https://wordpress.stackexchange.com/questions/314083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115840/" ]
I have get the following array from my database using mysql query in PHP. What is way to print the specific item (e.g: `staff_name` and `coupon`)? ``` {"items":[{"ca_id":1,"appointment_date":"2018-07-02 08:00:00","service_name":"Eye check-up","service_price":50,"service_tax":0,"wait_listed":false,"deposit_format":nul...
Not really a WordPress question, but I'll bite. That data is [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON). To manipulate it with PHP you need to decode it with [`json_decode()`](http://php.net/manual/en/function.json-decode.php). Then you can treat it as a PHP object. So to access t...
314,089
<p>I inadvertently posted a duplicate of this question in the other stackexchange - but it was MISTAKENLY marked as duplicated and solved by a different question answered using deprecated code </p> <p>So I will reask in the Wordpress forum where there may be more expertise</p> <p>I'm trying to combine functions - and...
[ { "answer_id": 314102, "author": "Ittikorn S.", "author_id": 68069, "author_profile": "https://wordpress.stackexchange.com/users/68069", "pm_score": 0, "selected": false, "text": "<p>I assumed the theme you are using on multi-site is supporting the Theme Logo feature. Then you could simp...
2018/09/13
[ "https://wordpress.stackexchange.com/questions/314089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121961/" ]
I inadvertently posted a duplicate of this question in the other stackexchange - but it was MISTAKENLY marked as duplicated and solved by a different question answered using deprecated code So I will reask in the Wordpress forum where there may be more expertise I'm trying to combine functions - and don't know how i...
modifying to this, works thanks // Switch to Blog switch\_to\_blog( $subsite->blog\_id ); $site\_description = get\_bloginfo( 'description' ); restore\_current\_blog(); still working on calling the logos
314,097
<p>I'm a novice at Wordpress and i'm pretty sure what i'm looking for is really easy. I have an issue with a function that doesn't work :</p> <pre><code> function user_homepage() { if ( is_user_logged_in() ) { $args = array( 'field' =&gt; 25, ); $user_homepage = bp_profi...
[ { "answer_id": 314102, "author": "Ittikorn S.", "author_id": 68069, "author_profile": "https://wordpress.stackexchange.com/users/68069", "pm_score": 0, "selected": false, "text": "<p>I assumed the theme you are using on multi-site is supporting the Theme Logo feature. Then you could simp...
2018/09/13
[ "https://wordpress.stackexchange.com/questions/314097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150574/" ]
I'm a novice at Wordpress and i'm pretty sure what i'm looking for is really easy. I have an issue with a function that doesn't work : ``` function user_homepage() { if ( is_user_logged_in() ) { $args = array( 'field' => 25, ); $user_homepage = bp_profile_field_data( $a...
modifying to this, works thanks // Switch to Blog switch\_to\_blog( $subsite->blog\_id ); $site\_description = get\_bloginfo( 'description' ); restore\_current\_blog(); still working on calling the logos
314,101
<p>I'm trying to show all the posts on a page with an audio player in it and for that I'm looping through posts in the following manner:</p> <pre><code>&lt;?php $posts = get_posts(); $ID; foreach( $posts as $item) { global $post; $post_id = $item-&gt;ID; $file_id = get_post_meta($post_id, 'sound_s', true); $file_...
[ { "answer_id": 314104, "author": "Ittikorn S.", "author_id": 68069, "author_profile": "https://wordpress.stackexchange.com/users/68069", "pm_score": -1, "selected": false, "text": "<p>Have you try to change the third attributes of <strong>get_post_meta()</strong> to <strong>false</strong...
2018/09/13
[ "https://wordpress.stackexchange.com/questions/314101", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150425/" ]
I'm trying to show all the posts on a page with an audio player in it and for that I'm looping through posts in the following manner: ``` <?php $posts = get_posts(); $ID; foreach( $posts as $item) { global $post; $post_id = $item->ID; $file_id = get_post_meta($post_id, 'sound_s', true); $file_url = wp_get_attachm...
Please try below code and check if '**sound\_s**' key exists in the array or not ``` $file_id = get_post_meta($post_id); echo "<pre>"; print_r( $file_id ); exit; ```
314,151
<p>Example:</p> <p>If I have a parent category 1 with child categories 2,3,4 etc</p> <p>instead of a call like this:</p> <pre><code>/wp/v2/posts?categories=1,2,3,4 </code></pre> <p>i want a call like this (imaging code)</p> <pre><code>/wp/v2/posts?categories=1&amp;includeallchilds=true </code></pre> <p>that will ...
[ { "answer_id": 314152, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>WP can already do this out of the box thanks to the <code>include_children</code> parameter of <code>tax_quer...
2018/09/13
[ "https://wordpress.stackexchange.com/questions/314151", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134864/" ]
Example: If I have a parent category 1 with child categories 2,3,4 etc instead of a call like this: ``` /wp/v2/posts?categories=1,2,3,4 ``` i want a call like this (imaging code) ``` /wp/v2/posts?categories=1&includeallchilds=true ``` that will include all articles from the child and sub-child of 1. how is thi...
WP can already do this out of the box thanks to the `include_children` parameter of `tax_query` which is true by default. While it is false by default for REST API parameters, it can be turned back on using a tax query, so you do not need to tell it the sub-terms. [Here's an example taken from the official Make WP bl...
314,160
<p>I am looking for a way to replace all links on images. Currently when a user clicks an image it links to the source file. </p> <p>What I want it to do is to ink to: example.com/editor=12&amp;image=filename.jpg So every that encloses an should link to that site with the image filename so it can be loaded in an edi...
[ { "answer_id": 314152, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>WP can already do this out of the box thanks to the <code>include_children</code> parameter of <code>tax_quer...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314160", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150609/" ]
I am looking for a way to replace all links on images. Currently when a user clicks an image it links to the source file. What I want it to do is to ink to: example.com/editor=12&image=filename.jpg So every that encloses an should link to that site with the image filename so it can be loaded in an editor. First, I t...
WP can already do this out of the box thanks to the `include_children` parameter of `tax_query` which is true by default. While it is false by default for REST API parameters, it can be turned back on using a tax query, so you do not need to tell it the sub-terms. [Here's an example taken from the official Make WP bl...
314,165
<p>I tried to customize my WordPress theme but it shows this error.</p> <blockquote> <p>Your theme has 2 widget areas, but this particular page doesn’t display them. You can navigate to other pages on your site while using the Customizer to view > and edit the widgets displayed on those pages.</p> </blockquote> <...
[ { "answer_id": 314152, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>WP can already do this out of the box thanks to the <code>include_children</code> parameter of <code>tax_quer...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314165", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150614/" ]
I tried to customize my WordPress theme but it shows this error. > > Your theme has 2 widget areas, but this particular page doesn’t display them. > You can navigate to other pages on your site while using the Customizer to view > and edit the widgets displayed on those pages. > > > First, there didn't show widg...
WP can already do this out of the box thanks to the `include_children` parameter of `tax_query` which is true by default. While it is false by default for REST API parameters, it can be turned back on using a tax query, so you do not need to tell it the sub-terms. [Here's an example taken from the official Make WP bl...
314,172
<p>I'm relatively new to working with wordpress and php in general, so I'd like to know if someone can help me with this.</p> <p>I have a custom query that looks like this</p> <pre><code>&lt;?php $args = array( //argumentos 'numberposts' =&gt; -1, ...
[ { "answer_id": 314152, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>WP can already do this out of the box thanks to the <code>include_children</code> parameter of <code>tax_quer...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314172", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150618/" ]
I'm relatively new to working with wordpress and php in general, so I'd like to know if someone can help me with this. I have a custom query that looks like this ``` <?php $args = array( //argumentos 'numberposts' => -1, 'post_type' =>...
WP can already do this out of the box thanks to the `include_children` parameter of `tax_query` which is true by default. While it is false by default for REST API parameters, it can be turned back on using a tax query, so you do not need to tell it the sub-terms. [Here's an example taken from the official Make WP bl...
314,175
<p>I have a custom post type called 'Bookmark'.</p> <p>When users add a new Bookmark in the Admin, the title of the page is <h1>Add a new Page</h1></p> <p>Is there a hook (filter) to change this title to <h1>Add a new Bookmark</h1></p>
[ { "answer_id": 314152, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>WP can already do this out of the box thanks to the <code>include_children</code> parameter of <code>tax_quer...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314175", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17248/" ]
I have a custom post type called 'Bookmark'. When users add a new Bookmark in the Admin, the title of the page is Add a new Page ============== Is there a hook (filter) to change this title to Add a new Bookmark ==================
WP can already do this out of the box thanks to the `include_children` parameter of `tax_query` which is true by default. While it is false by default for REST API parameters, it can be turned back on using a tax query, so you do not need to tell it the sub-terms. [Here's an example taken from the official Make WP bl...
314,182
<p><a href="https://i.stack.imgur.com/81kJk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/81kJk.png" alt="enter image description here"></a></p> <p>I am trying to get map from address but there are appear some error like <strong>You have exceeded your request quota for this API</strong> in my cons...
[ { "answer_id": 314152, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>WP can already do this out of the box thanks to the <code>include_children</code> parameter of <code>tax_quer...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314182", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143123/" ]
[![enter image description here](https://i.stack.imgur.com/81kJk.png)](https://i.stack.imgur.com/81kJk.png) I am trying to get map from address but there are appear some error like **You have exceeded your request quota for this API** in my console so can anyone help me to fix this. My Javascript code look like below...
WP can already do this out of the box thanks to the `include_children` parameter of `tax_query` which is true by default. While it is false by default for REST API parameters, it can be turned back on using a tax query, so you do not need to tell it the sub-terms. [Here's an example taken from the official Make WP bl...
314,220
<p>I have searched endlessly for this but I am yet to find a solution.</p> <p>I have found ways to add custom classes through functions but can't seem to achieve through woocommerce where a custom class is added on the single product page when a product is out of stock.</p> <p>Any pointers would be much appreciated.<...
[ { "answer_id": 314223, "author": "Andrea Somovigo", "author_id": 64435, "author_profile": "https://wordpress.stackexchange.com/users/64435", "pm_score": 1, "selected": true, "text": "<pre><code>add_filter('body_class', 'SE_314220_custom_outofstock_class');\n\n function SE_314220_custom_o...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314220", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94286/" ]
I have searched endlessly for this but I am yet to find a solution. I have found ways to add custom classes through functions but can't seem to achieve through woocommerce where a custom class is added on the single product page when a product is out of stock. Any pointers would be much appreciated.
``` add_filter('body_class', 'SE_314220_custom_outofstock_class'); function SE_314220_custom_outofstock_class ($classes) { global $post; if($post->post_type !="product") return $classes; $product = wc_get_product( $post->ID ); if($product->get_stock_quantity() ==0) $classes[] = 'OUT-OF-STOCK'; retu...
314,240
<p>I'm creating a WordPress child theme based on an existing parent theme, and I'd like to have any same-named file I put in my child theme directory take priority over the file in the parent theme directory. I thought this was how parent/child theming was set up in WP but I have hit a bump.</p> <p>According to the <a...
[ { "answer_id": 314241, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>This is essentially what <a href=\"https://developer.wordpress.org/reference/functions/locate_template/\" rel=\"nof...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314240", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2080/" ]
I'm creating a WordPress child theme based on an existing parent theme, and I'd like to have any same-named file I put in my child theme directory take priority over the file in the parent theme directory. I thought this was how parent/child theming was set up in WP but I have hit a bump. According to the [WordPress c...
This is essentially what [`locate_template()`](https://developer.wordpress.org/reference/functions/locate_template/) does. > > Searches in the STYLESHEETPATH (child) before TEMPLATEPATH (parent) and `wp-includes/theme-compat` so that themes which inherit from a parent theme can just overload one file. > > >
314,242
<p>I have a Gravity Form that on submission sends the data to a third party API. It is connecting with the following code and saving the data through the API. However, I'm now trying to figure out how to only send the Admin notification email if the API response comes back as a fail or anything other than status code 2...
[ { "answer_id": 314241, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>This is essentially what <a href=\"https://developer.wordpress.org/reference/functions/locate_template/\" rel=\"nof...
2018/09/14
[ "https://wordpress.stackexchange.com/questions/314242", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81422/" ]
I have a Gravity Form that on submission sends the data to a third party API. It is connecting with the following code and saving the data through the API. However, I'm now trying to figure out how to only send the Admin notification email if the API response comes back as a fail or anything other than status code 201....
This is essentially what [`locate_template()`](https://developer.wordpress.org/reference/functions/locate_template/) does. > > Searches in the STYLESHEETPATH (child) before TEMPLATEPATH (parent) and `wp-includes/theme-compat` so that themes which inherit from a parent theme can just overload one file. > > >
314,296
<p>Not sure what I'm doing wrong here. I am a beginner coder, but I've tried a lot of things already:</p> <p>I'm trying to print the_content from the post_parent of an image. Here's what I'm using right now. I am able to post the title, but not the content (all I can succeed in printing content-wise is the image's con...
[ { "answer_id": 314241, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>This is essentially what <a href=\"https://developer.wordpress.org/reference/functions/locate_template/\" rel=\"nof...
2018/09/15
[ "https://wordpress.stackexchange.com/questions/314296", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/95192/" ]
Not sure what I'm doing wrong here. I am a beginner coder, but I've tried a lot of things already: I'm trying to print the\_content from the post\_parent of an image. Here's what I'm using right now. I am able to post the title, but not the content (all I can succeed in printing content-wise is the image's content (wh...
This is essentially what [`locate_template()`](https://developer.wordpress.org/reference/functions/locate_template/) does. > > Searches in the STYLESHEETPATH (child) before TEMPLATEPATH (parent) and `wp-includes/theme-compat` so that themes which inherit from a parent theme can just overload one file. > > >
314,325
<p>I am using <code>wordpress 4.9.8</code> and <code>PHP 7.1.8</code> I have added a button to the new post screen:</p> <p><a href="https://i.stack.imgur.com/eiQbM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eiQbM.png" alt="enter image description here"></a></p> <p>I am trying to trigger the bu...
[ { "answer_id": 343221, "author": "Ahadul", "author_id": 147734, "author_profile": "https://wordpress.stackexchange.com/users/147734", "pm_score": 2, "selected": true, "text": "<p>Remove this line </p>\n\n<pre><code>add_action( 'wp_ajax_my_action', 'updateContent' );\n</code></pre>\n\n<p>...
2018/09/16
[ "https://wordpress.stackexchange.com/questions/314325", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48703/" ]
I am using `wordpress 4.9.8` and `PHP 7.1.8` I have added a button to the new post screen: [![enter image description here](https://i.stack.imgur.com/eiQbM.png)](https://i.stack.imgur.com/eiQbM.png) I am trying to trigger the button the following way: ``` add_action( 'media_buttons', 'add_my_media_button', 99 ); fun...
Remove this line ``` add_action( 'wp_ajax_my_action', 'updateContent' ); ``` Add this two Line ``` add_action( 'wp_ajax_nopriv_updateContent', 'updateContent' ); add_action( 'wp_ajax_updateContent', 'updateContent' ); ``` hopefully it will solve your issue <https://codex.wordpress.org/Plugin_API/Action_Referenc...
314,370
<p>I regularly need to create a batch of posts of a custom post type, with names and meta values that follow a regular pattern. This seems like a perfect canditate for using wp-cli, but so far it hasn't worked.</p> <p>Using wp-cli, if I enter:</p> <pre><code>wp post create --post_title='test' --post_status='draft' po...
[ { "answer_id": 314375, "author": "Hans", "author_id": 129367, "author_profile": "https://wordpress.stackexchange.com/users/129367", "pm_score": 3, "selected": true, "text": "<p>It should probably be </p>\n\n<p><code>wp post create --post_title='test' --post_status='draft' --post_type='cl...
2018/09/17
[ "https://wordpress.stackexchange.com/questions/314370", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34991/" ]
I regularly need to create a batch of posts of a custom post type, with names and meta values that follow a regular pattern. This seems like a perfect canditate for using wp-cli, but so far it hasn't worked. Using wp-cli, if I enter: ``` wp post create --post_title='test' --post_status='draft' post_type='class_notes'...
It should probably be `wp post create --post_title='test' --post_status='draft' --post_type='class_notes'` (note the two `--` that mark it as a command option)
314,371
<p>After the update regarding the GDPR, WordPress now has an option named <em>"Privacy Policy"</em> under the settings, which you can use a page to be used as your privacy policy page. </p> <p>How can I get the ID or the permalink for this page to use in my theme or plugin?</p>
[ { "answer_id": 314372, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": false, "text": "<p>WordPress stores the page id for the privacy policy page in the <code>options</code> table. To get the valu...
2018/09/17
[ "https://wordpress.stackexchange.com/questions/314371", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94498/" ]
After the update regarding the GDPR, WordPress now has an option named *"Privacy Policy"* under the settings, which you can use a page to be used as your privacy policy page. How can I get the ID or the permalink for this page to use in my theme or plugin?
WordPress stores the page id for the privacy policy page in the `options` table. To get the value, you can use: ``` $privacy_policy_page = get_option( 'wp_page_for_privacy_policy' ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } ``` The `$privacy_policy_page` vari...
314,377
<p>I have taxonomy="local", Term: ABC (parent) - HCM - Q1 - Q2 - Q3</p> <p>I used code in single_post_type: <code>&lt;?php echo get_the_term_list(get_the_ID(), 'local', '', ', ', ''); ?&gt;</code> but it display by letter (ABC,HCM,Q1,Q2,Q3). I want display child first->parent: Q1,Q2,Q3,HCM,ABC Please help me...
[ { "answer_id": 314372, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": false, "text": "<p>WordPress stores the page id for the privacy policy page in the <code>options</code> table. To get the valu...
2018/09/17
[ "https://wordpress.stackexchange.com/questions/314377", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/124366/" ]
I have taxonomy="local", Term: ABC (parent) - HCM - Q1 - Q2 - Q3 I used code in single\_post\_type: `<?php echo get_the_term_list(get_the_ID(), 'local', '', ', ', ''); ?>` but it display by letter (ABC,HCM,Q1,Q2,Q3). I want display child first->parent: Q1,Q2,Q3,HCM,ABC Please help me !!! thanks [![Pic](https://i.s...
WordPress stores the page id for the privacy policy page in the `options` table. To get the value, you can use: ``` $privacy_policy_page = get_option( 'wp_page_for_privacy_policy' ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } ``` The `$privacy_policy_page` vari...
314,398
<p>I am working on a tournament website. When you register you have the role "Member" and you can create a CPT " team".</p> <p>I created a "TeamAdmin" role with capabilities to <code>edit_published_posts</code>, so the TeamAdmin can change the team name, for example.</p> <p>My question is how to toggle the role on th...
[ { "answer_id": 314372, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": false, "text": "<p>WordPress stores the page id for the privacy policy page in the <code>options</code> table. To get the valu...
2018/09/17
[ "https://wordpress.stackexchange.com/questions/314398", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150756/" ]
I am working on a tournament website. When you register you have the role "Member" and you can create a CPT " team". I created a "TeamAdmin" role with capabilities to `edit_published_posts`, so the TeamAdmin can change the team name, for example. My question is how to toggle the role on the submit button, for example...
WordPress stores the page id for the privacy policy page in the `options` table. To get the value, you can use: ``` $privacy_policy_page = get_option( 'wp_page_for_privacy_policy' ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } ``` The `$privacy_policy_page` vari...
314,413
<p>I cannot hide this menu here (see picture) and I don't what else to do, please help. Apparently, I cannot find the correct hook to do achieve that.</p> <p>example: </p> <pre><code>add_action( 'wp_loaded', 'hide_guest_authors_link_from_backend'); function hide_guest_authors_link_from_backend() { ?&gt; &lt;scrip...
[ { "answer_id": 314372, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": false, "text": "<p>WordPress stores the page id for the privacy policy page in the <code>options</code> table. To get the valu...
2018/09/17
[ "https://wordpress.stackexchange.com/questions/314413", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150200/" ]
I cannot hide this menu here (see picture) and I don't what else to do, please help. Apparently, I cannot find the correct hook to do achieve that. example: ``` add_action( 'wp_loaded', 'hide_guest_authors_link_from_backend'); function hide_guest_authors_link_from_backend() { ?> <script> document.querySelect...
WordPress stores the page id for the privacy policy page in the `options` table. To get the value, you can use: ``` $privacy_policy_page = get_option( 'wp_page_for_privacy_policy' ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } ``` The `$privacy_policy_page` vari...
314,479
<p>I am facing a challenge. I need to check if Woocommerce Order Number will equal Post ID. I know that this is true like 90% of times, but I need bulletproof way to check this. See example where this is not true and Order number and Post ID do differ:</p> <p><a href="https://i.stack.imgur.com/m8E5S.png" rel="nofollow...
[ { "answer_id": 314372, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": false, "text": "<p>WordPress stores the page id for the privacy policy page in the <code>options</code> table. To get the valu...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314479", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10575/" ]
I am facing a challenge. I need to check if Woocommerce Order Number will equal Post ID. I know that this is true like 90% of times, but I need bulletproof way to check this. See example where this is not true and Order number and Post ID do differ: [![woocommerce different order number and post ID](https://i.stack.im...
WordPress stores the page id for the privacy policy page in the `options` table. To get the value, you can use: ``` $privacy_policy_page = get_option( 'wp_page_for_privacy_policy' ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } ``` The `$privacy_policy_page` vari...
314,485
<p><strong>Problem:</strong></p> <p>I do not want to develop (new features) of a wordpress site on production. So I set up an <strong>staging server</strong> where the same installation of wordpress is running on.</p> <p>So while I develop on the staging server on new features, there is content added on production by...
[ { "answer_id": 314372, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": false, "text": "<p>WordPress stores the page id for the privacy policy page in the <code>options</code> table. To get the valu...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129760/" ]
**Problem:** I do not want to develop (new features) of a wordpress site on production. So I set up an **staging server** where the same installation of wordpress is running on. So while I develop on the staging server on new features, there is content added on production by some other users. Furthermore we use a pag...
WordPress stores the page id for the privacy policy page in the `options` table. To get the value, you can use: ``` $privacy_policy_page = get_option( 'wp_page_for_privacy_policy' ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } ``` The `$privacy_policy_page` vari...
314,494
<p>I'm trying to submit a form in wordpress with ajax. But after the first submision the page itself is called again. </p> <p>My Form</p> <pre><code>&lt;form class="et_pb_contact_form clearfix" method="post" action="" id="loginform"&gt; &lt;p class="et_pb_contact_field et_pb_contact_field_0 et_pb_contact_field_last" ...
[ { "answer_id": 314495, "author": "Toheeb", "author_id": 130853, "author_profile": "https://wordpress.stackexchange.com/users/130853", "pm_score": -1, "selected": false, "text": "<p>Remove this line of code\n<code>window.location = 'main.php';</code></p>\n\n<p>Then it's better you use thi...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314494", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150815/" ]
I'm trying to submit a form in wordpress with ajax. But after the first submision the page itself is called again. My Form ``` <form class="et_pb_contact_form clearfix" method="post" action="" id="loginform"> <p class="et_pb_contact_field et_pb_contact_field_0 et_pb_contact_field_last" data-id="mail" data-type="inpu...
To solve this, you need to unbind the event that triggers the second AJAX request. You need to make sure that your `unbind()` function is called *after* the event binding has occurred. So why not just load it in the footer? One reason is that the other script that binds the event might be loading in the footer, too. ...
314,503
<p>I am trying to override a plugin's built in avatar with the default WP avatar. The plugin's filter is this:</p> <pre><code>add_filter( "idea_push_change_user_image", "idea_push_change_user_image_callback", 10, 1 ); function idea_push_change_user_image_callback( $userId ) { return "https://cdn.britannica.com/55/...
[ { "answer_id": 314505, "author": "Krishna Joshi", "author_id": 150621, "author_profile": "https://wordpress.stackexchange.com/users/150621", "pm_score": 2, "selected": true, "text": "<p>Replace the below line your code</p>\n\n<pre><code>return get_avatar( get_the_author_meta( 'ID' ), 32 ...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314503", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150825/" ]
I am trying to override a plugin's built in avatar with the default WP avatar. The plugin's filter is this: ``` add_filter( "idea_push_change_user_image", "idea_push_change_user_image_callback", 10, 1 ); function idea_push_change_user_image_callback( $userId ) { return "https://cdn.britannica.com/55/174255-004-9A4...
Replace the below line your code ``` return get_avatar( get_the_author_meta( 'ID' ), 32 ); ``` to ``` return get_avatar_url( get_the_author_meta( 'ID' ) ); ``` Hope this helps.
314,509
<pre><code>//Register new product taxonomy - Authors function register_author_taxonomy() { $labels = array( 'name' =&gt; __( 'Author', 'taxonomy general name' ), 'singular_name' =&gt; __( 'Author', 'taxonomy singular name' ), 'search_items' =&gt; __( 'Search Authors' ), 'all_items' =&gt; __( 'All Autho...
[ { "answer_id": 314519, "author": "Hans", "author_id": 129367, "author_profile": "https://wordpress.stackexchange.com/users/129367", "pm_score": 1, "selected": false, "text": "<p><code>get_the_terms()</code> returns <code>FALSE</code> if there are no terms in the taxonomy, so you could ch...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314509", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150832/" ]
``` //Register new product taxonomy - Authors function register_author_taxonomy() { $labels = array( 'name' => __( 'Author', 'taxonomy general name' ), 'singular_name' => __( 'Author', 'taxonomy singular name' ), 'search_items' => __( 'Search Authors' ), 'all_items' => __( 'All Authors' ), 'parent_...
`get_the_terms()` returns `FALSE` if there are no terms in the taxonomy, so you could check for that. ``` $authors = get_the_terms( $post->ID , 'product_author' ); if ( FALSE != $authors ) : // Do something endif; ``` If you want to avoid displaying empty terms, ie. terms that have no objects attached to them, ...
314,539
<p>I am trying to modify css.</p> <p><a href="https://i.stack.imgur.com/9mrmi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9mrmi.jpg" alt="enter image description here"></a></p> <p>I tried to modify the css with below code but does seems to work. if i try to change the color it works.</p> <pre>...
[ { "answer_id": 314541, "author": "RiddleMeThis", "author_id": 86845, "author_profile": "https://wordpress.stackexchange.com/users/86845", "pm_score": 3, "selected": true, "text": "<p>If its just that one style you want to edit, you could try...</p>\n\n<pre><code>add_action('admin_head', ...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314539", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am trying to modify css. [![enter image description here](https://i.stack.imgur.com/9mrmi.jpg)](https://i.stack.imgur.com/9mrmi.jpg) I tried to modify the css with below code but does seems to work. if i try to change the color it works. ``` #poststuff #post-body.columns-2 { margin-right: 300px; display:f...
If its just that one style you want to edit, you could try... ``` add_action('admin_head', 'admin_styles'); function admin_styles() { echo '<style> #poststuff #post-body.columns-2 { margin-right: 300px; dispay:flex important; flex-direction:column !important; } ...
314,549
<p>I have a wordpress site with the 10 latest posts shown on the homepage.</p> <p>I need to modify some text (because of duplicate content) on homepage but not on post page.</p> <p>I try to modify the following line in index.php like this :</p> <pre><code>php the_content(Read more ...'); php the_content(Read more ....
[ { "answer_id": 314557, "author": "jimihenrik", "author_id": 64625, "author_profile": "https://wordpress.stackexchange.com/users/64625", "pm_score": 0, "selected": false, "text": "<p><code>the_content(Read more ...')</code> echoes the stuff straight out so you can't modify it with <code>s...
2018/09/18
[ "https://wordpress.stackexchange.com/questions/314549", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150855/" ]
I have a wordpress site with the 10 latest posts shown on the homepage. I need to modify some text (because of duplicate content) on homepage but not on post page. I try to modify the following line in index.php like this : ``` php the_content(Read more ...'); php the_content(Read more ...') . $content = str_replac...
`the_content(Read more ...')` echoes the stuff straight out so you can't modify it with `str_replace` after the fact. If you wanna use `str_replace` you need to do something along the lines of ``` $content = get_the_content( 'Read more ...' ); $content = apply_filters( 'the_content', $content ); $content = s...
314,572
<p>I have created a local WordPress 4.9.8 setup with PHP 7 inside a Fedora running machine. When I try to upload media into the WordPress admin, it keeps saying that </p> <blockquote> <p>The uploaded file could not be moved to wp-content/uploads/</p> </blockquote> <p>I have given full(777) file permission for conte...
[ { "answer_id": 314557, "author": "jimihenrik", "author_id": 64625, "author_profile": "https://wordpress.stackexchange.com/users/64625", "pm_score": 0, "selected": false, "text": "<p><code>the_content(Read more ...')</code> echoes the stuff straight out so you can't modify it with <code>s...
2018/09/19
[ "https://wordpress.stackexchange.com/questions/314572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150871/" ]
I have created a local WordPress 4.9.8 setup with PHP 7 inside a Fedora running machine. When I try to upload media into the WordPress admin, it keeps saying that > > The uploaded file could not be moved to wp-content/uploads/ > > > I have given full(777) file permission for content/uploads directory but still, ...
`the_content(Read more ...')` echoes the stuff straight out so you can't modify it with `str_replace` after the fact. If you wanna use `str_replace` you need to do something along the lines of ``` $content = get_the_content( 'Read more ...' ); $content = apply_filters( 'the_content', $content ); $content = s...
314,580
<p>I have created taxonomy, but I want to use different post template for the taxonomy, how can I do it?</p> <pre><code>function create_topics_hierarchical_taxonomy() { // Add new taxonomy, make it hierarchical like categories //first do the translations part for GUI $labels = array( 'name' =&gt; _x( 'cars', '...
[ { "answer_id": 314583, "author": "Pratik Patel", "author_id": 143123, "author_profile": "https://wordpress.stackexchange.com/users/143123", "pm_score": 1, "selected": false, "text": "<p>You can create taxonomy template like <code>taxonomy-[Your-texonomy].php</code> in your theme folder.<...
2018/09/19
[ "https://wordpress.stackexchange.com/questions/314580", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150876/" ]
I have created taxonomy, but I want to use different post template for the taxonomy, how can I do it? ``` function create_topics_hierarchical_taxonomy() { // Add new taxonomy, make it hierarchical like categories //first do the translations part for GUI $labels = array( 'name' => _x( 'cars', 'taxonomy general ...
You can create taxonomy template like `taxonomy-[Your-texonomy].php` in your theme folder.
314,593
<p>I would like to change the &quot;Customer new account&quot; email.</p> <p>In this line:</p> <pre class="lang-php prettyprint-override"><code>&lt;p&gt;&lt;?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s', 'woocommerce' ), esc_html( $blogname ), '&lt;strong&gt;' . esc_html( $user_login ...
[ { "answer_id": 314594, "author": "Fabian Marz", "author_id": 77421, "author_profile": "https://wordpress.stackexchange.com/users/77421", "pm_score": 1, "selected": false, "text": "<p>The simplest one is to copy the mail template to your theme folder into <code>path/to/your/theme/woocomme...
2018/09/19
[ "https://wordpress.stackexchange.com/questions/314593", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150887/" ]
I would like to change the "Customer new account" email. In this line: ```php <p><?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>' ); ?></p> ``` I would like to change the parameter %2$s, inst...
The simplest one is to copy the mail template to your theme folder into `path/to/your/theme/woocommerce/emails/customer-new-account.php` and adjust the argument from `user_login` to `user_email`.
314,595
<p>My client shows his 5 most recent posts (excerpts) on the homepage followed by a "read more" link. On archive page he does not want to display the 5 most recent post again but posts from #6 to #20.</p> <p>How can I do this?</p>
[ { "answer_id": 314596, "author": "Adarsh", "author_id": 143452, "author_profile": "https://wordpress.stackexchange.com/users/143452", "pm_score": 2, "selected": false, "text": "<p>Add offset in the query and give value as 5 so, the first 5 will be skipped.</p>\n\n<p>Below is code snippet...
2018/09/19
[ "https://wordpress.stackexchange.com/questions/314595", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150890/" ]
My client shows his 5 most recent posts (excerpts) on the homepage followed by a "read more" link. On archive page he does not want to display the 5 most recent post again but posts from #6 to #20. How can I do this?
Add offset in the query and give value as 5 so, the first 5 will be skipped. Below is code snippet for the same ``` $custom_args = array('post_type' => 'your custom post type name', 'posts_per_page' => '20', 'orderby' => 'id', 'offset'=>5, 'order' => 'ASC',); $custom_query = get_posts($custom_args); foreach ($custom...
314,632
<p>I'm trying to add pagination to my archive template. If I use the same code as on my main blog template it doesn't filter results based on the tag in the URL, instead it simply shows all posts. Probably obvious to most but clearly I'm missing something.</p> <p>I've managed to get the archive page showing just the r...
[ { "answer_id": 314637, "author": "Tung Du", "author_id": 83304, "author_profile": "https://wordpress.stackexchange.com/users/83304", "pm_score": 2, "selected": false, "text": "<p>Since 4.1.0, WordPress introduce <code>the_posts_pagination</code> to handle number paginate link. I use it a...
2018/09/19
[ "https://wordpress.stackexchange.com/questions/314632", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108074/" ]
I'm trying to add pagination to my archive template. If I use the same code as on my main blog template it doesn't filter results based on the tag in the URL, instead it simply shows all posts. Probably obvious to most but clearly I'm missing something. I've managed to get the archive page showing just the relevant po...
Since 4.1.0, WordPress introduce `the_posts_pagination` to handle number paginate link. I use it all the time, and it just works. With any custom post type. You'll want to use that function after the `while` loop. See: <https://developer.wordpress.org/reference/functions/the_posts_pagination/>
314,633
<pre><code>function set_primary_on_publish ($post_id) { global $post; $categories = get_the_terms( $post-&gt;ID, 'category' ); // wrapper to hide any errors from top level categories or products without category if ( $categories &amp;&amp; ! is_wp_error( $category ) ) : // loop through each...
[ { "answer_id": 325830, "author": "Sergey Harchevnikov", "author_id": 159195, "author_profile": "https://wordpress.stackexchange.com/users/159195", "pm_score": 1, "selected": false, "text": "<p>Try instead </p>\n\n<pre><code>update_post_meta($post-&gt;ID,'_yoast_wpseo_primary_category',$...
2018/09/19
[ "https://wordpress.stackexchange.com/questions/314633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102035/" ]
``` function set_primary_on_publish ($post_id) { global $post; $categories = get_the_terms( $post->ID, 'category' ); // wrapper to hide any errors from top level categories or products without category if ( $categories && ! is_wp_error( $category ) ) : // loop through each cat forea...
Try instead ``` update_post_meta($post->ID,'_yoast_wpseo_primary_category',$childid); ``` Use below function: ``` function wpseoPrimaryTerm($taxonomy, $postID, $term){ if ( class_exists('WPSEO_Primary_Term') ) { // Set primary term. $primaryTermObject = new WPSEO_Primary_Term($taxonomy, $postID); $primar...
314,684
<p>I have a slider revolution where in there are four revolution sliders. </p> <p>Now the current scenario is the 2nd slider is been activated, but i want to deactivate the 2nd slider and activate first slider</p> <p>The screenshot is shown below <a href="https://i.stack.imgur.com/fZF3V.png" rel="nofollow noreferrer"...
[ { "answer_id": 325830, "author": "Sergey Harchevnikov", "author_id": 159195, "author_profile": "https://wordpress.stackexchange.com/users/159195", "pm_score": 1, "selected": false, "text": "<p>Try instead </p>\n\n<pre><code>update_post_meta($post-&gt;ID,'_yoast_wpseo_primary_category',$...
2018/09/20
[ "https://wordpress.stackexchange.com/questions/314684", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150954/" ]
I have a slider revolution where in there are four revolution sliders. Now the current scenario is the 2nd slider is been activated, but i want to deactivate the 2nd slider and activate first slider The screenshot is shown below [![Screenshots](https://i.stack.imgur.com/fZF3V.png)](https://i.stack.imgur.com/fZF3V.pn...
Try instead ``` update_post_meta($post->ID,'_yoast_wpseo_primary_category',$childid); ``` Use below function: ``` function wpseoPrimaryTerm($taxonomy, $postID, $term){ if ( class_exists('WPSEO_Primary_Term') ) { // Set primary term. $primaryTermObject = new WPSEO_Primary_Term($taxonomy, $postID); $primar...
314,698
<p>How can I change the tag contents of individual Wordpress posts?</p> <p>I want to add a meta tag for keyword. I use Yoast SEO but even though I specify the focus keyword, no keyword is added in the meta tag of the page's HTML.</p> <p>Please help me with this or suggest alternatives.</p> <p>Do I need to use costu...
[ { "answer_id": 314700, "author": "RiddleMeThis", "author_id": 86845, "author_profile": "https://wordpress.stackexchange.com/users/86845", "pm_score": 2, "selected": false, "text": "<p>I would <a href=\"https://yoast.com/meta-keywords/\" rel=\"nofollow noreferrer\">read this article</a>, ...
2018/09/20
[ "https://wordpress.stackexchange.com/questions/314698", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149467/" ]
How can I change the tag contents of individual Wordpress posts? I want to add a meta tag for keyword. I use Yoast SEO but even though I specify the focus keyword, no keyword is added in the meta tag of the page's HTML. Please help me with this or suggest alternatives. Do I need to use costume fields? If so, how?
I would [read this article](https://yoast.com/meta-keywords/), its from Yoast. I don't think you are understanding what the focus keyword feature does. This article talks about that as well as how adding the keyword meta tag is a waste of time (in most cases). I wouldn't worry about adding it BUT if you still want to ...
314,701
<p>How can I remove "View Details" link from plugins listing in Admin panel without change in WordPress core files.</p> <p><a href="https://i.stack.imgur.com/yPuw5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yPuw5.png" alt="enter image description here"></a></p>
[ { "answer_id": 314707, "author": "Aparna_29", "author_id": 84165, "author_profile": "https://wordpress.stackexchange.com/users/84165", "pm_score": 1, "selected": false, "text": "<p>Try following code:</p>\n\n<pre><code>add_filter('plugin_row_meta','fun_hide_view_details',10,4);\nfunction...
2018/09/20
[ "https://wordpress.stackexchange.com/questions/314701", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143123/" ]
How can I remove "View Details" link from plugins listing in Admin panel without change in WordPress core files. [![enter image description here](https://i.stack.imgur.com/yPuw5.png)](https://i.stack.imgur.com/yPuw5.png)
Try following code: ``` add_filter('plugin_row_meta','fun_hide_view_details',10,4); function fun_hide_view_details($plugin_meta, $plugin_file, $plugin_data, $status) { if($plugin_data['slug'] == 'YOUR_PLUGIN_SLUG') unset($plugin_meta[2]); return $plugin_meta; } ```
314,805
<p>I have 2 registration forms, default one on <code>/wp-login.php?action=register</code> for "recruiter" users, other one on <code>/wp-login.php?action=register&amp;type=candidat</code> for "candidates" users</p> <p>My problem is that on candidate form, the form tag still has <code>/wp-login.php?action=register</code...
[ { "answer_id": 314820, "author": "phatskat", "author_id": 20143, "author_profile": "https://wordpress.stackexchange.com/users/20143", "pm_score": 2, "selected": true, "text": "<p>You could do something like this:</p>\n\n<pre><code>&lt;?php\n\nadd_action( 'register_form', function() {\n ...
2018/09/21
[ "https://wordpress.stackexchange.com/questions/314805", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151041/" ]
I have 2 registration forms, default one on `/wp-login.php?action=register` for "recruiter" users, other one on `/wp-login.php?action=register&type=candidat` for "candidates" users My problem is that on candidate form, the form tag still has `/wp-login.php?action=register` as the action URL, and I want it to be `/wp-l...
You could do something like this: ``` <?php add_action( 'register_form', function() { $get_type = filter_input( INPUT_GET, 'type', FILTER_SANITIZE_STRING ); if ( ! $get_type ) { return; } ?> <input type="hidden" name="type" value="<?php echo esc_attr( $get_type ); ?>" /> <?php }); ``` This will...
314,807
<p>I need to use validation is_single('wordpress') in file functions.php. </p> <p>But the function is_single() does not work in the file functions.php. </p> <p>What can I do so that I can use is_single() in file functions.php?</p> <p>If more, then:</p> <p>I'm doing a check, its single page or not. </p> <p>And for ...
[ { "answer_id": 314819, "author": "phatskat", "author_id": 20143, "author_profile": "https://wordpress.stackexchange.com/users/20143", "pm_score": -1, "selected": true, "text": "<p><code>is_single</code> most likely only works inside of <a href=\"https://codex.wordpress.org/The_Loop\" rel...
2018/09/21
[ "https://wordpress.stackexchange.com/questions/314807", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/137220/" ]
I need to use validation is\_single('wordpress') in file functions.php. But the function is\_single() does not work in the file functions.php. What can I do so that I can use is\_single() in file functions.php? If more, then: I'm doing a check, its single page or not. And for single page I am set custom functio...
`is_single` most likely only works inside of [The Loop](https://codex.wordpress.org/The_Loop), and `functions.php` loads before you're in The Loop. You could try something like this: ``` add_action( 'wp_head', function(){ var_dump(is_single()); }); ``` And now you see that `is_single()` returns `true`. EDIT: I...
314,815
<p>I have a big site with several plugins that take up memory, a lot of requests to the server, etc. I've maxxed out my hosting to help account for this, but are there optimum PHP and Wordpress settings for big heavy site, or just optimum PHP base settings for Wordpress period.</p> <p>Here are my current settings:</p>...
[ { "answer_id": 314819, "author": "phatskat", "author_id": 20143, "author_profile": "https://wordpress.stackexchange.com/users/20143", "pm_score": -1, "selected": true, "text": "<p><code>is_single</code> most likely only works inside of <a href=\"https://codex.wordpress.org/The_Loop\" rel...
2018/09/21
[ "https://wordpress.stackexchange.com/questions/314815", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150825/" ]
I have a big site with several plugins that take up memory, a lot of requests to the server, etc. I've maxxed out my hosting to help account for this, but are there optimum PHP and Wordpress settings for big heavy site, or just optimum PHP base settings for Wordpress period. Here are my current settings: ``` allow_ur...
`is_single` most likely only works inside of [The Loop](https://codex.wordpress.org/The_Loop), and `functions.php` loads before you're in The Loop. You could try something like this: ``` add_action( 'wp_head', function(){ var_dump(is_single()); }); ``` And now you see that `is_single()` returns `true`. EDIT: I...
314,864
<p>I'm combining multiple queries for a loop using the following method:</p> <pre><code>function order_by_date( $a, $b ) { return strcmp( $b-&gt;post_date, $a-&gt;post_date ); } // get the posts for the first query $q1_args = array( // args for the first query ); $q1_posts = get_posts( $q1_args ); // get the ...
[ { "answer_id": 314867, "author": "Hans", "author_id": 129367, "author_profile": "https://wordpress.stackexchange.com/users/129367", "pm_score": 2, "selected": true, "text": "<p>It will work with the <code>SORT_REGULAR</code> flag:</p>\n\n<p><code>array_unique( array_merge( $q1_posts, $q2...
2018/09/22
[ "https://wordpress.stackexchange.com/questions/314864", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145165/" ]
I'm combining multiple queries for a loop using the following method: ``` function order_by_date( $a, $b ) { return strcmp( $b->post_date, $a->post_date ); } // get the posts for the first query $q1_args = array( // args for the first query ); $q1_posts = get_posts( $q1_args ); // get the posts for the second...
It will work with the `SORT_REGULAR` flag: `array_unique( array_merge( $q1_posts, $q2_posts ), SORT_REGULAR );`
314,886
<p>I am adding custom admin filters for my custom post types. I am a bit confused about how to go with the <code>parse_query</code> filter in order to have my posts filtered based on 2 or more filters.</p> <p>Initially for 1 filter, I can do:</p> <pre><code>$query-&gt;query_vars['meta_key'] = 'city'; $query-&gt;query...
[ { "answer_id": 314895, "author": "Tung Du", "author_id": 83304, "author_profile": "https://wordpress.stackexchange.com/users/83304", "pm_score": 0, "selected": false, "text": "<p>The problem is in the end of your code: <code>$query-&gt;meta_query = $metaQuery;</code>. </p>\n\n<p><code>me...
2018/09/23
[ "https://wordpress.stackexchange.com/questions/314886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43534/" ]
I am adding custom admin filters for my custom post types. I am a bit confused about how to go with the `parse_query` filter in order to have my posts filtered based on 2 or more filters. Initially for 1 filter, I can do: ``` $query->query_vars['meta_key'] = 'city'; $query->query_vars['meta_value'] = $cityId; $query-...
This is my final working piece of code: ``` function wpr_manager_filter($query) { global $pagenow; global $typenow; $current_page = isset( $_GET['post_type'] ) ? $_GET['post_type'] : ''; if ( is_admin() && 'properties' == $typenow && 'edit.php' == $pagenow ) { $queryParamsCounter = 0; if...
314,919
<p>I am removing jQuery migrate in WordPress in this way:</p> <pre><code>add_filter( 'wp_default_scripts', 'remove_jquery_migrate' ); function remove_jquery_migrate( &amp;$scripts ){ if(!is_admin()){ $scripts-&gt;remove( 'jquery'); $scripts-&gt;add( 'jquery', false, array( 'jquery-core' ), '1.2.1'...
[ { "answer_id": 315117, "author": "Ian", "author_id": 96731, "author_profile": "https://wordpress.stackexchange.com/users/96731", "pm_score": 1, "selected": false, "text": "<p>That is correct but you did supply a new source.</p>\n\n<p>Replace:</p>\n\n<pre><code>$scripts-&gt;add( 'jquery',...
2018/09/23
[ "https://wordpress.stackexchange.com/questions/314919", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1839/" ]
I am removing jQuery migrate in WordPress in this way: ``` add_filter( 'wp_default_scripts', 'remove_jquery_migrate' ); function remove_jquery_migrate( &$scripts ){ if(!is_admin()){ $scripts->remove( 'jquery'); $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.2.1'); } } ``` I'm con...
There is much safer way of removing `jquery-migrate`... Your code is almost correct, but first you remove jQuery and then add it again. If dependencies for jQuery will change, then your code will cause problems. But you don't have to remove script to change its dependencies. You can do exactly that: ``` function remo...
314,966
<p>I would like to write some arguments for my query and both need to be true. I am having trouble with the Syntax.</p> <p>'meta_key' => $campaign_type, </p> <p>'meta_value' => $Campaign_ID,</p> <p><strong>AND</strong></p> <p>'meta_key' => 'organisation',</p> <p>'meta_value' => $userOrg,</p> <p>Below is my query...
[ { "answer_id": 314926, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>You need to have a lot of traffic for naive protocol based optimizations to be effective, and even then i...
2018/09/24
[ "https://wordpress.stackexchange.com/questions/314966", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93209/" ]
I would like to write some arguments for my query and both need to be true. I am having trouble with the Syntax. 'meta\_key' => $campaign\_type, 'meta\_value' => $Campaign\_ID, **AND** 'meta\_key' => 'organisation', 'meta\_value' => $userOrg, Below is my query code: ``` $args = array ( 'meta_query' => array( 'r...
You need to have a lot of traffic for naive protocol based optimizations to be effective, and even then it is not obvious that you can gain much even when it does kick in. Most people will be first time users of your site, and browser have only a limited space to store information about the last update time of all the...
314,986
<p>As the title states i have tried it with the htaccess file to change the maximum upload size and nothing i have even created a php.ini file in the root of the wordpress folder and still nothing can some here please help me.</p>
[ { "answer_id": 314987, "author": "Pratik Patel", "author_id": 143123, "author_profile": "https://wordpress.stackexchange.com/users/143123", "pm_score": 0, "selected": false, "text": "<p>Try to create <strong>.user.ini</strong> in root</p>\n\n<pre><code>upload_max_filesize = 500M\npost_ma...
2018/09/24
[ "https://wordpress.stackexchange.com/questions/314986", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151167/" ]
As the title states i have tried it with the htaccess file to change the maximum upload size and nothing i have even created a php.ini file in the root of the wordpress folder and still nothing can some here please help me.
php.ini should be in the /wp-admin/ folder, not the root. Also, I've had success using a combination of the following in my /wp-admin/php.ini file AND a directive to increase the memory in my wp-config.php file, increased memory is needed when uploading larger files. Put something like this in your php.ini file (chang...
314,993
<p>Due to some important hardware failure, the <code>wp_options</code> table of one of my WP sites became corrupted, but everything else is okay (WP files and other tables). Obviously the site does not work because of this, and I had no backups.</p> <p>What would be the best way to repair this? How can I create a fres...
[ { "answer_id": 314994, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 3, "selected": false, "text": "<p>Uh oh, that's an important table. You might have lost a bunch of options, but you can still repair the data...
2018/09/24
[ "https://wordpress.stackexchange.com/questions/314993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151169/" ]
Due to some important hardware failure, the `wp_options` table of one of my WP sites became corrupted, but everything else is okay (WP files and other tables). Obviously the site does not work because of this, and I had no backups. What would be the best way to repair this? How can I create a fresh `wp_options` table ...
Uh oh, that's an important table. You might have lost a bunch of options, but you can still repair the database. WordPress allows a repair mode, which you can repair the database. Open the `wp-config.php` file using FTP, and add this line before the `ABSPATH`: ``` define( 'WP_ALLOW_REPAIR', true ); ``` now head ove...
315,000
<p>I've searched everywhere on the internet and tried to code it myself I want to change the default "Select A Category" placeholder text to "Select A Sub Category" so far I have tried this but it's not working:</p> <p>function _category_dropdown_filter( $list_args ) { $list_args['show_option_none'] = __('Select A...
[ { "answer_id": 315002, "author": "Pratik Patel", "author_id": 143123, "author_profile": "https://wordpress.stackexchange.com/users/143123", "pm_score": 0, "selected": false, "text": "<p>Try to using <code>apply_filters</code> in your functions.php</p>\n\n<pre><code>apply_filters( 'woocom...
2018/09/24
[ "https://wordpress.stackexchange.com/questions/315000", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151177/" ]
I've searched everywhere on the internet and tried to code it myself I want to change the default "Select A Category" placeholder text to "Select A Sub Category" so far I have tried this but it's not working: function \_category\_dropdown\_filter( $list\_args ) { $list\_args['show\_option\_none'] = \_\_('Select A Sub...
This worked for me: ``` add_filter( 'wp_dropdown_cats', function( $html, $args ) { if ( $args['taxonomy'] === 'product_cat' ) { $html = str_replace( '<select', '<select data-placeholder="New Placeholder"', $html ); } return $html; }, 10, 2); ```
315,067
<p>I have below code for contact form 7. Usually I use <code>autocomplete="off"</code> for html input field. However not able to figure out how to do the same for contact form 7 </p> <pre><code>&lt;div class="row"&gt; &lt;div class="col-md-6"&gt; [text* FirstName placeholder "First Name"] &lt;/div&gt; &lt;div clas...
[ { "answer_id": 315083, "author": "Aravona", "author_id": 49852, "author_profile": "https://wordpress.stackexchange.com/users/49852", "pm_score": 3, "selected": false, "text": "<p>According to the question and answer from the developer placed here: <a href=\"https://wordpress.org/support/...
2018/09/25
[ "https://wordpress.stackexchange.com/questions/315067", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/122253/" ]
I have below code for contact form 7. Usually I use `autocomplete="off"` for html input field. However not able to figure out how to do the same for contact form 7 ``` <div class="row"> <div class="col-md-6"> [text* FirstName placeholder "First Name"] </div> <div class="col-md-6"> [text* LastName placeholder ...
Autocomplete tag in form settings does not work anymore (as today Contact Form 7 plugin version `5.1.3`. The only solution which worked for me was to add custom attributes thanks to <https://stackoverflow.com/a/46316728/1720476>. E.g. if You have `FirstName` and `LastName` fields, where You want to disable autocomple...
315,072
<p>New Uploaded Code:</p> <pre><code>&lt;div class="col-sm-3 col-sm-pull-9 sidebar"&gt; &lt;div class="list-group products box"&gt; &lt;h4&gt;Product Range&lt;/h4&gt; &lt;?php $terms = get_the_terms( $post-&gt;ID, 'product_cat' ); ...
[ { "answer_id": 315083, "author": "Aravona", "author_id": 49852, "author_profile": "https://wordpress.stackexchange.com/users/49852", "pm_score": 3, "selected": false, "text": "<p>According to the question and answer from the developer placed here: <a href=\"https://wordpress.org/support/...
2018/09/25
[ "https://wordpress.stackexchange.com/questions/315072", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150429/" ]
New Uploaded Code: ``` <div class="col-sm-3 col-sm-pull-9 sidebar"> <div class="list-group products box"> <h4>Product Range</h4> <?php $terms = get_the_terms( $post->ID, 'product_cat' ); foreach ( $terms as $term ){ ...
Autocomplete tag in form settings does not work anymore (as today Contact Form 7 plugin version `5.1.3`. The only solution which worked for me was to add custom attributes thanks to <https://stackoverflow.com/a/46316728/1720476>. E.g. if You have `FirstName` and `LastName` fields, where You want to disable autocomple...
315,086
<p>I've searched a lot to find out how I can add a custom row inside the total costs in my WooCommerce shop and checked out the hooks but can't find the solution. This is what I've tried:</p> <pre><code>add_filter( 'woocommerce_get_order_item_totals', 'bbloomer_add_recurring_row_email', 10, 2 ); function bbloomer_add...
[ { "answer_id": 315087, "author": "Praveen", "author_id": 97802, "author_profile": "https://wordpress.stackexchange.com/users/97802", "pm_score": -1, "selected": false, "text": "<p>Try This:</p>\n\n<pre><code> // Add a custom field before single add to cart\nadd_action( 'woocommerc...
2018/09/25
[ "https://wordpress.stackexchange.com/questions/315086", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151233/" ]
I've searched a lot to find out how I can add a custom row inside the total costs in my WooCommerce shop and checked out the hooks but can't find the solution. This is what I've tried: ``` add_filter( 'woocommerce_get_order_item_totals', 'bbloomer_add_recurring_row_email', 10, 2 ); function bbloomer_add_recurring_row...
Its too late but it can still help to others who are looking for the same : Copy "plugins\woocommerce\templates\cart\cart-totals.php" to "your-theme\woocommerce\templates\cart\cart-totals.php" Open "your-theme\woocommerce\templates\cart\cart-totals.php" and add the following line inside the table tag ``` <?php d...
315,146
<p>I'm trying to make a loop that does the following,</p> <p>The first post is a different column size, and every post under that is a col 6.</p> <p>I'm using bootstrap. this image shows what i'm trying to accomplish. So each NEW posts shows at the top in the full column and everytime you create a new post it pushes ...
[ { "answer_id": 315087, "author": "Praveen", "author_id": 97802, "author_profile": "https://wordpress.stackexchange.com/users/97802", "pm_score": -1, "selected": false, "text": "<p>Try This:</p>\n\n<pre><code> // Add a custom field before single add to cart\nadd_action( 'woocommerc...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315146", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151273/" ]
I'm trying to make a loop that does the following, The first post is a different column size, and every post under that is a col 6. I'm using bootstrap. this image shows what i'm trying to accomplish. So each NEW posts shows at the top in the full column and everytime you create a new post it pushes down into the 1/2...
Its too late but it can still help to others who are looking for the same : Copy "plugins\woocommerce\templates\cart\cart-totals.php" to "your-theme\woocommerce\templates\cart\cart-totals.php" Open "your-theme\woocommerce\templates\cart\cart-totals.php" and add the following line inside the table tag ``` <?php d...
315,156
<p>I'm trying to add a dropdown to Wordpress core blocks to select a data attribute that will be added to the front-end (e.g. data-attr="value-from-dropdown").</p> <p>I think the solution is to add a custom attribute to the core blocks, set it in the back-end and pass it to the front-end, but I can't for the life of m...
[ { "answer_id": 315520, "author": "Ashiquzzaman Kiron", "author_id": 78505, "author_profile": "https://wordpress.stackexchange.com/users/78505", "pm_score": 2, "selected": false, "text": "<p>First inside the edit function declare a variable with your dropdown option -</p>\n\n<pre><code>co...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315156", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151276/" ]
I'm trying to add a dropdown to Wordpress core blocks to select a data attribute that will be added to the front-end (e.g. data-attr="value-from-dropdown"). I think the solution is to add a custom attribute to the core blocks, set it in the back-end and pass it to the front-end, but I can't for the life of me figure o...
You can add a custom attribute to any registered block by using the [`blocks.registerBlockType`](https://developer.wordpress.org/block-editor/developers/filters/block-filters/#blocks-registerblocktype) filter. ``` /** * Filter the attributes for all blocks to add custom ones * * Name can be used to only add the ne...
315,160
<p>I'm developing a wordpress plugin for a project. I'm expected to manage other plugins in this plugin. For example, I will be able to install Akismet over my plugin. I have done things like install, activating, deactivating. But I could not delete the plugin.</p> <p>I can also delete direct attachment files, but I d...
[ { "answer_id": 315520, "author": "Ashiquzzaman Kiron", "author_id": 78505, "author_profile": "https://wordpress.stackexchange.com/users/78505", "pm_score": 2, "selected": false, "text": "<p>First inside the edit function declare a variable with your dropdown option -</p>\n\n<pre><code>co...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315160", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151283/" ]
I'm developing a wordpress plugin for a project. I'm expected to manage other plugins in this plugin. For example, I will be able to install Akismet over my plugin. I have done things like install, activating, deactivating. But I could not delete the plugin. I can also delete direct attachment files, but I don't want ...
You can add a custom attribute to any registered block by using the [`blocks.registerBlockType`](https://developer.wordpress.org/block-editor/developers/filters/block-filters/#blocks-registerblocktype) filter. ``` /** * Filter the attributes for all blocks to add custom ones * * Name can be used to only add the ne...
315,164
<p>I have added a custom metabox that holds string from a <strong>textarea</strong> in database. Now if I just simply echo the meta box like this:</p> <pre><code>$post_meta = get_post_meta($pid); $answer = $post_meta["answer"][0]; echo $answer; </code></pre> <p>the html tags would be escaped and the text would appear...
[ { "answer_id": 315169, "author": "Adnan", "author_id": 90281, "author_profile": "https://wordpress.stackexchange.com/users/90281", "pm_score": -1, "selected": false, "text": "<p>Why don't you use <code>&lt;?php esc_textarea( $answer ); ?&gt;</code> </p>\n" }, { "answer_id": 31519...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144876/" ]
I have added a custom metabox that holds string from a **textarea** in database. Now if I just simply echo the meta box like this: ``` $post_meta = get_post_meta($pid); $answer = $post_meta["answer"][0]; echo $answer; ``` the html tags would be escaped and the text would appear like this: ``` blah blah blah <ul><li...
To add line-breaks inside `<textarea>` (but not on front-end output), use this inside `textarea`: ``` echo str_replace('</li>',"</li>\r\n", $answer); ```
315,176
<p>I need to capture the current page id, execute some conditional script in footer, in my own plugin function hooks to <code>wp_footer</code>.</p> <p>Here is my plugin code, but page id returning wrong value?</p> <pre><code>&lt;?php /* Plugin Name: My Plugin Author: GS Version: 1.1 */ Function footer_page_id(...
[ { "answer_id": 315169, "author": "Adnan", "author_id": 90281, "author_profile": "https://wordpress.stackexchange.com/users/90281", "pm_score": -1, "selected": false, "text": "<p>Why don't you use <code>&lt;?php esc_textarea( $answer ); ?&gt;</code> </p>\n" }, { "answer_id": 31519...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125604/" ]
I need to capture the current page id, execute some conditional script in footer, in my own plugin function hooks to `wp_footer`. Here is my plugin code, but page id returning wrong value? ``` <?php /* Plugin Name: My Plugin Author: GS Version: 1.1 */ Function footer_page_id() { global $post; echo '<div> p...
To add line-breaks inside `<textarea>` (but not on front-end output), use this inside `textarea`: ``` echo str_replace('</li>',"</li>\r\n", $answer); ```
315,187
<p>I am having this weird problem. Everytime I save a draft, the sidebar's black area appears and overlaps the editor making the editor unusable. It also attempts to save the draft repetitively and the only way to get out of it is to refresh the page. Kindly refer to the following image. <a href="https://i.stack.imgur...
[ { "answer_id": 315282, "author": "Mubashar Aftab", "author_id": 27507, "author_profile": "https://wordpress.stackexchange.com/users/27507", "pm_score": 0, "selected": false, "text": "<p>Okay, I found out! It was caused by WP Native Articles' Premium plug-in. I'm now talking to the develo...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315187", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27507/" ]
I am having this weird problem. Everytime I save a draft, the sidebar's black area appears and overlaps the editor making the editor unusable. It also attempts to save the draft repetitively and the only way to get out of it is to refresh the page. Kindly refer to the following image. [![inspecting it revealed nothing...
author of WP Native Articles here. This is normally a problem with other plugins incorrectly messing around with tag incorrectly and preventing it from setting the correct URL. If you save this code below as a separate file, upload it as a plugin and activate it it should fix it. ``` <?php /** * Plugin Name: WPNA Edi...
315,192
<p>I need a function that replaces the price in WooCommerce with "Request a quote". On my site's homepage I just need the text, but on the product page (which is a custom product from my travel theme) I need it to be a button.</p> <p>How can I have 2 functions, one that only works on Home and the other one that works ...
[ { "answer_id": 315196, "author": "T.Todua", "author_id": 33667, "author_profile": "https://wordpress.stackexchange.com/users/33667", "pm_score": 2, "selected": true, "text": "<p>Use this:</p>\n\n<pre><code>function your_function() \n{\n if ( is_front_page() ) {\n $output = ...\...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315192", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101024/" ]
I need a function that replaces the price in WooCommerce with "Request a quote". On my site's homepage I just need the text, but on the product page (which is a custom product from my travel theme) I need it to be a button. How can I have 2 functions, one that only works on Home and the other one that works in the res...
Use this: ``` function your_function() { if ( is_front_page() ) { $output = ... } else{ $output = ... } return $output; } ``` p.s. It's not needed to use `is_home()`. Whoever needs the technical details, see [`is_front_page`](https://developer.wordpress.org/reference/classes/wp_q...
315,246
<p>I use <a href="http://github.com/jjgrainger/PostTypes/" rel="nofollow noreferrer">http://github.com/jjgrainger/PostTypes/</a> to register my custom post types and ACF to add custom fields to my custom post and I want to include in my wp-json response all registered fields per post and I do the following</p> <pre><c...
[ { "answer_id": 342701, "author": "Adrian Barbosa", "author_id": 171706, "author_profile": "https://wordpress.stackexchange.com/users/171706", "pm_score": 2, "selected": false, "text": "<p>I really hope that you have managed this issue. In case you don't, this kinda works for me since the...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315246", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23759/" ]
I use <http://github.com/jjgrainger/PostTypes/> to register my custom post types and ACF to add custom fields to my custom post and I want to include in my wp-json response all registered fields per post and I do the following ``` $options = [ 'supports' => array('revisions'), 'has_archive' => false, 'show...
I really hope that you have managed this issue. In case you don't, this kinda works for me since there is a way to register a custom acf endpoint, in the `functions.php` file you have to add the next code: ``` //Custom acf endpoint; function my_endpoint( $request_data ) { // setup query argument $args = arra...
315,251
<p>After much troubleshooting and searching, I think I finally understand how to get The Loop going. Except I can't seem to get it to actually loop!</p> <p>I have created a Child theme, and added a <code>functions.php</code> file in there with this code:</p> <pre><code>&lt;?php function my_theme_enqueue_styles() { ...
[ { "answer_id": 342701, "author": "Adrian Barbosa", "author_id": 171706, "author_profile": "https://wordpress.stackexchange.com/users/171706", "pm_score": 2, "selected": false, "text": "<p>I really hope that you have managed this issue. In case you don't, this kinda works for me since the...
2018/09/26
[ "https://wordpress.stackexchange.com/questions/315251", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147631/" ]
After much troubleshooting and searching, I think I finally understand how to get The Loop going. Except I can't seem to get it to actually loop! I have created a Child theme, and added a `functions.php` file in there with this code: ``` <?php function my_theme_enqueue_styles() { $parent_style = 'grow-thinkup-st...
I really hope that you have managed this issue. In case you don't, this kinda works for me since there is a way to register a custom acf endpoint, in the `functions.php` file you have to add the next code: ``` //Custom acf endpoint; function my_endpoint( $request_data ) { // setup query argument $args = arra...
315,269
<p>I want to add "custom built" to the front of every product title in a certain category.</p> <pre><code>&lt;?php $args = array('post_type' =&gt; 'product', 'tax_query'=&gt; array( array('taxonomy' =&gt; 'product_cat', 'field' =&gt; 'id', 'terms' ...
[ { "answer_id": 342701, "author": "Adrian Barbosa", "author_id": 171706, "author_profile": "https://wordpress.stackexchange.com/users/171706", "pm_score": 2, "selected": false, "text": "<p>I really hope that you have managed this issue. In case you don't, this kinda works for me since the...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315269", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63922/" ]
I want to add "custom built" to the front of every product title in a certain category. ``` <?php $args = array('post_type' => 'product', 'tax_query'=> array( array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => '3439',),), ...
I really hope that you have managed this issue. In case you don't, this kinda works for me since there is a way to register a custom acf endpoint, in the `functions.php` file you have to add the next code: ``` //Custom acf endpoint; function my_endpoint( $request_data ) { // setup query argument $args = arra...
315,271
<p>I am having a premium wordpress theme which was hosted in godaddy, but its hosting got expired. I somehow managed to get all the previous files from godaddy by paying a hefty amount of money. but i don't know how to restore my site. currently it is showing "error establishing a database connection". what can be done...
[ { "answer_id": 342701, "author": "Adrian Barbosa", "author_id": 171706, "author_profile": "https://wordpress.stackexchange.com/users/171706", "pm_score": 2, "selected": false, "text": "<p>I really hope that you have managed this issue. In case you don't, this kinda works for me since the...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315271", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140116/" ]
I am having a premium wordpress theme which was hosted in godaddy, but its hosting got expired. I somehow managed to get all the previous files from godaddy by paying a hefty amount of money. but i don't know how to restore my site. currently it is showing "error establishing a database connection". what can be done?
I really hope that you have managed this issue. In case you don't, this kinda works for me since there is a way to register a custom acf endpoint, in the `functions.php` file you have to add the next code: ``` //Custom acf endpoint; function my_endpoint( $request_data ) { // setup query argument $args = arra...
315,295
<p>I want to add a product attribute (wc_create_attribute) &amp; assigned terms (wp_insert_term) via the functions.php.</p> <p>Example:</p> <pre><code>$args = array( 'name' =&gt; "Color", 'slug' =&gt; "color", 'order_by' =&gt; "menu_order", 'has_archives' =&gt; "", ); wc_create_attribute($...
[ { "answer_id": 342701, "author": "Adrian Barbosa", "author_id": 171706, "author_profile": "https://wordpress.stackexchange.com/users/171706", "pm_score": 2, "selected": false, "text": "<p>I really hope that you have managed this issue. In case you don't, this kinda works for me since the...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315295", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28159/" ]
I want to add a product attribute (wc\_create\_attribute) & assigned terms (wp\_insert\_term) via the functions.php. Example: ``` $args = array( 'name' => "Color", 'slug' => "color", 'order_by' => "menu_order", 'has_archives' => "", ); wc_create_attribute($args); $add = wp_insert_term( "B...
I really hope that you have managed this issue. In case you don't, this kinda works for me since there is a way to register a custom acf endpoint, in the `functions.php` file you have to add the next code: ``` //Custom acf endpoint; function my_endpoint( $request_data ) { // setup query argument $args = arra...
315,311
<p>I want to display <em>only</em> the sticky posts on my front page. Right now it's possible to do a setting where the sticky posts are displayed at the top followed by the rest of the posts. I don't want to rest of the posts to show up, so how do I make sure only the sticky posts are shown?</p> <p>Thank you!</p>
[ { "answer_id": 315313, "author": "Krishna Joshi", "author_id": 150621, "author_profile": "https://wordpress.stackexchange.com/users/150621", "pm_score": -1, "selected": false, "text": "<p>Try below steps</p>\n\n<ol>\n<li>Log into your WordPress admin panel.</li>\n<li>Look to the left han...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315311", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151369/" ]
I want to display *only* the sticky posts on my front page. Right now it's possible to do a setting where the sticky posts are displayed at the top followed by the rest of the posts. I don't want to rest of the posts to show up, so how do I make sure only the sticky posts are shown? Thank you!
WordPress saves sticky posts inside the option named `sticky_posts`. You can retrieve them via `get_option('sticky_posts')`. With that knowledge it is possible to change the query to only query for sticky posts, you usually do so via the [`pre_get_posts`](https://developer.wordpress.org/reference/hooks/pre_get_posts/)...
315,323
<p>I have a unique website type that only requires 10-20 seconds to make a new post. I want my WordPress site to reload the editor page automatically after a new post has been published hence I don't need to click "Add New" button in order to load blank post editor page.</p>
[ { "answer_id": 315313, "author": "Krishna Joshi", "author_id": 150621, "author_profile": "https://wordpress.stackexchange.com/users/150621", "pm_score": -1, "selected": false, "text": "<p>Try below steps</p>\n\n<ol>\n<li>Log into your WordPress admin panel.</li>\n<li>Look to the left han...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315323", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151377/" ]
I have a unique website type that only requires 10-20 seconds to make a new post. I want my WordPress site to reload the editor page automatically after a new post has been published hence I don't need to click "Add New" button in order to load blank post editor page.
WordPress saves sticky posts inside the option named `sticky_posts`. You can retrieve them via `get_option('sticky_posts')`. With that knowledge it is possible to change the query to only query for sticky posts, you usually do so via the [`pre_get_posts`](https://developer.wordpress.org/reference/hooks/pre_get_posts/)...
315,324
<p>I am coding a WordPress plugin that goes on top of WooCommerce. This plugin basically allows WooCommerce to allocate <strong>store credits</strong> to a logged-in customer whenever he makes an order later marked as <code>Completed</code> after payment. These store credits can then be used to offset the cost of a fut...
[ { "answer_id": 315366, "author": "Matt Royal", "author_id": 51860, "author_profile": "https://wordpress.stackexchange.com/users/51860", "pm_score": 3, "selected": true, "text": "<p>I would suggest adding a \"virtual\" coupon to the order which would represent the store credit.</p>\n\n<p>...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315324", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78806/" ]
I am coding a WordPress plugin that goes on top of WooCommerce. This plugin basically allows WooCommerce to allocate **store credits** to a logged-in customer whenever he makes an order later marked as `Completed` after payment. These store credits can then be used to offset the cost of a future order that the customer...
I would suggest adding a "virtual" coupon to the order which would represent the store credit. Coupons are applied on the cart page before checkout, this is where I would hook in. You can use something like the `woocommerce_cart_subtotal` filter as per my example below: ``` function royal_woocommerce_filter_checkout...
315,363
<p>I have created a custom post type. Within that I have assigned two custom taxonomies. One (computer) is what I use to drive the template files and slug of page (taxonomy-computer.php). The second (faq-option) is what will categorize all posts associated under the first taxonomy (computer). </p> <p>My issue that I a...
[ { "answer_id": 315357, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 2, "selected": false, "text": "<p>Content in WordPress is inside the WordPress database. </p>\n\n<p>If you have deleted the WP database,...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315363", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115019/" ]
I have created a custom post type. Within that I have assigned two custom taxonomies. One (computer) is what I use to drive the template files and slug of page (taxonomy-computer.php). The second (faq-option) is what will categorize all posts associated under the first taxonomy (computer). My issue that I am having i...
Content in WordPress is inside the WordPress database. If you have deleted the WP database, then the content is gone. Installing a new WP instance will create a new, mostly blank database. So, unless you have a backup copy of your database to restore, your content is gone. Your hosting place may have made a backup ...
315,369
<p>I'm running a query (200-300 posts), while this might not be for a lot of people / hosts, I just want to optimize wherever I can, given the fact that a lot of things happen when running that particular script, and so, my motivation is optimization.</p> <p>My query is exactly:</p> <pre><code> $args = [ '...
[ { "answer_id": 315379, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>It is not a \"must have\", but you should use it whenever you are not interested in knowing the total amo...
2018/09/27
[ "https://wordpress.stackexchange.com/questions/315369", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143406/" ]
I'm running a query (200-300 posts), while this might not be for a lot of people / hosts, I just want to optimize wherever I can, given the fact that a lot of things happen when running that particular script, and so, my motivation is optimization. My query is exactly: ``` $args = [ 'post_type' => 'post',...
I'm going to try and answer: > > Is `no_found_rows => true` a must-have when querying big lists of posts where you just need to know about all the posts in a given query? > > > Yes, but you shouldn't be doing that anyway. Fetching large numbers of posts in a single query is bad for numerous reasons: * memory exh...
315,383
<p>I see Yoast stores the snippet variables in the database. I'd like to get their values and ship them via the WP REST API. I'd also like to keep the Admin functionality for Administrators and the default settings for scalability. </p> <p>I'm shipping the values off to a different application, but I can't ship the pl...
[ { "answer_id": 315393, "author": "realloc", "author_id": 6972, "author_profile": "https://wordpress.stackexchange.com/users/6972", "pm_score": 0, "selected": false, "text": "<p>Yoast's SEO plugin has a <a href=\"https://yoast.com/wordpress/plugins/seo/api/\" rel=\"nofollow noreferrer\">n...
2018/09/28
[ "https://wordpress.stackexchange.com/questions/315383", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29089/" ]
I see Yoast stores the snippet variables in the database. I'd like to get their values and ship them via the WP REST API. I'd also like to keep the Admin functionality for Administrators and the default settings for scalability. I'm shipping the values off to a different application, but I can't ship the placeholders...
Basically this is the answer I was looking for from this question: ``` function yoastVariableToTitle( $post_id ) { $yoast_title = get_post_meta( $post_id, '_yoast_wpseo_title', true ); $title = strstr( $yoast_title, '%%', true ); if ( empty( $title ) ) { $title = get_the_title( $post_id ); ...
315,399
<p>To increase the loading speed, I would like to only enable Event Manager plugin on the pages where it's actually used. For that, I wrote this piece of code:</p> <pre><code>// deregister unnecessary plugin scripts: function my_deregister() { if ( !is_page('events') ) { wp_deregister_script( 'events-mana...
[ { "answer_id": 315393, "author": "realloc", "author_id": 6972, "author_profile": "https://wordpress.stackexchange.com/users/6972", "pm_score": 0, "selected": false, "text": "<p>Yoast's SEO plugin has a <a href=\"https://yoast.com/wordpress/plugins/seo/api/\" rel=\"nofollow noreferrer\">n...
2018/09/28
[ "https://wordpress.stackexchange.com/questions/315399", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/122123/" ]
To increase the loading speed, I would like to only enable Event Manager plugin on the pages where it's actually used. For that, I wrote this piece of code: ``` // deregister unnecessary plugin scripts: function my_deregister() { if ( !is_page('events') ) { wp_deregister_script( 'events-manager' ); }...
Basically this is the answer I was looking for from this question: ``` function yoastVariableToTitle( $post_id ) { $yoast_title = get_post_meta( $post_id, '_yoast_wpseo_title', true ); $title = strstr( $yoast_title, '%%', true ); if ( empty( $title ) ) { $title = get_the_title( $post_id ); ...
315,406
<p>I have a website it's contains a lot of news, i have to list this news in one PHP file , now i want to insert each news in wordPress as a Post.. what is the best practice way to do that (the news are more than 100 articles) , how can i build manually the XML file so i can import it in WordPress ? or what is the post...
[ { "answer_id": 315393, "author": "realloc", "author_id": 6972, "author_profile": "https://wordpress.stackexchange.com/users/6972", "pm_score": 0, "selected": false, "text": "<p>Yoast's SEO plugin has a <a href=\"https://yoast.com/wordpress/plugins/seo/api/\" rel=\"nofollow noreferrer\">n...
2018/09/28
[ "https://wordpress.stackexchange.com/questions/315406", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151424/" ]
I have a website it's contains a lot of news, i have to list this news in one PHP file , now i want to insert each news in wordPress as a Post.. what is the best practice way to do that (the news are more than 100 articles) , how can i build manually the XML file so i can import it in WordPress ? or what is the post in...
Basically this is the answer I was looking for from this question: ``` function yoastVariableToTitle( $post_id ) { $yoast_title = get_post_meta( $post_id, '_yoast_wpseo_title', true ); $title = strstr( $yoast_title, '%%', true ); if ( empty( $title ) ) { $title = get_the_title( $post_id ); ...