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
343,563
<p>I have tried adding a file inside my <code>header.php</code>, but it will not load correctly. I get this error:</p> <blockquote> <p>Fatal error: Uncaught Error: Call to undefined function get_tempalte_part()</p> </blockquote> <p>Here is my markup in my <code>header.php</code>:</p> <pre><code>&lt;html class="m...
[ { "answer_id": 343564, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 1, "selected": false, "text": "<p>You've spelt it wrong: <code>get_tempalte_part</code>, \"tempalte\", needs to be <code>get_template_par...
2019/07/24
[ "https://wordpress.stackexchange.com/questions/343563", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/124452/" ]
I have tried adding a file inside my `header.php`, but it will not load correctly. I get this error: > > Fatal error: Uncaught Error: Call to undefined function > get\_tempalte\_part() > > > Here is my markup in my `header.php`: ``` <html class="m-0"> <head> <meta charset="utf-8"> <meta name...
This is just a supplement to the other answer. > > I am trying to load `fd-blog.php` if it is the 'Blog' page, otherwise > load the `fd-default.php` > > > To actually load the template file, you should remove the dash (`-`): ```php get_template_part( 'inc/fd', 'blog' ); // loads inc/fd-blog.php get_template_...
343,595
<p>I have copied a wordpress instance from production to my local. After getting the public side of the site up - public homepage, pages, and blog posts -, I cannot access /wp-admin/ because that url always redirects to the / homepage. I have tried:</p> <ul> <li>Updating the siteurl and home to "<a href="https://tk....
[ { "answer_id": 343946, "author": "Justin Waulters", "author_id": 137235, "author_profile": "https://wordpress.stackexchange.com/users/137235", "pm_score": 1, "selected": false, "text": "<p>Please try going into the local database and looking in the <code>options</code> table for the home...
2019/07/24
[ "https://wordpress.stackexchange.com/questions/343595", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38029/" ]
I have copied a wordpress instance from production to my local. After getting the public side of the site up - public homepage, pages, and blog posts -, I cannot access /wp-admin/ because that url always redirects to the / homepage. I have tried: * Updating the siteurl and home to "<https://tk.local>" (homepage and po...
In my case, it ended up being some kind of adverse interaction in the nginx wordpress config that I had. Something about not passing along the naked arguments: ``` location / { original line: try_files $uri @php; new line: try_files $uri $uri/ /index.php?$args; } ``` And the asso...
343,598
<p><a href="https://developers.google.com/tag-manager/quickstart" rel="nofollow noreferrer">GTM documentation</a> says to include two snippets, 1 after <code>&lt;head&gt;</code> opening tag and 1 after <code>&lt;body&gt;</code> opening tag. Initially I was adding the snippets in my child's header.php file. I wanted to ...
[ { "answer_id": 343620, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 1, "selected": false, "text": "<p>The problem is that your code is inside the <code>&lt;head&gt;</code> element, but the code is trying t...
2019/07/24
[ "https://wordpress.stackexchange.com/questions/343598", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135723/" ]
[GTM documentation](https://developers.google.com/tag-manager/quickstart) says to include two snippets, 1 after `<head>` opening tag and 1 after `<body>` opening tag. Initially I was adding the snippets in my child's header.php file. I wanted to drop that method and use plain JS instead, mainly because of parent theme ...
The problem is that your code is inside the `<head>` element, but the code is trying to access `document.body` which won't exist at the time that your script is run. If I recall correctly you're *supposed* to place this code immediately after the opening `<body>` tag. To do this from functions.php your theme needs to s...
343,673
<p>It almost work correctly, but alwas return the same menu name: On home all menu elements name home on contact all menu elements name contact</p> <pre><code>function max_title_length( $title ) { global $post; $id = ($post-&gt;ID); $title = get_post( $id )-&gt;post_title; $max = 20; if( strlen( $t...
[ { "answer_id": 343676, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 1, "selected": false, "text": "<p>It's because you're not using the filter correctly. The <code>the_title</code> filter passes the title ...
2019/07/25
[ "https://wordpress.stackexchange.com/questions/343673", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/171954/" ]
It almost work correctly, but alwas return the same menu name: On home all menu elements name home on contact all menu elements name contact ``` function max_title_length( $title ) { global $post; $id = ($post->ID); $title = get_post( $id )->post_title; $max = 20; if( strlen( $title ) > $max ) { ...
It's because you're not using the filter correctly. The `the_title` filter passes the title to be filtered as the `$title` argument, but you're overwriting it with this code: ``` global $post; $id = ($post->ID); $title = get_post( $id )->post_title; ``` That code's completely unnecessary because the title is already...
343,778
<p>So this is not a transferrable question to other sites out there, but I am creating a Wordpress multisite for internal use at our office and instead of duplicating the theme CSS, JS, and other assets I created it all into one MU-Plugin.</p> <p>I know this is not standard practice, but I am the only one managing the...
[ { "answer_id": 343786, "author": "Кристиян Кацаров", "author_id": 140118, "author_profile": "https://wordpress.stackexchange.com/users/140118", "pm_score": 1, "selected": false, "text": "<p>Take a look at <code>after_switch_theme</code> <a href=\"https://codex.wordpress.org/Plugin_API/Ac...
2019/07/27
[ "https://wordpress.stackexchange.com/questions/343778", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17411/" ]
So this is not a transferrable question to other sites out there, but I am creating a Wordpress multisite for internal use at our office and instead of duplicating the theme CSS, JS, and other assets I created it all into one MU-Plugin. I know this is not standard practice, but I am the only one managing the sites, an...
@Кристиян Кацаров is correct in the handling of when to do the function, but I ended up writing something that doesn't use any WP inbuilt functions (which I was hoping there was). ``` function default_css_dir() { $themeName = wp_get_theme()->get('TextDomain'); $themeName = get_template(); $cssPathway = ...
343,841
<p>I have multi author wordpress site and every author can publish posts from two different post types . i want to display author post count by post type in author.php . According to codex.wordpress i used this code: but it displays total post count instead of author post count.</p> <pre><code>&lt;?php echo 'Number of...
[ { "answer_id": 343786, "author": "Кристиян Кацаров", "author_id": 140118, "author_profile": "https://wordpress.stackexchange.com/users/140118", "pm_score": 1, "selected": false, "text": "<p>Take a look at <code>after_switch_theme</code> <a href=\"https://codex.wordpress.org/Plugin_API/Ac...
2019/07/28
[ "https://wordpress.stackexchange.com/questions/343841", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172323/" ]
I have multi author wordpress site and every author can publish posts from two different post types . i want to display author post count by post type in author.php . According to codex.wordpress i used this code: but it displays total post count instead of author post count. ``` <?php echo 'Number of posts published ...
@Кристиян Кацаров is correct in the handling of when to do the function, but I ended up writing something that doesn't use any WP inbuilt functions (which I was hoping there was). ``` function default_css_dir() { $themeName = wp_get_theme()->get('TextDomain'); $themeName = get_template(); $cssPathway = ...
343,850
<p>New to MAMP, but had no issues with installation and viewing the WordPress site I pulled down from my server. However, can’t figure out to log into the admin side of my site. Here’s what I’ve tried, and the results:</p> <p>Setting: Web Server > Document Root > Sites</p> <ol> <li><p>localhost:8888 = displays websit...
[ { "answer_id": 343786, "author": "Кристиян Кацаров", "author_id": 140118, "author_profile": "https://wordpress.stackexchange.com/users/140118", "pm_score": 1, "selected": false, "text": "<p>Take a look at <code>after_switch_theme</code> <a href=\"https://codex.wordpress.org/Plugin_API/Ac...
2019/07/28
[ "https://wordpress.stackexchange.com/questions/343850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/153797/" ]
New to MAMP, but had no issues with installation and viewing the WordPress site I pulled down from my server. However, can’t figure out to log into the admin side of my site. Here’s what I’ve tried, and the results: Setting: Web Server > Document Root > Sites 1. localhost:8888 = displays website with no issues 2. <ht...
@Кристиян Кацаров is correct in the handling of when to do the function, but I ended up writing something that doesn't use any WP inbuilt functions (which I was hoping there was). ``` function default_css_dir() { $themeName = wp_get_theme()->get('TextDomain'); $themeName = get_template(); $cssPathway = ...
343,936
<p>I want to add more links in my menu.</p> <p>duvacon.de ---> you see only the "categories", I want also add the links of my footer menu to the header.</p> <p>This code is for the header menu, now I want to add a link for "contact", "chat"... in the header</p> <pre><code>&lt;div class="menu"&gt; &lt;a class="bt...
[ { "answer_id": 343786, "author": "Кристиян Кацаров", "author_id": 140118, "author_profile": "https://wordpress.stackexchange.com/users/140118", "pm_score": 1, "selected": false, "text": "<p>Take a look at <code>after_switch_theme</code> <a href=\"https://codex.wordpress.org/Plugin_API/Ac...
2019/07/29
[ "https://wordpress.stackexchange.com/questions/343936", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172659/" ]
I want to add more links in my menu. duvacon.de ---> you see only the "categories", I want also add the links of my footer menu to the header. This code is for the header menu, now I want to add a link for "contact", "chat"... in the header ``` <div class="menu"> <a class="btn"><?php _e("Categories", "myfriv"); ...
@Кристиян Кацаров is correct in the handling of when to do the function, but I ended up writing something that doesn't use any WP inbuilt functions (which I was hoping there was). ``` function default_css_dir() { $themeName = wp_get_theme()->get('TextDomain'); $themeName = get_template(); $cssPathway = ...
343,999
<p>I want to migrate my development wordpress site to the production domain. In order to success the migration I found and replace all previous url occurences (<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>) to the new (<a href="https://mywebsite.com" rel="nofollow noreferrer">https://mywebsi...
[ { "answer_id": 344000, "author": "Louis D.", "author_id": 172615, "author_profile": "https://wordpress.stackexchange.com/users/172615", "pm_score": 1, "selected": true, "text": "<p>It's possible to search and replace old urls to new ones by using <code>maybe_unserialize(get_theme_mods())...
2019/07/30
[ "https://wordpress.stackexchange.com/questions/343999", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172615/" ]
I want to migrate my development wordpress site to the production domain. In order to success the migration I found and replace all previous url occurences (<http://localhost>) to the new (<https://mywebsite.com>). The problem is that old urls cannot be replaced directly in the field `option_value` of `theme_mods_{your...
It's possible to search and replace old urls to new ones by using `maybe_unserialize(get_theme_mods())` and `get_theme_mod()` WP functions and following these steps: 1. Create a php file in the root folder of your WP installation (same path as `wp-load.php`). 2. Insert the following code : ```php require_once("wp-loa...
344,007
<p>I have my permalink structure for posts set up like this: <code>/%category%/%postname%/</code></p> <p>This generates URLs like this: <code>mysite.io/category/sub-category/post-name</code></p> <p>Thats all fine. However, the <strong>archive page</strong> URLs for <strong>sub</strong>categories are like this: <code...
[ { "answer_id": 344287, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>Is there some hook that I can use to alter a taxonomy that has already been register...
2019/07/30
[ "https://wordpress.stackexchange.com/questions/344007", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172709/" ]
I have my permalink structure for posts set up like this: `/%category%/%postname%/` This generates URLs like this: `mysite.io/category/sub-category/post-name` Thats all fine. However, the **archive page** URLs for **sub**categories are like this: `mysite.io/sub-category` Instead, the URLs for **sub**categories shou...
You answered your own question yourself. You want links to custom categories to look like this ``` {taxonomy_slug}/{parent_term}/{child_term}/{grandchild_term}/ ``` so you should pay attention to two parameters in the `register_taxonomy()` arguments: `hierarchical` and `rewrite`. ``` $args = [ 'hierarchical' =...
344,009
<p>I have a function in the WordPress functions.php file that searches for a condition in user meta and sends an email to a user based on what it finds. I currently use wp_mail() to send the email, and that works. However, I want to use the included PHPMailer class to do this so that I can send the messages via SMTP.</...
[ { "answer_id": 351194, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 2, "selected": false, "text": "<p>There's no need to use the PHPMailer class in place of <code>wp_mail()</code>. <code>wp_mail()</code> is ...
2019/07/30
[ "https://wordpress.stackexchange.com/questions/344009", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172712/" ]
I have a function in the WordPress functions.php file that searches for a condition in user meta and sends an email to a user based on what it finds. I currently use wp\_mail() to send the email, and that works. However, I want to use the included PHPMailer class to do this so that I can send the messages via SMTP. I ...
There's no need to use the PHPMailer class in place of `wp_mail()`. `wp_mail()` is a essentially a wrapper for the class. It just makes an easier way of packaging and sending the message. You can access the PHPMailer elements when it is initialized in order to have `wp_mail()` send through SMTP instead of the web serv...
344,063
<p>I have a WordPress post which is accessible via domain.com/test/</p> <p>What I want to be able to do is pass in a parameter using the URL - ie going to domain.com/test/ would load the same page as domain.com/test/ - but in url show the /accommodation/value1/<strong>?m=1</strong> in the browser address bar.</p> <p>...
[ { "answer_id": 351194, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 2, "selected": false, "text": "<p>There's no need to use the PHPMailer class in place of <code>wp_mail()</code>. <code>wp_mail()</code> is ...
2019/07/31
[ "https://wordpress.stackexchange.com/questions/344063", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/160490/" ]
I have a WordPress post which is accessible via domain.com/test/ What I want to be able to do is pass in a parameter using the URL - ie going to domain.com/test/ would load the same page as domain.com/test/ - but in url show the /accommodation/value1/**?m=1** in the browser address bar. I guess another way of putting...
There's no need to use the PHPMailer class in place of `wp_mail()`. `wp_mail()` is a essentially a wrapper for the class. It just makes an easier way of packaging and sending the message. You can access the PHPMailer elements when it is initialized in order to have `wp_mail()` send through SMTP instead of the web serv...
344,071
<p>I was hoping to limit the access that my new team of contributors have through the dashboard; and stumbling this video on YouTube on how to possibly limit this; i thought i'd give it a shot. </p> <ul> <li>Here's a link for reference: <a href="https://www.youtube.com/watch?v=9gUCVWjI6OA" rel="nofollow noreferrer">ht...
[ { "answer_id": 351194, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 2, "selected": false, "text": "<p>There's no need to use the PHPMailer class in place of <code>wp_mail()</code>. <code>wp_mail()</code> is ...
2019/07/31
[ "https://wordpress.stackexchange.com/questions/344071", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172774/" ]
I was hoping to limit the access that my new team of contributors have through the dashboard; and stumbling this video on YouTube on how to possibly limit this; i thought i'd give it a shot. * Here's a link for reference: <https://www.youtube.com/watch?v=9gUCVWjI6OA> So i went ahead and added the code to my function...
There's no need to use the PHPMailer class in place of `wp_mail()`. `wp_mail()` is a essentially a wrapper for the class. It just makes an easier way of packaging and sending the message. You can access the PHPMailer elements when it is initialized in order to have `wp_mail()` send through SMTP instead of the web serv...
344,148
<p>I'm a noob.</p> <p>I have copied the header.php from the parent theme, I have added some snippets and things work. However, I would like to be able to add those same snippets either using a plugin or via functions.php so when/if the theme is updated, I don't need to redo everything. I've tried many things but none ...
[ { "answer_id": 351194, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 2, "selected": false, "text": "<p>There's no need to use the PHPMailer class in place of <code>wp_mail()</code>. <code>wp_mail()</code> is ...
2019/08/01
[ "https://wordpress.stackexchange.com/questions/344148", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133956/" ]
I'm a noob. I have copied the header.php from the parent theme, I have added some snippets and things work. However, I would like to be able to add those same snippets either using a plugin or via functions.php so when/if the theme is updated, I don't need to redo everything. I've tried many things but none of them wo...
There's no need to use the PHPMailer class in place of `wp_mail()`. `wp_mail()` is a essentially a wrapper for the class. It just makes an easier way of packaging and sending the message. You can access the PHPMailer elements when it is initialized in order to have `wp_mail()` send through SMTP instead of the web serv...
344,261
<p>I have this code:</p> <pre><code>$query = "SELECT * FROM $wpdb-&gt;posts INNER JOIN $wpdb-&gt;postmeta ON $wpdb-&gt;posts.ID = $wpdb-&gt;postmeta.post_id INNER JOIN $wpdb-&gt;term_relationships ON $wpdb-&gt;posts.ID = $wpdb-&gt;t...
[ { "answer_id": 344263, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 0, "selected": false, "text": "<p>The difference is what is returned.</p>\n\n<p>The WPDB <code>query()</code> method returns <code>true</cod...
2019/08/02
[ "https://wordpress.stackexchange.com/questions/344261", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/142560/" ]
I have this code: ``` $query = "SELECT * FROM $wpdb->posts INNER JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id INNER JOIN $wpdb->term_relationships ON $wpdb->posts.ID = $wpdb->term_relationships.object_id ...
The difference is what is returned. The WPDB `query()` method returns `true` for CREATE, ALTER, TRUNCATE and DROP queries, an integer of how many results for all other queries, or simply `false` if if there's an error. The WPDB `get_results()` method actually returns the entire result of the query (like you would get...
344,308
<p>I have a multisite wordpress installation on aws linux, working perfectly fine. The WP Rest api is also working exactly as it should. Except for one single case.</p> <pre><code>/wp-json/wp/v2/posts?author=&lt;some int&gt; </code></pre> <p>For everything else, including my custom endpoints, and custom params/fields...
[ { "answer_id": 344263, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 0, "selected": false, "text": "<p>The difference is what is returned.</p>\n\n<p>The WPDB <code>query()</code> method returns <code>true</cod...
2019/08/03
[ "https://wordpress.stackexchange.com/questions/344308", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/171870/" ]
I have a multisite wordpress installation on aws linux, working perfectly fine. The WP Rest api is also working exactly as it should. Except for one single case. ``` /wp-json/wp/v2/posts?author=<some int> ``` For everything else, including my custom endpoints, and custom params/fields added to the api, it works perf...
The difference is what is returned. The WPDB `query()` method returns `true` for CREATE, ALTER, TRUNCATE and DROP queries, an integer of how many results for all other queries, or simply `false` if if there's an error. The WPDB `get_results()` method actually returns the entire result of the query (like you would get...
344,360
<p>I have set up WP as multisite installation with subdomains. The dashboard for both the site network and each site is working fine, except for the error I get using Block Editor on my parent site. </p> <p>So I have wyamazaki.fi as my main domain, and want to create two websites, one for blog, another for company web...
[ { "answer_id": 344263, "author": "butlerblog", "author_id": 38603, "author_profile": "https://wordpress.stackexchange.com/users/38603", "pm_score": 0, "selected": false, "text": "<p>The difference is what is returned.</p>\n\n<p>The WPDB <code>query()</code> method returns <code>true</cod...
2019/08/04
[ "https://wordpress.stackexchange.com/questions/344360", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172988/" ]
I have set up WP as multisite installation with subdomains. The dashboard for both the site network and each site is working fine, except for the error I get using Block Editor on my parent site. So I have wyamazaki.fi as my main domain, and want to create two websites, one for blog, another for company website using...
The difference is what is returned. The WPDB `query()` method returns `true` for CREATE, ALTER, TRUNCATE and DROP queries, an integer of how many results for all other queries, or simply `false` if if there's an error. The WPDB `get_results()` method actually returns the entire result of the query (like you would get...
344,386
<p>I'm using this code to display size attributes below each product on the shop archive page, but it throws the error below. How do I change the code to fix this error? My thoughts the code has depreciated. </p> <pre><code>add_action('woocommerce_after_shop_loop_item_title', 'add_attribute', 5); function add_attribut...
[ { "answer_id": 344400, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 3, "selected": true, "text": "<p>Your code is outdated since WooCommerce 3. <br>\nFirst, you need to target variable products type only to...
2019/08/05
[ "https://wordpress.stackexchange.com/questions/344386", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118008/" ]
I'm using this code to display size attributes below each product on the shop archive page, but it throws the error below. How do I change the code to fix this error? My thoughts the code has depreciated. ``` add_action('woocommerce_after_shop_loop_item_title', 'add_attribute', 5); function add_attribute() { $des...
Your code is outdated since WooCommerce 3. First, you need to target variable products type only to avoid errors on other products types and also `$product` is already the product object. Also you can also directly use the `WC_Product` method `get_attribute()` and your code will be much more simpler, compact and ...
344,393
<p>I'm using Jetpack to lazy load images and wanted to fade in them nicely using CSS. I've tried adding the following CSS in my theme:</p> <pre><code>.jetpack-lazy-image { opacity: 0; -webkit-transition: .3s; transition: .3s; } .jetpack-lazy-image--handled { opacity: 1; } </code></pre> <p>but that do...
[ { "answer_id": 344400, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 3, "selected": true, "text": "<p>Your code is outdated since WooCommerce 3. <br>\nFirst, you need to target variable products type only to...
2019/08/05
[ "https://wordpress.stackexchange.com/questions/344393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173014/" ]
I'm using Jetpack to lazy load images and wanted to fade in them nicely using CSS. I've tried adding the following CSS in my theme: ``` .jetpack-lazy-image { opacity: 0; -webkit-transition: .3s; transition: .3s; } .jetpack-lazy-image--handled { opacity: 1; } ``` but that doesn’t work. I've also trie...
Your code is outdated since WooCommerce 3. First, you need to target variable products type only to avoid errors on other products types and also `$product` is already the product object. Also you can also directly use the `WC_Product` method `get_attribute()` and your code will be much more simpler, compact and ...
344,404
<p>I'm trying to create a custom block but I need some assistance.</p> <p>I'm attempting to setup a <code>&lt;select&gt;</code> in the editor that lists all the posts. I'm not very experienced at the api yet but after reading the docs, it seems that the below line should work to get the posts.</p> <pre><code>wp.api.c...
[ { "answer_id": 344416, "author": "Den Pat", "author_id": 103569, "author_profile": "https://wordpress.stackexchange.com/users/103569", "pm_score": 1, "selected": false, "text": "<p>You need to enqueue WP API javascript, You should have added the above code in one of your custom files, su...
2019/08/05
[ "https://wordpress.stackexchange.com/questions/344404", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/59902/" ]
I'm trying to create a custom block but I need some assistance. I'm attempting to setup a `<select>` in the editor that lists all the posts. I'm not very experienced at the api yet but after reading the docs, it seems that the below line should work to get the posts. ``` wp.api.collections.Posts().fetch() ``` The p...
In addition to loading the `wp-api` script as mentioned [here](https://developer.wordpress.org/rest-api/using-the-rest-api/backbone-javascript-client/#using): ```php wp_enqueue_script( 'wp-api' ); // or use below when enqueueing as dependency //wp_enqueue_script( 'my_script', 'path/to/my/script', array( 'wp-api' ) ); ...
344,485
<p>I'm working on a custom gutenberg block, and in the <code>save</code> method, I have dynamically changing HTML in the form of a string.</p> <pre class="lang-js prettyprint-override"><code>element.createElement( 'div', null, contentString, ) </code></pre> <p>The above snippet just outputs the HTML as a ...
[ { "answer_id": 344492, "author": "Vortac", "author_id": 167651, "author_profile": "https://wordpress.stackexchange.com/users/167651", "pm_score": 1, "selected": false, "text": "<p>I haven’t tested it, but you might want to try:</p>\n\n<pre><code>element.createElement(\n 'div',\n nu...
2019/08/06
[ "https://wordpress.stackexchange.com/questions/344485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/59902/" ]
I'm working on a custom gutenberg block, and in the `save` method, I have dynamically changing HTML in the form of a string. ```js element.createElement( 'div', null, contentString, ) ``` The above snippet just outputs the HTML as a string, converting all the symbols to HTML entities (`&lt;`, `&gt;`, etc...
You can use [`dangerouslysetinnerhtml`](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml), a special HTML attribute in React: > > `dangerouslySetInnerHTML` is React’s replacement for using `innerHTML` > in the browser DOM. In general, setting HTML from code is risky > because it’s easy to inadvert...
344,537
<p>I have tried every which way to authenticate a post request.</p> <ol> <li><p>WP User Plugin - As per the <a href="http://wpuserplus.com/blog/doc/wordpress-rest-api-login-user/" rel="nofollow noreferrer">docs</a>, I've logged in at <code>wp-json/wpuser/v1/user/login</code> and received my token. I've passed that tok...
[ { "answer_id": 344540, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 1, "selected": false, "text": "<p>You don't need plugins for authentication unless you're making a cross domain request, and to get the nonce,...
2019/08/06
[ "https://wordpress.stackexchange.com/questions/344537", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/164858/" ]
I have tried every which way to authenticate a post request. 1. WP User Plugin - As per the [docs](http://wpuserplus.com/blog/doc/wordpress-rest-api-login-user/), I've logged in at `wp-json/wpuser/v1/user/login` and received my token. I've passed that token as a header called "Authorization" (also tried "authorization...
You don't need plugins for authentication unless you're making a cross domain request, and to get the nonce, you just create it as you would any other nonce. As the handbook states: > > For developers making manual Ajax requests, the nonce will need to be passed with each request. **The API uses nonces with the acti...
344,557
<p>The following code <a href="https://wordpress.stackexchange.com/a/344400/79855">from a previous answer</a> to one of my questions displays Woocommerce "Size" product attributes below each product on the shop page: </p> <pre><code>add_action( 'woocommerce_after_shop_loop_item_title', 'display_size_attribute', 5 ); f...
[ { "answer_id": 344561, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 3, "selected": true, "text": "<p>To get only available \"In stock\" displayed sizes, you need something a little more complicated and diff...
2019/08/07
[ "https://wordpress.stackexchange.com/questions/344557", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118008/" ]
The following code [from a previous answer](https://wordpress.stackexchange.com/a/344400/79855) to one of my questions displays Woocommerce "Size" product attributes below each product on the shop page: ``` add_action( 'woocommerce_after_shop_loop_item_title', 'display_size_attribute', 5 ); function display_size_attr...
To get only available "In stock" displayed sizes, you need something a little more complicated and different: ``` add_action( 'woocommerce_after_shop_loop_item_title', 'display_instock_sizes', 5 ); function display_instock_sizes() { global $product; if ( $product->is_type('variable') ) { $taxonomy ...
344,562
<p>I am working on this site for my own business and when I create a menu with child links, as per below image, only last child of that drop down menu, it actually clicks and loads a page.</p> <p><a href="https://i.stack.imgur.com/5UYwY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5UYwY.png" alt=...
[ { "answer_id": 344561, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 3, "selected": true, "text": "<p>To get only available \"In stock\" displayed sizes, you need something a little more complicated and diff...
2019/08/07
[ "https://wordpress.stackexchange.com/questions/344562", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173119/" ]
I am working on this site for my own business and when I create a menu with child links, as per below image, only last child of that drop down menu, it actually clicks and loads a page. [![enter image description here](https://i.stack.imgur.com/5UYwY.png)](https://i.stack.imgur.com/5UYwY.png) [![enter image descripti...
To get only available "In stock" displayed sizes, you need something a little more complicated and different: ``` add_action( 'woocommerce_after_shop_loop_item_title', 'display_instock_sizes', 5 ); function display_instock_sizes() { global $product; if ( $product->is_type('variable') ) { $taxonomy ...
344,572
<p>Let me start saying that I know a 'tax_query' is faster than 'meta_query'.</p> <p>It's always recommended to use taxonomies over custom meta when filtering by custom data is required, but here I found myself in this situation.</p> <p>I'm creating a Real Estate application where I have this obvious post type 'prope...
[ { "answer_id": 344575, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 0, "selected": false, "text": "<p>Well, I wouldn't say that <em>\"tax_query beats meta_query\"</em>... They're a little bit different t...
2019/08/07
[ "https://wordpress.stackexchange.com/questions/344572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/126374/" ]
Let me start saying that I know a 'tax\_query' is faster than 'meta\_query'. It's always recommended to use taxonomies over custom meta when filtering by custom data is required, but here I found myself in this situation. I'm creating a Real Estate application where I have this obvious post type 'property'. Each prop...
> > Does tax\_query beats meta\_query even in situations like this? > > > No. Taxonomies are appropriate if you have a common set of values that are shared by many posts, and you're doing a simple comparison based on whether the post has or does not have a particular value. They are *not* appropriate if you need ...
344,791
<p>I currently have a global function in my functions.php file</p> <pre><code>ein_error_log($message) { //push out $message to file... } </code></pre> <p>But I want to start using it in my MU-Plugin directory and it doesn't know it exists. So I assume it's because MU-Plugins folder is read before the theme fol...
[ { "answer_id": 344575, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 0, "selected": false, "text": "<p>Well, I wouldn't say that <em>\"tax_query beats meta_query\"</em>... They're a little bit different t...
2019/08/09
[ "https://wordpress.stackexchange.com/questions/344791", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/172849/" ]
I currently have a global function in my functions.php file ``` ein_error_log($message) { //push out $message to file... } ``` But I want to start using it in my MU-Plugin directory and it doesn't know it exists. So I assume it's because MU-Plugins folder is read before the theme folder in WordPress's hierarc...
> > Does tax\_query beats meta\_query even in situations like this? > > > No. Taxonomies are appropriate if you have a common set of values that are shared by many posts, and you're doing a simple comparison based on whether the post has or does not have a particular value. They are *not* appropriate if you need ...
344,792
<p>I'm attempting to put together a variable/mixed content carousel block. I'm having issues trying to figure out how to create/delete individual slides in the carousel (using something like rangecontrol).</p> <p>So far I have this:</p> <pre><code>const ALLOWED_BLOCKS = [ 'core/paragraph' ]; const BLOCKS_TEMPLATE = [...
[ { "answer_id": 344954, "author": "shramee", "author_id": 92887, "author_profile": "https://wordpress.stackexchange.com/users/92887", "pm_score": 0, "selected": false, "text": "<p>Something like this...</p>\n\nCreating slides elements\n\n<pre><code>const slides = [];\n\nfor ( let i = 0; i...
2019/08/09
[ "https://wordpress.stackexchange.com/questions/344792", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/98703/" ]
I'm attempting to put together a variable/mixed content carousel block. I'm having issues trying to figure out how to create/delete individual slides in the carousel (using something like rangecontrol). So far I have this: ``` const ALLOWED_BLOCKS = [ 'core/paragraph' ]; const BLOCKS_TEMPLATE = [ [ 'core/columns'...
The code from [core/columns](https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/columns) and [core/column](https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/column) blocks are a good example of how to achieve this behaviour. Basically we register 2 block types: Car...
344,800
<p>I'm building a block that has, among other things, a FontAwesome icon. I'm currently letting users choose which icon by using a WP <code>&lt;SelectControl&gt;</code>.</p> <p>For individual <code>&lt;option&gt;</code>s, there is a built-in way to add a label. For example:</p> <pre><code>&lt;SelectControl value=...
[ { "answer_id": 344806, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 0, "selected": false, "text": "<p>Looking at the <a href=\"https://github.com/WordPress/gutenberg/blob/master/packages/components/src/...
2019/08/09
[ "https://wordpress.stackexchange.com/questions/344800", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102815/" ]
I'm building a block that has, among other things, a FontAwesome icon. I'm currently letting users choose which icon by using a WP `<SelectControl>`. For individual `<option>`s, there is a built-in way to add a label. For example: ``` <SelectControl value={ icon } options={[ { label: '', value: 'fa-a...
I agree with Nathan's answer, but you can copy the [source](https://github.com/WordPress/gutenberg/blob/master/packages/components/src/select-control/index.js) and create your own `SelectControl` component based on that source. [Here's an example](https://gist.github.com/5ally/29a5b7f3e0c047e654b368ebd10908cb), with ba...
344,804
<p>I have a user profile field that I would like to allow users to edit, but I have the backend dashboard/profile disabled. If I only know the meta (dbem_paypal_account), how can I make this work? I've tried a few plugins, but have had no luck so far.</p> <p>Basically, I would like to add a text field onto a page allo...
[ { "answer_id": 344806, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 0, "selected": false, "text": "<p>Looking at the <a href=\"https://github.com/WordPress/gutenberg/blob/master/packages/components/src/...
2019/08/09
[ "https://wordpress.stackexchange.com/questions/344804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/170312/" ]
I have a user profile field that I would like to allow users to edit, but I have the backend dashboard/profile disabled. If I only know the meta (dbem\_paypal\_account), how can I make this work? I've tried a few plugins, but have had no luck so far. Basically, I would like to add a text field onto a page allowing the...
I agree with Nathan's answer, but you can copy the [source](https://github.com/WordPress/gutenberg/blob/master/packages/components/src/select-control/index.js) and create your own `SelectControl` component based on that source. [Here's an example](https://gist.github.com/5ally/29a5b7f3e0c047e654b368ebd10908cb), with ba...
344,808
<pre><code>$recent_query = new WP_Query(array ( 'post_status' =&gt; 'publish', 'posts_per_page' =&gt; -1 ) ); //$recent_query-&gt;posts[] = get_post(1480); //$recent_query-&gt;posts[] = get_post(1443); array_unshift($recent_query-&gt;posts, get_post(1480), get_post(1443)); print_r($recent_query-&gt;posts);...
[ { "answer_id": 344812, "author": "Faye", "author_id": 76600, "author_profile": "https://wordpress.stackexchange.com/users/76600", "pm_score": 0, "selected": false, "text": "<p>Okay, so the answer to this I think is to create a new array that combines your post IDs and the specific IDs yo...
2019/08/09
[ "https://wordpress.stackexchange.com/questions/344808", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17881/" ]
``` $recent_query = new WP_Query(array ( 'post_status' => 'publish', 'posts_per_page' => -1 ) ); //$recent_query->posts[] = get_post(1480); //$recent_query->posts[] = get_post(1443); array_unshift($recent_query->posts, get_post(1480), get_post(1443)); print_r($recent_query->posts); // The Loop if( $recent...
The solution is to do two queries and then a third query, to set up the wp\_query: ``` $query1 = new WP_Query(array ( 'post_status' => 'publish', 'posts_per_page' => $postnumber, 'ignore_sticky_posts' => 1, 'cat' => $category ) ); $query2 = new WP_Query(array( 'post_type' => 'page', 'post__i...
344,844
<p>I am planing to show a new price on my woo-commerce product page for all products. This is the installment price per month. I need to show this below the normal price (variable price and simple price) something like this.</p> <p>0% interest installments starting from Rs.3,093</p> <p>where Rs.3,093 is the new price...
[ { "answer_id": 344812, "author": "Faye", "author_id": 76600, "author_profile": "https://wordpress.stackexchange.com/users/76600", "pm_score": 0, "selected": false, "text": "<p>Okay, so the answer to this I think is to create a new array that combines your post IDs and the specific IDs yo...
2019/08/10
[ "https://wordpress.stackexchange.com/questions/344844", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173309/" ]
I am planing to show a new price on my woo-commerce product page for all products. This is the installment price per month. I need to show this below the normal price (variable price and simple price) something like this. 0% interest installments starting from Rs.3,093 where Rs.3,093 is the new price. this is the ca...
The solution is to do two queries and then a third query, to set up the wp\_query: ``` $query1 = new WP_Query(array ( 'post_status' => 'publish', 'posts_per_page' => $postnumber, 'ignore_sticky_posts' => 1, 'cat' => $category ) ); $query2 = new WP_Query(array( 'post_type' => 'page', 'post__i...
344,886
<p>In every post of my custom post type called <code>"announcements"</code> I save the users' ID inside an array which resides in a meta_key called <code>"post_is_read"</code> whenever a user reads an announcement.</p> <p>Just to explain: "post_is_read" contains an array (1, 2, 5, 12, 86, 100) where every number repre...
[ { "answer_id": 344929, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": true, "text": "<h2>Revised Answer</h2>\n<p><sup>( PS: I actually wanted to revise this answer long ago, but eventually I kept...
2019/08/11
[ "https://wordpress.stackexchange.com/questions/344886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15801/" ]
In every post of my custom post type called `"announcements"` I save the users' ID inside an array which resides in a meta\_key called `"post_is_read"` whenever a user reads an announcement. Just to explain: "post\_is\_read" contains an array (1, 2, 5, 12, 86, 100) where every number represents a user ID. I achieved ...
Revised Answer -------------- ( PS: I actually wanted to revise this answer long ago, but eventually I kept forgetting to do so. :) ) So in this revised answer, the main point is the first one below, but I hope the rest also help you: 1. What you're trying to do is not going to be (easily) possible with the way the ...
344,938
<p>I have a weird issue. I deleted a page and permanently deleted in from the trash but I can still get to it. On the deleted page it shows the posts page ("Blog" page). I have cleared the permalinks, cleared my browser cache and I have looked at it in incognito mode but I can still see the page. Other than turning plu...
[ { "answer_id": 344929, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": true, "text": "<h2>Revised Answer</h2>\n<p><sup>( PS: I actually wanted to revise this answer long ago, but eventually I kept...
2019/08/12
[ "https://wordpress.stackexchange.com/questions/344938", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173374/" ]
I have a weird issue. I deleted a page and permanently deleted in from the trash but I can still get to it. On the deleted page it shows the posts page ("Blog" page). I have cleared the permalinks, cleared my browser cache and I have looked at it in incognito mode but I can still see the page. Other than turning plugin...
Revised Answer -------------- ( PS: I actually wanted to revise this answer long ago, but eventually I kept forgetting to do so. :) ) So in this revised answer, the main point is the first one below, but I hope the rest also help you: 1. What you're trying to do is not going to be (easily) possible with the way the ...
344,939
<p>When I try to create a new post with accents width wp-cli (in windows 10 command, I got latest wp-cli)</p> <pre><code>wp post create --post_title="Héllo" --post_type=page --post_content="Héllo world" </code></pre> <p>I got error:</p> <blockquote> <p>"Impossible to insert this post in database"</p> </blockquote...
[ { "answer_id": 344947, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 2, "selected": true, "text": "<p>See <a href=\"https://make.wordpress.org/cli/handbook/common-issues/#cannot-create-a-post-with-latin-characte...
2019/08/12
[ "https://wordpress.stackexchange.com/questions/344939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135166/" ]
When I try to create a new post with accents width wp-cli (in windows 10 command, I got latest wp-cli) ``` wp post create --post_title="Héllo" --post_type=page --post_content="Héllo world" ``` I got error: > > "Impossible to insert this post in database" > > > It works fine when I replace the "é" by "e" ``` ...
See [Cannot create a post with Latin characters in the title on Windows](https://make.wordpress.org/cli/handbook/common-issues/#cannot-create-a-post-with-latin-characters-in-the-title-on-windows). > > Using UTF-8 in PHP arguments doesn’t work on Windows for PHP <= 7.0, > however it will work for PHP >= 7.1, as it wa...
344,990
<p>I'm trying include dynamic sidebar to Uncode Theme. I created child template, then I created all files and now I have a piece of code who shows content and sidebar area.</p> <p>In <code>functions.php</code> I created dynamic sidebar:</p> <pre><code>add_action( 'widgets_init', function () { $args = array( ...
[ { "answer_id": 344947, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 2, "selected": true, "text": "<p>See <a href=\"https://make.wordpress.org/cli/handbook/common-issues/#cannot-create-a-post-with-latin-characte...
2019/08/13
[ "https://wordpress.stackexchange.com/questions/344990", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/171603/" ]
I'm trying include dynamic sidebar to Uncode Theme. I created child template, then I created all files and now I have a piece of code who shows content and sidebar area. In `functions.php` I created dynamic sidebar: ``` add_action( 'widgets_init', function () { $args = array( 'name' => __( 'Sideb...
See [Cannot create a post with Latin characters in the title on Windows](https://make.wordpress.org/cli/handbook/common-issues/#cannot-create-a-post-with-latin-characters-in-the-title-on-windows). > > Using UTF-8 in PHP arguments doesn’t work on Windows for PHP <= 7.0, > however it will work for PHP >= 7.1, as it wa...
345,021
<p>I installed a new wordpress project using docker's guide:</p> <pre><code>mkdir my-wordpress-site cd my-wordpress-site ddev config --project-type=php ddev composer create wordpress/skeleton --no-interaction --prefer-dist ddev config --docroot=wp --project-type=wordpress ddev restart </code></pre> <p>All done and I ...
[ { "answer_id": 345033, "author": "Andy Mardell", "author_id": 72819, "author_profile": "https://wordpress.stackexchange.com/users/72819", "pm_score": 2, "selected": false, "text": "<h2>PhpMyAdmin</h2>\n\n<p>phpMyAdmin is installed with the commands you ran.</p>\n\n<p>It seems to generate...
2019/08/13
[ "https://wordpress.stackexchange.com/questions/345021", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/99178/" ]
I installed a new wordpress project using docker's guide: ``` mkdir my-wordpress-site cd my-wordpress-site ddev config --project-type=php ddev composer create wordpress/skeleton --no-interaction --prefer-dist ddev config --docroot=wp --project-type=wordpress ddev restart ``` All done and I ran the front-end configur...
There are ever-so-many ways to access the database. `ddev describe` will open your eyes to them. * As @Andy Mardell points out, you can use the built-in PHPMyAdmin (link in `ddev describe`) * You can also use a mysql client on the host, the port and such for this are also shown in `ddev describe` * You can also use `d...
345,036
<p>A visitor visits a page</p> <p>for example: <a href="https://www.example.com/wp-login.php?action=rp&amp;key=abc&amp;login=jim" rel="nofollow noreferrer">https://www.example.com/wp-login.php?action=rp&amp;key=abc&amp;login=jim</a></p> <p>I want to have a block of text that displays only if the URL has ?action=rp</p...
[ { "answer_id": 345174, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 2, "selected": true, "text": "<p>You can use <a href=\"https://developer.wordpress.org/reference/functions/add_shortcode/\" rel=\"nofollow n...
2019/08/13
[ "https://wordpress.stackexchange.com/questions/345036", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114749/" ]
A visitor visits a page for example: <https://www.example.com/wp-login.php?action=rp&key=abc&login=jim> I want to have a block of text that displays only if the URL has ?action=rp and a block of text that displays if the url is naked. There are many content visibility plugins that can control visibility based on ro...
You can use [`add_shortcode()`](https://developer.wordpress.org/reference/functions/add_shortcode/) to register custom Shortcodes for restricting access to certain parts of the post content. And here's a working example, with specific to your case: ```php function my_rp_shortcode( $atts = [], $content = '', $tag = ''...
345,054
<p>I try to get the value of the source field 'enddate', save it in the variable $enddatevar and write it in the target field 'promote' in the loop by activating the plugin, but the code I added to <a href="https://wordpress.stackexchange.com/questions/270472/assign-update-the-custom-field-value-for-all-posts">this wor...
[ { "answer_id": 345068, "author": "Jess_Pinkman", "author_id": 171161, "author_profile": "https://wordpress.stackexchange.com/users/171161", "pm_score": 1, "selected": false, "text": "<pre><code>$enddatevar = get_post_meta( $post_id, $key = 'enddate', $single = false);\n</code></pre>\n\n<...
2019/08/13
[ "https://wordpress.stackexchange.com/questions/345054", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173437/" ]
I try to get the value of the source field 'enddate', save it in the variable $enddatevar and write it in the target field 'promote' in the loop by activating the plugin, but the code I added to [this working code](https://wordpress.stackexchange.com/questions/270472/assign-update-the-custom-field-value-for-all-posts) ...
``` $enddatevar = get_post_meta( $post_id, $key = 'enddate', $single = false); ``` $post\_id is not defined, either declare it beforehand, or use $post->ID. ``` update_post_meta( $post->ID, 'promote', '$enddatevar' ); ``` '$enddatevar' shouldnt be inside quotes.
345,091
<p>I need to provide some custom menu items in a plugin. I mean people can go to dashboard > appearance > menus and add this custom menu item to any menu location.</p> <p>So I want to know how to add the meta box in that page, how to fill it with options and how to output the content in the front end.</p> <p>I tried ...
[ { "answer_id": 345115, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 1, "selected": false, "text": "<p>This is the slimmed down version of a plugin settings page that I'm working on. Put it in a file and incl...
2019/08/14
[ "https://wordpress.stackexchange.com/questions/345091", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131331/" ]
I need to provide some custom menu items in a plugin. I mean people can go to dashboard > appearance > menus and add this custom menu item to any menu location. So I want to know how to add the meta box in that page, how to fill it with options and how to output the content in the front end. I tried searching for lon...
This is the slimmed down version of a plugin settings page that I'm working on. Put it in a file and include it in your plugin. Searching on Google for **add\_options\_page**, **register\_setting**, **add\_settings\_field** etc. will lead you to the codex entries of WordPress with further descriptions. The code of th...
345,098
<p>Have a parent/child theme setup. The parent theme has a filter I want to remove. How do I remove these filters in the child theme functions?</p> <pre><code>/** --------- */ /** COMMENTS */ /** --------- */ /** FORMAT COMMENT REPLY FIELD */ add_filter('comment_form_field_comment', function () { \XPress::registry()-...
[ { "answer_id": 345115, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 1, "selected": false, "text": "<p>This is the slimmed down version of a plugin settings page that I'm working on. Put it in a file and incl...
2019/08/14
[ "https://wordpress.stackexchange.com/questions/345098", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/100439/" ]
Have a parent/child theme setup. The parent theme has a filter I want to remove. How do I remove these filters in the child theme functions? ``` /** --------- */ /** COMMENTS */ /** --------- */ /** FORMAT COMMENT REPLY FIELD */ add_filter('comment_form_field_comment', function () { \XPress::registry()->loadJS('theme...
This is the slimmed down version of a plugin settings page that I'm working on. Put it in a file and include it in your plugin. Searching on Google for **add\_options\_page**, **register\_setting**, **add\_settings\_field** etc. will lead you to the codex entries of WordPress with further descriptions. The code of th...
345,310
<p>I want to make it so that when a user clicks on an image in my site, they are redirected to a specific page. I WAS using a submit button for the redirect, but I want to replace it with a custom-designed icon which I have saved as a png. </p> <p>Here's what I used to have:</p> <pre><code> &lt;form method='post' ...
[ { "answer_id": 345182, "author": "Matthew Brown aka Lord Matt", "author_id": 109240, "author_profile": "https://wordpress.stackexchange.com/users/109240", "pm_score": 0, "selected": false, "text": "<p>The problem that you are going to run into is a fundamental one about how videos on web...
2019/08/16
[ "https://wordpress.stackexchange.com/questions/345310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147485/" ]
I want to make it so that when a user clicks on an image in my site, they are redirected to a specific page. I WAS using a submit button for the redirect, but I want to replace it with a custom-designed icon which I have saved as a png. Here's what I used to have: ``` <form method='post' id='back_button' action=...
I found this answer online which responds your question ![enter image description here](https://i.stack.imgur.com/DCh5n.jpg)
345,335
<p>I've created a custom post type called project for my Wordpress theme, which works fine. Each project has several custom fields, including a set of x and y values that indicate where the project should show on the front page (see the style section of the code below: I know it's not working but I'm showing what I wan...
[ { "answer_id": 345350, "author": "Rendy de Puniet", "author_id": 130106, "author_profile": "https://wordpress.stackexchange.com/users/130106", "pm_score": 0, "selected": false, "text": "<p>You can use <code>wp_localize_script()</code> function to pass value into js.\nFor example</p>\n\n<...
2019/08/17
[ "https://wordpress.stackexchange.com/questions/345335", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173574/" ]
I've created a custom post type called project for my Wordpress theme, which works fine. Each project has several custom fields, including a set of x and y values that indicate where the project should show on the front page (see the style section of the code below: I know it's not working but I'm showing what I want t...
You could output them as inline [CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) instead of left/top, and then use those to set the position in either CSS or Javascript. PHP: ``` <a class="project" href="<?php the_permalink(); ?>" style="—-x-position: <?php the_f...
345,359
<p>I installed the hestia theme from the themes listed in the dashboard. All other themes worked fine but this one causes Wordpress to crash and I am unable to login though, interestingly, I can view the hestia demo site installed on my system. </p> <p>So what do I need to do to be able to log in to Wordpress or remov...
[ { "answer_id": 345350, "author": "Rendy de Puniet", "author_id": 130106, "author_profile": "https://wordpress.stackexchange.com/users/130106", "pm_score": 0, "selected": false, "text": "<p>You can use <code>wp_localize_script()</code> function to pass value into js.\nFor example</p>\n\n<...
2019/08/18
[ "https://wordpress.stackexchange.com/questions/345359", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173579/" ]
I installed the hestia theme from the themes listed in the dashboard. All other themes worked fine but this one causes Wordpress to crash and I am unable to login though, interestingly, I can view the hestia demo site installed on my system. So what do I need to do to be able to log in to Wordpress or remove the hest...
You could output them as inline [CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) instead of left/top, and then use those to set the position in either CSS or Javascript. PHP: ``` <a class="project" href="<?php the_permalink(); ?>" style="—-x-position: <?php the_f...
345,367
<p>I am trying to create my first worpress plugin! </p> <p>Actually, the idea is when i click on the button, an ajax request is sent toward php file (ajax-process.php ), it contains a very basic code to pull some data from database and then displaying it as an alert or other in my home page .</p> <p>This is my plugi...
[ { "answer_id": 345394, "author": "Chetan Vaghela", "author_id": 169856, "author_profile": "https://wordpress.stackexchange.com/users/169856", "pm_score": -1, "selected": false, "text": "<p>Try bellow Code:</p>\n\n<ul>\n<li><p>DB-Puller.php</p>\n\n<pre><code>&lt;?php\n/**\n * Plugin Name:...
2019/08/18
[ "https://wordpress.stackexchange.com/questions/345367", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173693/" ]
I am trying to create my first worpress plugin! Actually, the idea is when i click on the button, an ajax request is sent toward php file (ajax-process.php ), it contains a very basic code to pull some data from database and then displaying it as an alert or other in my home page . This is my plugin floder (inside w...
I have already answered this question stackoverflow, but adding the answer here as well: Looking on the code it does not seem like the Wordpress way of doing this kind of thing. First you need to include your `ajax-process.php` in the plugins main file e.g: ``` require_once plugin_dir_path(__FILE__) . '/ajax-process...
345,376
<p>I am trying to add some custom meta variables to a custom post type, but I can't see the new variables when I dump a posts meta data, and I can't access it in</p> <p>Here is the post definition from my functions.php file</p> <pre><code>function register_team_post(){ register_post_type('team', [ 'public...
[ { "answer_id": 345378, "author": "Den Pat", "author_id": 103569, "author_profile": "https://wordpress.stackexchange.com/users/103569", "pm_score": -1, "selected": false, "text": "<p>Try Fire it on init instead of inside register_post_type like this:</p>\n\n<pre><code>add_action('init','3...
2019/08/18
[ "https://wordpress.stackexchange.com/questions/345376", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173665/" ]
I am trying to add some custom meta variables to a custom post type, but I can't see the new variables when I dump a posts meta data, and I can't access it in Here is the post definition from my functions.php file ``` function register_team_post(){ register_post_type('team', [ 'public'=>true, 'lab...
When registering the Custom Post Type, ensure **custom-fields** is present in `supports => array('editor','title', 'custom-fields')`. It's the legacy wording of *meta fields* and is commonly mistakenly omitted when declaring supports in CPTs. After you make the above change, your Team CPT should work with meta values....
345,384
<p>I need some help writing a shortcode to display all product tags associated with a specific product category which can be displayed on any page. </p> <p>My problem is that I can display all product tags anywhere by using the below code, but I'm unable to filter those tags by a given product category:</p> <pre><cod...
[ { "answer_id": 345389, "author": "Wordpress Dev", "author_id": 173354, "author_profile": "https://wordpress.stackexchange.com/users/173354", "pm_score": 0, "selected": false, "text": "<pre><code>function product_terms_by_cat() { \n$terms = get_terms (\n array (\n 'taxonom...
2019/08/19
[ "https://wordpress.stackexchange.com/questions/345384", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52551/" ]
I need some help writing a shortcode to display all product tags associated with a specific product category which can be displayed on any page. My problem is that I can display all product tags anywhere by using the below code, but I'm unable to filter those tags by a given product category: ``` function product_te...
Ahh ha! Have figured out how to do this. Here's the code for future people who are looking for the same thing: ``` function get_category_tags($args) { global $wpdb; $tags = $wpdb->get_results(" SELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, terms2.slug as tag_slug, null as tag_link ...
345,422
<p>I would like to remove the "private" prefix for each post title. I found the filter <a href="https://wp-mix.com/remove-private-post-titles/" rel="nofollow noreferrer">here</a>. I managed to removed the word "Private" but when I concatenate with " : ". That does not work anymore. I checked <code>$title</code> value...
[ { "answer_id": 345425, "author": "J.BizMai", "author_id": 128094, "author_profile": "https://wordpress.stackexchange.com/users/128094", "pm_score": 0, "selected": false, "text": "<p>I found a solution based on this <a href=\"https://css-tricks.com/snippets/wordpress/remove-privateprotect...
2019/08/19
[ "https://wordpress.stackexchange.com/questions/345422", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128094/" ]
I would like to remove the "private" prefix for each post title. I found the filter [here](https://wp-mix.com/remove-private-post-titles/). I managed to removed the word "Private" but when I concatenate with " : ". That does not work anymore. I checked `$title` value before the `str_replace` and it´s already translat...
The simplest answer is as follows: ``` add_filter( 'private_title_format', function ( $format ) { return '%s'; } ); ``` It uses the `private_title_format` to change the format of the title to just the post title, without any unnecessary classes or functions.
345,451
<h1>The Problem</h1> <p>I've been grappling with this bug over several days now to no luck. When editing either a post or a page, all icons in the Visual Editor are missing:</p> <p><a href="https://i.stack.imgur.com/nEvqS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nEvqS.jpg" alt="enter image d...
[ { "answer_id": 345582, "author": "Pete Moore", "author_id": 173871, "author_profile": "https://wordpress.stackexchange.com/users/173871", "pm_score": 0, "selected": false, "text": "<p>I've just come across this issue myself on a new siteground install.</p>\n\n<p>After some troubleshootin...
2019/08/19
[ "https://wordpress.stackexchange.com/questions/345451", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167562/" ]
The Problem =========== I've been grappling with this bug over several days now to no luck. When editing either a post or a page, all icons in the Visual Editor are missing: [![enter image description here](https://i.stack.imgur.com/nEvqS.jpg)](https://i.stack.imgur.com/nEvqS.jpg) As you can see this, includes the i...
After a few more days of frustrating testing, I managed to track the issue down to the External Links Rewrite option in Siteground's Site Tools, under SSL options. When HTTP Enforce is enabled with the optional External Links Rewrite option (being able to see these changes virtually immediately in the browser requires ...
345,476
<p>I'm trying to use a class from another file within a wp_ajax hook And the call returns a 500 status code</p> <p>I added the class with incloud (),</p> <p>I tried to put the whole class inside the function and it worked fine.</p> <p>Is there a way to use a class file within the wp_ajax function?</p> <p>This is th...
[ { "answer_id": 345582, "author": "Pete Moore", "author_id": 173871, "author_profile": "https://wordpress.stackexchange.com/users/173871", "pm_score": 0, "selected": false, "text": "<p>I've just come across this issue myself on a new siteground install.</p>\n\n<p>After some troubleshootin...
2019/08/20
[ "https://wordpress.stackexchange.com/questions/345476", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173797/" ]
I'm trying to use a class from another file within a wp\_ajax hook And the call returns a 500 status code I added the class with incloud (), I tried to put the whole class inside the function and it worked fine. Is there a way to use a class file within the wp\_ajax function? This is the code in the function.php fi...
After a few more days of frustrating testing, I managed to track the issue down to the External Links Rewrite option in Siteground's Site Tools, under SSL options. When HTTP Enforce is enabled with the optional External Links Rewrite option (being able to see these changes virtually immediately in the browser requires ...
345,485
<p>I have a custom post type with custom fields(advanced custom fields plugin). one of the custom fields named program_id. i can`t understand how to get all of the posts in that CPT where the ACF field value is x, and only them. i read ACF guide but i always get all of the post.</p> <pre><code>$student_query_args = [ ...
[ { "answer_id": 345520, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>Meta Queries are nested arrays. See the <a href=\"https://developer.wordpress.org/reference/classes/wp_quer...
2019/08/20
[ "https://wordpress.stackexchange.com/questions/345485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173802/" ]
I have a custom post type with custom fields(advanced custom fields plugin). one of the custom fields named program\_id. i can`t understand how to get all of the posts in that CPT where the ACF field value is x, and only them. i read ACF guide but i always get all of the post. ``` $student_query_args = [ 'post_type'...
Meta Queries are nested arrays. See the [WP\_Query section on meta queries](https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters). Option 1 ======== Use `meta_key` and `meta_value` directly in the query arguments, not as a meta query. ``` $student_query_args = [ 'post_type'...
345,514
<p>I'm creating a plugin to display schema script for my WooCommerce product. I use a custom field to add my gtin number in WooCommerce.</p> <p>This is what I did:<br></p> <pre><code>&lt;?php $gtin = get_post_meta(post_ID,'gtin',true); ?&gt; &lt;script type="application/ld+json"&gt;{ "gtin13:"&lt;?php echo $g...
[ { "answer_id": 345515, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 1, "selected": false, "text": "<p>There are some errors as <code>get_post_meta()</code> first argument need to be a defined product ID her...
2019/08/20
[ "https://wordpress.stackexchange.com/questions/345514", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/171340/" ]
I'm creating a plugin to display schema script for my WooCommerce product. I use a custom field to add my gtin number in WooCommerce. This is what I did: ``` <?php $gtin = get_post_meta(post_ID,'gtin',true); ?> <script type="application/ld+json">{ "gtin13:"<?php echo $gtin;?>"</script>} ``` The result: `...
There are some errors as `get_post_meta()` first argument need to be a defined product ID here (and in your code `post_ID` is not even dynamic variable and will not give anything)… Try the following: ``` <?php function check_gtin(){ if ( $gtin = get_post_meta(get_the_id(), 'gtin', true) ){ ...
345,533
<p>At <a href="https://core.trac.wordpress.org/changeset/37920" rel="nofollow noreferrer">https://core.trac.wordpress.org/changeset/37920</a> it defines the <code>wp_resource_hints()</code> function that was added with WordPress 4.6.</p> <p>On that page it shows a section of the general-template.php file where the <co...
[ { "answer_id": 345515, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 1, "selected": false, "text": "<p>There are some errors as <code>get_post_meta()</code> first argument need to be a defined product ID her...
2019/08/20
[ "https://wordpress.stackexchange.com/questions/345533", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58939/" ]
At <https://core.trac.wordpress.org/changeset/37920> it defines the `wp_resource_hints()` function that was added with WordPress 4.6. On that page it shows a section of the general-template.php file where the `wp_resource_hints()` function is defined, and there's also a function called `wp_resource_hints_scripts_style...
There are some errors as `get_post_meta()` first argument need to be a defined product ID here (and in your code `post_ID` is not even dynamic variable and will not give anything)… Try the following: ``` <?php function check_gtin(){ if ( $gtin = get_post_meta(get_the_id(), 'gtin', true) ){ ...
345,541
<p>I've followed the documentation from <a href="https://codex.wordpress.org/Function_Reference/get_query_var" rel="nofollow noreferrer">WordPress</a>, but my <code>functions.php</code> file still is not getting the <code>token</code> (<code>abcd</code>) variable from the URL: <code>https://example.com/reset-password/?...
[ { "answer_id": 345553, "author": "Pratikb.Simform", "author_id": 173473, "author_profile": "https://wordpress.stackexchange.com/users/173473", "pm_score": -1, "selected": false, "text": "<p>You can try </p>\n\n<pre><code>$token = $_REQUEST['token']\n</code></pre>\n" }, { "answer_...
2019/08/21
[ "https://wordpress.stackexchange.com/questions/345541", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173717/" ]
I've followed the documentation from [WordPress](https://codex.wordpress.org/Function_Reference/get_query_var), but my `functions.php` file still is not getting the `token` (`abcd`) variable from the URL: `https://example.com/reset-password/?token=abcd` My functions.php file includes the following: ``` function add_q...
Contact Form 7 provides a recipe for [**Validation as a Filter**](https://contactform7.com/2015/03/28/custom-validation/) which looks very much like what you are trying to do. Adapting their example to your code, I believe the following should work for you: ``` add_filter( 'wpcf7_validate_text*', 'custom_password_res...
345,564
<p>In most Genesis child themes, the following line of code exists:</p> <pre><code>// Starts the engine. require_once get_template_directory() . '/lib/init.php'; </code></pre> <p>I understand that this includes the init.php file from the lib directory within the Genesis parent theme folder. </p> <p>My question is si...
[ { "answer_id": 345566, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 2, "selected": true, "text": "<p>I'm not experienced with Genesis, specifically, but I imagine its child themes work the same as child th...
2019/08/21
[ "https://wordpress.stackexchange.com/questions/345564", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/170773/" ]
In most Genesis child themes, the following line of code exists: ``` // Starts the engine. require_once get_template_directory() . '/lib/init.php'; ``` I understand that this includes the init.php file from the lib directory within the Genesis parent theme folder. My question is simply - why does `get_template_dir...
I'm not experienced with Genesis, specifically, but I imagine its child themes work the same as child themes for any other theme. [As documented](https://developer.wordpress.org/themes/advanced-topics/child-themes/), a child theme is created by adding a `Template:` line to the style.css header, which is the directory n...
345,571
<p>I've two custom post type:</p> <p>1.products 2.seller</p> <p>Now I want to relate both the post types using the meta box. I want to display products in seller posts so that sellers can select the required multiple products and assign a price to each selected product. Finally, In the seller's post, those products ...
[ { "answer_id": 346102, "author": "pax", "author_id": 967, "author_profile": "https://wordpress.stackexchange.com/users/967", "pm_score": 1, "selected": false, "text": "<p>You'd need a repeater <em>relationship</em> custom field. The easiest way would be still to user a plugin for this pa...
2019/08/21
[ "https://wordpress.stackexchange.com/questions/345571", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/97802/" ]
I've two custom post type: 1.products 2.seller Now I want to relate both the post types using the meta box. I want to display products in seller posts so that sellers can select the required multiple products and assign a price to each selected product. Finally, In the seller's post, those products need to be displa...
I assume you would like to end up with something like this: ![enter image description here](https://i.stack.imgur.com/IFMIU.png) Code way ======== If you want to put this logic in your template/plugin, as you state in your question, there is quite a bit of coding. You need to: * create custom post types * create m...
345,656
<pre><code>&lt;?php /* Template Name: Dummy Practice Page*/?&gt; &lt;div id="main-content" class="main-content"&gt; &lt;div class="main-content-inner"&gt; &lt;form method="post"&gt; &lt;p&gt;&lt;div&gt; &lt;input name="nametxt" id="nametxt" type="text" style="height:30px; wid...
[ { "answer_id": 346102, "author": "pax", "author_id": 967, "author_profile": "https://wordpress.stackexchange.com/users/967", "pm_score": 1, "selected": false, "text": "<p>You'd need a repeater <em>relationship</em> custom field. The easiest way would be still to user a plugin for this pa...
2019/08/22
[ "https://wordpress.stackexchange.com/questions/345656", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173921/" ]
``` <?php /* Template Name: Dummy Practice Page*/?> <div id="main-content" class="main-content"> <div class="main-content-inner"> <form method="post"> <p><div> <input name="nametxt" id="nametxt" type="text" style="height:30px; width: 350px; " maxlength="5" placeholder="Name" ...
I assume you would like to end up with something like this: ![enter image description here](https://i.stack.imgur.com/IFMIU.png) Code way ======== If you want to put this logic in your template/plugin, as you state in your question, there is quite a bit of coding. You need to: * create custom post types * create m...
345,692
<p>I've been searching a lot but haven't found one very simple thing: how to import a post created on Instagram and turn it into a Wordpress post, that is, copy one Instagram post (text + photo) and create a simple post on the Wordpress blog?</p>
[ { "answer_id": 346102, "author": "pax", "author_id": 967, "author_profile": "https://wordpress.stackexchange.com/users/967", "pm_score": 1, "selected": false, "text": "<p>You'd need a repeater <em>relationship</em> custom field. The easiest way would be still to user a plugin for this pa...
2019/08/22
[ "https://wordpress.stackexchange.com/questions/345692", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143330/" ]
I've been searching a lot but haven't found one very simple thing: how to import a post created on Instagram and turn it into a Wordpress post, that is, copy one Instagram post (text + photo) and create a simple post on the Wordpress blog?
I assume you would like to end up with something like this: ![enter image description here](https://i.stack.imgur.com/IFMIU.png) Code way ======== If you want to put this logic in your template/plugin, as you state in your question, there is quite a bit of coding. You need to: * create custom post types * create m...
345,743
<p>How can i make wordpress blog event titles clickable and direct to their respective post itself? Thank you!</p> <pre><code>&lt;li id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class( 'stm_post_info' ); ?&gt;&gt; &lt;?php if( get_the_title() ): ?&gt; &lt;h4 class="stripe_2"&gt;&lt;?php the_title(); ?&gt;&lt;/...
[ { "answer_id": 345747, "author": "zain_ali", "author_id": 154909, "author_profile": "https://wordpress.stackexchange.com/users/154909", "pm_score": 1, "selected": true, "text": "<pre><code>&lt;li id=\"post-&lt;?php the_ID(); ?&gt;\" &lt;?php post_class( 'stm_post_info' ); ?&gt;&gt;\n&lt;...
2019/08/23
[ "https://wordpress.stackexchange.com/questions/345743", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173989/" ]
How can i make wordpress blog event titles clickable and direct to their respective post itself? Thank you! ``` <li id="post-<?php the_ID(); ?>" <?php post_class( 'stm_post_info' ); ?>> <?php if( get_the_title() ): ?> <h4 class="stripe_2"><?php the_title(); ?></h4> <?php endif; ?> ```
``` <li id="post-<?php the_ID(); ?>" <?php post_class( 'stm_post_info' ); ?>> <?php if( get_the_title() ): ?> <h4 class="stripe_2"><a href="<?php the_permalink() ?>" ><?php the_title(); ?></a></h4> <?php endif; ?> ``` Please try this
345,753
<p>The website I am busy working on was built by another company that no longer supports Wordpress so I am looking for help. Below is the PHP for the search function. From the research Ive done it seems they have used the standard Wordpress code. The client has asked that the search only results in the related product....
[ { "answer_id": 345747, "author": "zain_ali", "author_id": 154909, "author_profile": "https://wordpress.stackexchange.com/users/154909", "pm_score": 1, "selected": true, "text": "<pre><code>&lt;li id=\"post-&lt;?php the_ID(); ?&gt;\" &lt;?php post_class( 'stm_post_info' ); ?&gt;&gt;\n&lt;...
2019/08/23
[ "https://wordpress.stackexchange.com/questions/345753", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173997/" ]
The website I am busy working on was built by another company that no longer supports Wordpress so I am looking for help. Below is the PHP for the search function. From the research Ive done it seems they have used the standard Wordpress code. The client has asked that the search only results in the related product. At...
``` <li id="post-<?php the_ID(); ?>" <?php post_class( 'stm_post_info' ); ?>> <?php if( get_the_title() ): ?> <h4 class="stripe_2"><a href="<?php the_permalink() ?>" ><?php the_title(); ?></a></h4> <?php endif; ?> ``` Please try this
345,770
<p>I got all my website with a lot of internal cloaked links with a nofollow attribute. </p> <p>I need a function or filter to add inside <code>functions.php</code> that removes the <code>nofollow</code> attribute when the permalink contains a specific word es <code>"/link/pluto"</code>. Could you help me?</p> <p>Tha...
[ { "answer_id": 345979, "author": "Mike Baxter", "author_id": 38628, "author_profile": "https://wordpress.stackexchange.com/users/38628", "pm_score": 1, "selected": true, "text": "<p>I wrote the following code to address ADDING tag attributes, but here is a version to help you locate, and...
2019/08/23
[ "https://wordpress.stackexchange.com/questions/345770", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/171547/" ]
I got all my website with a lot of internal cloaked links with a nofollow attribute. I need a function or filter to add inside `functions.php` that removes the `nofollow` attribute when the permalink contains a specific word es `"/link/pluto"`. Could you help me? Thanks for your support. Gp
I wrote the following code to address ADDING tag attributes, but here is a version to help you locate, and remove `nofollow`: ``` add_filter( 'the_content', 'ex1_the_content_filter' ); function ex1_the_content_filter($content) { // finds all links in your content with a nofollow preg_match_all('/\<a .*?"nofoll...
345,790
<p>I have this command that I'm using. I want it to use the template formating for the title but I can't figure out how to add it. I found this code online to strip everything and I added <code>&lt;?php wp_title(); ?&gt;</code> which shows the title but in plain text. How can I add it to match the rest of the site? ...
[ { "answer_id": 345793, "author": "Mike Baxter", "author_id": 38628, "author_profile": "https://wordpress.stackexchange.com/users/38628", "pm_score": 0, "selected": false, "text": "<p>Basically, if I understand your question properly, you will want to look for another file named \"header....
2019/08/23
[ "https://wordpress.stackexchange.com/questions/345790", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174026/" ]
I have this command that I'm using. I want it to use the template formating for the title but I can't figure out how to add it. I found this code online to strip everything and I added `<?php wp_title(); ?>` which shows the title but in plain text. How can I add it to match the rest of the site? smdpphiladelphia.com `...
Basically, if I understand your question properly, you will want to look for another file named "header.php" (or "page-{something}-header.php" for a special header that only applies to a specific page type), which represents what is output by wp-head() (shown in your code). If you open header.php, you should find some...
345,824
<p>I'm currently using <code>&lt;?php the_post_thumbnail('250px', array('class'=&gt;"review-siteshot", 'alt' =&gt; get_the_title() )); ?&gt;</code></p> <p>I know that <code>'alt' =&gt; "review"</code> will output review as all text.</p> <p>I'm trying to use <code>get_the_title()</code> along with "review" so that I g...
[ { "answer_id": 345829, "author": "Lazar Momcilovic", "author_id": 138412, "author_profile": "https://wordpress.stackexchange.com/users/138412", "pm_score": 3, "selected": true, "text": "<p>Like this:</p>\n\n<pre><code>'alt' =&gt; get_the_title(). ' review'\n</code></pre>\n\n<p>So the ful...
2019/08/24
[ "https://wordpress.stackexchange.com/questions/345824", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145504/" ]
I'm currently using `<?php the_post_thumbnail('250px', array('class'=>"review-siteshot", 'alt' => get_the_title() )); ?>` I know that `'alt' => "review"` will output review as all text. I'm trying to use `get_the_title()` along with "review" so that I get **title-text review** as my alt text for the thumbnail.
Like this: ``` 'alt' => get_the_title(). ' review' ``` So the full code would be: ``` <?php the_post_thumbnail('250px', array('class'=>"review-siteshot", 'alt' => get_the_title(). ' review' )); ?> ```
345,908
<p>Since my theme's font <a href="https://wordpress.stackexchange.com/q/344767/64282">doesn't support my language</a>, I add this code to style.css to change the font. It does work:</p> <pre><code>@font-face { font-family: 'new-baskerville'; font-style: normal; src: url('/wp-content/uploads/useanyfont/1908...
[ { "answer_id": 345955, "author": "Mike Baxter", "author_id": 38628, "author_profile": "https://wordpress.stackexchange.com/users/38628", "pm_score": 1, "selected": false, "text": "<p>I don't want to sound too critical, but you might want to review <a href=\"https://www.w3schools.com/cssr...
2019/08/26
[ "https://wordpress.stackexchange.com/questions/345908", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64282/" ]
Since my theme's font [doesn't support my language](https://wordpress.stackexchange.com/q/344767/64282), I add this code to style.css to change the font. It does work: ``` @font-face { font-family: 'new-baskerville'; font-style: normal; src: url('/wp-content/uploads/useanyfont/190811081519New-Baskerville.e...
I don't want to sound too critical, but you might want to review [how to properly introduce a new font](https://www.w3schools.com/cssref/css3_pr_font-face_rule.asp), and apply font styles content. The declaration that you presented appears to have a couple of issues: * Using ".new-baskerville" would cause everything w...
345,916
<p>This is a rather specific and weird issue that is really bothering me now. </p> <p>Here's the setup. <br> - I'm using Elementor Pro and I've created a single page template. <br> - I have four shortcode widgets on the page that is hooked up to ACF text fields. <br> - The ACF text field takes a shortcode source of a...
[ { "answer_id": 346049, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": true, "text": "<p>The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the p...
2019/08/26
[ "https://wordpress.stackexchange.com/questions/345916", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/173882/" ]
This is a rather specific and weird issue that is really bothering me now. Here's the setup. - I'm using Elementor Pro and I've created a single page template. - I have four shortcode widgets on the page that is hooked up to ACF text fields. - The ACF text field takes a shortcode source of an iframe from ...
The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the parameter to it. I tested your code example / shortcode (added 4 times to the post content) and here's what I got as a result, ``` <div><iframe class="airtable-embed" &#8217;src<="" iframe=""></div> <div class = "airtab...
345,928
<p>I am creating a contact form on WordPress site.</p> <p>The form is perfectly working with following code:</p> <p><code> //validate email if(!filter_var($email, FILTER_VALIDATE_EMAIL)) my_contact_form_generate_response("error", $email_invalid); else //email is valid { //valid...
[ { "answer_id": 346049, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": true, "text": "<p>The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the p...
2019/08/26
[ "https://wordpress.stackexchange.com/questions/345928", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69221/" ]
I am creating a contact form on WordPress site. The form is perfectly working with following code: `//validate email if(!filter_var($email, FILTER_VALIDATE_EMAIL)) my_contact_form_generate_response("error", $email_invalid); else //email is valid { //validate presence of name and message if(empty($name) || empty...
The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the parameter to it. I tested your code example / shortcode (added 4 times to the post content) and here's what I got as a result, ``` <div><iframe class="airtable-embed" &#8217;src<="" iframe=""></div> <div class = "airtab...
345,961
<p>I would like to add a post_meta (test_meta_1234) field to an existing CPT (organizer) of an external plugin.</p> <p>With register_meta() it doesn't work. But a taxonomy I can add to the same CPT with register_taxonomy().</p> <p>Code Sample:</p> <pre><code>register_meta('post', 'test_meta_1234', array( 'objec...
[ { "answer_id": 346049, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": true, "text": "<p>The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the p...
2019/08/26
[ "https://wordpress.stackexchange.com/questions/345961", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133541/" ]
I would like to add a post\_meta (test\_meta\_1234) field to an existing CPT (organizer) of an external plugin. With register\_meta() it doesn't work. But a taxonomy I can add to the same CPT with register\_taxonomy(). Code Sample: ``` register_meta('post', 'test_meta_1234', array( 'object_subtype' => 'organize...
The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the parameter to it. I tested your code example / shortcode (added 4 times to the post content) and here's what I got as a result, ``` <div><iframe class="airtable-embed" &#8217;src<="" iframe=""></div> <div class = "airtab...
345,962
<p>I'm trying to set up a function to fix common content errors on a site. I want to take an array of post fields <code>$check_fields</code> and check them for common errors as set up in an array called <code>$replacement_terms</code>.</p> <p>I have the following so far:</p> <pre><code>$check_fields = array( "pos...
[ { "answer_id": 346049, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": true, "text": "<p>The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the p...
2019/08/26
[ "https://wordpress.stackexchange.com/questions/345962", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109355/" ]
I'm trying to set up a function to fix common content errors on a site. I want to take an array of post fields `$check_fields` and check them for common errors as set up in an array called `$replacement_terms`. I have the following so far: ``` $check_fields = array( "post_title", "post_content" ); $replaceme...
The iframes not showing is probably caused by the shortcode parser freaking out by how you pass the parameter to it. I tested your code example / shortcode (added 4 times to the post content) and here's what I got as a result, ``` <div><iframe class="airtable-embed" &#8217;src<="" iframe=""></div> <div class = "airtab...
346,052
<p>I have a custom Submenu page with my post type in which I am querying all posts and adding custom textareas and dropdowns that will repeat with each entry. The id and name for each field is the same accept the end of it is hyphenated with the post ID at the end. I want to be able to save the values entered in these ...
[ { "answer_id": 346057, "author": "Mike Baxter", "author_id": 38628, "author_profile": "https://wordpress.stackexchange.com/users/38628", "pm_score": -1, "selected": false, "text": "<p>WPBeginner <a href=\"https://www.wpbeginner.com/plugins/how-to-block-a-wordpress-user-without-deleting-t...
2019/08/27
[ "https://wordpress.stackexchange.com/questions/346052", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81422/" ]
I have a custom Submenu page with my post type in which I am querying all posts and adding custom textareas and dropdowns that will repeat with each entry. The id and name for each field is the same accept the end of it is hyphenated with the post ID at the end. I want to be able to save the values entered in these fie...
Although you could create another class of users, I'd just do the following: * Change their password to something really strong and random * Change their email address to an invalid value (or maybe a variation of yours) so they can't do a password reset. * Maybe change their description/info to show that they are a 'p...
346,089
<p>Google did not fix my problem so..</p> <p>Anyone here know how to increase the character limit for woocommerce product attribute slug, default it has a limit of 28 characters (max 32 in database) i need max 40.(tried to increase to max 128).</p> <p>I’m testing a local site where product information comes from impo...
[ { "answer_id": 346113, "author": "Rup", "author_id": 3276, "author_profile": "https://wordpress.stackexchange.com/users/3276", "pm_score": 0, "selected": false, "text": "<p>As discussed in the comments, the problem is that these slugs are also used as taxonomy names and there's a 32-char...
2019/08/28
[ "https://wordpress.stackexchange.com/questions/346089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174237/" ]
Google did not fix my problem so.. Anyone here know how to increase the character limit for woocommerce product attribute slug, default it has a limit of 28 characters (max 32 in database) i need max 40.(tried to increase to max 128). I’m testing a local site where product information comes from imported xml files, s...
There is a solution for this. 1. Manually create the long name attribute in "Product Attributes" page, and **use a short slug name here**. In the product import section there is no "attribute slug" in the Column Headers(Or maybe there is one but not used by WooCommerce by default). Like so [![enter image description...
346,106
<p>I have two custom plugins that use the <a href="https://github.com/pippinsplugins/wp-logging" rel="nofollow noreferrer">WP Logging</a> class. It creates a custom post type called Logs, which (at least in my case) is only visible inside the admin, for example at /wp-admin/edit.php?s&amp;post_status=all&amp;post_type=...
[ { "answer_id": 346109, "author": "Jonathan Stegall", "author_id": 41356, "author_profile": "https://wordpress.stackexchange.com/users/41356", "pm_score": 0, "selected": false, "text": "<p>Now that I've been looking at it, I thought of a possible solution.</p>\n\n<pre><code>// add a filte...
2019/08/28
[ "https://wordpress.stackexchange.com/questions/346106", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41356/" ]
I have two custom plugins that use the [WP Logging](https://github.com/pippinsplugins/wp-logging) class. It creates a custom post type called Logs, which (at least in my case) is only visible inside the admin, for example at /wp-admin/edit.php?s&post\_status=all&post\_type=wp\_log. To make it easier to tell which plug...
In your code, you add the filter like this: ```php add_action( 'restrict_manage_posts', array( $this, 'restrict_log_posts' ) ); ``` Which adds a function that starts like this: ```php public function restrict_log_posts() { $type = 'wp_log'; $taxonomy = 'wp_log_type'; // only add filter to post type ...
346,180
<p>I have two wordpress installations: a single one and a multisite with subdirectories. On both my users can logout with the url:</p> <pre><code>[URL to]/wp-login.php?action=logout&amp;redirect_to=%2Fmydir%2F&amp;_wpnonce=[some_code] </code></pre> <p>This works on the single site without confirmation, but on the sit...
[ { "answer_id": 346109, "author": "Jonathan Stegall", "author_id": 41356, "author_profile": "https://wordpress.stackexchange.com/users/41356", "pm_score": 0, "selected": false, "text": "<p>Now that I've been looking at it, I thought of a possible solution.</p>\n\n<pre><code>// add a filte...
2019/08/29
[ "https://wordpress.stackexchange.com/questions/346180", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174300/" ]
I have two wordpress installations: a single one and a multisite with subdirectories. On both my users can logout with the url: ``` [URL to]/wp-login.php?action=logout&redirect_to=%2Fmydir%2F&_wpnonce=[some_code] ``` This works on the single site without confirmation, but on the site within the multisite it doesn't....
In your code, you add the filter like this: ```php add_action( 'restrict_manage_posts', array( $this, 'restrict_log_posts' ) ); ``` Which adds a function that starts like this: ```php public function restrict_log_posts() { $type = 'wp_log'; $taxonomy = 'wp_log_type'; // only add filter to post type ...
346,269
<p>Can someone explain how I would rewrite this bit of code to include a tel: clickable phone number and make the email address clickable to info:hi.com </p> <p>I am having a bit of trouble with this.</p> <pre><code>&lt;address class="address_phone"&gt; &lt;span class="icon ico...
[ { "answer_id": 346271, "author": "Pratikb.Simform", "author_id": 173473, "author_profile": "https://wordpress.stackexchange.com/users/173473", "pm_score": 1, "selected": true, "text": "<p>Please edit your code as below:</p>\n\n<pre><code>&lt;address class=\"address_phone\"&gt;\n ...
2019/08/30
[ "https://wordpress.stackexchange.com/questions/346269", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174372/" ]
Can someone explain how I would rewrite this bit of code to include a tel: clickable phone number and make the email address clickable to info:hi.com I am having a bit of trouble with this. ``` <address class="address_phone"> <span class="icon icon-phone"></span> ...
Please edit your code as below: ``` <address class="address_phone"> <span class="icon icon-phone"></span> <div class="contact_title"><?php echo esc_html__('Phone:', 'yogastudio') ?></div> <span class...
346,355
<p>I need to get posts with a price less than or equal to for example '1000'. The price is set in an arbitrary custom field. Trying to posts a price that is less than or equal to 1000</p> <pre><code>$posts = new WP_Query( { 'post_type' =&gt; 'post', 'meta_query' =&gt; array( 'key' =&gt; 'price', 'comp...
[ { "answer_id": 404942, "author": "mahaidery", "author_id": 221415, "author_profile": "https://wordpress.stackexchange.com/users/221415", "pm_score": 1, "selected": false, "text": "<p>Restart PHP-FPM and it will resolve this issue :)</p>\n<p>PS: I know its an old thread, but anyone came h...
2019/09/01
[ "https://wordpress.stackexchange.com/questions/346355", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174447/" ]
I need to get posts with a price less than or equal to for example '1000'. The price is set in an arbitrary custom field. Trying to posts a price that is less than or equal to 1000 ``` $posts = new WP_Query( { 'post_type' => 'post', 'meta_query' => array( 'key' => 'price', 'compare' => '<=', 'valu...
Restart PHP-FPM and it will resolve this issue :) PS: I know its an old thread, but anyone came here for the same issue, do this to get it resolved
346,380
<p>hi guys i wanna show how much customers save with current deal. I entered regular and sale price for all products on my store and it show the percentage of discount on prdocut catalog.Woocommerce cart shows only the total and subtotal.</p> <p>Subtotal:10$<br> Total:10$</p> <p>so i wrote this function to show what...
[ { "answer_id": 404942, "author": "mahaidery", "author_id": 221415, "author_profile": "https://wordpress.stackexchange.com/users/221415", "pm_score": 1, "selected": false, "text": "<p>Restart PHP-FPM and it will resolve this issue :)</p>\n<p>PS: I know its an old thread, but anyone came h...
2019/09/01
[ "https://wordpress.stackexchange.com/questions/346380", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/127608/" ]
hi guys i wanna show how much customers save with current deal. I entered regular and sale price for all products on my store and it show the percentage of discount on prdocut catalog.Woocommerce cart shows only the total and subtotal. Subtotal:10$ Total:10$ so i wrote this function to show what i want. Although i...
Restart PHP-FPM and it will resolve this issue :) PS: I know its an old thread, but anyone came here for the same issue, do this to get it resolved
346,439
<p>I am trying to retrieve a list of all my <code>attributes_name</code> values (carat, color, size etc) from the WooCommerce table <code>wp_woocommerce_attribute_taxonomies</code> in WordPress database. </p> <p>And here is my code from the below but getting the name of the attribute and not what's inside that column:...
[ { "answer_id": 346442, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 3, "selected": true, "text": "<p>With WordPress to make a custom SQL query, you should always use the dedicated <a href=\"https://codex.wo...
2019/09/02
[ "https://wordpress.stackexchange.com/questions/346439", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174503/" ]
I am trying to retrieve a list of all my `attributes_name` values (carat, color, size etc) from the WooCommerce table `wp_woocommerce_attribute_taxonomies` in WordPress database. And here is my code from the below but getting the name of the attribute and not what's inside that column: ``` $sql = "SELECT attribute_...
With WordPress to make a custom SQL query, you should always use the dedicated [`WPDB`](https://codex.wordpress.org/Class_Reference/wpdb) Class and related methods as [`get_results()`](https://developer.wordpress.org/reference/classes/wpdb/get_results/), this way: ``` global $wpdb; $results = $wpdb->get_results( " ...
346,452
<p>I have a custom taxonomy called <code>campaign</code> and a custom post type called <code>asset</code>. For assets, I want to have the following permalink structure: <code>mysite.com/&lt;campaign_name&gt;/&lt;asset_name&gt;</code>. I have achieved this by the following code, but now if I go to any normal page with t...
[ { "answer_id": 346780, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>My answer isn't directly applicable to your case as my experience is about doing funky stuff with CP...
2019/09/03
[ "https://wordpress.stackexchange.com/questions/346452", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94844/" ]
I have a custom taxonomy called `campaign` and a custom post type called `asset`. For assets, I want to have the following permalink structure: `mysite.com/<campaign_name>/<asset_name>`. I have achieved this by the following code, but now if I go to any normal page with the url structure `mysite.com/<pagename>` it give...
Solution would be a little tricky but you're on the right path. 1. You need to register taxonomy and post type with dynamic rewrite: ``` function wpse346452_cpt() { register_taxonomy( 'campaign', 'asset', array( 'label' => 'Campaing' ) ); register_post_type( 'asset', array( 'public' => true, ...
346,479
<p>I host my own WP site on a Debian/Raspbian buster server.</p> <p>I upgraded PHP 7.1 to 7.3 and the site broke.</p> <p>I can't understand why it broke because mysql_connect() is deprecated for 7.x (though wp-db.php seems to use it extensively - while WP nags you to upgrade to 7.3). So I looked to enabling the vario...
[ { "answer_id": 346483, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 2, "selected": false, "text": "<p>I mean your php.ini is changed, check for the entry <code>extension=php_mysqll.dll</code>.</p>\n\n<p>(If you has ...
2019/09/03
[ "https://wordpress.stackexchange.com/questions/346479", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70649/" ]
I host my own WP site on a Debian/Raspbian buster server. I upgraded PHP 7.1 to 7.3 and the site broke. I can't understand why it broke because mysql\_connect() is deprecated for 7.x (though wp-db.php seems to use it extensively - while WP nags you to upgrade to 7.3). So I looked to enabling the various modules in th...
I mean your php.ini is changed, check for the entry `extension=php_mysqll.dll`. (If you has no knowledge where is your used php.ini - see <https://stackoverflow.com/questions/8684609/dude-wheres-my-php-ini>) Is this entry active, has no `;` before the string. After change of the php.ini you need a restart of mysql, ...
346,567
<p>I found this code around and I'm testing it but it doesn't work.</p> <p>How can I solve it?</p> <pre><code>add_action( 'validate_password_reset', 'rsm_redirect_after_rest', 10, 2 ); function rsm_redirect_after_rest($errors, $user) { if ( ( ! $errors-&gt;get_error_code() ) &amp;&amp; isset( $_POST['pass1'] ) &a...
[ { "answer_id": 346569, "author": "Ted Stresen-Reuter", "author_id": 112766, "author_profile": "https://wordpress.stackexchange.com/users/112766", "pm_score": 3, "selected": true, "text": "<p><code>$rp_cookie</code> and <code>$rp_path</code> are inside a function but are not initialized i...
2019/09/04
[ "https://wordpress.stackexchange.com/questions/346567", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174135/" ]
I found this code around and I'm testing it but it doesn't work. How can I solve it? ``` add_action( 'validate_password_reset', 'rsm_redirect_after_rest', 10, 2 ); function rsm_redirect_after_rest($errors, $user) { if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) { ...
`$rp_cookie` and `$rp_path` are inside a function but are not initialized inside the function so they are out of scope and thus, empty. You can try calling `global $rp_cookie, $rp_path;` at the start of your function but I don't know if those variables have been set at the time your function is running and thus they mi...
346,603
<p>I am registering a custom post type called "Products &amp; Services". I have created a file within <code>wp-content/themes/theme/</code> called <code>archive-products&amp;services.php</code> but it's not using this file. </p> <p>I also tried <code>archive-products &amp; services.php</code>, <code>archive-productsan...
[ { "answer_id": 346605, "author": "user2924019", "author_id": 105515, "author_profile": "https://wordpress.stackexchange.com/users/105515", "pm_score": -1, "selected": false, "text": "<p>After changing the post type to \"Products and Services\" it works with the file name \"archive-produc...
2019/09/04
[ "https://wordpress.stackexchange.com/questions/346603", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105515/" ]
I am registering a custom post type called "Products & Services". I have created a file within `wp-content/themes/theme/` called `archive-products&services.php` but it's not using this file. I also tried `archive-products & services.php`, `archive-productsandservices.php` but still it wont load the template. ``` reg...
Your problem was the & which WordPress cannot support as is. That is because & is used as part of a URL to join query vars together. Like this: ``` example.com/file.php?foo=bar&baz=zoo ``` Also, as pointed out in comments file names have to follow the naming standard. Which is clearly laid out in the documentation. ...
346,689
<p>I have a posttype 'timeslip' and I am calling this with the following API endpoint:</p> <pre><code>/wp-json/wp/v2/timeslip?meta_key=user_id&amp;meta_value=1 </code></pre> <p>I have exposed my custom field user_id to the API meta and can see it in the response.</p> <pre><code>add_filter('rest_timeslip_query', arra...
[ { "answer_id": 346704, "author": "Roel Magdaleno", "author_id": 99204, "author_profile": "https://wordpress.stackexchange.com/users/99204", "pm_score": 2, "selected": true, "text": "<p>Add a third parameter in the <code>get_post_meta()</code> function as <strong>true</strong>, that will ...
2019/09/05
[ "https://wordpress.stackexchange.com/questions/346689", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28355/" ]
I have a posttype 'timeslip' and I am calling this with the following API endpoint: ``` /wp-json/wp/v2/timeslip?meta_key=user_id&meta_value=1 ``` I have exposed my custom field user\_id to the API meta and can see it in the response. ``` add_filter('rest_timeslip_query', array($this, 'timeslip_meta_request_params')...
Add a third parameter in the `get_post_meta()` function as **true**, that will return the single value of the current post meta, if you don't set it it will return an array of the values. What is happening now is that internally the query is trying to compare the meta\_value with an array instead of a string or intege...
346,696
<p>An administrator wants to make posts for a future date but not visible for visitors. The posts come from a custom <code>WP_Query</code> inside my plugin so the basical WP behaviour does not work in this case.</p> <p>I tried this :</p> <pre><code>$args = array( 'post_type' =&gt; "my-post-type", 'date_query'...
[ { "answer_id": 346704, "author": "Roel Magdaleno", "author_id": 99204, "author_profile": "https://wordpress.stackexchange.com/users/99204", "pm_score": 2, "selected": true, "text": "<p>Add a third parameter in the <code>get_post_meta()</code> function as <strong>true</strong>, that will ...
2019/09/05
[ "https://wordpress.stackexchange.com/questions/346696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128094/" ]
An administrator wants to make posts for a future date but not visible for visitors. The posts come from a custom `WP_Query` inside my plugin so the basical WP behaviour does not work in this case. I tried this : ``` $args = array( 'post_type' => "my-post-type", 'date_query' => array( 'before...
Add a third parameter in the `get_post_meta()` function as **true**, that will return the single value of the current post meta, if you don't set it it will return an array of the values. What is happening now is that internally the query is trying to compare the meta\_value with an array instead of a string or intege...
346,707
<p>simple issue but i need some help because i dont why i m wrong on this...</p> <p>The apply filter (Important, this is in construct Class):</p> <pre><code> if ( apply_filters( 'tc_bridge_for_woocommerce_content_order_table_is_after', true ) == true ) { add_action( 'woocommerce_emai...
[ { "answer_id": 346704, "author": "Roel Magdaleno", "author_id": 99204, "author_profile": "https://wordpress.stackexchange.com/users/99204", "pm_score": 2, "selected": true, "text": "<p>Add a third parameter in the <code>get_post_meta()</code> function as <strong>true</strong>, that will ...
2019/09/05
[ "https://wordpress.stackexchange.com/questions/346707", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/96285/" ]
simple issue but i need some help because i dont why i m wrong on this... The apply filter (Important, this is in construct Class): ``` if ( apply_filters( 'tc_bridge_for_woocommerce_content_order_table_is_after', true ) == true ) { add_action( 'woocommerce_email_after_order_table',...
Add a third parameter in the `get_post_meta()` function as **true**, that will return the single value of the current post meta, if you don't set it it will return an array of the values. What is happening now is that internally the query is trying to compare the meta\_value with an array instead of a string or intege...
346,714
<p>I have a page template named <code>overview.php</code> which inside shows all the pages that are of the same category. As a result all the pages with the same category are printed but so is the current main page,because it is of the same category as well, and I don't want this to happen. So inside the loop I want to...
[ { "answer_id": 346716, "author": "Greg", "author_id": 123552, "author_profile": "https://wordpress.stackexchange.com/users/123552", "pm_score": -1, "selected": false, "text": "<p>You could store the \"current\" page ID in a variable outside of the loop.</p>\n" }, { "answer_id": 3...
2019/09/05
[ "https://wordpress.stackexchange.com/questions/346714", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174691/" ]
I have a page template named `overview.php` which inside shows all the pages that are of the same category. As a result all the pages with the same category are printed but so is the current main page,because it is of the same category as well, and I don't want this to happen. So inside the loop I want to get the ID of...
The current queried page can be accessed with `get_queried_object()`, or if you just need the ID, you can use `get_queried_object_id()`. However, while comparing the current ID in the loop to the queried object ID will allow you to skip a specific post, it won't work well with your pagination, because the page that fe...
346,755
<p><strong>Context:</strong></p> <p>I'm making a WooCommerce/Dokan marketplace for people to sell second hand products. As this are second hand products each product should have an inventory of just 1. All products are simple products, no variations.</p> <p><strong>Problem</strong></p> <p>I want to set by default a ...
[ { "answer_id": 346781, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>I believe in WooC the product stock data is saved as post meta with the key of <code>_stock</code>. ...
2019/09/06
[ "https://wordpress.stackexchange.com/questions/346755", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14756/" ]
**Context:** I'm making a WooCommerce/Dokan marketplace for people to sell second hand products. As this are second hand products each product should have an inventory of just 1. All products are simple products, no variations. **Problem** I want to set by default a stock of 1 to all products. I don't want the users...
For "New" simple products on admin, the following embedded jQuery script will: * trigger and enable "Stock management" at product level, * set the "Stock quantity" to "1", * set the "Low stock threshold" to "0". The code: ``` add_action( 'admin_footer', 'new_product_stock_default_setting' ); function new_product_sto...
346,830
<p>I am trying to pass args to archive.php so that I can order the posts, set the number of posts, etc..</p> <p>but the query is done like this </p> <pre><code>&lt;?php if (have_posts()): ?&gt; &lt;?php while (have_posts()): the_post();?&gt; </code></pre> <p>if it was<code>new \WP_Query($args);</code> i was able t...
[ { "answer_id": 346832, "author": "Matteo Feduzi", "author_id": 174135, "author_profile": "https://wordpress.stackexchange.com/users/174135", "pm_score": -1, "selected": false, "text": "<p>this is the code from my archive.php file:</p>\n\n<pre><code>$args = array( \n 'posts_per_page' =...
2019/09/07
[ "https://wordpress.stackexchange.com/questions/346830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am trying to pass args to archive.php so that I can order the posts, set the number of posts, etc.. but the query is done like this ``` <?php if (have_posts()): ?> <?php while (have_posts()): the_post();?> ``` if it was`new \WP_Query($args);` i was able to pass the args here but this can't be done in archive.p...
The `pre_get_posts` hook can be used to modify queries before they're run. You can use `$query->set()` to set arguments on the `WP_Query` object, and `$query->is_main_query()` in the callback to limit your changes to the main query: ``` add_action( 'pre_get_posts', function( $query ) { if ( ! is_admin(...
346,860
<p>How can I find what options or plugins are taking up all that size? It's not transients because after deleting all it's still 13GB.</p> <p><code>SELECT option_name, option_value FROM hihgv_options WHERE autoload = 'yes'</code> Returns 833 rows in 0.141 sec</p> <p><code>SELECT SUM(LENGTH(option_value)) as autoload_...
[ { "answer_id": 346861, "author": "Daviid", "author_id": 171564, "author_profile": "https://wordpress.stackexchange.com/users/171564", "pm_score": 2, "selected": true, "text": "<p>After executing these:</p>\n\n<pre><code>[root@shop ~]# mysqlcheck -p -c wordpress hihgv_options\nwordpress.h...
2019/09/08
[ "https://wordpress.stackexchange.com/questions/346860", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/171564/" ]
How can I find what options or plugins are taking up all that size? It's not transients because after deleting all it's still 13GB. `SELECT option_name, option_value FROM hihgv_options WHERE autoload = 'yes'` Returns 833 rows in 0.141 sec `SELECT SUM(LENGTH(option_value)) as autoload_size FROM hihgv_options WHERE aut...
After executing these: ``` [root@shop ~]# mysqlcheck -p -c wordpress hihgv_options wordpress.hihgv_options OK [root@shop ~]# mysqlcheck -p -o wordpress hihgv_options wordpress.hihgv_options note : Table does not support optimize, doing recreate + analyze instead status : OK [root@shop ...
346,949
<p>I'm writing a plugin to block some pages to anonymous users on my site. I already blocked some pages but I can't get to identify the feed page <code>my-wordpress-site.com/feed</code>.</p> <p>I've tried:</p> <ul> <li><code>$GLOBALS['pagenow'] == 'feed'</code></li> <li><code>is_feed()</code></li> <li><code>is_page('...
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/09
[ "https://wordpress.stackexchange.com/questions/346949", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174889/" ]
I'm writing a plugin to block some pages to anonymous users on my site. I already blocked some pages but I can't get to identify the feed page `my-wordpress-site.com/feed`. I've tried: * `$GLOBALS['pagenow'] == 'feed'` * `is_feed()` * `is_page('feed')` * checking on `$_SERVER['REQUEST_URI']` and `$_SERVER['PATH_INFO'...
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
346,955
<p>I'm trying to add property values for each user on a real estate website.</p> <p>I have a custom post type "properties." I'd like to take the "listing_price" from all of them and add them up to show how much that agent has for active listings.</p> <p>Really don't even know where to start. I see threads to add all ...
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/09
[ "https://wordpress.stackexchange.com/questions/346955", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109430/" ]
I'm trying to add property values for each user on a real estate website. I have a custom post type "properties." I'd like to take the "listing\_price" from all of them and add them up to show how much that agent has for active listings. Really don't even know where to start. I see threads to add all custom post type...
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
346,973
<p>Recently I got my website compromised so I cleaned it and enforce security. Among other things I've installed wordfence plugin that now scans everything in my worpdress installation, searched for the correct file permissions, etc...</p> <p>The problem is that I've found in a scan that many files (theme/functions.ph...
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/10
[ "https://wordpress.stackexchange.com/questions/346973", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174907/" ]
Recently I got my website compromised so I cleaned it and enforce security. Among other things I've installed wordfence plugin that now scans everything in my worpdress installation, searched for the correct file permissions, etc... The problem is that I've found in a scan that many files (theme/functions.php and anot...
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
348,077
<p>I need to get the title from my custom post but its showing from my default post. here is my code. please help.<a href="https://i.stack.imgur.com/SYfy2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SYfy2.png" alt="enter image description here"></a></p>
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/11
[ "https://wordpress.stackexchange.com/questions/348077", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/174994/" ]
I need to get the title from my custom post but its showing from my default post. here is my code. please help.[![enter image description here](https://i.stack.imgur.com/SYfy2.png)](https://i.stack.imgur.com/SYfy2.png)
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
348,105
<p>I would like to display order_item of order in admin list like in this screenshot:</p> <p><a href="https://i.stack.imgur.com/OQSyl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OQSyl.png" alt="enter image description here"></a></p> <p>Changing <code>/woocommerce/includes/admin/list-tables/cla...
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/12
[ "https://wordpress.stackexchange.com/questions/348105", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/175019/" ]
I would like to display order\_item of order in admin list like in this screenshot: [![enter image description here](https://i.stack.imgur.com/OQSyl.png)](https://i.stack.imgur.com/OQSyl.png) Changing `/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php` file, I tried to add the following: ...
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
348,175
<p>When creating a post <a href="https://wordpress.stackexchange.com/questions/151741/how-to-programmatically-create-posts-in-wordpress">programmatically</a> (with <code>wp_insert_post();</code>), how do you select the format? </p>
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/12
[ "https://wordpress.stackexchange.com/questions/348175", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109240/" ]
When creating a post [programmatically](https://wordpress.stackexchange.com/questions/151741/how-to-programmatically-create-posts-in-wordpress) (with `wp_insert_post();`), how do you select the format?
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
348,220
<p>Both functions return the website url.</p> <p>And, as home_url() needs sanitization (for example <code>&lt;?php echo esc_url( home_url( '/' ) ); ?&gt;)</code>, why it is this snippet of code, instead of <code>&lt;?php echo get_ home_url( '/' ); ?&gt;</code>, that we found in Wordpress Codex and Wordpress Template T...
[ { "answer_id": 348182, "author": "freejack", "author_id": 124757, "author_profile": "https://wordpress.stackexchange.com/users/124757", "pm_score": 4, "selected": true, "text": "<p>You have not specified exactly when your code runs but you can hook into \"request\" to check the requested...
2019/09/13
[ "https://wordpress.stackexchange.com/questions/348220", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/175093/" ]
Both functions return the website url. And, as home\_url() needs sanitization (for example `<?php echo esc_url( home_url( '/' ) ); ?>)`, why it is this snippet of code, instead of `<?php echo get_ home_url( '/' ); ?>`, that we found in Wordpress Codex and Wordpress Template Twenty Nineteen ?
You have not specified exactly when your code runs but you can hook into "request" to check the requested page: ``` add_filter( 'request', function( $request ){ if( isset( $request['feed'] ) ){ //This is a feed request } return $request; }); ``` When the requested page is a feed `$request`, which...
348,237
<p>I am witnessing a strange problem in WordPress which automatically removes 'http' from my sub domain link. I don't know why this is happening.</p> <p>Note that my domain is <em>https</em> while it's subdomain is <em>http</em>.</p> <p>My WordPress is installed in my main domain. When I add the below url of my sub d...
[ { "answer_id": 348248, "author": "Matthew Brown aka Lord Matt", "author_id": 109240, "author_profile": "https://wordpress.stackexchange.com/users/109240", "pm_score": 1, "selected": false, "text": "<p>You might find that you do not want to solve this one. Links starting //example.com are...
2019/09/13
[ "https://wordpress.stackexchange.com/questions/348237", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/175101/" ]
I am witnessing a strange problem in WordPress which automatically removes 'http' from my sub domain link. I don't know why this is happening. Note that my domain is *https* while it's subdomain is *http*. My WordPress is installed in my main domain. When I add the below url of my sub domain to any post: ``` <a href...
You might find that you do not want to solve this one. Links starting //example.com are protocol agnostic. This means it will load over whatever the site it is on loads over. Be that http, http**s**, or some truly esoteric. You should find that links like this work in both secure and insecure connections just fine. It...
348,257
<p>The search form on my website has a couple radio inputs for the user to select which source (all but one are external to the website) the search query should use. </p> <p>I retrieve those inputs (search term and source as ) ; </p> <pre><code>function search_redirect_form() { if (is_search() &amp;&amp; ! empty( $...
[ { "answer_id": 348261, "author": "Mike Baxter", "author_id": 38628, "author_profile": "https://wordpress.stackexchange.com/users/38628", "pm_score": 0, "selected": false, "text": "<p>You could try just removing anything that had the potential to alter your url. I would suggest something...
2019/09/13
[ "https://wordpress.stackexchange.com/questions/348257", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48698/" ]
The search form on my website has a couple radio inputs for the user to select which source (all but one are external to the website) the search query should use. I retrieve those inputs (search term and source as ) ; ``` function search_redirect_form() { if (is_search() && ! empty( $_GET['simple'] ) ) { ...
Right after posting, I learned a couple things, most importantly, [that url encoding is done differently for paths and queries](https://www.gyrocode.com/articles/php-urlencode-vs-rawurlencode/) and one of our search sources treats the search query as a path, so I had to use rawurlencode for the path; and urlencode for ...
348,292
<p>EDIT</p> <p>May be my question is not well formed i need to use the url <a href="http://localhost/wordpress/houses/all-houses" rel="nofollow noreferrer">http://localhost/wordpress/houses/all-houses</a> to display a house plugin view somewhere in plugin directory</p> <pre><code>function getHouses(){ include pl...
[ { "answer_id": 348261, "author": "Mike Baxter", "author_id": 38628, "author_profile": "https://wordpress.stackexchange.com/users/38628", "pm_score": 0, "selected": false, "text": "<p>You could try just removing anything that had the potential to alter your url. I would suggest something...
2019/09/14
[ "https://wordpress.stackexchange.com/questions/348292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/175133/" ]
EDIT May be my question is not well formed i need to use the url <http://localhost/wordpress/houses/all-houses> to display a house plugin view somewhere in plugin directory ``` function getHouses(){ include plugin_dir_path(__FILE__) . 'public/publicHouse.php'; } ``` the result i'm getting is on the picture bel...
Right after posting, I learned a couple things, most importantly, [that url encoding is done differently for paths and queries](https://www.gyrocode.com/articles/php-urlencode-vs-rawurlencode/) and one of our search sources treats the search query as a path, so I had to use rawurlencode for the path; and urlencode for ...
348,298
<p>I am currently modernising an old WordPress theme (a standalone theme, not a child of any official themes). Trying to build pagination I am finding some issues creating one function that works for both archives and search. The first snippet works fine with archives (categories, loops, etc):</p> <pre><code>function ...
[ { "answer_id": 348315, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 2, "selected": true, "text": "<p>From the <a href=\"https://codex.wordpress.org/Function_Reference/paginate_links#Examples\" rel=\"nofollow ...
2019/09/14
[ "https://wordpress.stackexchange.com/questions/348298", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23296/" ]
I am currently modernising an old WordPress theme (a standalone theme, not a child of any official themes). Trying to build pagination I am finding some issues creating one function that works for both archives and search. The first snippet works fine with archives (categories, loops, etc): ``` function pagination_bar...
From the [Codex](https://codex.wordpress.org/Function_Reference/paginate_links#Examples): > > To add pagination to your *search results and archives*, you can use > the following example: > > > > ``` > <?php > global $wp_query; > > $big = 999999999; // need an unlikely integer > > echo paginate_links( array( > ...
348,300
<p>I'm really not a developer, but this is something I <strong>expect</strong> not to be too hard to achieve :-) I really don't know where to start, so that's point 1. I read all of the topics about dynamically changing the widget title, but they all need human interaction.</p> <p>Maybe I'm thinking too simple, but wo...
[ { "answer_id": 348315, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 2, "selected": true, "text": "<p>From the <a href=\"https://codex.wordpress.org/Function_Reference/paginate_links#Examples\" rel=\"nofollow ...
2019/09/14
[ "https://wordpress.stackexchange.com/questions/348300", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85557/" ]
I'm really not a developer, but this is something I **expect** not to be too hard to achieve :-) I really don't know where to start, so that's point 1. I read all of the topics about dynamically changing the widget title, but they all need human interaction. Maybe I'm thinking too simple, but wouldn't it be easy to re...
From the [Codex](https://codex.wordpress.org/Function_Reference/paginate_links#Examples): > > To add pagination to your *search results and archives*, you can use > the following example: > > > > ``` > <?php > global $wp_query; > > $big = 999999999; // need an unlikely integer > > echo paginate_links( array( > ...
348,310
<p>I am trying to query some custom posts so that I can iterate through them, extract the title of ecah and add the titles into an array. The reason I am doing this is so that I can then create a select field in woocommerce using the array contents to generate the options (haven't done this bit yet)</p> <p>Can anyone ...
[ { "answer_id": 348311, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": false, "text": "<p>I see two problems with the code you've written. The first one is that <code>the_title()</code> echo...
2019/09/14
[ "https://wordpress.stackexchange.com/questions/348310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161436/" ]
I am trying to query some custom posts so that I can iterate through them, extract the title of ecah and add the titles into an array. The reason I am doing this is so that I can then create a select field in woocommerce using the array contents to generate the options (haven't done this bit yet) Can anyone see where ...
I see two problems with the code you've written. The first one is that `the_title()` echos the post title although returning the title would be more appropriate in this context. Also `wp_reset_postdata()` should be after the `while` loop inside the `if` statement. But as you mentioned that you only need the post title...
348,378
<p>I am looking for solution to display related product by multiple product attributes. I've tried <em>"<a href="https://stackoverflow.com/a/49961446/3730754">Display Related products for a specific product attribute value in single product pages </a>"</em> StackOverFlow answer code, but it works only for <strong>one</...
[ { "answer_id": 348311, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": false, "text": "<p>I see two problems with the code you've written. The first one is that <code>the_title()</code> echo...
2019/09/16
[ "https://wordpress.stackexchange.com/questions/348378", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am looking for solution to display related product by multiple product attributes. I've tried *"[Display Related products for a specific product attribute value in single product pages](https://stackoverflow.com/a/49961446/3730754)"* StackOverFlow answer code, but it works only for **one** product attribute value. ...
I see two problems with the code you've written. The first one is that `the_title()` echos the post title although returning the title would be more appropriate in this context. Also `wp_reset_postdata()` should be after the `while` loop inside the `if` statement. But as you mentioned that you only need the post title...