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
268,495
<p><a href="https://developer.wordpress.org/reference/classes/wp_posts_list_table/extra_tablenav/" rel="noreferrer">WP_Posts_List_Table::extra_tablenav()</a> applies <a href="https://developer.wordpress.org/reference/hooks/restrict_manage_posts/" rel="noreferrer">restrict_manage_posts</a>, which can be used by a plugin...
[ { "answer_id": 268720, "author": "constancecchen", "author_id": 110820, "author_profile": "https://wordpress.stackexchange.com/users/110820", "pm_score": 2, "selected": false, "text": "<p>I've been searching around for the same answer to your question and running into the exact same issu...
2017/05/29
[ "https://wordpress.stackexchange.com/questions/268495", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/113496/" ]
[WP\_Posts\_List\_Table::extra\_tablenav()](https://developer.wordpress.org/reference/classes/wp_posts_list_table/extra_tablenav/) applies [restrict\_manage\_posts](https://developer.wordpress.org/reference/hooks/restrict_manage_posts/), which can be used by a plugin to output extra dropdowns (or other markup) that all...
I've been searching around for the same answer to your question and running into the exact same issues, and really appreciate your thorough research. I'm definitely +1 here for proposing this addition! To attempt to answer 2) - I don't think there's a good reason to exclude it. I think WordPress's taxonomy terms are w...
268,513
<p>I'm using the theme customizer where I'm trying to find a way to check two settings. Here's my code and an explanation what it does:</p> <pre><code>// start a setting called 'twsa_show_active_days' $wp_customize-&gt;add_setting( 'twsa_show_active_days' ); // add options to the setting, in this case a radio to selec...
[ { "answer_id": 268516, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>In general, there should not be any limitation on what is being checked in <code>active_callback</code> o...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268513", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8049/" ]
I'm using the theme customizer where I'm trying to find a way to check two settings. Here's my code and an explanation what it does: ``` // start a setting called 'twsa_show_active_days' $wp_customize->add_setting( 'twsa_show_active_days' ); // add options to the setting, in this case a radio to select three options $...
Maybe I'm misreading your question, but combining these two conditions in one anonymous function doesn't look that difficult: ``` 'active_callback' => function() use ( $wp_customize ) { $condition1 == $wp_customize->get_setting( 'twsa_show_schedule' )->value(); $condition2 == $wp_customize->get_setting( 'twsa_...
268,531
<p>I realise this may be a generic php question, but as it's related to WP I'm including it here.</p> <p>If adding a simple conditional to my page.php template, do I need to include an 'else' (for other pages) and 'endif'?</p> <pre><code>&lt;?php if (is_tree(39)) : get_template_part('templates/partial/menu-buy'); els...
[ { "answer_id": 268533, "author": "Steve", "author_id": 120700, "author_profile": "https://wordpress.stackexchange.com/users/120700", "pm_score": 4, "selected": true, "text": "<p>You just need an else block:</p>\n\n<pre><code>//templating syntax\nif($condOne):\n //do stuff if $condOne ...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268531", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103213/" ]
I realise this may be a generic php question, but as it's related to WP I'm including it here. If adding a simple conditional to my page.php template, do I need to include an 'else' (for other pages) and 'endif'? ``` <?php if (is_tree(39)) : get_template_part('templates/partial/menu-buy'); elseif (is_tree(117)) : get...
You just need an else block: ``` //templating syntax if($condOne): //do stuff if $condOne is true elseif($condTwo): //do stuff if $condOne is false and $condTwo is true else: //do stuff if both $condOne and $condTwo are false endif; //braces syntax if($condOne){ //do stuff if $condOne is true }elseif(...
268,535
<p>How i can create custom post method url in wordpress? For Example i will send data by ajax to urls: </p> <p><a href="http://example.com/?call_option=option1" rel="nofollow noreferrer">http://example.com/?call_option=option1</a> or <a href="http://example.com/?call_option=option2" rel="nofollow noreferrer">http://ex...
[ { "answer_id": 268540, "author": "Jiten Gaikwad", "author_id": 120716, "author_profile": "https://wordpress.stackexchange.com/users/120716", "pm_score": 3, "selected": true, "text": "<p>WordPress comes with built in support for using AJAX calls from within your plugins or themes function...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268535", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120726/" ]
How i can create custom post method url in wordpress? For Example i will send data by ajax to urls: <http://example.com/?call_option=option1> or <http://example.com/?call_option=option2> And this will execute my code in function.php (in theme folder) ``` $option = trim($_GET['call_option']); if(empty($option)) { ...
WordPress comes with built in support for using AJAX calls from within your plugins or themes functions.php. Following is the sample example: Javascript code: ``` jQuery( document ).on( 'click', '.event-trigger', function() { var ajax_url = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; //You can define this p...
268,560
<p>I'm desperately trying to make an advanced searchform in order to get posts by their meta fields. I got this: </p> <p>[UPDATE]: This is the correct code:</p> <pre><code>/** *Registering custom query vars * */ function sy_register_query_var( $vars ){ $vars[] = 'type'; $vars[] = 'cabins'; $vars[] = 'base'; ...
[ { "answer_id": 268540, "author": "Jiten Gaikwad", "author_id": 120716, "author_profile": "https://wordpress.stackexchange.com/users/120716", "pm_score": 3, "selected": true, "text": "<p>WordPress comes with built in support for using AJAX calls from within your plugins or themes function...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268560", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120682/" ]
I'm desperately trying to make an advanced searchform in order to get posts by their meta fields. I got this: [UPDATE]: This is the correct code: ``` /** *Registering custom query vars * */ function sy_register_query_var( $vars ){ $vars[] = 'type'; $vars[] = 'cabins'; $vars[] = 'base'; return $vars; } add_...
WordPress comes with built in support for using AJAX calls from within your plugins or themes functions.php. Following is the sample example: Javascript code: ``` jQuery( document ).on( 'click', '.event-trigger', function() { var ajax_url = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; //You can define this p...
268,563
<p>I was able to echo out all terms belonging to a custom taxonomy using the code below:</p> <pre><code>$args = array('post_type' =&gt; 'my_post_type','number' =&gt; '999'); $terms = get_terms( 'my_taxo', [ 'hide_empty' =&gt; true, 'orderby' =&gt; 'wpse_last_word', ] , $args...
[ { "answer_id": 268569, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 3, "selected": true, "text": "<p>Your code is wrong. I don't know how it is working in your localhost. Cause- </p>\n\n<ol>\n<li>You are call...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268563", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/97402/" ]
I was able to echo out all terms belonging to a custom taxonomy using the code below: ``` $args = array('post_type' => 'my_post_type','number' => '999'); $terms = get_terms( 'my_taxo', [ 'hide_empty' => true, 'orderby' => 'wpse_last_word', ] , $args ); foreach ( $terms as $...
Your code is wrong. I don't know how it is working in your localhost. Cause- 1. You are calling `get_terms()` with 3 parameters which actually accepts 2 parameters. The last one is extra. 2. And secondly `get_terms()` returns all the terms of a taxonomy, not the terms associated with a post. For getting the terms as...
268,591
<h1>Background</h1> <p>I am trying to add page templates from inside of a plugin. For this question, I have trimmed my code down into a test plugin which has two files, the PHP main plugin file, and a PHP template file.</p> <p>wp-plugins/test-plugin/test-plugin.php</p> <p>wp-plugins/test-plugin/templates/test-templa...
[ { "answer_id": 268569, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 3, "selected": true, "text": "<p>Your code is wrong. I don't know how it is working in your localhost. Cause- </p>\n\n<ol>\n<li>You are call...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268591", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47789/" ]
Background ========== I am trying to add page templates from inside of a plugin. For this question, I have trimmed my code down into a test plugin which has two files, the PHP main plugin file, and a PHP template file. wp-plugins/test-plugin/test-plugin.php wp-plugins/test-plugin/templates/test-template.php The plu...
Your code is wrong. I don't know how it is working in your localhost. Cause- 1. You are calling `get_terms()` with 3 parameters which actually accepts 2 parameters. The last one is extra. 2. And secondly `get_terms()` returns all the terms of a taxonomy, not the terms associated with a post. For getting the terms as...
268,607
<p>I've got a page where I only want to display one post per page with pagination at the bottom to go to the next/ previous post. This is my code:</p> <pre><code> &lt;?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : '1'; $args = array ( 'nopaging' =&gt; false, 'paged' ...
[ { "answer_id": 268569, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 3, "selected": true, "text": "<p>Your code is wrong. I don't know how it is working in your localhost. Cause- </p>\n\n<ol>\n<li>You are call...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268607", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120767/" ]
I've got a page where I only want to display one post per page with pagination at the bottom to go to the next/ previous post. This is my code: ``` <?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : '1'; $args = array ( 'nopaging' => false, 'paged' => $pag...
Your code is wrong. I don't know how it is working in your localhost. Cause- 1. You are calling `get_terms()` with 3 parameters which actually accepts 2 parameters. The last one is extra. 2. And secondly `get_terms()` returns all the terms of a taxonomy, not the terms associated with a post. For getting the terms as...
268,609
<p>We use Open Live Writer to upload to our Wordpress Blog on GoDaddy. It takes us numerous times to upload the draft with pictures to the Blog as we get the error message of lost connection. I have noticed in the Media file that the pictures are uploading in stages. That is, after I get the connection error message...
[ { "answer_id": 268569, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 3, "selected": true, "text": "<p>Your code is wrong. I don't know how it is working in your localhost. Cause- </p>\n\n<ol>\n<li>You are call...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268609", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120768/" ]
We use Open Live Writer to upload to our Wordpress Blog on GoDaddy. It takes us numerous times to upload the draft with pictures to the Blog as we get the error message of lost connection. I have noticed in the Media file that the pictures are uploading in stages. That is, after I get the connection error message I che...
Your code is wrong. I don't know how it is working in your localhost. Cause- 1. You are calling `get_terms()` with 3 parameters which actually accepts 2 parameters. The last one is extra. 2. And secondly `get_terms()` returns all the terms of a taxonomy, not the terms associated with a post. For getting the terms as...
268,615
<p>How can I prevent Headers from being sent?</p> <p>I am trying to list (WordPress) blog posts on a non-WordPress site (both sites share a public web folder). </p> <p>I want to run the following PHP code to get the blog posts:</p> <pre><code> &lt;ul class='list-unstyled'&gt; &lt;?php def...
[ { "answer_id": 268617, "author": "DaveLak", "author_id": 119673, "author_profile": "https://wordpress.stackexchange.com/users/119673", "pm_score": 0, "selected": false, "text": "<p>Output of the page started as your php is executing. Look into into <a href=\"http://php.net/manual/en/book...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268615", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120771/" ]
How can I prevent Headers from being sent? I am trying to list (WordPress) blog posts on a non-WordPress site (both sites share a public web folder). I want to run the following PHP code to get the blog posts: ``` <ul class='list-unstyled'> <?php define('WP_USE_THEMES', false); ...
"Headers already sent" is not a WordPress error, it is PHP processing error message. Good explanation here; <https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php> . I suspect it might be caused by some characters (probably space characters) sent before your `<?php` code segment. Eve...
268,630
<p>I'm working on a function where I just want to output a button that links to a specific term. I have used <code>get_the_terms</code> and have gotten it to work successfully, but I've been trying <code>get_term</code> and I've have no luck. I want the shortcode to look like this <code>[see_all_products category="bake...
[ { "answer_id": 268617, "author": "DaveLak", "author_id": 119673, "author_profile": "https://wordpress.stackexchange.com/users/119673", "pm_score": 0, "selected": false, "text": "<p>Output of the page started as your php is executing. Look into into <a href=\"http://php.net/manual/en/book...
2017/05/30
[ "https://wordpress.stackexchange.com/questions/268630", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/96257/" ]
I'm working on a function where I just want to output a button that links to a specific term. I have used `get_the_terms` and have gotten it to work successfully, but I've been trying `get_term` and I've have no luck. I want the shortcode to look like this `[see_all_products category="bakery"]` and output a button that...
"Headers already sent" is not a WordPress error, it is PHP processing error message. Good explanation here; <https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php> . I suspect it might be caused by some characters (probably space characters) sent before your `<?php` code segment. Eve...
268,653
<p>Media Library is not loading on grid view and also featured image not select any image from post and page . The progress circle keeps spinning. Due to this issue, I am not able to add any image in the post as insert image option also opens in “grid view” by default.</p> <p>The things I tried but not resolved my iss...
[ { "answer_id": 268778, "author": "Pavnish Yadav", "author_id": 68882, "author_profile": "https://wordpress.stackexchange.com/users/68882", "pm_score": -1, "selected": false, "text": "<p>I faced same issue on my wordpress site. After the lot of debugging i fixed my problem step by step.</...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268653", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68882/" ]
Media Library is not loading on grid view and also featured image not select any image from post and page . The progress circle keeps spinning. Due to this issue, I am not able to add any image in the post as insert image option also opens in “grid view” by default. The things I tried but not resolved my issue: 1. Re...
I ran into a similar issue with the same symptoms. What I determined was in my theme's function.php there was a DEBUG statement that output some html. While this was fine for browsing, when the POST request came into admin-ajax.php to refresh the thumbnails, it was causing the infinite spinning wheel and not showing im...
268,669
<p>I have a custom post type containing job listings, that is highly volatile. Jobs are frequently added and removed. Our analytics show that a lot of crawling errors are for detail pages of jobs that have been unlisted.</p> <p>The solution I came up with is to redirect all visits for non-existant URLs within the CPT'...
[ { "answer_id": 268673, "author": "Aishan", "author_id": 89530, "author_profile": "https://wordpress.stackexchange.com/users/89530", "pm_score": 0, "selected": false, "text": "<p>If there is no page on your site with that post type, you need to ask yourself the question:\nshould I really ...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268669", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120812/" ]
I have a custom post type containing job listings, that is highly volatile. Jobs are frequently added and removed. Our analytics show that a lot of crawling errors are for detail pages of jobs that have been unlisted. The solution I came up with is to redirect all visits for non-existant URLs within the CPT's slug to ...
It looks like `template_redirect` is as far up the WordPress action chain you can go while still being able to detect that a 404 error is being thrown. This action will trigger before any template files would be loaded so it will happen before loading unnecessary resources. You can try adding this into your `/wp-cont...
268,696
<p>Using theme (and child theme) of Sailent, I'm trying to work out a way to completely remove a menu item from my navigation bar while on desktop. See site here: <a href="http://www.boinginflatables.com/2017update/" rel="nofollow noreferrer">http://www.boinginflatables.com/2017update/</a></p> <p><a href="https://i.st...
[ { "answer_id": 268673, "author": "Aishan", "author_id": 89530, "author_profile": "https://wordpress.stackexchange.com/users/89530", "pm_score": 0, "selected": false, "text": "<p>If there is no page on your site with that post type, you need to ask yourself the question:\nshould I really ...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120829/" ]
Using theme (and child theme) of Sailent, I'm trying to work out a way to completely remove a menu item from my navigation bar while on desktop. See site here: <http://www.boinginflatables.com/2017update/> [![It's there, although not visible](https://i.stack.imgur.com/7eec2.png)](https://i.stack.imgur.com/7eec2.png) A...
It looks like `template_redirect` is as far up the WordPress action chain you can go while still being able to detect that a 404 error is being thrown. This action will trigger before any template files would be loaded so it will happen before loading unnecessary resources. You can try adding this into your `/wp-cont...
268,700
<p>I need to get all post ids, post_titles and the according meta_value which is "featured" for a custom post_type. I think I need to do a join, but I don't know how they work.. Could anyone help me out on this? </p>
[ { "answer_id": 268673, "author": "Aishan", "author_id": 89530, "author_profile": "https://wordpress.stackexchange.com/users/89530", "pm_score": 0, "selected": false, "text": "<p>If there is no page on your site with that post type, you need to ask yourself the question:\nshould I really ...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268700", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80443/" ]
I need to get all post ids, post\_titles and the according meta\_value which is "featured" for a custom post\_type. I think I need to do a join, but I don't know how they work.. Could anyone help me out on this?
It looks like `template_redirect` is as far up the WordPress action chain you can go while still being able to detect that a 404 error is being thrown. This action will trigger before any template files would be loaded so it will happen before loading unnecessary resources. You can try adding this into your `/wp-cont...
268,732
<p>Is it possible to password protect a PDF for visitors to our website (not users)? We have uploaded a PDF to our media and created a link to it on a page, but we would like to password protect just that PDF and not the whole page that contains the link to it.</p>
[ { "answer_id": 268673, "author": "Aishan", "author_id": 89530, "author_profile": "https://wordpress.stackexchange.com/users/89530", "pm_score": 0, "selected": false, "text": "<p>If there is no page on your site with that post type, you need to ask yourself the question:\nshould I really ...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120857/" ]
Is it possible to password protect a PDF for visitors to our website (not users)? We have uploaded a PDF to our media and created a link to it on a page, but we would like to password protect just that PDF and not the whole page that contains the link to it.
It looks like `template_redirect` is as far up the WordPress action chain you can go while still being able to detect that a 404 error is being thrown. This action will trigger before any template files would be loaded so it will happen before loading unnecessary resources. You can try adding this into your `/wp-cont...
268,742
<p>I am using WordPress MU Domain Mapping which works fine, but when I try to these any theme's customizer, I get this error when trying to save:</p> <p><strong>Cheatin’ uh? Sorry, you are not allowed to customize this site.</strong></p> <p>When I deactivate the plugin, the customizer works. I have 'Remote Login' and...
[ { "answer_id": 268947, "author": "Nikolay", "author_id": 100555, "author_profile": "https://wordpress.stackexchange.com/users/100555", "pm_score": 0, "selected": false, "text": "<p>Try mapping without a plugin then. Since WP 4.5 this is possible. Just point the domain to the server with ...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268742", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101588/" ]
I am using WordPress MU Domain Mapping which works fine, but when I try to these any theme's customizer, I get this error when trying to save: **Cheatin’ uh? Sorry, you are not allowed to customize this site.** When I deactivate the plugin, the customizer works. I have 'Remote Login' and ' Redirect administration pag...
After much trial and error, I found the cause to be a conflict with the WP Super Cache plugin, I had to disable the following from my wp-config.php file: ``` define( 'WPCACHEHOME', '/var/www/html/wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager ```
268,750
<p>I want to link a external url as follows:</p> <pre><code>$url='www.example.com'; $output ='&lt;div class="button"&gt;&lt;a href="'.$url.'"&gt; View Profile&lt;/a&gt;&lt;/div&gt;'; </code></pre> <p>I run this wordpress web app at my localhost and base url is localhost/wordpress. When I echo <code>$output</code> it ...
[ { "answer_id": 268752, "author": "Sam", "author_id": 115586, "author_profile": "https://wordpress.stackexchange.com/users/115586", "pm_score": 0, "selected": false, "text": "<p>You have a / thats not needed in the href this will add the link to the end of your current url hence localhost...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268750", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120824/" ]
I want to link a external url as follows: ``` $url='www.example.com'; $output ='<div class="button"><a href="'.$url.'"> View Profile</a></div>'; ``` I run this wordpress web app at my localhost and base url is localhost/wordpress. When I echo `$output` it produce a link for view profile: `localhost/wordpress/www.exa...
@Sam is close, but I think you need to do this: ``` $url = 'http://www.example.com'; ``` Without the protocol in front, you get the wrong result. Change to ``` $url = 'https://www.example.com'; ``` if you need an SSL link.
268,755
<p>I'm trying to allow Subscriber roles to be allowed to delete their own posts using the following code:</p> <pre><code>&lt;?php if ($post-&gt;post_author == $current_user-&gt;ID) { ?&gt; &lt;div class="col-sm-12 box-delete" style="margin-top: 20px;"&gt; &lt;a class="option" onclick="return confirm('Are y...
[ { "answer_id": 268756, "author": "Sam", "author_id": 115586, "author_profile": "https://wordpress.stackexchange.com/users/115586", "pm_score": -1, "selected": false, "text": "<p>You should be able to adapt the below to suit your needs, Just make sure to select the option for delete_posts...
2017/05/31
[ "https://wordpress.stackexchange.com/questions/268755", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54953/" ]
I'm trying to allow Subscriber roles to be allowed to delete their own posts using the following code: ``` <?php if ($post->post_author == $current_user->ID) { ?> <div class="col-sm-12 box-delete" style="margin-top: 20px;"> <a class="option" onclick="return confirm('Are you sure you want to delete <?php th...
The capability required to delete posts is `delete_posts`. If you want them to be able to delete their own published posts, the capability is `delete_published_posts`. The capability required to view the administration panel is `read`. Subscribers have this capability natively, so unless you have removed it, subscribe...
268,763
<p>I'm designing a theme for a customer. We have only <strong>one post</strong> for each <strong>TvShow</strong>, And inside that post, We have all the <strong>Seasons</strong> and <strong>Episodes</strong>. (Using <code>meta_post</code>).</p> <p>Now, I have a <code>ul</code> for <strong>filtering seasons</strong> and...
[ { "answer_id": 268770, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>You're almost there. You need to add the <code>season</code> and <code>episode</code> query vars to the array of r...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268763", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120875/" ]
I'm designing a theme for a customer. We have only **one post** for each **TvShow**, And inside that post, We have all the **Seasons** and **Episodes**. (Using `meta_post`). Now, I have a `ul` for **filtering seasons** and one for **filtering episodes**, Like *Show 1st Season, Episode 3*. But that needs adding rules t...
You're almost there. You need to add the `season` and `episode` query vars to the array of recognized vars. Note the small change to your regex as well- ``` function wpd_add_my_rule(){ add_rewrite_rule( '^([^/]+)/season-([0-9]+)/episode-([0-9]+)/?$', 'index.php?name=$matches[1]&season=$matches[2]&e...
268,774
<p>So in WordPress 4.6 they added the localization to the jQuery datepicker to be automatic. I am posting here first because I am not sure if this is actually a bug with WP or if I am doing something wrong.</p> <p>If I set my language in the settings to French then the datepicker correctly gets localized and shows the...
[ { "answer_id": 269354, "author": "Frank P. Walentynowicz", "author_id": 32851, "author_profile": "https://wordpress.stackexchange.com/users/32851", "pm_score": 1, "selected": false, "text": "<p>Create <code>page-156.php</code> template with its content matching the page you use right now...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268774", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48502/" ]
So in WordPress 4.6 they added the localization to the jQuery datepicker to be automatic. I am posting here first because I am not sure if this is actually a bug with WP or if I am doing something wrong. If I set my language in the settings to French then the datepicker correctly gets localized and shows the months et...
I was able to successfully change the datepicker's strings to a different locale for a single page using the [`switch_to_locale()`](https://developer.wordpress.org/reference/functions/switch_to_locale/) function introduced in [WordPress v4.7](https://make.wordpress.org/core/2016/11/07/user-admin-languages-and-locale-sw...
268,809
<p>I have a custom user role : Photograph.</p> <p>This role should not be able to log into the back-office, but have to be able to delete their own posts from the front-end.</p> <p>I am using this code to block all non-admin user from connecting to the backoffice with this (function.php) :</p> <pre><code>add_action(...
[ { "answer_id": 269327, "author": "hwl", "author_id": 118366, "author_profile": "https://wordpress.stackexchange.com/users/118366", "pm_score": 3, "selected": true, "text": "<p>Assuming you're talking about a custom user <strong>role</strong> named \"<em>photographer</em>\", I believe som...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268809", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/97852/" ]
I have a custom user role : Photograph. This role should not be able to log into the back-office, but have to be able to delete their own posts from the front-end. I am using this code to block all non-admin user from connecting to the backoffice with this (function.php) : ``` add_action( 'init', 'blockusers_init' )...
Assuming you're talking about a custom user **role** named "*photographer*", I believe something like this should add the `delete_posts` capability to that role. ``` function add_delete_cap_to_photog_role() { $role = get_role( 'photographer' ); $role->add_cap( 'delete_posts' ); } add_action( 'admin_init', 'ad...
268,827
<p>I want to merge two queries together and remove duplicate. I got it working individually. Now I got it working together but the results are not mixed and the duplicates are not removed. So I got the first queries result and then the second query result...</p> <pre><code> $fav_author_list = get_user_option( 'favo...
[ { "answer_id": 269327, "author": "hwl", "author_id": 118366, "author_profile": "https://wordpress.stackexchange.com/users/118366", "pm_score": 3, "selected": true, "text": "<p>Assuming you're talking about a custom user <strong>role</strong> named \"<em>photographer</em>\", I believe som...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120827/" ]
I want to merge two queries together and remove duplicate. I got it working individually. Now I got it working together but the results are not mixed and the duplicates are not removed. So I got the first queries result and then the second query result... ``` $fav_author_list = get_user_option( 'favorite-authors',...
Assuming you're talking about a custom user **role** named "*photographer*", I believe something like this should add the `delete_posts` capability to that role. ``` function add_delete_cap_to_photog_role() { $role = get_role( 'photographer' ); $role->add_cap( 'delete_posts' ); } add_action( 'admin_init', 'ad...
268,829
<p>I need to hook to the users list page.</p> <p>I Need to add a checkbox column for each user to remember if they have paid or not.</p> <p>Thanks for help because can’t find snippet to hook to this admin page.</p>
[ { "answer_id": 268835, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 1, "selected": false, "text": "<p>The users list column is filtered by <code>manage_users_columns</code>. Take a look into this simple exampl...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268829", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120924/" ]
I need to hook to the users list page. I Need to add a checkbox column for each user to remember if they have paid or not. Thanks for help because can’t find snippet to hook to this admin page.
One thing you should remember is that function, which will be hooked into `manage_users_custom_column` action **must have 3 parameters**, the first of which (i.e. `$val`) should be the returned value: ``` // Add custom column using 'manage_users_columns' filter if(!function_exists('bm_utm_column')){ function bm_utm_co...
268,842
<p>I'm moving existing data involving paintings from an old host that didn't use WordPress to a new host that does.</p> <p>With the old site, data was stored in a database so that each painting had its own page with information (artist, name, year, style, etc) and media pertaining to it, and the pages could then be se...
[ { "answer_id": 268845, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>You <em>could</em> use custom rewrite rule so that WP interprets specific URLs to call and present data from old da...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268842", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120930/" ]
I'm moving existing data involving paintings from an old host that didn't use WordPress to a new host that does. With the old site, data was stored in a database so that each painting had its own page with information (artist, name, year, style, etc) and media pertaining to it, and the pages could then be searched by ...
Before getting into [*Importing*](https://codex.wordpress.org/Importing_Content), I would familiarize yourself with both the [standard post type](https://codex.wordpress.org/Post_Types) and [post\_meta](https://codex.wordpress.org/Post_Meta_Data_Section) as well as [custom post types](https://codex.wordpress.org/Post_T...
268,864
<p>I will frequently add a line of text in my article sending the reader to the article page. This is separate from the actual produced permalink. The problem I'm having is that I can't get the permalink until the article is posted. I can copy the text from the displayed permalink, but if the title is too long that won...
[ { "answer_id": 268845, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>You <em>could</em> use custom rewrite rule so that WP interprets specific URLs to call and present data from old da...
2017/06/01
[ "https://wordpress.stackexchange.com/questions/268864", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120941/" ]
I will frequently add a line of text in my article sending the reader to the article page. This is separate from the actual produced permalink. The problem I'm having is that I can't get the permalink until the article is posted. I can copy the text from the displayed permalink, but if the title is too long that won't ...
Before getting into [*Importing*](https://codex.wordpress.org/Importing_Content), I would familiarize yourself with both the [standard post type](https://codex.wordpress.org/Post_Types) and [post\_meta](https://codex.wordpress.org/Post_Meta_Data_Section) as well as [custom post types](https://codex.wordpress.org/Post_T...
268,900
<p>I've built a marketplace-type site that lets different users post custom listings to the site.</p> <p>I want to use the WP backend to administer these listings with my admin account. The custom post types are displayed much like normal posts there.</p> <p>The problem is that the post author isn't shown. I googled ...
[ { "answer_id": 274573, "author": "PoeHaH", "author_id": 102898, "author_profile": "https://wordpress.stackexchange.com/users/102898", "pm_score": 2, "selected": false, "text": "<p>You can achieve this by using the <code>add_post_type_support</code> function as described here: <a href=\"h...
2017/06/02
[ "https://wordpress.stackexchange.com/questions/268900", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104550/" ]
I've built a marketplace-type site that lets different users post custom listings to the site. I want to use the WP backend to administer these listings with my admin account. The custom post types are displayed much like normal posts there. The problem is that the post author isn't shown. I googled the issue and qui...
You can achieve this by using the `add_post_type_support` function as described here: <https://codex.wordpress.org/Function_Reference/add_post_type_support>. This code should work: ``` function add_author_support_to_posts() { add_post_type_support( 'your_custom_post_type', 'author' ); } add_action( 'init', 'add_a...
268,913
<p>I want to get several post by tag. So I try to use get_posts() function:</p> <pre><code>&lt;?php $args = array( 'numberposts' =&gt; '3', 'post_status' =&gt; 'publish', 'tag' =&gt; 'travel' ); $recent_posts = get_posts($args);?&gt; </code></pre> <p>But it doesn't work. How can I get posts by tag?</p>
[ { "answer_id": 268934, "author": "Jan Čejka", "author_id": 70265, "author_profile": "https://wordpress.stackexchange.com/users/70265", "pm_score": 1, "selected": false, "text": "<p>Look at this section: <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters\" rel=\...
2017/06/02
[ "https://wordpress.stackexchange.com/questions/268913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103556/" ]
I want to get several post by tag. So I try to use get\_posts() function: ``` <?php $args = array( 'numberposts' => '3', 'post_status' => 'publish', 'tag' => 'travel' ); $recent_posts = get_posts($args);?> ``` But it doesn't work. How can I get posts by tag?
Look at this section: [Tag parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters) in WP Codex, where is explained search by tags. Your code like right. Try change numberposts to int: ``` <?php $args = array( 'numberposts' => 3, 'post_status' => 'publish', 'tag' => 'travel' ); ``...
268,928
<p>I would like to redirect users to my home page when the requested page or post cannot be found, but don't know how to go about with that.</p> <p>How do I proceed with such and action?</p>
[ { "answer_id": 268969, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>You can set any page/url to handle a 404 error via the <code>htaccess</code> file. This is a good tuto...
2017/06/02
[ "https://wordpress.stackexchange.com/questions/268928", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120985/" ]
I would like to redirect users to my home page when the requested page or post cannot be found, but don't know how to go about with that. How do I proceed with such and action?
You can use this code inside your `404.php` template file to safely redirect to users to homepage: ``` wp_safe_redirect(site_url()); exit(); ``` Use this code before every line of code in your `404.php`. This will redirect everyone who visits the 404 page to the website's home URL, which would be what you are lookin...
268,978
<p>I need to copy over Wordpress users with roles/passwords intact to a new install. I'd prefer not to copy the entire site (though if I have to I will.)</p> <p>Currently I only have the one main admin account on the new install. Some people have mentioned importing the old user and user-meta tables from the original ...
[ { "answer_id": 268969, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>You can set any page/url to handle a 404 error via the <code>htaccess</code> file. This is a good tuto...
2017/06/02
[ "https://wordpress.stackexchange.com/questions/268978", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106747/" ]
I need to copy over Wordpress users with roles/passwords intact to a new install. I'd prefer not to copy the entire site (though if I have to I will.) Currently I only have the one main admin account on the new install. Some people have mentioned importing the old user and user-meta tables from the original database, ...
You can use this code inside your `404.php` template file to safely redirect to users to homepage: ``` wp_safe_redirect(site_url()); exit(); ``` Use this code before every line of code in your `404.php`. This will redirect everyone who visits the 404 page to the website's home URL, which would be what you are lookin...
269,016
<p>Recently I've locked myself out of my WordPress site by changing the site URL. I fixed that problem by reverting the site URL to the original one in PHPmyadmin database.</p> <p>But what happens now is that my website is working properly but whenever i access the back-end, only the HTML part of WordPress is loading ...
[ { "answer_id": 268969, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>You can set any page/url to handle a 404 error via the <code>htaccess</code> file. This is a good tuto...
2017/06/03
[ "https://wordpress.stackexchange.com/questions/269016", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121030/" ]
Recently I've locked myself out of my WordPress site by changing the site URL. I fixed that problem by reverting the site URL to the original one in PHPmyadmin database. But what happens now is that my website is working properly but whenever i access the back-end, only the HTML part of WordPress is loading and not th...
You can use this code inside your `404.php` template file to safely redirect to users to homepage: ``` wp_safe_redirect(site_url()); exit(); ``` Use this code before every line of code in your `404.php`. This will redirect everyone who visits the 404 page to the website's home URL, which would be what you are lookin...
269,017
<p>I need to know how to write function for registering <code>activation_hook</code> and <code>deactivation_hook</code> following <strong>OOP fashion with best practices</strong>.</p> <p>I know there are some tasks we can do inside plugin activation/deactivation which is really essential in some cases like to create p...
[ { "answer_id": 269023, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 1, "selected": false, "text": "<p>Well there I got the below ways better-</p>\n\n<pre><code>// in the main plugin file\ndefine( 'PLUGIN_BASE...
2017/06/03
[ "https://wordpress.stackexchange.com/questions/269017", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119647/" ]
I need to know how to write function for registering `activation_hook` and `deactivation_hook` following **OOP fashion with best practices**. I know there are some tasks we can do inside plugin activation/deactivation which is really essential in some cases like to create professional plugins. Thanks.
It can be demonstrated like this way: **Step-1:** Create a folder named *`includes`* (or any name you like) inside the plugin root folder. Create two new files named `class-responsive-slider-activator.php` and `class-responsive-slider-deactivator.php` Now, in *class-responsive-slider-activator.php* create a class -...
269,037
<p>I'm very new to WP theming and I know there are several types of functions to add Widget areas.</p> <p>The following one, for example, adds a widget area dedicated for menus:</p> <pre><code># functions.php (register a new widget area): function newMenuWidgetArea() { register_nav_menus( array ( 'my...
[ { "answer_id": 269023, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 1, "selected": false, "text": "<p>Well there I got the below ways better-</p>\n\n<pre><code>// in the main plugin file\ndefine( 'PLUGIN_BASE...
2017/06/03
[ "https://wordpress.stackexchange.com/questions/269037", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121038/" ]
I'm very new to WP theming and I know there are several types of functions to add Widget areas. The following one, for example, adds a widget area dedicated for menus: ``` # functions.php (register a new widget area): function newMenuWidgetArea() { register_nav_menus( array ( 'my-custom-menu' => __('...
It can be demonstrated like this way: **Step-1:** Create a folder named *`includes`* (or any name you like) inside the plugin root folder. Create two new files named `class-responsive-slider-activator.php` and `class-responsive-slider-deactivator.php` Now, in *class-responsive-slider-activator.php* create a class -...
269,061
<p>I've tried a few solutions I found online on this site and many others, but most issues are with theme users and not theme developers. There is a issue with my theme that I am building it is not setting Featured Image/Thumbnail in any type of template meaning pages, post, etc... I also can't remove ones that I prese...
[ { "answer_id": 269372, "author": "Roshan Deshapriya", "author_id": 97402, "author_profile": "https://wordpress.stackexchange.com/users/97402", "pm_score": -1, "selected": false, "text": "<p>Add below function to function.php</p>\n\n<pre>\nif (function_exists('add_theme_support')) { add_t...
2017/06/04
[ "https://wordpress.stackexchange.com/questions/269061", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94807/" ]
I've tried a few solutions I found online on this site and many others, but most issues are with theme users and not theme developers. There is a issue with my theme that I am building it is not setting Featured Image/Thumbnail in any type of template meaning pages, post, etc... I also can't remove ones that I preset m...
You added your own answer in the comments section: > > There is only one total php warning/error: > > > ``` wp-admin/admin-header.php:9 - Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas13_data03/47/3056147/html/wp-includ‌​es/functions.php:413‌​8) i...
269,071
<p>I've got my HTML Custom Nav set up and it works fine for static template. I want to convert it into wordpress navigation menu. I am totally new to wordpress and i want help to convert html menu to wordpress.</p> <p>Here is the HTML code : </p> <pre><code>&lt;div id="cs-header-menu"&gt; &lt;div clas...
[ { "answer_id": 269372, "author": "Roshan Deshapriya", "author_id": 97402, "author_profile": "https://wordpress.stackexchange.com/users/97402", "pm_score": -1, "selected": false, "text": "<p>Add below function to function.php</p>\n\n<pre>\nif (function_exists('add_theme_support')) { add_t...
2017/06/04
[ "https://wordpress.stackexchange.com/questions/269071", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119438/" ]
I've got my HTML Custom Nav set up and it works fine for static template. I want to convert it into wordpress navigation menu. I am totally new to wordpress and i want help to convert html menu to wordpress. Here is the HTML code : ``` <div id="cs-header-menu"> <div class="cs-container"> ...
You added your own answer in the comments section: > > There is only one total php warning/error: > > > ``` wp-admin/admin-header.php:9 - Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas13_data03/47/3056147/html/wp-includ‌​es/functions.php:413‌​8) i...
269,109
<p>I'm trying to add a dynamic attribute to an existing (3rd party) shortcode. The shortcode appears several times on the same page. When I do this (in my functions.php), I can get the first shortcode to output correctly but the others don't.</p> <pre class="lang-php prettyprint-override"><code>function testOne(){ ...
[ { "answer_id": 269113, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>I think you're just missing some single quotes to escape out to php:</p>\n\n<pre><code>function testOne(){\n re...
2017/06/04
[ "https://wordpress.stackexchange.com/questions/269109", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121089/" ]
I'm trying to add a dynamic attribute to an existing (3rd party) shortcode. The shortcode appears several times on the same page. When I do this (in my functions.php), I can get the first shortcode to output correctly but the others don't. ```php function testOne(){ return do_shortcode('[abc type="contact" orderby...
I think you are having syntax errors in the shortcode like missing single quotes.Please check the code properly.
269,121
<p>I've been having some issues since Google requires an API code (which I already have) to display the map on the theme page, but the thing is I'm not sure where and how it should be enqueued.</p> <p>This is what it looks like on the code:</p> <pre><code>function sano_footer_scripts() { // wp_enqueue_script( 'jq...
[ { "answer_id": 269122, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 0, "selected": false, "text": "<p>You are using <code>wp_enqueue_scripts()</code> in the proper way, however you are enqueuing everything in ...
2017/06/05
[ "https://wordpress.stackexchange.com/questions/269121", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121097/" ]
I've been having some issues since Google requires an API code (which I already have) to display the map on the theme page, but the thing is I'm not sure where and how it should be enqueued. This is what it looks like on the code: ``` function sano_footer_scripts() { // wp_enqueue_script( 'jquery_1.11.2_min_js', ...
Your API key is URL encoded as a GET variable like so: ``` wp_enqueue_script( 'google_js', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=yourKeyHere', '', '' ); ``` I don't urlencode the handle. The function/class does that. So if you're having problems getting the script to load, don't urlencode...
269,133
<p>I am finding a way to add <em>A</em> before the menu if we are on desktop and to add <em>B</em> if we are on mobile device.</p> <p>As such, this is are my functions for <em>A</em> and <em>B</em>:</p> <pre><code>add_action( 'wp_head', 'A_function' ); function A_function() { //add A } add_filter( 'wp_nav_menu_it...
[ { "answer_id": 269122, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 0, "selected": false, "text": "<p>You are using <code>wp_enqueue_scripts()</code> in the proper way, however you are enqueuing everything in ...
2017/06/05
[ "https://wordpress.stackexchange.com/questions/269133", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102551/" ]
I am finding a way to add *A* before the menu if we are on desktop and to add *B* if we are on mobile device. As such, this is are my functions for *A* and *B*: ``` add_action( 'wp_head', 'A_function' ); function A_function() { //add A } add_filter( 'wp_nav_menu_items', 'B_function', 10, 2 ); function B_function(...
Your API key is URL encoded as a GET variable like so: ``` wp_enqueue_script( 'google_js', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=yourKeyHere', '', '' ); ``` I don't urlencode the handle. The function/class does that. So if you're having problems getting the script to load, don't urlencode...
269,153
<p>I am aware that contributors cannot publish posts, and that by design WP will not show contributors in the author dropdown list (this has been discussed here: <a href="https://wordpress.stackexchange.com/questions/168665/contributors-missing-from-author-dropdown">Contributors missing from author dropdown</a>), howev...
[ { "answer_id": 269209, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 3, "selected": true, "text": "<p>Here's a solution that will remove the original author meta box and replace it with a similar, but customize...
2017/06/05
[ "https://wordpress.stackexchange.com/questions/269153", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1210/" ]
I am aware that contributors cannot publish posts, and that by design WP will not show contributors in the author dropdown list (this has been discussed here: [Contributors missing from author dropdown](https://wordpress.stackexchange.com/questions/168665/contributors-missing-from-author-dropdown)), however I am lookin...
Here's a solution that will remove the original author meta box and replace it with a similar, but customized version which includes users with the `contributor` role. The logic for adding/removing the author meta box is pulled directly from the core. The meta box display callback is also cloned from the core, but we ...
269,160
<p>When using a 3rd party theme, some external dependancies are enqueued using the HTTP protocol, which is fine if you don't use SSL and if the child theme is allowing complete control over all of these elements, which in this case something is either being missed by myself or enqueued through another stylesheet - I've...
[ { "answer_id": 269209, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 3, "selected": true, "text": "<p>Here's a solution that will remove the original author meta box and replace it with a similar, but customize...
2017/06/05
[ "https://wordpress.stackexchange.com/questions/269160", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52020/" ]
When using a 3rd party theme, some external dependancies are enqueued using the HTTP protocol, which is fine if you don't use SSL and if the child theme is allowing complete control over all of these elements, which in this case something is either being missed by myself or enqueued through another stylesheet - I've us...
Here's a solution that will remove the original author meta box and replace it with a similar, but customized version which includes users with the `contributor` role. The logic for adding/removing the author meta box is pulled directly from the core. The meta box display callback is also cloned from the core, but we ...
269,215
<p>I am trying to add this to functions.php. In my test lab on a different site it adds the test info information fine. But on the website I am trying to add it to nothing happens. The website is running a builder thrifty theme with the latest woocommerce. Any ideas? I'm basically just wanting to add a line of text on ...
[ { "answer_id": 269220, "author": "hwl", "author_id": 118366, "author_profile": "https://wordpress.stackexchange.com/users/118366", "pm_score": 1, "selected": false, "text": "<p>It's possible the theme or another plugin are using that hook with a later priority. Your <code>add_action</cod...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269215", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121164/" ]
I am trying to add this to functions.php. In my test lab on a different site it adds the test info information fine. But on the website I am trying to add it to nothing happens. The website is running a builder thrifty theme with the latest woocommerce. Any ideas? I'm basically just wanting to add a line of text on eve...
It's possible the theme or another plugin are using that hook with a later priority. Your `add_action` would have the default of 10; try giving it a 12 or a 20, etc. and see if the text shows up. `add_action('woocommerce_before_add_to_cart_form','print_something_below_short_description', 10);` You can [read about Pri...
269,231
<p><a href="https://i.stack.imgur.com/XQVgH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XQVgH.jpg" alt="enter image description here"></a> I am writing a query for inserting data in to database but when I am printing query at output it turns into "SHOW COLUMNS from tbl_name" query. I am writing b...
[ { "answer_id": 269251, "author": "Roger Bücker", "author_id": 121189, "author_profile": "https://wordpress.stackexchange.com/users/121189", "pm_score": 0, "selected": false, "text": "<p>Just had the same Problem, the fix was i tried to add varchar longer than the database field can hold....
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269231", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121179/" ]
[![enter image description here](https://i.stack.imgur.com/XQVgH.jpg)](https://i.stack.imgur.com/XQVgH.jpg) I am writing a query for inserting data in to database but when I am printing query at output it turns into "SHOW COLUMNS from tbl\_name" query. I am writing below query . But it executes like shown in image ```...
For anyone else finding this question. Wordpress seems to do a `SHOW FULL COLUMNS` query before executing the `INSERT` query. If it determines that the `INSERT` query would fail/store bad data, for example because the given data types would not fit in the column, it does not execute the insert query at all and return f...
269,254
<p>I have used bootstrap nav walker but it works good with just 1 and 2 level , 3 level is not supported correctly.</p> <p>I found one here <a href="http://www.dangtrinh.com/2015/05/multilevel-drop-down-menu-in-wordpress.html" rel="nofollow noreferrer">http://www.dangtrinh.com/2015/05/multilevel-drop-down-menu-in-wor...
[ { "answer_id": 269302, "author": "Porosh Ahammed", "author_id": 68186, "author_profile": "https://wordpress.stackexchange.com/users/68186", "pm_score": 2, "selected": true, "text": "<p>Download <a href=\"https://drive.google.com/open?id=0B1mlr5jLh4p8TEFya1JsQmQzWW8\" rel=\"nofollow nore...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269254", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78103/" ]
I have used bootstrap nav walker but it works good with just 1 and 2 level , 3 level is not supported correctly. I found one here <http://www.dangtrinh.com/2015/05/multilevel-drop-down-menu-in-wordpress.html> but it is not that good . How can I make navigation like one in blazok theme on themeforest.
Download [Bootstrap nav walker file](https://drive.google.com/open?id=0B1mlr5jLh4p8TEFya1JsQmQzWW8).Call this file to your functions.php. Then Put this code to dynamic your nav menu: ``` <?php $args = array( 'theme_location' => 'primary', ...
269,267
<p>I am using a plugin called AddThis on a website at: <a href="http://minionsphotography.com/" rel="nofollow noreferrer">http://minionsphotography.com/</a>. With AddThis enabled I am getting some extra P tags in-between the header and the text on the page: <code>&lt;p&gt;&lt;!-- AddThis Sharing Buttons above --&gt;&lt...
[ { "answer_id": 269302, "author": "Porosh Ahammed", "author_id": 68186, "author_profile": "https://wordpress.stackexchange.com/users/68186", "pm_score": 2, "selected": true, "text": "<p>Download <a href=\"https://drive.google.com/open?id=0B1mlr5jLh4p8TEFya1JsQmQzWW8\" rel=\"nofollow nore...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269267", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9820/" ]
I am using a plugin called AddThis on a website at: <http://minionsphotography.com/>. With AddThis enabled I am getting some extra P tags in-between the header and the text on the page: `<p><!-- AddThis Sharing Buttons above --></p>`, this adds a lot of extra space and shouldn't be there. \*On the homepage it's the spa...
Download [Bootstrap nav walker file](https://drive.google.com/open?id=0B1mlr5jLh4p8TEFya1JsQmQzWW8).Call this file to your functions.php. Then Put this code to dynamic your nav menu: ``` <?php $args = array( 'theme_location' => 'primary', ...
269,277
<p>I can't figure how to get the ID of the custom taxonomy I'm using to loop through the custom post type called "test_values". </p> <pre><code>function prefix_load_term_posts () { $term_slug = $_POST[ 'term' ]; $args = array ( 'post_type' =&gt; 'test_values', 'posts_per_page' =&gt; 1...
[ { "answer_id": 269380, "author": "Shefali", "author_id": 117047, "author_profile": "https://wordpress.stackexchange.com/users/117047", "pm_score": 4, "selected": true, "text": "<p>You can try this function <code>get_term_by($field, $value, $taxonomy, $output, $filter )</code> or </p>\n...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109345/" ]
I can't figure how to get the ID of the custom taxonomy I'm using to loop through the custom post type called "test\_values". ``` function prefix_load_term_posts () { $term_slug = $_POST[ 'term' ]; $args = array ( 'post_type' => 'test_values', 'posts_per_page' => 1, 'tax...
You can try this function `get_term_by($field, $value, $taxonomy, $output, $filter )` or ``` $termID = []; $terms = get_the_terms($post->ID, 'taxonomy'); foreach ($terms as $term) { $termID[] = $term->term_id; } ``` or `get_queried_object_id()`
269,291
<p>i'm using (<a href="https://codex.wordpress.org/Javascript_Reference/wp.media" rel="nofollow noreferrer">media library</a>) in my theme on Frontend.</p> <p>It's possible load only attachment of current user logged? For example, my wp user id is 55 and load only my attachment and not others by different users?</p> ...
[ { "answer_id": 269380, "author": "Shefali", "author_id": 117047, "author_profile": "https://wordpress.stackexchange.com/users/117047", "pm_score": 4, "selected": true, "text": "<p>You can try this function <code>get_term_by($field, $value, $taxonomy, $output, $filter )</code> or </p>\n...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269291", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110442/" ]
i'm using ([media library](https://codex.wordpress.org/Javascript_Reference/wp.media)) in my theme on Frontend. It's possible load only attachment of current user logged? For example, my wp user id is 55 and load only my attachment and not others by different users? There isn't a documentation about how work js in WP...
You can try this function `get_term_by($field, $value, $taxonomy, $output, $filter )` or ``` $termID = []; $terms = get_the_terms($post->ID, 'taxonomy'); foreach ($terms as $term) { $termID[] = $term->term_id; } ``` or `get_queried_object_id()`
269,308
<p>I want to add class to caption shortcode, pulled from custom attachment field. I add the field via:</p> <pre><code>function add_img_class( $form_fields, $post ) { $form_fields['img_class_field'] = array( 'label' =&gt; __( 'Image class', 'text-domain' ), 'input' =&gt; 'text', 'value' =&gt...
[ { "answer_id": 269380, "author": "Shefali", "author_id": 117047, "author_profile": "https://wordpress.stackexchange.com/users/117047", "pm_score": 4, "selected": true, "text": "<p>You can try this function <code>get_term_by($field, $value, $taxonomy, $output, $filter )</code> or </p>\n...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269308", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121208/" ]
I want to add class to caption shortcode, pulled from custom attachment field. I add the field via: ``` function add_img_class( $form_fields, $post ) { $form_fields['img_class_field'] = array( 'label' => __( 'Image class', 'text-domain' ), 'input' => 'text', 'value' => get_post_meta( $post-...
You can try this function `get_term_by($field, $value, $taxonomy, $output, $filter )` or ``` $termID = []; $terms = get_the_terms($post->ID, 'taxonomy'); foreach ($terms as $term) { $termID[] = $term->term_id; } ``` or `get_queried_object_id()`
269,316
<pre><code>&lt;p&gt; &lt;?php the_author_meta('description'); ?&gt; &lt;a href="#"&gt; Read More &lt;/a&gt; &lt;/p&gt; </code></pre> <p>I just wanted to pull authors link here "#", but I tried many options such as →</p> <pre><code>get_the_author() the_author_link() the_author_posts_link() </code></pre> <p>All of t...
[ { "answer_id": 269380, "author": "Shefali", "author_id": 117047, "author_profile": "https://wordpress.stackexchange.com/users/117047", "pm_score": 4, "selected": true, "text": "<p>You can try this function <code>get_term_by($field, $value, $taxonomy, $output, $filter )</code> or </p>\n...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269316", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
``` <p> <?php the_author_meta('description'); ?> <a href="#"> Read More </a> </p> ``` I just wanted to pull authors link here "#", but I tried many options such as → ``` get_the_author() the_author_link() the_author_posts_link() ``` All of them are pulling authors name also. Any solution that will help me pull J...
You can try this function `get_term_by($field, $value, $taxonomy, $output, $filter )` or ``` $termID = []; $terms = get_the_terms($post->ID, 'taxonomy'); foreach ($terms as $term) { $termID[] = $term->term_id; } ``` or `get_queried_object_id()`
269,323
<p>Hoping someone can help.</p> <p>I am trying to change the "Notice of Email Change" text within the email you receive when updating an email address.</p> <p>Here is what I have so far</p> <pre><code>add_filter( 'password_change_email', 'red_change_password_mail_message', 10, 3 ); function red_change_password_mail...
[ { "answer_id": 269326, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>You're already passing a <code>$user</code> object into your function, so you should be able to substitut...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269323", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111895/" ]
Hoping someone can help. I am trying to change the "Notice of Email Change" text within the email you receive when updating an email address. Here is what I have so far ``` add_filter( 'password_change_email', 'red_change_password_mail_message', 10, 3 ); function red_change_password_mail_message( $pass_change_mail,...
The filter to use to modify the e-mail sent to a user when they change their *e-mail* address is `email_change_email`. Note that this is different from `password_change_email` which you've used in your original code. That filter allows you to modify the e-mail sent to the user when their *password* is changed. These t...
269,336
<p>I am trying to locate the correct file to edit my internal linking anchor tags i.e.<code>&lt;a href=</code></p> <p>Can anyone point me to to the correct file? When I view the source code I see about 50 of them but I am not able to locate them in any files for editing????</p> <p>I have looked in Header, Footer, Fun...
[ { "answer_id": 269326, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>You're already passing a <code>$user</code> object into your function, so you should be able to substitut...
2017/06/06
[ "https://wordpress.stackexchange.com/questions/269336", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117358/" ]
I am trying to locate the correct file to edit my internal linking anchor tags i.e.`<a href=` Can anyone point me to to the correct file? When I view the source code I see about 50 of them but I am not able to locate them in any files for editing???? I have looked in Header, Footer, Functions and many other hooks but...
The filter to use to modify the e-mail sent to a user when they change their *e-mail* address is `email_change_email`. Note that this is different from `password_change_email` which you've used in your original code. That filter allows you to modify the e-mail sent to the user when their *password* is changed. These t...
269,358
<p>This is my careers first WordPress theme: <a href="http://codepen.trafficopedia.com/site01/" rel="nofollow noreferrer">Click Here</a>.</p> <p>If you search anything than the design breaks. Search for example this string → The Authors Name </p> <p>I could not understand why only search results breaks the design, an...
[ { "answer_id": 269361, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 3, "selected": true, "text": "<p>Check out the markup. On the search results page, the <code>&lt;body&gt;</code> element is assigned the clas...
2017/06/07
[ "https://wordpress.stackexchange.com/questions/269358", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
This is my careers first WordPress theme: [Click Here](http://codepen.trafficopedia.com/site01/). If you search anything than the design breaks. Search for example this string → The Authors Name I could not understand why only search results breaks the design, and I remember 2 weeks back I think all this was working...
Check out the markup. On the search results page, the `<body>` element is assigned the classes `search` and `search-no-results`. ``` <body class="search search-no-results"> ``` Looking at the CSS, the styles for `.search` are intended to be used for the search input. They are working for that, but they are also bein...
269,416
<p>I need to get only the custom posts which have <code>meta_key</code> <code>landing_exported</code> as <code>meta_value</code> <code>NULL</code>.</p> <p>I know that exists at least 2 custom posts in my database, but my code print "nothing found".</p> <pre><code>$args = array( 'post_type' =&gt; LANDI...
[ { "answer_id": 269422, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>I am not sure where are you getting that <code>BOOLEAN</code> type from. I don’t think it is a type supported by <c...
2017/06/07
[ "https://wordpress.stackexchange.com/questions/269416", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115372/" ]
I need to get only the custom posts which have `meta_key` `landing_exported` as `meta_value` `NULL`. I know that exists at least 2 custom posts in my database, but my code print "nothing found". ``` $args = array( 'post_type' => LANDING__CUSTOM_POST, 'meta_query' => array( ...
I depends if you're looking for an empty value: ``` $args = array( 'post_type' => LANDING__CUSTOM_POST, 'meta_query' => array( array( 'key' => 'landing_exported', 'value' => '', 'compare' => '=' ) ) ); // query $the_query = new WP_Query( $args ); ...
269,439
<p>I've been using the <code>document_title_parts</code> hook to change the page title for some front end pages. However, this doesn't seem to work for the login, register and password management pages.</p> <p>How can I change the wp-login.php page <code>&lt;title&gt;</code>?</p>
[ { "answer_id": 269446, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 3, "selected": true, "text": "<p>It looks like it's not easily accessible as it's displayed as <sup><a href=\"https://github.com/WordPress/Word...
2017/06/07
[ "https://wordpress.stackexchange.com/questions/269439", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22599/" ]
I've been using the `document_title_parts` hook to change the page title for some front end pages. However, this doesn't seem to work for the login, register and password management pages. How can I change the wp-login.php page `<title>`?
It looks like it's not easily accessible as it's displayed as [src](https://github.com/WordPress/WordPress/blob/1d34043e8cd2eead37048bc8aed379d57ff32408/wp-login.php#L69): ``` <title><?php echo get_bloginfo( 'name', 'display' ) . $separator . $title; ?></title> ``` where the separator is: ``` $separator = is_rt...
269,468
<p>I am creating a child theme. I noticed my parent theme is adding some inline CSS in its functions.php:</p> <pre><code>wp_add_inline_style( 'persona-style-css', $custom_css ); </code></pre> <p>Since I cannot change some values there, is it possible to dequeue it? I have tried to dequeue it using <code>wp_dequeue_st...
[ { "answer_id": 269471, "author": "Benoti", "author_id": 58141, "author_profile": "https://wordpress.stackexchange.com/users/58141", "pm_score": 3, "selected": true, "text": "<p>If <code>wp_add_inline_css</code> is fired within an action you can use <code>remove_action</code> with the sam...
2017/06/08
[ "https://wordpress.stackexchange.com/questions/269468", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90981/" ]
I am creating a child theme. I noticed my parent theme is adding some inline CSS in its functions.php: ``` wp_add_inline_style( 'persona-style-css', $custom_css ); ``` Since I cannot change some values there, is it possible to dequeue it? I have tried to dequeue it using `wp_dequeue_style ('persona-style-css')` but ...
If `wp_add_inline_css` is fired within an action you can use `remove_action` with the same parameters. You also might use `wp_enqueue_scripts` action to dequeue any scripts or styles in a proper way. But, inline style are not included in the `$wp_styles` global, you can unset them with the action `print_styles_array`,...
269,486
<p>I have added following code in my theme functions.php </p> <pre><code>function my_loginlcustomization() { wp_register_style('custom_loginstyle', get_template_directory_uri() . '/login/login-styles.css', __FILE__); wp_enqueue_style('custom_loginstyle'); } add_action('login_head', 'my_loginlcustomization'); </code>...
[ { "answer_id": 269471, "author": "Benoti", "author_id": 58141, "author_profile": "https://wordpress.stackexchange.com/users/58141", "pm_score": 3, "selected": true, "text": "<p>If <code>wp_add_inline_css</code> is fired within an action you can use <code>remove_action</code> with the sam...
2017/06/08
[ "https://wordpress.stackexchange.com/questions/269486", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/95126/" ]
I have added following code in my theme functions.php ``` function my_loginlcustomization() { wp_register_style('custom_loginstyle', get_template_directory_uri() . '/login/login-styles.css', __FILE__); wp_enqueue_style('custom_loginstyle'); } add_action('login_head', 'my_loginlcustomization'); ``` Custom login pa...
If `wp_add_inline_css` is fired within an action you can use `remove_action` with the same parameters. You also might use `wp_enqueue_scripts` action to dequeue any scripts or styles in a proper way. But, inline style are not included in the `$wp_styles` global, you can unset them with the action `print_styles_array`,...
269,529
<p>After reading several posts regarding post category manipulation with a given time I wanted to create a plugin that would manipulate posts after a date. My original post reference is from six years ago: "<a href="https://wordpress.stackexchange.com/questions/7571/plugin-for-changing-a-posts-category-based-on-its-po...
[ { "answer_id": 269471, "author": "Benoti", "author_id": 58141, "author_profile": "https://wordpress.stackexchange.com/users/58141", "pm_score": 3, "selected": true, "text": "<p>If <code>wp_add_inline_css</code> is fired within an action you can use <code>remove_action</code> with the sam...
2017/06/08
[ "https://wordpress.stackexchange.com/questions/269529", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25271/" ]
After reading several posts regarding post category manipulation with a given time I wanted to create a plugin that would manipulate posts after a date. My original post reference is from six years ago: "[Plugin for changing a post's category based on it's post date?](https://wordpress.stackexchange.com/questions/7571/...
If `wp_add_inline_css` is fired within an action you can use `remove_action` with the same parameters. You also might use `wp_enqueue_scripts` action to dequeue any scripts or styles in a proper way. But, inline style are not included in the `$wp_styles` global, you can unset them with the action `print_styles_array`,...
269,570
<p>If you have like 20 text box widgets and you are using widget logic or something to selectively display them on various pages, it gets confusing what content is in each box IF you are not using the title box. they will all then just say "text."</p> <p>Would be nice if the text widgets had a descriptive field where ...
[ { "answer_id": 269577, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p>It looks like the suggestion by @DaveRomsey will solve the problem. </p>\n\n<p>Another simple idea is from a ...
2017/06/08
[ "https://wordpress.stackexchange.com/questions/269570", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121412/" ]
If you have like 20 text box widgets and you are using widget logic or something to selectively display them on various pages, it gets confusing what content is in each box IF you are not using the title box. they will all then just say "text." Would be nice if the text widgets had a descriptive field where you can en...
It looks like the suggestion by @DaveRomsey will solve the problem. Another simple idea is from a [plugin](https://wordpress.org/plugins/remove-widget-titles/) by [Stephen Cronin](https://profiles.wordpress.org/stephencronin), (*I'm not related to that plugin in any way.*) that uses the `widget_title` filter: ``` ad...
269,579
<p>I have a post that contain images, let's say image with id 19, 12, 10. I attach image 19 first, 12 below the first and 10 as the last, and I need to retrieve them. I </p> <pre><code>$post_images = get_children( array( 'post_parent' =&gt; $id, 'post_status' =&gt; 'inherit', 'post_type' =&gt; 'attachment'...
[ { "answer_id": 269580, "author": "Jared Cobb", "author_id": 6737, "author_profile": "https://wordpress.stackexchange.com/users/6737", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/Function_Reference/get_children\" rel=\"nofollow noreferrer\">The docu...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269579", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121420/" ]
I have a post that contain images, let's say image with id 19, 12, 10. I attach image 19 first, 12 below the first and 10 as the last, and I need to retrieve them. I ``` $post_images = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' ...
[The documentation for `get_children`](https://codex.wordpress.org/Function_Reference/get_children) isn't great (at the time of this answer), however `get_children` is simply a wrapper for [`get_posts()`](https://codex.wordpress.org/Template_Tags/get_posts). This means that `orderby` and `order` are valid arguments for...
269,606
<p>I have a custom div (holder for extra settings) which I need to load some specific controls from a specific section in there. I can get the controls in JavaScript but I can't generate the necessary HTML as WordPress do in sections.</p> <pre><code>wp.customize.section( 'custom_div_1' ).controls(); </code></pre> <p>...
[ { "answer_id": 269601, "author": "hilaryk", "author_id": 121431, "author_profile": "https://wordpress.stackexchange.com/users/121431", "pm_score": 0, "selected": false, "text": "<p><a href=\"https://i.stack.imgur.com/qt38l.jpg\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgu...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269606", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24688/" ]
I have a custom div (holder for extra settings) which I need to load some specific controls from a specific section in there. I can get the controls in JavaScript but I can't generate the necessary HTML as WordPress do in sections. ``` wp.customize.section( 'custom_div_1' ).controls(); ``` It gives an array of contr...
[![enter image description here](https://i.stack.imgur.com/Tp9QG.jpg)](https://i.stack.imgur.com/Tp9QG.jpg) Here is how it looks like at my end. I have checked it in chrome, mozilla and IE as well. It look fine in all browsers.
269,612
<p>I need to show the various content of a post in a modal overlay.</p> <p>How do I call Wordpress through AJAX from the front end (directly from a .js file), using the classic jQuery method?</p> <pre><code>$.ajax({ 'url' : ? data : { 'id' : 247 &lt;-- post ID } ... }); </code></pre> <p>This ...
[ { "answer_id": 269623, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 1, "selected": true, "text": "<p>You can output your javascript via <code>wp_add_inline_script()</code>. This way you can set the post's id a...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269612", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120374/" ]
I need to show the various content of a post in a modal overlay. How do I call Wordpress through AJAX from the front end (directly from a .js file), using the classic jQuery method? ``` $.ajax({ 'url' : ? data : { 'id' : 247 <-- post ID } ... }); ``` This is NOT a PHP file, so no: `admin_ur...
You can output your javascript via `wp_add_inline_script()`. This way you can set the post's id and AJAX URL before outputting the code: ``` wp_add_inline_script('my-js', ' jQuery.ajax({ \'url\' : '.admin_url('admin-ajax.php?action=my_action').' data : { \'id\' : '.get_the_ID().' ...
269,625
<p>How can i put a youtube video on my post without show the default title from youtube?</p> <p>I tried to put this code in the theme´s functions, but not worked.</p> <pre><code>function remove_youtube_controls($code){ if(strpos($code, 'youtu.be') !== false || strpos($code, 'youtube.com') !== false){ $re...
[ { "answer_id": 269732, "author": "Bikash Waiba", "author_id": 121069, "author_profile": "https://wordpress.stackexchange.com/users/121069", "pm_score": -1, "selected": true, "text": "<p>Update: Try this one.. it works for youtube url in your post which is converted to iframe by wordpress...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269625", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116787/" ]
How can i put a youtube video on my post without show the default title from youtube? I tried to put this code in the theme´s functions, but not worked. ``` function remove_youtube_controls($code){ if(strpos($code, 'youtu.be') !== false || strpos($code, 'youtube.com') !== false){ $return = preg_replace("@...
Update: Try this one.. it works for youtube url in your post which is converted to iframe by wordpress. ``` function remove_youtube_controls($code){ if(strpos($code, 'youtu.be') !== false || strpos($code, 'youtube.com') !== false){ $return = preg_replace("@src=(['\"])?([^'\">]*)@", "src=$1$2&showinfo=0...
269,627
<p>I need to make WordPress call a specific REST endpoint when a new post is published, passing the most important post data via JSON.</p> <p>I found a plugin, HookPress, that apparently did just that by letting you configure webhooks for various events. Unfortunately it has not been updated in over 2 years and does n...
[ { "answer_id": 269633, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>You can use a post status transition hook. In this case, it sounds like {status}_{post_type} may be the m...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269627", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121459/" ]
I need to make WordPress call a specific REST endpoint when a new post is published, passing the most important post data via JSON. I found a plugin, HookPress, that apparently did just that by letting you configure webhooks for various events. Unfortunately it has not been updated in over 2 years and does not work wi...
You don't have to write a new plugin. You can either add the code to your theme's `functions.php` file, or create a [child theme](https://codex.wordpress.org/Child_Themes). To wrap your data in a JSON format, you can use the `json_encode` function. Hook into the post when it's published, and send the data. In the fol...
269,629
<p>I'm stuck right now. For my project, I have to create login not using WP user system but another system. </p> <p>Now, when with my system API login, I created some cookie but, obviously I didn't also create wp cookie for user logged in. So, I want to allow a user upload with media library of WP (<a href="https://wo...
[ { "answer_id": 269640, "author": "scott", "author_id": 93587, "author_profile": "https://wordpress.stackexchange.com/users/93587", "pm_score": 1, "selected": false, "text": "<p>First, you do not want to edit core WP files, because your changes will disappear when there's an update. That'...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269629", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110442/" ]
I'm stuck right now. For my project, I have to create login not using WP user system but another system. Now, when with my system API login, I created some cookie but, obviously I didn't also create wp cookie for user logged in. So, I want to allow a user upload with media library of WP ([link of WP codex](https://wo...
First, you do not want to edit core WP files, because your changes will disappear when there's an update. That's why you are encouraged to create child themes. Second, you may want to peruse this [Codex page](https://codex.wordpress.org/AJAX_in_Plugins) on AJAX. Note that it shows how to handle both kinds of users (lo...
269,639
<p>I want to have one header page for the front page of the site and all other pages that follow by clicking "next" and a different header for all other pages, categories, articles, etc. on the site. Is there a way to do this within the header.php file or do I have to do something differently?</p> <p>I'm using a free...
[ { "answer_id": 269640, "author": "scott", "author_id": 93587, "author_profile": "https://wordpress.stackexchange.com/users/93587", "pm_score": 1, "selected": false, "text": "<p>First, you do not want to edit core WP files, because your changes will disappear when there's an update. That'...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269639", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/100669/" ]
I want to have one header page for the front page of the site and all other pages that follow by clicking "next" and a different header for all other pages, categories, articles, etc. on the site. Is there a way to do this within the header.php file or do I have to do something differently? I'm using a free theme for ...
First, you do not want to edit core WP files, because your changes will disappear when there's an update. That's why you are encouraged to create child themes. Second, you may want to peruse this [Codex page](https://codex.wordpress.org/AJAX_in_Plugins) on AJAX. Note that it shows how to handle both kinds of users (lo...
269,644
<p>I'm having a hard time figuring out why my repeatable fields javascript doesn't work. I'm using the following plugin: Rhyzz (repeatable-fields): <a href="http://www.rhyzz.com/repeatable-fields.html" rel="nofollow noreferrer">http://www.rhyzz.com/repeatable-fields.html</a>. I scraped the website and I see he ran the ...
[ { "answer_id": 269640, "author": "scott", "author_id": 93587, "author_profile": "https://wordpress.stackexchange.com/users/93587", "pm_score": 1, "selected": false, "text": "<p>First, you do not want to edit core WP files, because your changes will disappear when there's an update. That'...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269644", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121469/" ]
I'm having a hard time figuring out why my repeatable fields javascript doesn't work. I'm using the following plugin: Rhyzz (repeatable-fields): <http://www.rhyzz.com/repeatable-fields.html>. I scraped the website and I see he ran the script inside html and also ran his javascript all on the same page. My website is a ...
First, you do not want to edit core WP files, because your changes will disappear when there's an update. That's why you are encouraged to create child themes. Second, you may want to peruse this [Codex page](https://codex.wordpress.org/AJAX_in_Plugins) on AJAX. Note that it shows how to handle both kinds of users (lo...
269,645
<p>I am using this code below to specify a post template for a specific category in my functions.php file.</p> <pre><code>function get_custom_cat_template($single_template) { global $post; if ( in_category( 'ms-conversations' )) { $single_template = dirname( __FILE__ ) . '/CUSTOM-POST-BLOG-POST.php'; } r...
[ { "answer_id": 269647, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>You don't need multiple functions. Use an <code>array</code> with <code>in_category</code> to pass multiple slugs:...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269645", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78325/" ]
I am using this code below to specify a post template for a specific category in my functions.php file. ``` function get_custom_cat_template($single_template) { global $post; if ( in_category( 'ms-conversations' )) { $single_template = dirname( __FILE__ ) . '/CUSTOM-POST-BLOG-POST.php'; } return $single_...
This is my final code. ``` function get_custom_cat_template($single_template) { global $post; if( in_category( array( 'ms-conversations', 'artist-of-the-month', 'exercise', 'hiking-for-multiple-sclerosis', 'msaa', 'caregiving-msaa', 'updates', 'ms-resources', 'ms-tips-msaa', 'recipe-of-the-month', 'stories-to-ins...
269,656
<p>How can I retrieve the values ​​passed to the shortcode using only one parameter?</p> <p>Example:</p> <pre><code>[related type="2,3,4,5,6"] </code></pre> <p>Is it possible to do that?</p>
[ { "answer_id": 269657, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 1, "selected": false, "text": "<p>You can pass a JSON object in a short code:</p>\n\n<pre><code>[related values='{\"a\":\"foo\",\"b\":\"b...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269656", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121477/" ]
How can I retrieve the values ​​passed to the shortcode using only one parameter? Example: ``` [related type="2,3,4,5,6"] ``` Is it possible to do that?
The solution below will parse the comma separated values passed to the shortcode's `type` parameter. We'll also strip out any whitespace surrounding the values which is a usability improvement (see example 2 after the code below). ``` add_shortcode( 'related', 'wpse_related' ); function wpse_related( $atts, $content =...
269,676
<p>I would like to update a post on every new comment, so that the <code>Last Modified Date</code> is always up to date on the sitemap.</p> <p>How can i do this?</p> <p>Thanks.</p>
[ { "answer_id": 269686, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>That may change the order of posts on your main page, depending on your theme. </p>\n\n<p>There are wa...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269676", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117210/" ]
I would like to update a post on every new comment, so that the `Last Modified Date` is always up to date on the sitemap. How can i do this? Thanks.
From what i understand, you want to change the post's modification time whenever a comment is left on your post. For this, you need to hook into the `wp_insert_comment` hook and update the post's date manually: ``` add_action('wp_insert_comment','update_post_time',99,2); function update_post_time($comment_id, $comment...
269,679
<p>I'm in trouble with Bootstrap and Wordpress.</p> <p>I want to get Taxonomy list to expand (show custom posts from Taxonomy). But it is hard!!!!</p> <p>Its basically a custom sidebar</p> <p>My code:</p> <pre><code>&lt;h3&gt; Portfólio &lt;/h3&gt; &lt;?php $catprod = get_terms( array( 'taxono...
[ { "answer_id": 269686, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>That may change the order of posts on your main page, depending on your theme. </p>\n\n<p>There are wa...
2017/06/09
[ "https://wordpress.stackexchange.com/questions/269679", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121494/" ]
I'm in trouble with Bootstrap and Wordpress. I want to get Taxonomy list to expand (show custom posts from Taxonomy). But it is hard!!!! Its basically a custom sidebar My code: ``` <h3> Portfólio </h3> <?php $catprod = get_terms( array( 'taxonomy' => 'categoria-produto', 'order' ...
From what i understand, you want to change the post's modification time whenever a comment is left on your post. For this, you need to hook into the `wp_insert_comment` hook and update the post's date manually: ``` add_action('wp_insert_comment','update_post_time',99,2); function update_post_time($comment_id, $comment...
269,699
<p>I wanted to know if i can change the way i display views count in WordPress.</p> <p>Example: 1000 views = 1k - 10000 views = 10k</p> <p>I'm counting and viewing post views by using this code:</p> <pre><code>// Count views function setPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta...
[ { "answer_id": 269700, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>Yes you can. You have to check if the post view count is higher than 1000, is so, then round it and return i...
2017/06/10
[ "https://wordpress.stackexchange.com/questions/269699", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117100/" ]
I wanted to know if i can change the way i display views count in WordPress. Example: 1000 views = 1k - 10000 views = 10k I'm counting and viewing post views by using this code: ``` // Count views function setPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true);...
Yes you can. You have to check if the post view count is higher than 1000, is so, then round it and return it: ``` function getPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count=='') { delete_post_meta($postID, $count_key); add...
269,708
<p>I have used thumbnail like this in my wordpress theme's one template →</p> <pre><code>&lt;?php the_post_thumbnail( 'medium' ); ?&gt; </code></pre> <p>In the browser it is rendering like this →</p> <pre><code>&lt;img width="300" height="220" src="http://example.com/image-300x220.jpg" class="att...
[ { "answer_id": 269700, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>Yes you can. You have to check if the post view count is higher than 1000, is so, then round it and return i...
2017/06/10
[ "https://wordpress.stackexchange.com/questions/269708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
I have used thumbnail like this in my wordpress theme's one template → ``` <?php the_post_thumbnail( 'medium' ); ?> ``` In the browser it is rendering like this → ``` <img width="300" height="220" src="http://example.com/image-300x220.jpg" class="attachment-medium size-medium wp-post-image" ...
Yes you can. You have to check if the post view count is higher than 1000, is so, then round it and return it: ``` function getPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count=='') { delete_post_meta($postID, $count_key); add...
269,719
<p>Can the new 4.8 widget visual editor in the default text widget be unhooked or removed and the widget restored to the pre-4.8 editor style?</p> <p>I don't need or want the visual editor in widgets; I use them for plain text and html and don't need other users adding anything other than plain text.</p> <p>I did lea...
[ { "answer_id": 269724, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 3, "selected": true, "text": "<p>The answer is mostly no. The \"enhanced\" text widget was designed to work like the post editor as much as...
2017/06/10
[ "https://wordpress.stackexchange.com/questions/269719", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101490/" ]
Can the new 4.8 widget visual editor in the default text widget be unhooked or removed and the widget restored to the pre-4.8 editor style? I don't need or want the visual editor in widgets; I use them for plain text and html and don't need other users adding anything other than plain text. I did learn how to *remove...
The answer is mostly no. The "enhanced" text widget was designed to work like the post editor as much as possible, including autop which might break whatever HTML that can not stand the conversion of lines into paragraphs. Several people have released plugins to restore the former functionality, but 4.8.1 will also in...
269,736
<p>I was able to add the file last modified time as version to css and js files. As you can see I have to repeatly adding <code>filemtime(get_theme_file_path('...'))</code> every time when a new link is added.</p> <pre><code>function _enqueue_scripts() { wp_enqueue_style('_base', get_theme_file_uri('/assets/css/ba...
[ { "answer_id": 269740, "author": "inarilo", "author_id": 17923, "author_profile": "https://wordpress.stackexchange.com/users/17923", "pm_score": 4, "selected": true, "text": "<p>You could use <a href=\"http://developer.wordpress.org/reference/functions/add_query_arg\" rel=\"noreferrer\">...
2017/06/10
[ "https://wordpress.stackexchange.com/questions/269736", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9508/" ]
I was able to add the file last modified time as version to css and js files. As you can see I have to repeatly adding `filemtime(get_theme_file_path('...'))` every time when a new link is added. ``` function _enqueue_scripts() { wp_enqueue_style('_base', get_theme_file_uri('/assets/css/base.css'), array(), filemt...
You could use [add\_query\_arg()](http://developer.wordpress.org/reference/functions/add_query_arg) but then you'd have to parse the uri everytime, I'd rather create a wrapper function for wp\_enqueue\_script/style: ``` function my_enqueuer($my_handle, $relpath, $type='script', $my_deps=array()) { $uri = get_theme...
269,794
<p><a href="https://i.stack.imgur.com/RIKPa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RIKPa.jpg" alt="Can You plz guide me"></a> how to create the logic that makes those posts sortable either by the first letter of title or numbers?</p> <p>I want when I click on a "letter" the posts must get u...
[ { "answer_id": 296408, "author": "Alex Sancho", "author_id": 2536, "author_profile": "https://wordpress.stackexchange.com/users/2536", "pm_score": 4, "selected": true, "text": "<p>I think there's a better approach, just create a custom taxonomy that holds the alphanumeric terms, then ass...
2017/06/11
[ "https://wordpress.stackexchange.com/questions/269794", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116722/" ]
[![Can You plz guide me](https://i.stack.imgur.com/RIKPa.jpg)](https://i.stack.imgur.com/RIKPa.jpg) how to create the logic that makes those posts sortable either by the first letter of title or numbers? I want when I click on a "letter" the posts must get updated with the given first letter I want when I click on a "...
I think there's a better approach, just create a custom taxonomy that holds the alphanumeric terms, then assign each post to the correct term. You can use the save post action to auto assign posts to correct term on post save: ``` function save_index( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAV...
269,798
<p>I freshly installed a WordPress site and I configured it behind a reverse proxy with site URL - <code>http://example.com/hello</code></p> <h2>Problem</h2> <p>I can reach the admin dashboard page, however I cannot go further as the link becomes <code>http://example.com/wp-admin</code> instead of <code>http://exampl...
[ { "answer_id": 269801, "author": "Victor Wong", "author_id": 121572, "author_profile": "https://wordpress.stackexchange.com/users/121572", "pm_score": 2, "selected": false, "text": "<p>Eventually, I found the reason of this weird behaviour.</p>\n\n<p>It is caused by the JavaScript embedd...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269798", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121572/" ]
I freshly installed a WordPress site and I configured it behind a reverse proxy with site URL - `http://example.com/hello` Problem ------- I can reach the admin dashboard page, however I cannot go further as the link becomes `http://example.com/wp-admin` instead of `http://example.com/hello/wp-admin`. How could I get...
Eventually, I found the reason of this weird behaviour. It is caused by the JavaScript embedded in `wp_admin_canonical_url()` (<https://developer.wordpress.org/reference/functions/wp_admin_canonical_url/>) The URL is determined by this piece of code ``` $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ``` where the...
269,836
<p>I have a WordPress site, which has a list of playlists, which are essentially custom post types.</p> <p>There is a screenshot below. I want to extend this so it also includes <code>playlist_id</code> as an option of input. </p> <p>Currently you see it just has Image, Portfolio Title, Categories and Date.</p> <p>C...
[ { "answer_id": 269801, "author": "Victor Wong", "author_id": 121572, "author_profile": "https://wordpress.stackexchange.com/users/121572", "pm_score": 2, "selected": false, "text": "<p>Eventually, I found the reason of this weird behaviour.</p>\n\n<p>It is caused by the JavaScript embedd...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269836", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121592/" ]
I have a WordPress site, which has a list of playlists, which are essentially custom post types. There is a screenshot below. I want to extend this so it also includes `playlist_id` as an option of input. Currently you see it just has Image, Portfolio Title, Categories and Date. Can anyone advise which file/files I...
Eventually, I found the reason of this weird behaviour. It is caused by the JavaScript embedded in `wp_admin_canonical_url()` (<https://developer.wordpress.org/reference/functions/wp_admin_canonical_url/>) The URL is determined by this piece of code ``` $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ``` where the...
269,853
<p>With WP 4.8 extending the widgets API, the simple text widget is using TinyMCE. The advantage is that TinyMCE scripts are already enqueued in Ajax requests.</p> <p>However, for a client, I need a widget which has <strong>multiple editors</strong> inside it. This widget is not only used on the Widgets' Page but also...
[ { "answer_id": 270853, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 0, "selected": false, "text": "<p>If I recall correctly the ID supplied to <code>wp_editor</code> needs to already exist. </p>\n\n<p>Perhaps it ...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269853", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12035/" ]
With WP 4.8 extending the widgets API, the simple text widget is using TinyMCE. The advantage is that TinyMCE scripts are already enqueued in Ajax requests. However, for a client, I need a widget which has **multiple editors** inside it. This widget is not only used on the Widgets' Page but also within the Plugin ***P...
It's hard to say without seeing *all* the code. Yes if you don't refer to the instance - then it won't really be a unique ID. Something like this would work - you would just reference the class property $id: ``` for ( $i = 0; $i <= count( $suffixes ); $i++) { wp_editor( 'your content', "{$this->id}_$i" );...
269,856
<p>I need to add custom item to WooCommerce My Account navigation. I can add the item with no problem. Since it is a link to user's profile I use the following code:</p> <pre><code>&lt;?php global $switched; switch_to_blog(2); ?&gt; &lt;a href=”&lt;?php echo bp_loggedin_user_domain(); ?&gt;”&gt;Profile&lt;/a&gt; &...
[ { "answer_id": 270853, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 0, "selected": false, "text": "<p>If I recall correctly the ID supplied to <code>wp_editor</code> needs to already exist. </p>\n\n<p>Perhaps it ...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269856", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93413/" ]
I need to add custom item to WooCommerce My Account navigation. I can add the item with no problem. Since it is a link to user's profile I use the following code: ``` <?php global $switched; switch_to_blog(2); ?> <a href=”<?php echo bp_loggedin_user_domain(); ?>”>Profile</a> <?php restore_current_blog(); //switche...
It's hard to say without seeing *all* the code. Yes if you don't refer to the instance - then it won't really be a unique ID. Something like this would work - you would just reference the class property $id: ``` for ( $i = 0; $i <= count( $suffixes ); $i++) { wp_editor( 'your content', "{$this->id}_$i" );...
269,862
<p>How to set custom title of custom page template?</p> <p>I try use <code>wp_title</code> filter but it's not working.</p>
[ { "answer_id": 269864, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 0, "selected": false, "text": "<p>You can do a conditional and check if you are on a custom post type page, and then update the title:</p>\n\...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269862", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117356/" ]
How to set custom title of custom page template? I try use `wp_title` filter but it's not working.
[Reference](https://wordpress.stackexchange.com/questions/62415/changing-document-title-only-on-a-custom-page-template/62417?newreg=9e9601805cd5461e9ab988dc3e605854) Got success by adding this code to `your-page-template.php` file before `get_header()` function: ``` function my_page_title() { return 'Your value ...
269,868
<p>I migrated my WordPress site to a new host and new URL. I've done all the typical search and replace in mysql and the site works great.</p> <p>However, the links of my images are all missing <code>.co.uk</code>, thus not working.</p> <p><a href="https://i.stack.imgur.com/T9Rmn.jpg" rel="nofollow noreferrer"><img s...
[ { "answer_id": 269881, "author": "DaveLak", "author_id": 119673, "author_profile": "https://wordpress.stackexchange.com/users/119673", "pm_score": 3, "selected": false, "text": "<p>As mentioned in the comments under your question, some data in the WordPress database is serialized and the...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269868", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81862/" ]
I migrated my WordPress site to a new host and new URL. I've done all the typical search and replace in mysql and the site works great. However, the links of my images are all missing `.co.uk`, thus not working. [![Image below](https://i.stack.imgur.com/T9Rmn.jpg)](https://i.stack.imgur.com/T9Rmn.jpg) The odd thing ...
As mentioned in the comments under your question, some data in the WordPress database is serialized and therefore not possible to change with a simple find and replace. You should read through the [Moving WordPress](https://codex.wordpress.org/Moving_WordPress) section of the codex. Specifically the [Changing Your Dom...
269,878
<p>I'm struggling with WordPress Multisite page creation when newly site created. I found some hooks to achieve this but the hook is not responding. Some of the resources I found on stack and other sites are <a href="https://stackoverflow.com/questions/40014419/wordpress-multisite-default-page-for-newly-created-site">h...
[ { "answer_id": 269888, "author": "Nikolay", "author_id": 100555, "author_profile": "https://wordpress.stackexchange.com/users/100555", "pm_score": 3, "selected": true, "text": "<p>The code you provided works great on my multisite. I am putting it in a network activated plugin though. Try...
2017/06/12
[ "https://wordpress.stackexchange.com/questions/269878", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/60914/" ]
I'm struggling with WordPress Multisite page creation when newly site created. I found some hooks to achieve this but the hook is not responding. Some of the resources I found on stack and other sites are <https://stackoverflow.com/questions/40014419/wordpress-multisite-default-page-for-newly-created-site> and <http://...
The code you provided works great on my multisite. I am putting it in a network activated plugin though. Try the same.
269,934
<p>I'm using <em>Knowall</em> theme for WordPress. I've developed a child theme with the following code placed in my <code>style.css</code> file in my child theme's folder:</p> <pre><code>/* Theme Name: KnowAll Child Theme Theme URI: help.mysite.com Description: Help site Author: myurl.com Template: knowall Vers...
[ { "answer_id": 269961, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>There is most likely some issues about using <a href=\"https://developer.wordpress.org/reference/functions/g...
2017/06/13
[ "https://wordpress.stackexchange.com/questions/269934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121660/" ]
I'm using *Knowall* theme for WordPress. I've developed a child theme with the following code placed in my `style.css` file in my child theme's folder: ``` /* Theme Name: KnowAll Child Theme Theme URI: help.mysite.com Description: Help site Author: myurl.com Template: knowall Version: 1.0 */ @import url("../kno...
There is most likely some issues about using [`get_template_directory_uri()`](https://developer.wordpress.org/reference/functions/get_template_directory_uri/) or [`get_stylesheet_directory_uri()`](https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri). According to WordPress Code reference: > >...
269,970
<p>I'have this structure:</p> <ul> <li><strong>News</strong> (CPT. A page showing all news) </li> <li><strong>Works</strong> (CPT. A page showing all works)</li> </ul> <p>Then, inside a single page of <strong>works</strong> I want to show the news related to this work:</p> <ul> <li>Single work <ul> <li>title</li> <...
[ { "answer_id": 269961, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>There is most likely some issues about using <a href=\"https://developer.wordpress.org/reference/functions/g...
2017/06/13
[ "https://wordpress.stackexchange.com/questions/269970", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77722/" ]
I'have this structure: * **News** (CPT. A page showing all news) * **Works** (CPT. A page showing all works) Then, inside a single page of **works** I want to show the news related to this work: * Single work + title + content + news related to this single work How can I make a relation between a single post in ...
There is most likely some issues about using [`get_template_directory_uri()`](https://developer.wordpress.org/reference/functions/get_template_directory_uri/) or [`get_stylesheet_directory_uri()`](https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri). According to WordPress Code reference: > >...
270,005
<p>I have a custom endpoint defined like so:</p> <pre><code> add_action( 'rest_api_init', function () { register_rest_route( 'menc/v1', '/crosscat/(?P&lt;dept&gt;[\w-]+)/(?P&lt;cat&gt;[\w-]+)', array( 'methods' =&gt; 'GET', 'callback' =&gt; 'dept_cat_api', 'args' =&gt; ar...
[ { "answer_id": 270128, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>I had a quick look and here's how the headers are set in the <a href=\"https://developer.wordpress.org/referen...
2017/06/13
[ "https://wordpress.stackexchange.com/questions/270005", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/98703/" ]
I have a custom endpoint defined like so: ``` add_action( 'rest_api_init', function () { register_rest_route( 'menc/v1', '/crosscat/(?P<dept>[\w-]+)/(?P<cat>[\w-]+)', array( 'methods' => 'GET', 'callback' => 'dept_cat_api', 'args' => array( 'dept' => arra...
I had a quick look and here's how the headers are set in the [`WP_REST_Posts_Controller::get_items()`](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/get_items/) method: ``` $response = rest_ensure_response( $posts ); // ... $response->header( 'X-WP-Total', (int) $total_posts ); $response-...
270,008
<p>I've read a couple of things about the wp.media object and have successfully initialised in the state that I can find to upload images. But for the plug-in that I am building I need to have the same layout as when I click my attachment in de media grid gallery.</p> <p>For now this is my "simple" code that opens the...
[ { "answer_id": 278838, "author": "user63350", "author_id": 83763, "author_profile": "https://wordpress.stackexchange.com/users/83763", "pm_score": 2, "selected": false, "text": "<p>Unfortunately the logic of the attachment details isn't made to be used standalone - it requires the grid t...
2017/06/13
[ "https://wordpress.stackexchange.com/questions/270008", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58001/" ]
I've read a couple of things about the wp.media object and have successfully initialised in the state that I can find to upload images. But for the plug-in that I am building I need to have the same layout as when I click my attachment in de media grid gallery. For now this is my "simple" code that opens the default w...
Unfortunately the logic of the attachment details isn't made to be used standalone - it requires the grid that opens it. You can however use the `get_media_item( attachment_id )` method to receive the HTML of the form for modifying images: <https://developer.wordpress.org/reference/functions/get_media_item/>
270,010
<p>Running NGINX, Wordpress 4.75 after upgrading from a way older version of Wordpress, our images are being served locally and I would like to change that to our CDN. </p> <p>In the past images that were uploaded to the blog were uploaded directly to our CDN using a plugin ( I think Offload S3 Lite ). </p> <p>My go...
[ { "answer_id": 270052, "author": "Morgan Estes", "author_id": 26317, "author_profile": "https://wordpress.stackexchange.com/users/26317", "pm_score": 0, "selected": false, "text": "<p>You probably want to use the <a href=\"https://developer.wordpress.org/reference/hooks/wp_get_attachment...
2017/06/13
[ "https://wordpress.stackexchange.com/questions/270010", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51263/" ]
Running NGINX, Wordpress 4.75 after upgrading from a way older version of Wordpress, our images are being served locally and I would like to change that to our CDN. In the past images that were uploaded to the blog were uploaded directly to our CDN using a plugin ( I think Offload S3 Lite ). My goal is that I want ...
Since the major adoption of **Responsive Images** and the addition of new `srcset` attribute to the `<img>` element. WordPress has to evolve too. WordPress 4.4 added the responsive images feature. If you inspect the `src` attribute it might point to the CDN, however, you still need to consider the `srcset` attribute ...
270,111
<p>I have a new client who has recently had her site migrated to 1and1.com, and since the migration, none of her images will load, along with other assets.</p> <p>In the Media Library, the path to all of the images display as simply /u/, instead of /wp-content/uploads/:</p> <p><a href="https://i.stack.imgur.com/1B45y...
[ { "answer_id": 270035, "author": "Pisuke Soramame", "author_id": 120818, "author_profile": "https://wordpress.stackexchange.com/users/120818", "pm_score": 1, "selected": false, "text": "<p>One possible solution is to add a metadata field to your post indicating the status (i.e. completed...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270111", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16909/" ]
I have a new client who has recently had her site migrated to 1and1.com, and since the migration, none of her images will load, along with other assets. In the Media Library, the path to all of the images display as simply /u/, instead of /wp-content/uploads/: [![enter image description here](https://i.stack.imgur.co...
> > For example, let's say that Property is the post type. We would like > to display several different views (completed (built), for sale, and > for rent.) > > > Sure. Just make *Completed*, *For Sale*, and *For Rent* [taxonomies](https://codex.wordpress.org/Taxonomies) for the *Property* post type. Look into ...
270,126
<p>The plugin <strong><em>search and filter</em></strong>, doesn't retrieve <code>author_meta</code>. So i need to add <code>post_meta</code> from <code>author_meta</code>. Is it possible?</p> <h2>EDIT</h2> <p>I create user_meta in this way:</p> <pre><code> function custom_user_profile_fields($user){ $previou...
[ { "answer_id": 270035, "author": "Pisuke Soramame", "author_id": 120818, "author_profile": "https://wordpress.stackexchange.com/users/120818", "pm_score": 1, "selected": false, "text": "<p>One possible solution is to add a metadata field to your post indicating the status (i.e. completed...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270126", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121790/" ]
The plugin ***search and filter***, doesn't retrieve `author_meta`. So i need to add `post_meta` from `author_meta`. Is it possible? EDIT ---- I create user\_meta in this way: ``` function custom_user_profile_fields($user){ $previous_value = ''; if( is_object($user) && isset($user->ID) ) { $previ...
> > For example, let's say that Property is the post type. We would like > to display several different views (completed (built), for sale, and > for rent.) > > > Sure. Just make *Completed*, *For Sale*, and *For Rent* [taxonomies](https://codex.wordpress.org/Taxonomies) for the *Property* post type. Look into ...
270,129
<p>I am trying to setup rewrite rules for a custom homepage because we are planning on using full-screen slides and using a javascript pushstate to update the url instead of using formal WordPress pages. We decided using GET variables would be easiest in order to allow linking to a certain slide on the homepage, but it...
[ { "answer_id": 270131, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Two problems I see- rewrite rules need to set query vars that will result in a successful main query. Setting just...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270129", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/100538/" ]
I am trying to setup rewrite rules for a custom homepage because we are planning on using full-screen slides and using a javascript pushstate to update the url instead of using formal WordPress pages. We decided using GET variables would be easiest in order to allow linking to a certain slide on the homepage, but it's ...
Two problems I see- rewrite rules need to set query vars that will result in a successful main query. Setting just a custom var like `slide` doesn't parse to anything WordPress can load. Additionally, `slide` needs to be [added to the recognized query vars](https://codex.wordpress.org/Plugin_API/Filter_Reference/query_...
270,141
<p>Inside a WordPress loop, I'd like to conditionally check to see if the post has a title, in order to provide necessary wrapping HTML. If the post does not have a title, I don't want any of the wrapping HTML to appear.</p>
[ { "answer_id": 270142, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 3, "selected": true, "text": "<p>While you're in The Loop you can check against the <a href=\"https://codex.wordpress.org/Class_Reference/WP_...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270141", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121798/" ]
Inside a WordPress loop, I'd like to conditionally check to see if the post has a title, in order to provide necessary wrapping HTML. If the post does not have a title, I don't want any of the wrapping HTML to appear.
While you're in The Loop you can check against the [WP\_Post Object](https://codex.wordpress.org/Class_Reference/WP_Post) like so: ``` <?php while( have_posts() ) : the_post(); ?> <?php if( ! empty( $post->post_title ) ) : ?> <h1><?php the_title(); ?></h1> <?php endif; ?> <?php endwhile; ?> ```
270,158
<p>Sorry for this, but I really combed everything there is on the subject and cannot come to the solution, although it is probably super-simple:</p> <p>I have a front-page.php set as the static front page of the WordPress site. In it there is a link that I'd like to link to the home.php or index.php.</p> <p>How do I ...
[ { "answer_id": 270159, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>There really should be a simpler way to do it but you kind of need to know that WordPress stores both the F...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270158", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121586/" ]
Sorry for this, but I really combed everything there is on the subject and cannot come to the solution, although it is probably super-simple: I have a front-page.php set as the static front page of the WordPress site. In it there is a link that I'd like to link to the home.php or index.php. How do I write the url? ...
There really should be a simpler way to do it but you kind of need to know that WordPress stores both the Front Page ID and Blog Page ID in the options table. So, to get the URL of the blog you need to use both [`get_permalink()`](https://developer.wordpress.org/reference/functions/get_permalink/) and [`get_option()`](...
270,166
<p>In <code>category-about.php</code> I have</p> <pre><code>&lt;?php /** * The template for displaying the posts in the About category * */ ?&gt; &lt;!-- category-about.php --&gt; &lt;?php get_header(); ?&gt; &lt;?php $args = array( 'post_type' =&gt; 'post', 'category_name' =&gt; 'about', ); ?&gt; &...
[ { "answer_id": 270168, "author": "lowtechsun", "author_id": 77054, "author_profile": "https://wordpress.stackexchange.com/users/77054", "pm_score": 3, "selected": false, "text": "<p>In <code>category-about.php</code> I have</p>\n\n<pre><code>&lt;?php\n/**\n * The template for displaying ...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270166", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77054/" ]
In `category-about.php` I have ``` <?php /** * The template for displaying the posts in the About category * */ ?> <!-- category-about.php --> <?php get_header(); ?> <?php $args = array( 'post_type' => 'post', 'category_name' => 'about', ); ?> <?php // How to put this part in get_template_part ? ...
In `category-about.php` I have ``` <?php /** * The template for displaying the posts in the About category * */ ?> <!-- category-about.php --> <?php get_header(); ?> <?php $args = array( 'post_type' => 'post', 'category_name' => 'about', ); ?> <?php // important bit set_query_var( 'query_c...
270,167
<p>I am trying to show a weblink to my WordPress users only if they are logged in. If they are logged out they will see text that says they need to "Login to View"</p> <p>My Original Code</p> <pre><code>&lt;a href="&lt;?php echo get_post_meta($post_id, 'external_link', true); ?&gt;"&gt;View Website&lt;/a&gt; </code><...
[ { "answer_id": 270169, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 0, "selected": false, "text": "<p>Here's what you need:</p>\n\n<pre><code>&lt;?php\nif ( is_user_logged_in() ) {\n echo '&lt;a href...
2017/06/14
[ "https://wordpress.stackexchange.com/questions/270167", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121812/" ]
I am trying to show a weblink to my WordPress users only if they are logged in. If they are logged out they will see text that says they need to "Login to View" My Original Code ``` <a href="<?php echo get_post_meta($post_id, 'external_link', true); ?>">View Website</a> ``` My Altered Code ``` <a href="<?php i...
The code you posted: ``` <a href="<?php if ( is_user_logged_in() ) { echo get_post_meta($post_id, 'external_link', true); } else { echo 'Login to View'; } ?> ">View Website</a> ``` Is going to echo "Login to View" as the `href` attribute. You need something more like: ``` ...
270,176
<p>Basically as the title says I want to get list of categories and subcategories and then posts(with links to them) for those categories/subcategories.</p> <p>This is the structure I'm trying to achieve:</p> <ul> <li>Category 1</li> <ul> <li>Subcategory 1 within category 1</li> <ul> <li...
[ { "answer_id": 270169, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 0, "selected": false, "text": "<p>Here's what you need:</p>\n\n<pre><code>&lt;?php\nif ( is_user_logged_in() ) {\n echo '&lt;a href...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119868/" ]
Basically as the title says I want to get list of categories and subcategories and then posts(with links to them) for those categories/subcategories. This is the structure I'm trying to achieve: * Category 1 + Subcategory 1 within category 1 - Post 1 within subcategory 1 - Post 2 within subcategory 1 - Post 3 within ...
The code you posted: ``` <a href="<?php if ( is_user_logged_in() ) { echo get_post_meta($post_id, 'external_link', true); } else { echo 'Login to View'; } ?> ">View Website</a> ``` Is going to echo "Login to View" as the `href` attribute. You need something more like: ``` ...
270,187
<p>I've created a shortcode that should be showing an image depending on the day of the week.</p> <pre><code> function custom_shortcode() { return '&lt;img src="/wp-content/themes/coworker/images/daily-social-image-' . the_weekday() . '.gif" width="100%" /&gt;'; } add_shortcode( 'weekday', 'custom_sh...
[ { "answer_id": 270169, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 0, "selected": false, "text": "<p>Here's what you need:</p>\n\n<pre><code>&lt;?php\nif ( is_user_logged_in() ) {\n echo '&lt;a href...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270187", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/100731/" ]
I've created a shortcode that should be showing an image depending on the day of the week. ``` function custom_shortcode() { return '<img src="/wp-content/themes/coworker/images/daily-social-image-' . the_weekday() . '.gif" width="100%" />'; } add_shortcode( 'weekday', 'custom_shortcode' ); ``` Th...
The code you posted: ``` <a href="<?php if ( is_user_logged_in() ) { echo get_post_meta($post_id, 'external_link', true); } else { echo 'Login to View'; } ?> ">View Website</a> ``` Is going to echo "Login to View" as the `href` attribute. You need something more like: ``` ...
270,209
<p>There is a plugin that uses a class; and create an object like this:</p> <pre><code>class WC_Disability_VAT_Exemption { public function __construct() { add_action( 'woocommerce_after_order_notes', array( $this, 'exemption_field' ) ); } public function exemption_field() { //some code he...
[ { "answer_id": 270212, "author": "CodeMascot", "author_id": 44192, "author_profile": "https://wordpress.stackexchange.com/users/44192", "pm_score": 0, "selected": false, "text": "<p>Well, you used <a href=\"http://php.net/manual/en/language.variables.scope.php\" rel=\"nofollow noreferrer...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270209", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57671/" ]
There is a plugin that uses a class; and create an object like this: ``` class WC_Disability_VAT_Exemption { public function __construct() { add_action( 'woocommerce_after_order_notes', array( $this, 'exemption_field' ) ); } public function exemption_field() { //some code here } } /...
Woocommerce support sent me the solution of my problem: ``` function unregister_parent_hook() { if ( function_exists( 'wc_dve' ) ) { $instance = wc_dve(); remove_action( 'woocommerce_after_order_notes', array( $instance, 'exemption_field' ) ); } } ```
270,218
<p>I am stuck in a situation where the requirement is to create a custom email template for a particular product category, so that when any user buy product from that category he/she get that customised order email. Please help if anyone have any idea about how this can be achieved. Thanks in advance.</p>
[ { "answer_id": 270256, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>Whatever plugin you're using for ecommerce, there should be an email hook available to customize the emai...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270218", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121842/" ]
I am stuck in a situation where the requirement is to create a custom email template for a particular product category, so that when any user buy product from that category he/she get that customised order email. Please help if anyone have any idea about how this can be achieved. Thanks in advance.
Firstly extend WC\_Email class to define the email header, subject, email template for content secondly, add custom email class to the default WooCommerce email classes using woocommerce\_email\_classes filter, with trigger that calls terms ``` if ( has_term( 'Your Cat', 'product_cat', $item['product_id'] ) ) ``` ...
270,229
<p>I am working with underscores me trying to build a template by my own.</p> <p>I have build a homepage template and also a single-post file for the custom post types.</p> <p>What I am trying to get its to display in the homepage a kind of gallery with the featured images from each custom post type with title and ta...
[ { "answer_id": 270256, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>Whatever plugin you're using for ecommerce, there should be an email hook available to customize the emai...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270229", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120964/" ]
I am working with underscores me trying to build a template by my own. I have build a homepage template and also a single-post file for the custom post types. What I am trying to get its to display in the homepage a kind of gallery with the featured images from each custom post type with title and tags. Have tried d...
Firstly extend WC\_Email class to define the email header, subject, email template for content secondly, add custom email class to the default WooCommerce email classes using woocommerce\_email\_classes filter, with trigger that calls terms ``` if ( has_term( 'Your Cat', 'product_cat', $item['product_id'] ) ) ``` ...
270,235
<p>I'm trying to make booking - plugin with form on WordPress-admin site, where I can add new event in calendar (made with JavaScript). I have to submit form with all data and insert data to MySQL Database.</p> <p>My <strong>ajax.js</strong> file:</p> <pre><code>function ajaxSubmit(e){ var nazwa_szkolenia = document.ge...
[ { "answer_id": 270256, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>Whatever plugin you're using for ecommerce, there should be an email hook available to customize the emai...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270235", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121854/" ]
I'm trying to make booking - plugin with form on WordPress-admin site, where I can add new event in calendar (made with JavaScript). I have to submit form with all data and insert data to MySQL Database. My **ajax.js** file: ``` function ajaxSubmit(e){ var nazwa_szkolenia = document.getElementById("nazwa_szkolenia")....
Firstly extend WC\_Email class to define the email header, subject, email template for content secondly, add custom email class to the default WooCommerce email classes using woocommerce\_email\_classes filter, with trigger that calls terms ``` if ( has_term( 'Your Cat', 'product_cat', $item['product_id'] ) ) ``` ...
270,253
<p>I display a wp_editor on the front-end and everything was going fine until a recent WP update.</p> <p>Now, the "insert/edit link" is not working due to a Javascript error:</p> <pre><code>Uncaught TypeError: Cannot set property 'tempHide' of undefined </code></pre> <p>This error only appears on front-end. The back...
[ { "answer_id": 270269, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>I suspect a theme error. Try a different theme (like the standard ones - Twenty-whatevers).</p>\n" }...
2017/06/15
[ "https://wordpress.stackexchange.com/questions/270253", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121184/" ]
I display a wp\_editor on the front-end and everything was going fine until a recent WP update. Now, the "insert/edit link" is not working due to a Javascript error: ``` Uncaught TypeError: Cannot set property 'tempHide' of undefined ``` This error only appears on front-end. The back-end is going fine. I've looked...
I found it at last! Using the browser debugger, I found that there was a "editor.wp" which was undefined (in the complete version of the js file). Then I understood that the "wordpress" plugin was not used in the editor. When calling the function wp\_editor, I was setting a list of plugin : paste, wplink, textcolor. ...