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
290,195
<p>I would like to allow contributors to upload media by using the following code added to <code>functions.php</code>. But the Add Media Button still doesn't show up.</p> <pre class="lang-php prettyprint-override"><code>// Allow Contributors to Add Media if ( current_user_can('contributor') &amp;&amp; ! current_user_ca...
[ { "answer_id": 290186, "author": "Cedon", "author_id": 80069, "author_profile": "https://wordpress.stackexchange.com/users/80069", "pm_score": 1, "selected": false, "text": "<p>Looks like there maybe a problem with your <code>plugins.js</code> on line 35 according to my console. I'm gett...
2018/01/05
[ "https://wordpress.stackexchange.com/questions/290195", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133386/" ]
I would like to allow contributors to upload media by using the following code added to `functions.php`. But the Add Media Button still doesn't show up. ```php // Allow Contributors to Add Media if ( current_user_can('contributor') && ! current_user_can('upload_files') ) { add_action('admin_init', 'allow_contribut...
Looks like there maybe a problem with your `plugins.js` on line 35 according to my console. I'm getting the error `TypeError: portfolioContainer.imagesLoaded is not a function.` The code in question is: ``` if (jQuery().isotope){ var portfolioContainer = jQuery('.w-portfolio.type_sortable .w-portfolio-list-h'...
290,225
<p>I have many containers over the said image itself such as <code>col-md-10</code> which defines a <code>max-width</code> of 80% or so, this is how I generate my post:</p> <pre><code>&lt;article id="single-post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class('single-post'); ?&gt;&gt; &lt;?php $post_share = new ...
[ { "answer_id": 290186, "author": "Cedon", "author_id": 80069, "author_profile": "https://wordpress.stackexchange.com/users/80069", "pm_score": 1, "selected": false, "text": "<p>Looks like there maybe a problem with your <code>plugins.js</code> on line 35 according to my console. I'm gett...
2018/01/05
[ "https://wordpress.stackexchange.com/questions/290225", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133461/" ]
I have many containers over the said image itself such as `col-md-10` which defines a `max-width` of 80% or so, this is how I generate my post: ``` <article id="single-post-<?php the_ID(); ?>" <?php post_class('single-post'); ?>> <?php $post_share = new Post_Share( array( 'facebook', 'twitter', 'gplus', 'pinte...
Looks like there maybe a problem with your `plugins.js` on line 35 according to my console. I'm getting the error `TypeError: portfolioContainer.imagesLoaded is not a function.` The code in question is: ``` if (jQuery().isotope){ var portfolioContainer = jQuery('.w-portfolio.type_sortable .w-portfolio-list-h'...
290,234
<p>how to prevent/block direct access to a thank you page, only access if redirected from submiiting a form (in a different page)?</p>
[ { "answer_id": 290237, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 4, "selected": true, "text": "<p>If the form is redirecting from one page only, you can easily use <a href=\"https://developer.wordpress.org/ref...
2018/01/05
[ "https://wordpress.stackexchange.com/questions/290234", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134311/" ]
how to prevent/block direct access to a thank you page, only access if redirected from submiiting a form (in a different page)?
If the form is redirecting from one page only, you can easily use [`wp_get_referer()`](https://developer.wordpress.org/reference/functions/wp_get_referer/) to check for it and if not, redirect. ``` add_action('template_redirect', function() { // ID of the thank you page if (!is_page(12345)) { return; ...
290,246
<p>I'm working on my own custom theme (first custom WP work so I'm a real beginner) and need help in listing the first 20 words of a list of recent posts. </p> <p>I managed to solve this with manual? excerpt but I would like to just get the first 20 words of the content, but not sure how to best do that. The applicati...
[ { "answer_id": 290247, "author": "Ben Goodman", "author_id": 134320, "author_profile": "https://wordpress.stackexchange.com/users/134320", "pm_score": 1, "selected": false, "text": "<p>You can achieve this by using the following;</p>\n\n<pre><code>$content = get_the_content();\necho subs...
2018/01/05
[ "https://wordpress.stackexchange.com/questions/290246", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27546/" ]
I'm working on my own custom theme (first custom WP work so I'm a real beginner) and need help in listing the first 20 words of a list of recent posts. I managed to solve this with manual? excerpt but I would like to just get the first 20 words of the content, but not sure how to best do that. The application is in a...
Use [`wp_trim_words()`](https://developer.wordpress.org/reference/functions/wp_trim_words/) ``` wp_trim_words( get_the_content(), 20 ) ``` As you're outside the main loop ``` wp_trim_words( $recent[ 'post_content' ], 20 ) ``` If you want to apply the same filters as to `the_content()` in the main loop ``` wp_tri...
290,259
<p>Our post have a Max width of 768, so using the medium_large images is the preferred size for our authors. I ssumed since medium_large isnpart of core, this would be included but I don't see an easy way to activate that option.</p> <p>Can this be activated as a new hook in our functions.php?</p>
[ { "answer_id": 290261, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 1, "selected": false, "text": "<p>Please go through <a href=\"https://wpshout.com/wordpress-custom-image-sizes/\" rel=\"nofollow noreferrer\">link ...
2018/01/05
[ "https://wordpress.stackexchange.com/questions/290259", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/76979/" ]
Our post have a Max width of 768, so using the medium\_large images is the preferred size for our authors. I ssumed since medium\_large isnpart of core, this would be included but I don't see an easy way to activate that option. Can this be activated as a new hook in our functions.php?
since I'm using a size already generated by WP, I just needed to add: ``` add_filter( 'image_size_names_choose', 'fresh_custom_sizes' ); function fresh_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'medium_large' => __( 'Medium Large' ), ) ); } ```
290,301
<p>I'm new to WooCommerce and I have had a request to make a minor change to the new order email which I have managed to find the template, but I am not sure which line I should change.</p> <p>At the moment the new order email has:</p> <blockquote> <p>You have received an order from (billing address first name)</p>...
[ { "answer_id": 290365, "author": "admcfajn", "author_id": 123674, "author_profile": "https://wordpress.stackexchange.com/users/123674", "pm_score": 1, "selected": false, "text": "<p>Yes, it's possible.</p>\n\n<p>Copy the email folder from the plugin directory to a woocommerce folder in y...
2018/01/06
[ "https://wordpress.stackexchange.com/questions/290301", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134354/" ]
I'm new to WooCommerce and I have had a request to make a minor change to the new order email which I have managed to find the template, but I am not sure which line I should change. At the moment the new order email has: > > You have received an order from (billing address first name) > > > But I want to change...
I have found the line I need to edit I think ``` <p><?php printf( __( 'You have received an order from %s. The order is as follows:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p> ``` would that change to ``` <p><?php printf( __( 'You have received an order from %s. The order is as follows:'...
290,302
<p>I've been trying to change the number of posts that is displayed on my CPT movie-review archive page and I've tried about 20 - 30 different variations (and even a few plugins), but no luck. It is <strong>stuck at 5 posts</strong>, even though I know I have 10. There is also no pagination. update: fixed that.</p> <...
[ { "answer_id": 290318, "author": "Andrew", "author_id": 50767, "author_profile": "https://wordpress.stackexchange.com/users/50767", "pm_score": 0, "selected": false, "text": "<p>Your <code>wpd_testimonials_query</code> function is limiting the query to 5 posts with this line:</p>\n\n<p><...
2018/01/06
[ "https://wordpress.stackexchange.com/questions/290302", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134352/" ]
I've been trying to change the number of posts that is displayed on my CPT movie-review archive page and I've tried about 20 - 30 different variations (and even a few plugins), but no luck. It is **stuck at 5 posts**, even though I know I have 10. There is also no pagination. update: fixed that. Most of the variation...
Using the Query Monitor suggested by [@Andrew](https://wordpress.stackexchange.com/users/50767/andrew) (Thanks, Andrew!) I found a little gem in my parent theme that overrides everything set in my function. I found out wordpress loads the child themes functions.php first `myfunction{ $query->set( 'posts_per_page', 15...
290,333
<p>I have created this interval in my functions.php:</p> <pre><code>function minute_interval( $schedules ) { $schedules['minute'] = array( 'interval' =&gt; 60, 'display' =&gt; __('Every minute') ); return $schedules; } add_filter( 'cron_schedules', 'minute_interval' ); </code></pre> <p>I have this sched...
[ { "answer_id": 290357, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 1, "selected": false, "text": "<p>You have to add filter:</p>\n\n<pre><code>add_filter( 'cron_schedules', 'minute_interval' );\n</code></...
2018/01/06
[ "https://wordpress.stackexchange.com/questions/290333", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63073/" ]
I have created this interval in my functions.php: ``` function minute_interval( $schedules ) { $schedules['minute'] = array( 'interval' => 60, 'display' => __('Every minute') ); return $schedules; } add_filter( 'cron_schedules', 'minute_interval' ); ``` I have this scheduled event in my plugin: ``` if...
You have to add filter: ``` add_filter( 'cron_schedules', 'minute_interval' ); ``` Otherwise your function minute\_interval is not invoked, interval is not defined, and event doesn't work.
290,351
<p>I've come across situations where people have used either <code>esc_html()</code> or <code>esc_url()</code> with certain WP functions such as <code>home_url('/')</code>. An example being in the opening anchor tag of <code>&lt;a&gt;</code> link back to the homepage such as this:</p> <pre><code>&lt;a href="&lt;?php e...
[ { "answer_id": 290356, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 2, "selected": false, "text": "<p>Any output of untrusted data (including data from database) must be sanitized. WordPress Codex describe...
2018/01/06
[ "https://wordpress.stackexchange.com/questions/290351", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106972/" ]
I've come across situations where people have used either `esc_html()` or `esc_url()` with certain WP functions such as `home_url('/')`. An example being in the opening anchor tag of `<a>` link back to the homepage such as this: ``` <a href="<?php echo esc_url( home_url( '/' ) ); ?>"> ``` How do you know which WP f...
Any that return data. * If a function outputs internally, then it's taken responsibility for escaping * if a function returns the data for use, it will be unescaped to avoid double escaping, it's your responsibility This is because you should always late escape so that there is no doubt if a variable is escaped. If ...
290,385
<pre><code> &lt;div class="col-lg-4 col-md-4 col-sm-6 exhibitors-child"&gt; &lt;div class="exhibitors-border"&gt; &lt;?php the_post_thumbnail(); ?&gt; &lt;div class="find"&gt; ...
[ { "answer_id": 290364, "author": "andrewsandlin", "author_id": 131642, "author_profile": "https://wordpress.stackexchange.com/users/131642", "pm_score": 0, "selected": false, "text": "<p>Yes, it will affect performance to some degree. Revisions are stored in the database and if the datab...
2018/01/07
[ "https://wordpress.stackexchange.com/questions/290385", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134400/" ]
``` <div class="col-lg-4 col-md-4 col-sm-6 exhibitors-child"> <div class="exhibitors-border"> <?php the_post_thumbnail(); ?> <div class="find"> <a h...
Having 2 revisions or 100,000 will not change front end performance in a default plugin-less WordPress setup However plugin and theme authors who do not query the database correctly, could end up accidentally searching/querying revisions, which could have some performance issues Here’s a snippet on it > > revisions...
290,433
<p>When you are using the wordpress customizer, if you don't make any changes to the settings, the wordpress customizer doesn't enable the publish button. And it shows like this:</p> <p><a href="https://i.stack.imgur.com/vSdkn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vSdkn.jpg" alt="enter ima...
[ { "answer_id": 290495, "author": "tpaksu", "author_id": 14452, "author_profile": "https://wordpress.stackexchange.com/users/14452", "pm_score": 0, "selected": false, "text": "<p>Actually, triggering the change event of an linked input did the trick.</p>\n" }, { "answer_id": 29049...
2018/01/08
[ "https://wordpress.stackexchange.com/questions/290433", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14452/" ]
When you are using the wordpress customizer, if you don't make any changes to the settings, the wordpress customizer doesn't enable the publish button. And it shows like this: [![enter image description here](https://i.stack.imgur.com/vSdkn.jpg)](https://i.stack.imgur.com/vSdkn.jpg) And I want it to be displayed like...
Just set the `saved` state to `false`: ``` wp.customize.bind( 'ready', function() { wp.customize.state( 'saved' ).set( false ); } ); ```
290,437
<p>I am trying to create new WordPress plugin with object oriented programming.I want to create database when plugin activation and delete database when plugin deleting.Below is my code its not working for me.I have two files one is main plugin file other one is plugin functions included files.</p> <p>main file code a...
[ { "answer_id": 290448, "author": "mukto90", "author_id": 57944, "author_profile": "https://wordpress.stackexchange.com/users/57944", "pm_score": 1, "selected": false, "text": "<p>Use this code instead-</p>\n\n<pre><code>class hidemysite_security{\n\n public function __construct() {\n ...
2018/01/08
[ "https://wordpress.stackexchange.com/questions/290437", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134441/" ]
I am trying to create new WordPress plugin with object oriented programming.I want to create database when plugin activation and delete database when plugin deleting.Below is my code its not working for me.I have two files one is main plugin file other one is plugin functions included files. main file code as below: ...
Use this code instead- ``` class hidemysite_security{ public function __construct() { if (is_admin()) { register_activation_hook(__FILE__, array( $this, 'activate')); register_deactivation_hook( __FILE__, array( $this, 'my_plugin_remove_database' ) ); } } public f...
290,455
<p>I have several different pages. Every one of them has different css links. Rather than the css links all items are same in the head element of those pages. I need to shift those head element to <code>header.php</code> so that I can include head using <code>get_header()</code>. </p> <p>So How can I load different...
[ { "answer_id": 290457, "author": "Andrew", "author_id": 50767, "author_profile": "https://wordpress.stackexchange.com/users/50767", "pm_score": 2, "selected": false, "text": "<p>You can achieve this using <a href=\"https://codex.wordpress.org/Conditional_Tags\" rel=\"nofollow noreferrer\...
2018/01/08
[ "https://wordpress.stackexchange.com/questions/290455", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134458/" ]
I have several different pages. Every one of them has different css links. Rather than the css links all items are same in the head element of those pages. I need to shift those head element to `header.php` so that I can include head using `get_header()`. So How can I load different css file for different pages? I ha...
You can achieve this using [conditionals](https://codex.wordpress.org/Conditional_Tags) inside the function enqueuing your styles. ``` function wpdocs_theme_name_scripts() { wp_enqueue_style( 'global', get_stylesheet_uri() ); if ( is_page(5) ) { wp_enqueue_style( 'page-five', get_stylesheet_uri() . '/pa...
290,464
<p>I’m trying to pass a variable from the template to js, but with no luck. </p> <p>I’ve tried using <code>wp_localize_script</code>, and it seems to be working fine when attached to <code>wp_enqueue_scripts</code> action, but it doesn’t work when called from within template. Do my only resort is to use HTML &amp; <co...
[ { "answer_id": 290457, "author": "Andrew", "author_id": 50767, "author_profile": "https://wordpress.stackexchange.com/users/50767", "pm_score": 2, "selected": false, "text": "<p>You can achieve this using <a href=\"https://codex.wordpress.org/Conditional_Tags\" rel=\"nofollow noreferrer\...
2018/01/08
[ "https://wordpress.stackexchange.com/questions/290464", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121208/" ]
I’m trying to pass a variable from the template to js, but with no luck. I’ve tried using `wp_localize_script`, and it seems to be working fine when attached to `wp_enqueue_scripts` action, but it doesn’t work when called from within template. Do my only resort is to use HTML & `data-` for handling this? It would b...
You can achieve this using [conditionals](https://codex.wordpress.org/Conditional_Tags) inside the function enqueuing your styles. ``` function wpdocs_theme_name_scripts() { wp_enqueue_style( 'global', get_stylesheet_uri() ); if ( is_page(5) ) { wp_enqueue_style( 'page-five', get_stylesheet_uri() . '/pa...
290,510
<p>I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :</p> <pre><code>add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) ) </co...
[ { "answer_id": 290512, "author": "Scruffy Paws", "author_id": 28787, "author_profile": "https://wordpress.stackexchange.com/users/28787", "pm_score": 2, "selected": false, "text": "<p>It sounds like you are looking for <code>do_action()</code> In your method that you wrote add do_action...
2018/01/08
[ "https://wordpress.stackexchange.com/questions/290510", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134479/" ]
I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like : ``` add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) ) ``` I can't figu...
It sounds like you are looking for `do_action()` In your method that you wrote add do\_action and it will trigger your new custom action. Then you can use `add_action()` in the same way you use the build in actions. <https://developer.wordpress.org/reference/functions/do_action/> Example of your method in the class.....
290,522
<p>In a theme I'm developing I would like to have a button with a mailto: href so that it when a user clicks on it, it generates the email address dependent on the post author.</p> <p>I've managed to get it so that the email subject is generated from the post title by simply using the the_title(); </p> <p>I can't see...
[ { "answer_id": 290512, "author": "Scruffy Paws", "author_id": 28787, "author_profile": "https://wordpress.stackexchange.com/users/28787", "pm_score": 2, "selected": false, "text": "<p>It sounds like you are looking for <code>do_action()</code> In your method that you wrote add do_action...
2018/01/08
[ "https://wordpress.stackexchange.com/questions/290522", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106972/" ]
In a theme I'm developing I would like to have a button with a mailto: href so that it when a user clicks on it, it generates the email address dependent on the post author. I've managed to get it so that the email subject is generated from the post title by simply using the the\_title(); I can't seem to work out ho...
It sounds like you are looking for `do_action()` In your method that you wrote add do\_action and it will trigger your new custom action. Then you can use `add_action()` in the same way you use the build in actions. <https://developer.wordpress.org/reference/functions/do_action/> Example of your method in the class.....
290,537
<p>I am using Wordpress archive widget to display archives of My WordPress site. But there is a condition, I want to display only last year archives, not this year. I am using inbuilt widget, so what can I do to stop this year's archive coming on the widget?</p>
[ { "answer_id": 290512, "author": "Scruffy Paws", "author_id": 28787, "author_profile": "https://wordpress.stackexchange.com/users/28787", "pm_score": 2, "selected": false, "text": "<p>It sounds like you are looking for <code>do_action()</code> In your method that you wrote add do_action...
2018/01/09
[ "https://wordpress.stackexchange.com/questions/290537", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134497/" ]
I am using Wordpress archive widget to display archives of My WordPress site. But there is a condition, I want to display only last year archives, not this year. I am using inbuilt widget, so what can I do to stop this year's archive coming on the widget?
It sounds like you are looking for `do_action()` In your method that you wrote add do\_action and it will trigger your new custom action. Then you can use `add_action()` in the same way you use the build in actions. <https://developer.wordpress.org/reference/functions/do_action/> Example of your method in the class.....
290,549
<p>I am getting dynamic content on page load and sending it via mail using wp_mail(). Right now all contents going in body section of email but I want it to store in .doc(MS word) file and then send that file as an attachment. </p> <p>I can send attachment via wp_mail(). But I am not getting any solution about how to ...
[ { "answer_id": 290556, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": 2, "selected": false, "text": "<p>Can't help you with the creation of the .doc-file, as i have never done that. But if you manage to ge...
2018/01/09
[ "https://wordpress.stackexchange.com/questions/290549", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81621/" ]
I am getting dynamic content on page load and sending it via mail using wp\_mail(). Right now all contents going in body section of email but I want it to store in .doc(MS word) file and then send that file as an attachment. I can send attachment via wp\_mail(). But I am not getting any solution about how to auto cre...
Can't help you with the creation of the .doc-file, as i have never done that. But if you manage to get the encoded file into a string, you can work with the Wordpress PHP-Mailer instance like this: ``` function send_my_mail_with_attachment($from,$to,$subject,$body,$attachmentstring=""){ global $phpmailer; ...
290,572
<p>On my WooCommerce site I am trying to output the star rating for a product that is reviewed. Instead, it outputs this:</p> <blockquote> <p>Rated 3.38 out of 5 based on 8 customer ratings</p> </blockquote> <p>What am I missing with the following code?</p> <pre><code>$rating_count = $product-&gt;get_rating_count(...
[ { "answer_id": 299038, "author": "Regolith", "author_id": 103884, "author_profile": "https://wordpress.stackexchange.com/users/103884", "pm_score": 3, "selected": false, "text": "<p>Suffered with same problem. Finally after lot of search and trial I came up with this solution.</p>\n\n<p>...
2018/01/09
[ "https://wordpress.stackexchange.com/questions/290572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1354/" ]
On my WooCommerce site I am trying to output the star rating for a product that is reviewed. Instead, it outputs this: > > Rated 3.38 out of 5 based on 8 customer ratings > > > What am I missing with the following code? ``` $rating_count = $product->get_rating_count(); $review_count = $product->get_review_count(...
Suffered with same problem. Finally after lot of search and trial I came up with this solution. This gets the template where the rating is displayed from. But it displays like this: `Rated 4.50 out of 5 based on 2 customer ratings (2 customer reviews)` ``` <div class="rating-custom"> <?php wc_get_template( 'singl...
290,574
<p>i'm bad at redirection so i'm asking you.</p> <p>I have my old site with some posts like www.oldsite.com/category/my-awesome-post, www.oldsite.com/category/my-awesome-post-2 ...</p> <p>I would like to redirect each URL to a new domain like www.newsite.com/category/my-awesome-post</p> <p>so all URL will be redirec...
[ { "answer_id": 290579, "author": "knif3r", "author_id": 94644, "author_profile": "https://wordpress.stackexchange.com/users/94644", "pm_score": 0, "selected": false, "text": "<p>If you want 301/302 redirect sitewide my suggestion is to use .htaccess file, but that's not a good practice a...
2018/01/09
[ "https://wordpress.stackexchange.com/questions/290574", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134525/" ]
i'm bad at redirection so i'm asking you. I have my old site with some posts like www.oldsite.com/category/my-awesome-post, www.oldsite.com/category/my-awesome-post-2 ... I would like to redirect each URL to a new domain like www.newsite.com/category/my-awesome-post so all URL will be redirect dynamiccaly. Is it p...
If you want 301/302 redirect sitewide my suggestion is to use .htaccess file, but that's not a good practice at all. Anyway the code should be something like this ``` Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC] RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]...
290,582
<p>How can I prevent an email being sent when the order is marked as Completed?</p>
[ { "answer_id": 290595, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 1, "selected": false, "text": "<p>you can unhook the email action by placing this code in your functions.php:</p>\n\n<pre><code>remove_action( '...
2018/01/09
[ "https://wordpress.stackexchange.com/questions/290582", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25239/" ]
How can I prevent an email being sent when the order is marked as Completed?
you can unhook the email action by placing this code in your functions.php: ``` remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) ); ```
290,631
<p>I'm trying to create the hooks and function for the php to receive my ajax call and when the response is alerted, all I receive is 0.</p> <p>I suppose my question is, are the add_action hooks supposed to go into the bottom of the admin-ajax.php file or are they supposed to go elsewhere? Keep in mind that my Ajax r...
[ { "answer_id": 290654, "author": "DHL17", "author_id": 125227, "author_profile": "https://wordpress.stackexchange.com/users/125227", "pm_score": 3, "selected": true, "text": "<p>may be here is the error </p>\n\n<pre><code>add_action( 'wp_ajax_my_ajax_action', 'my_ajax_action_callback' );...
2018/01/09
[ "https://wordpress.stackexchange.com/questions/290631", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134557/" ]
I'm trying to create the hooks and function for the php to receive my ajax call and when the response is alerted, all I receive is 0. I suppose my question is, are the add\_action hooks supposed to go into the bottom of the admin-ajax.php file or are they supposed to go elsewhere? Keep in mind that my Ajax request is ...
may be here is the error ``` add_action( 'wp_ajax_my_ajax_action', 'my_ajax_action_callback' ); add_action( 'wp_ajax_nopriv_my_ajax_action', 'my_ajax_action_callback' ); ``` change to ``` add_action( 'wp_ajax_my_ajax_action_callback', 'my_ajax_action_callback' ); add_action('wp_ajax_nopriv_my_ajax_action_callback'...
290,638
<p>I have a picture gallery that is working, I am converting it to a shortcode so the positioning can be flexible and I don't have to copy the code over and over again.</p> <p>The issue I am having is that the pagination doesn't advance to the next page. The images show, the pagination shows, the page number shows...b...
[ { "answer_id": 290640, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>Don't use a hyphen in the shortcode name. See <a href=\"https://codex.wordpress.org/Shortcode_API#Hyph...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290638", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9820/" ]
I have a picture gallery that is working, I am converting it to a shortcode so the positioning can be flexible and I don't have to copy the code over and over again. The issue I am having is that the pagination doesn't advance to the next page. The images show, the pagination shows, the page number shows...but when I ...
So, I managed to find a solution. I tried to change `query_posts` on my shortcode, but for some reason, I wasn't able to get that working. I changed the query on the page which fixed the issue. The query now looks like: ``` <?php $args = array( 'order' => 'asc', 'orderby' => 'menu_order', ...
290,641
<p>Hy everyone! I listed the all network posts on my multisite to my network-home's homepage with "WDS Multisite Aggregate" plugin. This works fine, but now I want to get the author/publisher subsite's domains above each posts, similar to: by Author_name, just in this case so: via subsite_url.</p> <p>So now, if Author...
[ { "answer_id": 290640, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>Don't use a hyphen in the shortcode name. See <a href=\"https://codex.wordpress.org/Shortcode_API#Hyph...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290641", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134567/" ]
Hy everyone! I listed the all network posts on my multisite to my network-home's homepage with "WDS Multisite Aggregate" plugin. This works fine, but now I want to get the author/publisher subsite's domains above each posts, similar to: by Author\_name, just in this case so: via subsite\_url. So now, if Author1 publis...
So, I managed to find a solution. I tried to change `query_posts` on my shortcode, but for some reason, I wasn't able to get that working. I changed the query on the page which fixed the issue. The query now looks like: ``` <?php $args = array( 'order' => 'asc', 'orderby' => 'menu_order', ...
290,667
<p><strong>If i write</strong> <code>http://domain.com/wp-login.php?redirect_to=http://domain.com/specificpage/?parameter1=dog&amp;parameter2=dog&amp;parameter3=cat</code> in the url address bar (to make the login page redirect to a specific page with parameters) and login.</p> <p><strong>I get</strong> redirected to ...
[ { "answer_id": 290640, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>Don't use a hyphen in the shortcode name. See <a href=\"https://codex.wordpress.org/Shortcode_API#Hyph...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290667", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/123362/" ]
**If i write** `http://domain.com/wp-login.php?redirect_to=http://domain.com/specificpage/?parameter1=dog&parameter2=dog&parameter3=cat` in the url address bar (to make the login page redirect to a specific page with parameters) and login. **I get** redirected to the right page but only with first parameter (`http://d...
So, I managed to find a solution. I tried to change `query_posts` on my shortcode, but for some reason, I wasn't able to get that working. I changed the query on the page which fixed the issue. The query now looks like: ``` <?php $args = array( 'order' => 'asc', 'orderby' => 'menu_order', ...
290,696
<p>On my WP site, I want to create a menu which includes sub-menus inside a dropdown.</p> <p>I structured my menu to be like this: <a href="https://i.stack.imgur.com/cQzPp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cQzPp.png" alt="enter image description here"></a></p> <p>From what I have seen...
[ { "answer_id": 290640, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>Don't use a hyphen in the shortcode name. See <a href=\"https://codex.wordpress.org/Shortcode_API#Hyph...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133243/" ]
On my WP site, I want to create a menu which includes sub-menus inside a dropdown. I structured my menu to be like this: [![enter image description here](https://i.stack.imgur.com/cQzPp.png)](https://i.stack.imgur.com/cQzPp.png) From what I have seen from several WP tutorials on the web. It is expected that the three...
So, I managed to find a solution. I tried to change `query_posts` on my shortcode, but for some reason, I wasn't able to get that working. I changed the query on the page which fixed the issue. The query now looks like: ``` <?php $args = array( 'order' => 'asc', 'orderby' => 'menu_order', ...
290,703
<p>I've been struggling with a quite specific point. I registered some custom post types and specified the rewrite slug for each one of them.</p> <pre><code>'rewrite' =&gt; array( 'slug' =&gt; 'my-slug' ), </code></pre> <p>But later when i'm trying to use the "rewrite slug" and to find which post_type is re...
[ { "answer_id": 290707, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 2, "selected": false, "text": "<p>There are two ways I've used for doing this...each with issues:</p>\n\n<p>This one this only works if you've s...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290703", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134609/" ]
I've been struggling with a quite specific point. I registered some custom post types and specified the rewrite slug for each one of them. ``` 'rewrite' => array( 'slug' => 'my-slug' ), ``` But later when i'm trying to use the "rewrite slug" and to find which post\_type is requested I cannot use the get\_p...
There are two ways I've used for doing this...each with issues: This one this only works if you've set the rewrite slug for your CPT. if you don't set one it could lead to an error: ``` $post_type = get_queried_object(); echo $post_type->rewrite['slug']; ``` This one will not work on archive pages, because the page...
290,709
<p>This is how I started to update WordPress daily:</p> <pre><code>cat &lt;&lt;-"CRON_DAILY" &gt; /etc/cron.daily/nses_cron_daily for dir in /var/www/html/*/; do cd "$dir" &amp;&amp; /usr/local/bin/wp plugin update --all --allow-root; done for dir in /var/www/html/*/; do cd "$dir" &amp;&amp; /usr/local/bin/wp ...
[ { "answer_id": 290718, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 3, "selected": true, "text": "<p>If you have this statement (by default) in your wp-config file</p>\n\n<pre><code>define( 'WP_AUTO_UPDAT...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131001/" ]
This is how I started to update WordPress daily: ``` cat <<-"CRON_DAILY" > /etc/cron.daily/nses_cron_daily for dir in /var/www/html/*/; do cd "$dir" && /usr/local/bin/wp plugin update --all --allow-root; done for dir in /var/www/html/*/; do cd "$dir" && /usr/local/bin/wp core update --allow-root; done for ...
If you have this statement (by default) in your wp-config file ``` define( 'WP_AUTO_UPDATE_CORE', true ); ``` Then WP core files are automatically updated for you. This assumes that you have traffic to your site (if nobody ever visits your site, the updates won't happen.) So your solution is actually causing more w...
290,732
<p>there are many plugins that do some job but can i add custom code for example: <code>&lt;link href="http://buhehe.de/wp-content/uploads/2017/12/Buhehe.ico" rel="shortcut icon" type="image/x-icon"&gt; &lt;/head&gt;</code> from Function.php?</p>
[ { "answer_id": 290736, "author": "David Sword", "author_id": 132362, "author_profile": "https://wordpress.stackexchange.com/users/132362", "pm_score": 1, "selected": false, "text": "<p>Yes, you can:</p>\n\n<pre><code>add_action('wp_head',function() {\n echo 'your html here';\n});\n</cod...
2018/01/10
[ "https://wordpress.stackexchange.com/questions/290732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133900/" ]
there are many plugins that do some job but can i add custom code for example: `<link href="http://buhehe.de/wp-content/uploads/2017/12/Buhehe.ico" rel="shortcut icon" type="image/x-icon"> </head>` from Function.php?
Yes, you can: ``` add_action('wp_head',function() { echo 'your html here'; }); ``` However your `.ico` file should be put in a place it can't be purposely or accidentally deleted, like your theme folder beside your functions.php. Once done you can then use the following to construct the URL: ``` add_action('wp_he...
290,757
<p>I am trying to add custom post data( post meta data) through wordpress API but I am getting difficulty while updating/adding custom post data. below is the code that am using.</p> <p><strong>Code written in function.php</strong></p> <pre><code> add_action( 'rest_api_init', 'create_api_posts_meta_field' ); func...
[ { "answer_id": 291240, "author": "Muddasir Abbas", "author_id": 59271, "author_profile": "https://wordpress.stackexchange.com/users/59271", "pm_score": 1, "selected": false, "text": "<p><em>You can write custom post data using below code. I write custom post type \"ad_portfolio\" categor...
2018/01/11
[ "https://wordpress.stackexchange.com/questions/290757", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134644/" ]
I am trying to add custom post data( post meta data) through wordpress API but I am getting difficulty while updating/adding custom post data. below is the code that am using. **Code written in function.php** ``` add_action( 'rest_api_init', 'create_api_posts_meta_field' ); function create_api_posts_meta_field()...
I just ran a test with your code and in my opinion, this is not working because you have an error in the `get_callback` function. First time it will try to get the `subtitle`( or the `timing_of_experience`) but it will trigger an error because it doesn't exists in the first place and this error will block the registr...
290,793
<p>I get this error when I try to create something with WP CLI:</p> <pre><code>Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `localhost`. This could mean your host’s database se...
[ { "answer_id": 290797, "author": "maverick", "author_id": 132953, "author_profile": "https://wordpress.stackexchange.com/users/132953", "pm_score": 0, "selected": false, "text": "<p>Step1: check if your mysql server is running\nStep2: if yes then you can log in to mysql using </p>\n\n<pr...
2018/01/11
[ "https://wordpress.stackexchange.com/questions/290793", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25239/" ]
I get this error when I try to create something with WP CLI: ``` Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `localhost`. This could mean your host’s database server is down. ...
Go into your `wp-config.php` and change your `DB_HOST` to `127.0.0.1` instead of localhost. Credit goes to Craig Wayne above in the comments.
290,855
<p>I would like to set up a function in my functions.php file in a theme so that when a custom-post-type is being viewed, if the user clicks the author name in the post, it only shows CPTs by that author, but on the main blog if they click the author name it will only show the blog posts of that author. I already have ...
[ { "answer_id": 290863, "author": "blanck", "author_id": 134708, "author_profile": "https://wordpress.stackexchange.com/users/134708", "pm_score": -1, "selected": false, "text": "<p><code>SELECT * FROM wp_posts WHERE autor=[autor id] AND post_type=[custom post type]</code></p>\n" }, {...
2018/01/11
[ "https://wordpress.stackexchange.com/questions/290855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106972/" ]
I would like to set up a function in my functions.php file in a theme so that when a custom-post-type is being viewed, if the user clicks the author name in the post, it only shows CPTs by that author, but on the main blog if they click the author name it will only show the blog posts of that author. I already have the...
You will need to filter 'author\_link' to conditionally add the parameter that can be used to add the custom post type into the query for the author's posts. ``` add_filter( 'author_link', 'myprefix_author_link', 10, 3 ); function myprefix_author_link( $link, $author_id, $author_nicename ) { if ( is_singular( 'myC...
290,858
<p>The “Lost your password?” link on the standard WordPress login screen (wp-login) links to /shop/my-account/lost-password/ instead of the WP standard (wp-login.php?action=lostpassword). My website is the following: www.lazonemph.com </p> <p>I use Members plugin and Wocommerce.. </p> <p>1) How do I set this back to ...
[ { "answer_id": 290863, "author": "blanck", "author_id": 134708, "author_profile": "https://wordpress.stackexchange.com/users/134708", "pm_score": -1, "selected": false, "text": "<p><code>SELECT * FROM wp_posts WHERE autor=[autor id] AND post_type=[custom post type]</code></p>\n" }, {...
2018/01/11
[ "https://wordpress.stackexchange.com/questions/290858", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134706/" ]
The “Lost your password?” link on the standard WordPress login screen (wp-login) links to /shop/my-account/lost-password/ instead of the WP standard (wp-login.php?action=lostpassword). My website is the following: www.lazonemph.com I use Members plugin and Wocommerce.. 1) How do I set this back to the WP password p...
You will need to filter 'author\_link' to conditionally add the parameter that can be used to add the custom post type into the query for the author's posts. ``` add_filter( 'author_link', 'myprefix_author_link', 10, 3 ); function myprefix_author_link( $link, $author_id, $author_nicename ) { if ( is_singular( 'myC...
290,867
<p>I'm trying to add some custom elements to a site's RSS feed. I thought it would be as simple as adding something like this to the active theme's functions.php:</p> <pre><code>function add_fields_to_videocast_rss_item() { echo "&lt;test&gt;This is a test&lt;/test&gt;"; } add_action('rss2_item', 'add_fields_to_vi...
[ { "answer_id": 290863, "author": "blanck", "author_id": 134708, "author_profile": "https://wordpress.stackexchange.com/users/134708", "pm_score": -1, "selected": false, "text": "<p><code>SELECT * FROM wp_posts WHERE autor=[autor id] AND post_type=[custom post type]</code></p>\n" }, {...
2018/01/11
[ "https://wordpress.stackexchange.com/questions/290867", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37750/" ]
I'm trying to add some custom elements to a site's RSS feed. I thought it would be as simple as adding something like this to the active theme's functions.php: ``` function add_fields_to_videocast_rss_item() { echo "<test>This is a test</test>"; } add_action('rss2_item', 'add_fields_to_videocast_rss_item'); ``` ...
You will need to filter 'author\_link' to conditionally add the parameter that can be used to add the custom post type into the query for the author's posts. ``` add_filter( 'author_link', 'myprefix_author_link', 10, 3 ); function myprefix_author_link( $link, $author_id, $author_nicename ) { if ( is_singular( 'myC...
290,878
<p>I have created a page template to display specific data. Is it a bad idea to copy the loop from page.php and paste it as is in the template file? Does this mess with the loop? Doing this has made my page just as I need it. I tried a custom query using WP_Query but that didn't want to work</p> <p>I am using a custom...
[ { "answer_id": 290880, "author": "maverick", "author_id": 132953, "author_profile": "https://wordpress.stackexchange.com/users/132953", "pm_score": -1, "selected": false, "text": "<p>I think it's okay to do that.\nproblem will arise if you don't name the file in proper way.\ni.e., wordpr...
2018/01/12
[ "https://wordpress.stackexchange.com/questions/290878", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14761/" ]
I have created a page template to display specific data. Is it a bad idea to copy the loop from page.php and paste it as is in the template file? Does this mess with the loop? Doing this has made my page just as I need it. I tried a custom query using WP\_Query but that didn't want to work I am using a custom query in...
It seems all I needed to do was put in the template\_part ``` get_template_part( 'template-parts/page/content', 'page' ); ```
290,893
<p>I have a webpage hosted in 'www.example.com' (for example) and a domain 'www.domain.com'. My problem is that I do not know how to point configure WordPress and make my page available online. </p> <p>I've already tried changing the site address (www.domain.com) and the WordPress address (www.example.com) in General ...
[ { "answer_id": 290880, "author": "maverick", "author_id": 132953, "author_profile": "https://wordpress.stackexchange.com/users/132953", "pm_score": -1, "selected": false, "text": "<p>I think it's okay to do that.\nproblem will arise if you don't name the file in proper way.\ni.e., wordpr...
2018/01/12
[ "https://wordpress.stackexchange.com/questions/290893", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128080/" ]
I have a webpage hosted in 'www.example.com' (for example) and a domain 'www.domain.com'. My problem is that I do not know how to point configure WordPress and make my page available online. I've already tried changing the site address (www.domain.com) and the WordPress address (www.example.com) in General Settings a...
It seems all I needed to do was put in the template\_part ``` get_template_part( 'template-parts/page/content', 'page' ); ```
290,923
<p>I have a site that we have developed that we have just moved live.</p> <p>Another company has the domain name currently so they are redirecting to our IP and DNS. </p> <p>The website works fine and all forms are working but the admin login form is getting a 'too many redirects' error when trying to load.</p> <p>...
[ { "answer_id": 290880, "author": "maverick", "author_id": 132953, "author_profile": "https://wordpress.stackexchange.com/users/132953", "pm_score": -1, "selected": false, "text": "<p>I think it's okay to do that.\nproblem will arise if you don't name the file in proper way.\ni.e., wordpr...
2018/01/12
[ "https://wordpress.stackexchange.com/questions/290923", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106013/" ]
I have a site that we have developed that we have just moved live. Another company has the domain name currently so they are redirecting to our IP and DNS. The website works fine and all forms are working but the admin login form is getting a 'too many redirects' error when trying to load. We run our development si...
It seems all I needed to do was put in the template\_part ``` get_template_part( 'template-parts/page/content', 'page' ); ```
290,965
<p>I have a custom hierarchical taxonomy ('location') that looks like:</p> <pre><code>Tokyo --Minato ----Roppongi </code></pre> <p>I have a post where only "Roppongi" is selected and I want to display as text only the top level parent term of the taxonomy (Tokyo) without any category link.</p> <pre><code>&lt;?php $m...
[ { "answer_id": 290966, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 2, "selected": false, "text": "<p>It is an object, and you can use the following notation:</p>\n\n<pre><code>&lt;?php echo $myterms[0]-&g...
2018/01/13
[ "https://wordpress.stackexchange.com/questions/290965", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62598/" ]
I have a custom hierarchical taxonomy ('location') that looks like: ``` Tokyo --Minato ----Roppongi ``` I have a post where only "Roppongi" is selected and I want to display as text only the top level parent term of the taxonomy (Tokyo) without any category link. ``` <?php $myterms = get_terms( array( 'taxonomy' =>...
It is an object, and you can use the following notation: ``` <?php echo $myterms[0]->name; ?> ```
290,968
<p>I'm working on the WordPress theme, I want to ask how to do the demo content, how to EXPORT the all - menu, pictures, texts, widgets, everything? I also made require download plugins whit TGM Plugin with which the theme works, but how to do when installing the theme, these plugins to come with my custom settings fro...
[ { "answer_id": 290966, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 2, "selected": false, "text": "<p>It is an object, and you can use the following notation:</p>\n\n<pre><code>&lt;?php echo $myterms[0]-&g...
2018/01/13
[ "https://wordpress.stackexchange.com/questions/290968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134794/" ]
I'm working on the WordPress theme, I want to ask how to do the demo content, how to EXPORT the all - menu, pictures, texts, widgets, everything? I also made require download plugins whit TGM Plugin with which the theme works, but how to do when installing the theme, these plugins to come with my custom settings from t...
It is an object, and you can use the following notation: ``` <?php echo $myterms[0]->name; ?> ```
290,976
<p>I have a plugin with a setting page, and there are some action that have to be done when a certain option is saved. I am using the <code>pre_update_option_</code> hook to do this. So far so good. If something goes wrong, however, I'd also need to notify that to the user. I tried these things:</p> <p><strong>1) Add ...
[ { "answer_id": 290978, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 1, "selected": false, "text": "<p>No, you are doing wrong. <code>add_action</code> must be in <code>__construct()</code> of your plugin o...
2018/01/13
[ "https://wordpress.stackexchange.com/questions/290976", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/61991/" ]
I have a plugin with a setting page, and there are some action that have to be done when a certain option is saved. I am using the `pre_update_option_` hook to do this. So far so good. If something goes wrong, however, I'd also need to notify that to the user. I tried these things: **1) Add hook to admin\_notices befo...
After digging in the setting API I found the answer. Method 1 was correct, but the notification should not be done by hooking to `admin_notices`, rather by the function [add\_settings\_error](https://codex.wordpress.org/Function_Reference/add_settings_error) ``` add_action ('pre_update_option_my_var', function( $new_v...
290,979
<p><br> I want to remove "Browsed By Категорија: ..." from my category pages, but I don't know how. Web site is: <a href="http://deks.org.rs/sanunis/" rel="nofollow noreferrer">http://deks.org.rs/sanunis/</a> <br> Theme is nisarg. <br> Thank you in advance.</p>
[ { "answer_id": 290978, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 1, "selected": false, "text": "<p>No, you are doing wrong. <code>add_action</code> must be in <code>__construct()</code> of your plugin o...
2018/01/13
[ "https://wordpress.stackexchange.com/questions/290979", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134556/" ]
I want to remove "Browsed By Категорија: ..." from my category pages, but I don't know how. Web site is: <http://deks.org.rs/sanunis/> Theme is nisarg. Thank you in advance.
After digging in the setting API I found the answer. Method 1 was correct, but the notification should not be done by hooking to `admin_notices`, rather by the function [add\_settings\_error](https://codex.wordpress.org/Function_Reference/add_settings_error) ``` add_action ('pre_update_option_my_var', function( $new_v...
290,989
<p>I try to get the value of WooCommerce custom field from an array of product ID. No luck, I'm on the custom page not on the woocommerce loop.</p> <p>tried this: <code>$productArray1</code> is a list of product ID (and it's working)</p> <pre><code>global $wpdb; global $product; foreach ($productArray1 as $value) { ...
[ { "answer_id": 291023, "author": "user1397532", "author_id": 134805, "author_profile": "https://wordpress.stackexchange.com/users/134805", "pm_score": 2, "selected": true, "text": "<p>Poedit is the way to go fro translating most of your plugins.</p>\n\n<p>WPMl is doing quite a good job, ...
2018/01/13
[ "https://wordpress.stackexchange.com/questions/290989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114157/" ]
I try to get the value of WooCommerce custom field from an array of product ID. No luck, I'm on the custom page not on the woocommerce loop. tried this: `$productArray1` is a list of product ID (and it's working) ``` global $wpdb; global $product; foreach ($productArray1 as $value) { $querystr = " SELECT met...
Poedit is the way to go fro translating most of your plugins. WPMl is doing quite a good job, though, at parsing plugins and themes strings for translation purposes. You should give it a try.
291,117
<p>I am trying to retrieve a list including both builtin and custom post types:</p> <pre><code>$post_types = get_post_types(array( 'public' =&gt; TRUE, ), 'objects'); </code></pre> <p>The above almost works, but I would like to exclude the <code>attachment</code> from this list, only returning post types with speci...
[ { "answer_id": 291121, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://developer.wordpress.org/reference/functions/get_post_types/\" rel=\"nofollow noreferrer\"><...
2018/01/15
[ "https://wordpress.stackexchange.com/questions/291117", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14870/" ]
I am trying to retrieve a list including both builtin and custom post types: ``` $post_types = get_post_types(array( 'public' => TRUE, ), 'objects'); ``` The above almost works, but I would like to exclude the `attachment` from this list, only returning post types with specific support such as `editor`, `title` an...
I found out that [`get_post_types_by_support()`](https://developer.wordpress.org/reference/functions/get_post_types_by_support/) seems to be the solution to get the desired result: ``` $post_types = get_post_types_by_support(array('title', 'editor', 'thumbnail')); ``` The above will return `post`, `page` and any cus...
291,145
<p>Is there a way to put some code into the header but have it load only on blog posts? </p> <p>Maybe a plugin or a piece of code that could help me accomplish this?</p>
[ { "answer_id": 291146, "author": "Chazlie", "author_id": 129681, "author_profile": "https://wordpress.stackexchange.com/users/129681", "pm_score": -1, "selected": false, "text": "<p>You could create another header called header-blog.php</p>\n\n<p>Then on your blogs template replace the <...
2018/01/15
[ "https://wordpress.stackexchange.com/questions/291145", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134930/" ]
Is there a way to put some code into the header but have it load only on blog posts? Maybe a plugin or a piece of code that could help me accomplish this?
Yes. In your `functions.php` file, add something like the following: ``` function my_post_header_function() { if( is_single() ) { // Your Code Goes Here } } add_action( 'wp_head', 'my_post_header_function' ); ``` What this will do is execute this when `wp_head()` is fired. It will see if you're on a sing...
291,169
<pre><code>$category = get_category( get_query_var( 'cat' ) ); $child_cats = (array) get_term_children( $category , 'category' ); wp_list_categories( array( 'exclude' =&gt; $child_cats ) ); </code></pre> <p>Is it possible to exclude all child categories?</p> <p>Update : I tried this also but it doesn't...
[ { "answer_id": 291146, "author": "Chazlie", "author_id": 129681, "author_profile": "https://wordpress.stackexchange.com/users/129681", "pm_score": -1, "selected": false, "text": "<p>You could create another header called header-blog.php</p>\n\n<p>Then on your blogs template replace the <...
2018/01/16
[ "https://wordpress.stackexchange.com/questions/291169", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104464/" ]
``` $category = get_category( get_query_var( 'cat' ) ); $child_cats = (array) get_term_children( $category , 'category' ); wp_list_categories( array( 'exclude' => $child_cats ) ); ``` Is it possible to exclude all child categories? Update : I tried this also but it doesn't work. ``` $categories = get...
Yes. In your `functions.php` file, add something like the following: ``` function my_post_header_function() { if( is_single() ) { // Your Code Goes Here } } add_action( 'wp_head', 'my_post_header_function' ); ``` What this will do is execute this when `wp_head()` is fired. It will see if you're on a sing...
291,181
<p>I used following code </p> <pre><code>function userinfo_global() { global $users_info; wp_get_current_user(); } add_action( 'init', 'userinfo_global' ); </code></pre> <p>in a file <code>users.php</code> , this file are call in inside <code>funtions.php</code>.</p> <p>in template file I have <code>&lt;?php...
[ { "answer_id": 291182, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 4, "selected": true, "text": "<p>You'll also have to fill the variable, e.g.</p>\n\n<pre><code>function userinfo_global() {\n global $users_i...
2018/01/16
[ "https://wordpress.stackexchange.com/questions/291181", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129093/" ]
I used following code ``` function userinfo_global() { global $users_info; wp_get_current_user(); } add_action( 'init', 'userinfo_global' ); ``` in a file `users.php` , this file are call in inside `funtions.php`. in template file I have `<?php echo $users_info->user_firstname; ?>` , but no working.. I w...
You'll also have to fill the variable, e.g. ``` function userinfo_global() { global $users_info; $users_info = wp_get_current_user(); } add_action( 'init', 'userinfo_global' ); ``` And you should then be able to use $users\_info everywhere in global context. Keep in mind that some template pars (header.php, ...
291,229
<p>I have a Custom Post Type Called <code>SlidersCPT</code> as I register the CPT like</p> <pre><code>register_post_type( 'SlidersCPT', $args ); </code></pre> <p>and I need to apply some CSS rules on admin page <strong>only</strong> when creating New SlidersCPT custom Post Type. I thought this might help:</p> <pre><...
[ { "answer_id": 291233, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 0, "selected": false, "text": "<p>The URL of the admin Add screen looks like this:</p>\n\n<pre><code>https://example.com/wp-admin/post-new.ph...
2018/01/16
[ "https://wordpress.stackexchange.com/questions/291229", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35444/" ]
I have a Custom Post Type Called `SlidersCPT` as I register the CPT like ``` register_post_type( 'SlidersCPT', $args ); ``` and I need to apply some CSS rules on admin page **only** when creating New SlidersCPT custom Post Type. I thought this might help: ``` if(get_post_type() == 'SlidersCPT') {} ``` but as you ...
You can use this code: ``` add_action( 'admin_enqueue_scripts', 'load_admin_style' ); function load_admin_style() { global $pagenow; if ( 'post.php' === $pagenow && isset($_GET['post']) && 'YOURPOSTTYPE' === get_post_type( $_GET['post'] ) ) { wp_enqueue_style( 'admin_css', get_template_directory_uri()...
291,261
<p>I have custom wp_query used in buddypress to list all posts of the author (taken from the profile user currently visits). I tried to follow other topics but I'm failing miserably. </p> <p>Code below: </p> <pre><code> ?php // Display posts in user profile // Construct new user profile tab add_action( 'bp_s...
[ { "answer_id": 291233, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 0, "selected": false, "text": "<p>The URL of the admin Add screen looks like this:</p>\n\n<pre><code>https://example.com/wp-admin/post-new.ph...
2018/01/16
[ "https://wordpress.stackexchange.com/questions/291261", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/132331/" ]
I have custom wp\_query used in buddypress to list all posts of the author (taken from the profile user currently visits). I tried to follow other topics but I'm failing miserably. Code below: ``` ?php // Display posts in user profile // Construct new user profile tab add_action( 'bp_setup_nav', 'add_prof...
You can use this code: ``` add_action( 'admin_enqueue_scripts', 'load_admin_style' ); function load_admin_style() { global $pagenow; if ( 'post.php' === $pagenow && isset($_GET['post']) && 'YOURPOSTTYPE' === get_post_type( $_GET['post'] ) ) { wp_enqueue_style( 'admin_css', get_template_directory_uri()...
291,268
<p><a href="https://i.stack.imgur.com/cydDR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cydDR.png" alt="enter image description here"></a></p> <p>As you can see, WooCommerce's State fields use select field.</p> <p>But, I just want user enter State directly!</p> <p>How can I do this?</p>
[ { "answer_id": 291505, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 0, "selected": false, "text": "<pre><code>$('#billing_address_1').removeAttr('disabled');\n</code></pre>\n" }, { "answer_id...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291268", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/136439/" ]
[![enter image description here](https://i.stack.imgur.com/cydDR.png)](https://i.stack.imgur.com/cydDR.png) As you can see, WooCommerce's State fields use select field. But, I just want user enter State directly! How can I do this?
Add this to your functions.php Simply add this code to your functions file and your WooCommerce will now use standard drop downs. ``` add_action( 'wp_enqueue_scripts', 'agentwp_dequeue_stylesandscripts', 100 ); function agentwp_dequeue_stylesandscripts() { if ( class_exists( 'woocommerce' ) ) { wp_dequeue_style( 'sel...
291,288
<p>I have created custom fields for posts by using the add_meta_box action. I want to create my own WP Query based on my custom field, to make sure I will only load a post collection with the correct data. If I add a new field, the post doesn't automatically have a value for my custom field. So I am not able to load th...
[ { "answer_id": 291292, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 3, "selected": true, "text": "<p>Try <code>meta_query</code> to get posts having <code>theme_settings_post_show == true</code> (for new posts...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291288", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135022/" ]
I have created custom fields for posts by using the add\_meta\_box action. I want to create my own WP Query based on my custom field, to make sure I will only load a post collection with the correct data. If I add a new field, the post doesn't automatically have a value for my custom field. So I am not able to load the...
Try `meta_query` to get posts having `theme_settings_post_show == true` (for new posts) and `theme_settings_post_show` not set at all (for old posts): ``` <?php $queryArguments = array( 'posts_per_page' => -1, 'post_type' => 'post', 'meta_query' => array( 'relation' => 'OR', // value is not set ...
291,297
<p>So inside my plugin I have the following code. It gets a question from a custom_post. I'm processing it here so that further updates can be done by AJAX/JSON and the page only has to be configured for one type of data source.</p> <pre><code>$observations = new WP_Query($args); if ( $observations-&gt; have_posts(...
[ { "answer_id": 291306, "author": "Peter HvD", "author_id": 134918, "author_profile": "https://wordpress.stackexchange.com/users/134918", "pm_score": 1, "selected": false, "text": "<p>This might be one of those times when certain functions work better as part of the loop. Although you're ...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291297", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65939/" ]
So inside my plugin I have the following code. It gets a question from a custom\_post. I'm processing it here so that further updates can be done by AJAX/JSON and the page only has to be configured for one type of data source. ``` $observations = new WP_Query($args); if ( $observations-> have_posts() ) : $questi...
According to the `get_edit_post_link()` function [source](https://developer.wordpress.org/reference/functions/get_edit_post_link/) this can happen in following conditions: * there is no such post; * there is no such post type; * you don't have enough permissions to edit the post; * `_edit_link` was changed during post...
291,301
<p>I've been working on ajax lately. The tutorials you find on the net are all very similar and quite easy to implement. But I always get a <strong>bad request 400</strong> on my <code>ajax-admin.php</code> file.</p> <p>After a long and intensive search, I have now found out that's because of the time of integration.<...
[ { "answer_id": 291303, "author": "swissspidy", "author_id": 12404, "author_profile": "https://wordpress.stackexchange.com/users/12404", "pm_score": 5, "selected": true, "text": "<p>I think the only thing missing here is that you need to move <code>add_action('wp_ajax_nopriv_ajaxlogin','a...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291301", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129895/" ]
I've been working on ajax lately. The tutorials you find on the net are all very similar and quite easy to implement. But I always get a **bad request 400** on my `ajax-admin.php` file. After a long and intensive search, I have now found out that's because of the time of integration. If I use the `init` action hook t...
I think the only thing missing here is that you need to move `add_action('wp_ajax_nopriv_ajaxlogin','ajax_login');` outside `ajax_login_init`. That code registers your Ajax handler, but when you only run it on `wp_enqueue_scripts`, it's already too late and `wp_ajax_nopriv_` hooks are already run. So, have you tried ...
291,307
<p>This is simple posts result array.</p> <pre><code>$query = new WP_Query( array( 'post_type' =&gt; 'post' ) ); $posts = $query-&gt;posts; // returns simple array of data </code></pre> <p>Is there a way to get the results from wp-json/wp/v2/posts/?_embed without making extra request to server to pull json and then d...
[ { "answer_id": 291338, "author": "Janiis", "author_id": 43543, "author_profile": "https://wordpress.stackexchange.com/users/43543", "pm_score": 0, "selected": false, "text": "<p>After digging into source code ended up with this solution. Works for me, might be useful to others as well.</...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291307", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43543/" ]
This is simple posts result array. ``` $query = new WP_Query( array( 'post_type' => 'post' ) ); $posts = $query->posts; // returns simple array of data ``` Is there a way to get the results from wp-json/wp/v2/posts/?\_embed without making extra request to server to pull json and then decode to php array? Looking fo...
I think we can simplify it with: ``` $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); $response = rest_do_request( $request ); $data = rest_get_server()->response_to_data( $response, true ); ``` by using [`rest_do_request()`](https://developer.wordpress.org/reference/functions/rest_do_request/).
291,329
<p>I'm working on a query to show related items op a CPT by the term assigned to the current post.</p> <p>I already have the code to complete the query but don't get it why my initial code returns a NULL</p> <p>To get the term assigned to the post I'm using this code </p> <pre><code>$terms = get_the_terms( $post-&gt...
[ { "answer_id": 291338, "author": "Janiis", "author_id": 43543, "author_profile": "https://wordpress.stackexchange.com/users/43543", "pm_score": 0, "selected": false, "text": "<p>After digging into source code ended up with this solution. Works for me, might be useful to others as well.</...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291329", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28103/" ]
I'm working on a query to show related items op a CPT by the term assigned to the current post. I already have the code to complete the query but don't get it why my initial code returns a NULL To get the term assigned to the post I'm using this code ``` $terms = get_the_terms( $post->ID, 'taxonomy_name' ); ``` I...
I think we can simplify it with: ``` $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); $response = rest_do_request( $request ); $data = rest_get_server()->response_to_data( $response, true ); ``` by using [`rest_do_request()`](https://developer.wordpress.org/reference/functions/rest_do_request/).
291,335
<p>I have some shortcode that I am using. The shortcode itself is working. The shortcode has pagination because it's cycling through a picture gallery.</p> <p>The pagination itself works, but when it advances, it also advances the pagination for other picture galleries that are using the same shortcode.</p> <p>My que...
[ { "answer_id": 291338, "author": "Janiis", "author_id": 43543, "author_profile": "https://wordpress.stackexchange.com/users/43543", "pm_score": 0, "selected": false, "text": "<p>After digging into source code ended up with this solution. Works for me, might be useful to others as well.</...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291335", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9820/" ]
I have some shortcode that I am using. The shortcode itself is working. The shortcode has pagination because it's cycling through a picture gallery. The pagination itself works, but when it advances, it also advances the pagination for other picture galleries that are using the same shortcode. My question is, how can...
I think we can simplify it with: ``` $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); $response = rest_do_request( $request ); $data = rest_get_server()->response_to_data( $response, true ); ``` by using [`rest_do_request()`](https://developer.wordpress.org/reference/functions/rest_do_request/).
291,374
<p>I need to get product ID from an array of custom field, I have this code to find all product with the same custom field, after deleting all duplicate custom field value, I need to retrieve product id for all custom field:</p> <pre><code>&lt;?php // Get all product cip by category $product_args = array( 'post_ty...
[ { "answer_id": 291394, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 2, "selected": true, "text": "<pre><code>$product = array(\n 'post_type' =&gt; 'product',\n 'post_status' =&gt; 'publish',\n ...
2018/01/17
[ "https://wordpress.stackexchange.com/questions/291374", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114157/" ]
I need to get product ID from an array of custom field, I have this code to find all product with the same custom field, after deleting all duplicate custom field value, I need to retrieve product id for all custom field: ``` <?php // Get all product cip by category $product_args = array( 'post_type' => 'product',...
``` $product = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'product_cip', 'value' => 'some value', 'compare' => '=', ) ), 'fields' => 'ids', ); $product_post = get...
291,402
<p>By importing orders from Amazon in WooCommerce and creating WooCommerce orders programmatically, emails for new order or order status changing are sent.</p> <p>Is it possible to prevent this email sending at least on new order creation? I could use a condition on a custom field value, but what actions/filters I hav...
[ { "answer_id": 291394, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 2, "selected": true, "text": "<pre><code>$product = array(\n 'post_type' =&gt; 'product',\n 'post_status' =&gt; 'publish',\n ...
2018/01/18
[ "https://wordpress.stackexchange.com/questions/291402", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111673/" ]
By importing orders from Amazon in WooCommerce and creating WooCommerce orders programmatically, emails for new order or order status changing are sent. Is it possible to prevent this email sending at least on new order creation? I could use a condition on a custom field value, but what actions/filters I have to use? ...
``` $product = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'product_cip', 'value' => 'some value', 'compare' => '=', ) ), 'fields' => 'ids', ); $product_post = get...
291,407
<p>Is it possible to install a multisite and have the <strong>first</strong> installation here:</p> <pre><code>http://www.example.com/en/blog/ </code></pre> <p>and then all <strong>other</strong> sites in these places?</p> <pre><code>http://www.example.com/cn/blog/ http://www.example.com/ru/blog/ http://www.exampl...
[ { "answer_id": 291408, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 1, "selected": false, "text": "<p>Yes, your requirements are possible. </p>\n\n<p>As addition, you can also use different domains for each language...
2018/01/18
[ "https://wordpress.stackexchange.com/questions/291407", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135100/" ]
Is it possible to install a multisite and have the **first** installation here: ``` http://www.example.com/en/blog/ ``` and then all **other** sites in these places? ``` http://www.example.com/cn/blog/ http://www.example.com/ru/blog/ http://www.example.com/jp/blog/ ``` *Note that the first installation cannot b...
I got it working! The trick was writing a variable PATH\_CURRENT\_SITE definition after enabling and altering the additional site settings. Simple, and no other special htaccess rewrites or code needed. Step 1) Original installation ----------------------------- Under `https://www.example.com/en/blog/` Step 2) Enabl...
291,450
<p>I'm running the latest version of WordPress (4.9.2) and WooCommerce (3.2.6) and I'm having issues overwriting the <code>My Account</code> template.</p> <p>I've created a file in my theme:</p> <pre><code>theme-name/woocommerce/myaccount/my-account.php </code></pre> <p>I have a page in my <code>WP Admin</code> with...
[ { "answer_id": 291909, "author": "Dilip Gupta", "author_id": 110899, "author_profile": "https://wordpress.stackexchange.com/users/110899", "pm_score": 0, "selected": false, "text": "<p>so <code>do_shortcode('[woocommerce_my_account]');</code> is working in index.php and <code>[woocommerc...
2018/01/18
[ "https://wordpress.stackexchange.com/questions/291450", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104711/" ]
I'm running the latest version of WordPress (4.9.2) and WooCommerce (3.2.6) and I'm having issues overwriting the `My Account` template. I've created a file in my theme: ``` theme-name/woocommerce/myaccount/my-account.php ``` I have a page in my `WP Admin` with the `post_content` set to: ``` [woocommerce_my_accoun...
so `do_shortcode('[woocommerce_my_account]');` is working in index.php and `[woocommerce_my_account]` is not working normal `wp admin` page. have you tried looking for the issue with `the_content()` function? check if the loop is correct in your theme's template file.
291,474
<p>I have a shortcode which will have a big HTML.</p> <p>It will have 4 selects which I'm getting the data inside the shortcode:</p> <pre><code>$house_types = get_terms(array( 'taxonomy' =&gt; 'house_types', 'hide_empty' =&gt; 0 )); </code></pre> <p>I would like to insert a template that can read this variable i...
[ { "answer_id": 291502, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 0, "selected": false, "text": "<pre><code>&lt;label for=\"tipo\"&gt;Tipos:&lt;/label&gt;\n&lt;select name=\"tipo\" id=\"house_types...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291474", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133606/" ]
I have a shortcode which will have a big HTML. It will have 4 selects which I'm getting the data inside the shortcode: ``` $house_types = get_terms(array( 'taxonomy' => 'house_types', 'hide_empty' => 0 )); ``` I would like to insert a template that can read this variable in order to build the select, my templat...
Your core issue is that you pass value as globals but never declare them as such. Generally speaking, "template parts" are useful when you want to give the ability to someone else to override them via a child theme or plugin, but if you are doing a "one off" theme, it is just better to write a function that generates ...
291,524
<p>Let me start off by saying that I usually make alot of research before asking publicly for help - due to likelyhood of information already being on the web - altho I've done several days of reseach etc I'm still in agony...</p> <p>I'm using Wordpress with Advanced Custom Fields plugin - I've been able to make it sh...
[ { "answer_id": 291525, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 2, "selected": true, "text": "<p>You have to use <code>do_shortcode()</code> to execute shortcodes in your string</p>\n\n<p>Full code sho...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291524", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135164/" ]
Let me start off by saying that I usually make alot of research before asking publicly for help - due to likelyhood of information already being on the web - altho I've done several days of reseach etc I'm still in agony... I'm using Wordpress with Advanced Custom Fields plugin - I've been able to make it show the ima...
You have to use `do_shortcode()` to execute shortcodes in your string Full code should be like that ``` <?php function my_shortcode( $atts ) { $atts = shortcode_atts( array( 'post_id' => '', // Default value. ), $atts ); $output = '[acf field="image" post_id="' . $atts['post_id'] . '"]'; $out...
291,538
<p>I'm want to add confirm popup in checkout page if user select credit card gateway. I success to add javascript code after click on "place order" button using:</p> <pre><code>jQuery(function ($) { $("form.woocommerce-checkout").on('submit', function () { // show confirm popup and conditions to continue...
[ { "answer_id": 291541, "author": "mmm", "author_id": 74311, "author_profile": "https://wordpress.stackexchange.com/users/74311", "pm_score": 2, "selected": false, "text": "<p>the first step is to define the event in doing this for the function </p>\n\n<pre><code>.on('submit', function (e...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291538", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135167/" ]
I'm want to add confirm popup in checkout page if user select credit card gateway. I success to add javascript code after click on "place order" button using: ``` jQuery(function ($) { $("form.woocommerce-checkout").on('submit', function () { // show confirm popup and conditions to continue or return to ...
the first step is to define the event in doing this for the function ``` .on('submit', function (event) { ``` and after you can stop the form submit with this code : ``` event.preventDefault(); ```
291,558
<p>I am currently working on a wordpress/woocommerce project. At the backend, when the user clicks on woocommerce/orders menu, it will display all available order details. In order this table, there are several fields/columns (such as order, ship to, date, total, actions).</p> <p>Under actions field, there are two but...
[ { "answer_id": 291563, "author": "mmm", "author_id": 74311, "author_profile": "https://wordpress.stackexchange.com/users/74311", "pm_score": 0, "selected": false, "text": "<p>to add a action in this row, you can try this code : </p>\n\n<pre><code>add_filter(\"woocommerce_admin_order_acti...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291558", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/132874/" ]
I am currently working on a wordpress/woocommerce project. At the backend, when the user clicks on woocommerce/orders menu, it will display all available order details. In order this table, there are several fields/columns (such as order, ship to, date, total, actions). Under actions field, there are two buttons (orde...
@mmm thanks for that code, I didnt know this filter yet. Do you know if it is also possible to add a tooltip that way? Anyway, I have a different solution to add a new button to this column, and also want to post it: ``` add_action( 'woocommerce_admin_order_actions_end', 'add_content_to_wcactions_column' ); functio...
291,579
<p>I'm using Gravity Forms and after submission I want to use its built-in action <code>add_action( 'gform_after_submission', 'after_submission', 10, 2 );</code> to trigger a couple of click events from 2 different elements in that page. Is it possible? If so, how is it done?</p>
[ { "answer_id": 291563, "author": "mmm", "author_id": 74311, "author_profile": "https://wordpress.stackexchange.com/users/74311", "pm_score": 0, "selected": false, "text": "<p>to add a action in this row, you can try this code : </p>\n\n<pre><code>add_filter(\"woocommerce_admin_order_acti...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291579", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78848/" ]
I'm using Gravity Forms and after submission I want to use its built-in action `add_action( 'gform_after_submission', 'after_submission', 10, 2 );` to trigger a couple of click events from 2 different elements in that page. Is it possible? If so, how is it done?
@mmm thanks for that code, I didnt know this filter yet. Do you know if it is also possible to add a tooltip that way? Anyway, I have a different solution to add a new button to this column, and also want to post it: ``` add_action( 'woocommerce_admin_order_actions_end', 'add_content_to_wcactions_column' ); functio...
291,584
<p>Im trying to disallow editors from publishing their own post, I would like editors to only be allowed to publish others submitted posts. </p> <p>I would like contributors and authors to submit their posts for review. I would like the editor to approve these posts for publishing, but I do not want the editor to be a...
[ { "answer_id": 291563, "author": "mmm", "author_id": 74311, "author_profile": "https://wordpress.stackexchange.com/users/74311", "pm_score": 0, "selected": false, "text": "<p>to add a action in this row, you can try this code : </p>\n\n<pre><code>add_filter(\"woocommerce_admin_order_acti...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291584", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107068/" ]
Im trying to disallow editors from publishing their own post, I would like editors to only be allowed to publish others submitted posts. I would like contributors and authors to submit their posts for review. I would like the editor to approve these posts for publishing, but I do not want the editor to be able to pub...
@mmm thanks for that code, I didnt know this filter yet. Do you know if it is also possible to add a tooltip that way? Anyway, I have a different solution to add a new button to this column, and also want to post it: ``` add_action( 'woocommerce_admin_order_actions_end', 'add_content_to_wcactions_column' ); functio...
291,601
<p>I am trying to retrieve a file uploaded in the front-end with contact form 7 and assign it to a featured image custom post type. Heres is my code so far :</p> <pre><code>function form_to_post( $posted_data ) { $args = array( 'post_type' =&gt; 'projects', 'post_status'=&gt; 'draft', 'pos...
[ { "answer_id": 291620, "author": "Judd Franklin", "author_id": 135197, "author_profile": "https://wordpress.stackexchange.com/users/135197", "pm_score": 1, "selected": false, "text": "<p>It looks like the filter you are hooking onto doesn't have access to the post data.</p>\n\n<p>If you ...
2018/01/19
[ "https://wordpress.stackexchange.com/questions/291601", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54879/" ]
I am trying to retrieve a file uploaded in the front-end with contact form 7 and assign it to a featured image custom post type. Heres is my code so far : ``` function form_to_post( $posted_data ) { $args = array( 'post_type' => 'projects', 'post_status'=> 'draft', 'post_title'=> wp_strip_...
Thanks @Judd Franklin for the directions. I was also missing `$submission->uploaded_files();`. Here is the working code for those who are looking for the same answer: ``` function image_form_to_featured_image( $contact_form ) { $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_p...
291,639
<p>I am trying to change this wordpress function given in my theme to show posts from category instead of tags.</p> <p>But due to wordpress beginner i am unable to do this. </p> <p>Please help me to change this code.</p> <pre><code>&lt;div id="tabs_content_container2"&gt; &lt;div id="tab3...
[ { "answer_id": 291620, "author": "Judd Franklin", "author_id": 135197, "author_profile": "https://wordpress.stackexchange.com/users/135197", "pm_score": 1, "selected": false, "text": "<p>It looks like the filter you are hooking onto doesn't have access to the post data.</p>\n\n<p>If you ...
2018/01/20
[ "https://wordpress.stackexchange.com/questions/291639", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135224/" ]
I am trying to change this wordpress function given in my theme to show posts from category instead of tags. But due to wordpress beginner i am unable to do this. Please help me to change this code. ``` <div id="tabs_content_container2"> <div id="tab3" class="tab_content2" style="display...
Thanks @Judd Franklin for the directions. I was also missing `$submission->uploaded_files();`. Here is the working code for those who are looking for the same answer: ``` function image_form_to_featured_image( $contact_form ) { $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_p...
291,675
<p>From WordPress 4.9.2, I created a child theme for twentyseventeen. I noticed that it comes with its own SVG icon system for social media icons at the bottom of the page. I see some of that code initiated within the <code>site-info.php</code> file, in <code>wp_nav_menu()</code>.</p> <pre><code>&lt;nav class="social-...
[ { "answer_id": 291620, "author": "Judd Franklin", "author_id": 135197, "author_profile": "https://wordpress.stackexchange.com/users/135197", "pm_score": 1, "selected": false, "text": "<p>It looks like the filter you are hooking onto doesn't have access to the post data.</p>\n\n<p>If you ...
2018/01/20
[ "https://wordpress.stackexchange.com/questions/291675", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/98671/" ]
From WordPress 4.9.2, I created a child theme for twentyseventeen. I noticed that it comes with its own SVG icon system for social media icons at the bottom of the page. I see some of that code initiated within the `site-info.php` file, in `wp_nav_menu()`. ``` <nav class="social-navigation" role="navigation" aria-labe...
Thanks @Judd Franklin for the directions. I was also missing `$submission->uploaded_files();`. Here is the working code for those who are looking for the same answer: ``` function image_form_to_featured_image( $contact_form ) { $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_p...
291,700
<p>WordPress loads jQuery.migrate automatically:</p> <p>How can I disable it without plugins? I didn't find code in functions.php with <code>enqueue</code>.</p> <p>It loads from <code>/wp-includes</code>. How can I disable it?</p>
[ { "answer_id": 291711, "author": "swissspidy", "author_id": 12404, "author_profile": "https://wordpress.stackexchange.com/users/12404", "pm_score": 5, "selected": false, "text": "<p>jQuery Migrate is nothing but a dependency of the jQuery script in WordPress, so one can simply remove tha...
2018/01/21
[ "https://wordpress.stackexchange.com/questions/291700", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133900/" ]
WordPress loads jQuery.migrate automatically: How can I disable it without plugins? I didn't find code in functions.php with `enqueue`. It loads from `/wp-includes`. How can I disable it?
jQuery Migrate is nothing but a dependency of the jQuery script in WordPress, so one can simply remove that dependency. The code for that is pretty straightforward: ``` function dequeue_jquery_migrate( $scripts ) { if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) { $scripts->registered['jq...
291,721
<p>I'm getting the following errors on my WordPress site</p> <pre><code>Warning: require(/home/[site]/public_html/wp-includes/load.php): failed to open stream: No such file or directory in /home/[site]/public_html/wp-settings.php on line 19 Warning: require(/home/[site]/public_html/wp-includes/load.php): failed to op...
[ { "answer_id": 291719, "author": "VihangaAW", "author_id": 105067, "author_profile": "https://wordpress.stackexchange.com/users/105067", "pm_score": 3, "selected": true, "text": "<p>Just install a good anti-spam plugin. They will monitors site's comments for spam and automatically blocks...
2018/01/21
[ "https://wordpress.stackexchange.com/questions/291721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120278/" ]
I'm getting the following errors on my WordPress site ``` Warning: require(/home/[site]/public_html/wp-includes/load.php): failed to open stream: No such file or directory in /home/[site]/public_html/wp-settings.php on line 19 Warning: require(/home/[site]/public_html/wp-includes/load.php): failed to open stream: No ...
Just install a good anti-spam plugin. They will monitors site's comments for spam and automatically blocks spam comments. BTW WordPress come with Akismet which is a spam protection plugin installed by default. To enable the plugin, go to the Plugins and activate the Plugin. [Akismet Anti-Spam](https://wordpress....
291,732
<p>I've been trying to edit a footer.php file for the Wordpress eCommerce theme called SornaCommerce. There is a text that says "Proudly powered by WordPress | Theme: SornaCommerce by eDataStyle.". Instead of that I want to add some links and widgets.</p> <p>The footer.php text says the following</p> <pre><code>&lt...
[ { "answer_id": 291733, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 0, "selected": false, "text": "<p>That's an action you can hook into, see also <a href=\"https://codex.wordpress.org/Plugin_API/Action_Reference...
2018/01/21
[ "https://wordpress.stackexchange.com/questions/291732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135280/" ]
I've been trying to edit a footer.php file for the Wordpress eCommerce theme called SornaCommerce. There is a text that says "Proudly powered by WordPress | Theme: SornaCommerce by eDataStyle.". Instead of that I want to add some links and widgets. The footer.php text says the following ``` </div> ``` ``` <?php...
The original theme url here ( <https://wordpress.org/themes/sornacommerce/> ) The theme working by using WordPress hooks You can update this file: `sornacommerce\inc\theme-hooks.php` on line 438 to 497 Otherwise remove the function on the hook like bellow: ``` remove_action( 'sornacommerce_site_footer_block', 'so...
291,735
<p>I am working on a plugin that creates lists. After creating a list, I wanted to remove the slug from the url</p> <p>Post type:</p> <pre><code>$rewrite = [ 'slug' =&gt; 'single-link', 'with_front' =&gt; false, 'pages' =&gt; false, 'feeds' =&gt; false, ]; $args...
[ { "answer_id": 291990, "author": "luukvhoudt", "author_id": 44637, "author_profile": "https://wordpress.stackexchange.com/users/44637", "pm_score": 2, "selected": false, "text": "<p>You have to alter the perma structure. By default your custom post type's post will only be found wenether...
2018/01/21
[ "https://wordpress.stackexchange.com/questions/291735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135201/" ]
I am working on a plugin that creates lists. After creating a list, I wanted to remove the slug from the url Post type: ``` $rewrite = [ 'slug' => 'single-link', 'with_front' => false, 'pages' => false, 'feeds' => false, ]; $args = [ 'label' ...
The registering of the custom post type and the permalink modification is OK. The problem is with the WordPress rewrite rules that more than likely will match the "cleaned up" URL of your simple links to pages and it will set the `pagename` query var not `name` as your `change_slug_struct()` function assumed. So chang...
291,827
<p>How can I add classes on the <code>echo</code> returns?</p> <pre><code> &lt;div class="author_sidebar"&gt; &lt;?php if ( is_singular( 'post' ) ) { echo get_avatar( get_the_author_meta( 'user_email' ), 75 ); echo get_the_author_meta( 'display_name' ); ?&gt; &lt;/div&gt; </code></pre> <p>I managed to ...
[ { "answer_id": 291820, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 2, "selected": true, "text": "<p>If your site and home URL are set to https, WordPress will redirect all requests made to it.</p>\n\n<p>Please c...
2018/01/22
[ "https://wordpress.stackexchange.com/questions/291827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135332/" ]
How can I add classes on the `echo` returns? ``` <div class="author_sidebar"> <?php if ( is_singular( 'post' ) ) { echo get_avatar( get_the_author_meta( 'user_email' ), 75 ); echo get_the_author_meta( 'display_name' ); ?> </div> ``` I managed to solve the problem by rapping the `echo` returns in `div...
If your site and home URL are set to https, WordPress will redirect all requests made to it. Please check under Settings -> General if this is the case.
291,832
<p>Have a look, please: <a href="http://www.heavyweightsoftware.com/blog" rel="nofollow noreferrer">http://www.heavyweightsoftware.com/blog</a> and click on Blog. You should see my article, How to Use Tabs with Angular 5. Now click on this article to view it and you should get an "Oops! Can't find that." page.</p> <p>...
[ { "answer_id": 291833, "author": "Cátia Rodrigues", "author_id": 135334, "author_profile": "https://wordpress.stackexchange.com/users/135334", "pm_score": 3, "selected": true, "text": "<p>Have you tried to save the permalinks again?</p>\n\n<pre><code>Step 1: In the main menu find \"Setti...
2018/01/22
[ "https://wordpress.stackexchange.com/questions/291832", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104795/" ]
Have a look, please: <http://www.heavyweightsoftware.com/blog> and click on Blog. You should see my article, How to Use Tabs with Angular 5. Now click on this article to view it and you should get an "Oops! Can't find that." page. What's up with that? It looks like something odd is going on with single quotes in the ...
Have you tried to save the permalinks again? ``` Step 1: In the main menu find "Settings > Permalinks". Step 2: Scroll down if needed and click "Save Changes". Step 3: Rewrite rules and permalinks are flushed. ```
291,855
<p>I'm using Contact Form 7 in my wordpress installation. I need to somehow pass a hidden field with the current page url in the contact form hidden field. I tried their custom function and tried the short code, no luck. </p> <pre><code>wpcf7_add_shortcode('sourceurl', 'wpcf7_sourceurl_shortcode_handler', true); func...
[ { "answer_id": 291862, "author": "mmm", "author_id": 74311, "author_profile": "https://wordpress.stackexchange.com/users/74311", "pm_score": 2, "selected": false, "text": "<p>the form submit already send the container post then you just need to retrive it in and put it in the e-mail.<br>...
2018/01/22
[ "https://wordpress.stackexchange.com/questions/291855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90895/" ]
I'm using Contact Form 7 in my wordpress installation. I need to somehow pass a hidden field with the current page url in the contact form hidden field. I tried their custom function and tried the short code, no luck. ``` wpcf7_add_shortcode('sourceurl', 'wpcf7_sourceurl_shortcode_handler', true); function wpcf7_sou...
See this example on how to create and parse the shortcode in the contact form 7 to use it add `[current_url]` ``` add_action( 'wpcf7_init', 'wpcf7_add_form_tag_current_url' ); function wpcf7_add_form_tag_current_url() { // Add shortcode for the form [current_url] wpcf7_add_form_tag( 'current_url', 'wpc...
291,864
<p>On the main blog page for a site I am developing, my designer has the first post styled uniquely and in a different section on the page than the rest. Since it is a paginated archive page, I need to loop through all posts on the paginated page just excluding the first post, as I will get that in it's own loop. </p> ...
[ { "answer_id": 291883, "author": "Jignesh Patel", "author_id": 111556, "author_profile": "https://wordpress.stackexchange.com/users/111556", "pm_score": 0, "selected": false, "text": "<p>Following this step:</p>\n\n<p>Step 1: For different section you can display first Posts. when put th...
2018/01/22
[ "https://wordpress.stackexchange.com/questions/291864", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/67264/" ]
On the main blog page for a site I am developing, my designer has the first post styled uniquely and in a different section on the page than the rest. Since it is a paginated archive page, I need to loop through all posts on the paginated page just excluding the first post, as I will get that in it's own loop. I trie...
You don't need separate queries, you can run multiple loops on the same query- ``` // output first post if( have_posts() ){ the_post(); the_title(); } // output the rest of the posts... if( have_posts() ){ while( have_posts() ){ the_post(); the_title(); } } ``` You can also use `rewi...
291,872
<p>I have a project going on and this is the first time I've encountered CSV. I've read numerous post but haven't found what I need.</p> <p>So we have and CSV with values like this</p> <pre><code>Name,Country,Color,Pet David,UK,Red,Dog Andy,USA,Blue,Cat,Dog,Fish ... </code></pre> <p>So sometimes there are multiple v...
[ { "answer_id": 291883, "author": "Jignesh Patel", "author_id": 111556, "author_profile": "https://wordpress.stackexchange.com/users/111556", "pm_score": 0, "selected": false, "text": "<p>Following this step:</p>\n\n<p>Step 1: For different section you can display first Posts. when put th...
2018/01/22
[ "https://wordpress.stackexchange.com/questions/291872", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74294/" ]
I have a project going on and this is the first time I've encountered CSV. I've read numerous post but haven't found what I need. So we have and CSV with values like this ``` Name,Country,Color,Pet David,UK,Red,Dog Andy,USA,Blue,Cat,Dog,Fish ... ``` So sometimes there are multiple values on "Pet", and that's how cl...
You don't need separate queries, you can run multiple loops on the same query- ``` // output first post if( have_posts() ){ the_post(); the_title(); } // output the rest of the posts... if( have_posts() ){ while( have_posts() ){ the_post(); the_title(); } } ``` You can also use `rewi...
291,878
<p>EDIT: This shortcode is meant to be used and valid on any WP page. // Thanks Jacob for the note.</p> <p>I am trying to display a sidebar inside a shortcode.</p> <p>However, the result of the shortcode, jumps out from the wrapping element (div) in which I am trying to display it.</p> <p>The red rectangle in screen...
[ { "answer_id": 291880, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": true, "text": "<p>You're using a mix of echoing and returning. </p>\n\n<p>Here you're starting by echoing:</p>\n\n<pre><co...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291878", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103078/" ]
EDIT: This shortcode is meant to be used and valid on any WP page. // Thanks Jacob for the note. I am trying to display a sidebar inside a shortcode. However, the result of the shortcode, jumps out from the wrapping element (div) in which I am trying to display it. The red rectangle in screenshots illustrates the pr...
You're using a mix of echoing and returning. Here you're starting by echoing: ``` echo '<div class="clear"></div>'; ``` Here you're putting the output into a variable (correctly): ``` $output = '<div class="row">'; ``` And here you're just writing the content in quotes without echoing or assigning to a variable...
291,895
<p>Wordpress srcset is a great feature but there are occasions when it's important to control exactly which image sizes are included in the srcset code.</p> <p>For example, on one of our sites we generate a custom image size which is ONLY intended for external use - this means an external sales portal collects this im...
[ { "answer_id": 291906, "author": "Andrew", "author_id": 50767, "author_profile": "https://wordpress.stackexchange.com/users/50767", "pm_score": -1, "selected": false, "text": "<p>WordPress adds scrset attributes via a filter attached the the <code>the_content</code> hook.</p>\n\n<p><code...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291895", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84924/" ]
Wordpress srcset is a great feature but there are occasions when it's important to control exactly which image sizes are included in the srcset code. For example, on one of our sites we generate a custom image size which is ONLY intended for external use - this means an external sales portal collects this image automa...
WordPress allows you to hook into `wp_calculate_image_srcset` [See Core file on Trac](https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/media.php#L1203) This filter gives you 5 arguments: * **$sources** One or more arrays of source data to include in the 'srcset' * **$size\_array** Array of width and ...
291,930
<p>I need to get the author information, who having maximum number of post(custom post type).</p> <p>Here is the code I tried to get the result.</p> <pre><code> $author_query = new WP_User_Query(array ( 'orderby' =&gt; 'post_count', 'order' =&gt; 'DESC', ...
[ { "answer_id": 291940, "author": "Philip Downer", "author_id": 947, "author_profile": "https://wordpress.stackexchange.com/users/947", "pm_score": 1, "selected": false, "text": "<p>Because the post_count attribute in the users table includes the total number of posts for the user and is ...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291930", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/99307/" ]
I need to get the author information, who having maximum number of post(custom post type). Here is the code I tried to get the result. ``` $author_query = new WP_User_Query(array ( 'orderby' => 'post_count', 'order' => 'DESC', )); $authors = $...
You can try with the following query, where the author data as well as the post count can be retrieved. ``` $sql = "SELECT SQL_CALC_FOUND_ROWS wp_users.ID,post_count FROM wp_users RIGHT JOIN (SELECT post_author, COUNT(*) as post_count FROM wp_posts WHERE ( ( post_type = 'custom-post-type' AND ( post_status = 'publish'...
291,931
<p>I need to add a string in front of the following php code, what Is the best method of doing this?</p> <pre><code>&lt;?php echo human_time_diff( get_the_time('U') ) . __(' ago', 'yourlanguageslug'); ?&gt;&lt;br/&gt; </code></pre>
[ { "answer_id": 291940, "author": "Philip Downer", "author_id": 947, "author_profile": "https://wordpress.stackexchange.com/users/947", "pm_score": 1, "selected": false, "text": "<p>Because the post_count attribute in the users table includes the total number of posts for the user and is ...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291931", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135332/" ]
I need to add a string in front of the following php code, what Is the best method of doing this? ``` <?php echo human_time_diff( get_the_time('U') ) . __(' ago', 'yourlanguageslug'); ?><br/> ```
You can try with the following query, where the author data as well as the post count can be retrieved. ``` $sql = "SELECT SQL_CALC_FOUND_ROWS wp_users.ID,post_count FROM wp_users RIGHT JOIN (SELECT post_author, COUNT(*) as post_count FROM wp_posts WHERE ( ( post_type = 'custom-post-type' AND ( post_status = 'publish'...
291,964
<p>I know that is not the number of plugins, it's the quality. But anyway, I want to limit the number of plugins that can be installed on a WordPress installation. Any ideas?</p> <p>It doesn't matter if the limit applies to all admins including me.</p>
[ { "answer_id": 291977, "author": "iantsch", "author_id": 90220, "author_profile": "https://wordpress.stackexchange.com/users/90220", "pm_score": 1, "selected": false, "text": "<p>There are a few possible solutions you can investigate further to limit the possibility to install plugins. <...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291964", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25552/" ]
I know that is not the number of plugins, it's the quality. But anyway, I want to limit the number of plugins that can be installed on a WordPress installation. Any ideas? It doesn't matter if the limit applies to all admins including me.
The most performant way to do this is probably by hooking into [`map_meta_cap`](https://developer.wordpress.org/reference/hooks/map_meta_cap/) to conditionally disallow the `install_plugins` capability. There are no database calls involved with that. Here's an (untested) example: ``` add_filter( 'map_meta_cap', 'wpse...
291,970
<p>I read near the end of <a href="https://www.ctrl.blog/entry/how-to-wordpress-sshguard" rel="nofollow noreferrer">this guide</a> regarding utilizing <a href="https://www.sshguard.net/" rel="nofollow noreferrer">SSHguard</a> to protect WordPress from Brute force attacks that after configuring SSHguard the relevant way...
[ { "answer_id": 291978, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 3, "selected": true, "text": "<p>On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291970", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131001/" ]
I read near the end of [this guide](https://www.ctrl.blog/entry/how-to-wordpress-sshguard) regarding utilizing [SSHguard](https://www.sshguard.net/) to protect WordPress from Brute force attacks that after configuring SSHguard the relevant way, one must: > > disable XML-RPC by blocking all remote access to /xmlrpc.ph...
On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your configuration file: ``` location ~ ^/(xmlrpc\.php) { deny all; } ```
291,976
<p>I have a CPT <code>locations</code> with a custom taxonomy <code>regions</code> using hierarchical terms (State is the parent term, City is the child term.</p> <p><strong>Regions Custom Taxonomy</strong></p> <ul> <li>North Carolina (parent) <ul> <li>Charlotte (child)</li> <li>Raleigh (child)</li> </ul></li> <li>G...
[ { "answer_id": 291978, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 3, "selected": true, "text": "<p>On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291976", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119547/" ]
I have a CPT `locations` with a custom taxonomy `regions` using hierarchical terms (State is the parent term, City is the child term. **Regions Custom Taxonomy** * North Carolina (parent) + Charlotte (child) + Raleigh (child) * Georgia (parent) + Atlanta (child) Using an ACF Relationship field, I'm trying to buil...
On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your configuration file: ``` location ~ ^/(xmlrpc\.php) { deny all; } ```
291,979
<p>I am creating a website. I need to hide the avatar and the name of the user who is currently editing, and replace the name with the role. Is that possible?</p> <p>Thank you for your help</p> <p><a href="https://i.stack.imgur.com/pj2n1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pj2n1.jpg" al...
[ { "answer_id": 291978, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 3, "selected": true, "text": "<p>On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291979", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135417/" ]
I am creating a website. I need to hide the avatar and the name of the user who is currently editing, and replace the name with the role. Is that possible? Thank you for your help [![enter image description here](https://i.stack.imgur.com/pj2n1.jpg)](https://i.stack.imgur.com/pj2n1.jpg)
On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your configuration file: ``` location ~ ^/(xmlrpc\.php) { deny all; } ```
291,982
<p>When customers fill out the contact form on our site, the form goes straight into the spam folder in our gmail account. It never used to do this. Is this a Wordpress setting or a gmail setting that needs to be changes so that it sends to the inbox rather than the spam folder?</p> <p>Thanks</p>
[ { "answer_id": 291978, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 3, "selected": true, "text": "<p>On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your...
2018/01/23
[ "https://wordpress.stackexchange.com/questions/291982", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135421/" ]
When customers fill out the contact form on our site, the form goes straight into the spam folder in our gmail account. It never used to do this. Is this a Wordpress setting or a gmail setting that needs to be changes so that it sends to the inbox rather than the spam folder? Thanks
On nginx, to block access to the xmlrpc.php file, add this location block to the server block of your configuration file: ``` location ~ ^/(xmlrpc\.php) { deny all; } ```
292,007
<p>I'm having trouble using <code>remove_filter</code> to override the read more links in my parent theme. </p> <p>Here's the parent theme functions: </p> <pre><code>/* Modify the '[...]' Read More Text */ add_filter( 'the_content_more_link', 'hoot_modify_read_more_link' ); if ( apply_filters( 'hoot_force_excerpt_rea...
[ { "answer_id": 292013, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 2, "selected": false, "text": "<p><strong>A Note on Priorities</strong></p>\n\n<p>Note that if you're trying to remove a function u...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292007", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51985/" ]
I'm having trouble using `remove_filter` to override the read more links in my parent theme. Here's the parent theme functions: ``` /* Modify the '[...]' Read More Text */ add_filter( 'the_content_more_link', 'hoot_modify_read_more_link' ); if ( apply_filters( 'hoot_force_excerpt_readmore', true ) ) { add_filte...
**A Note on Priorities** Note that if you're trying to remove a function using `remove_action()` or `remove_filter()` and the function has had a priority assigned to it, you must include the priority when removing it, or it won't work. **So if the function in the parent theme looks like this:** ``` <?php function pa...
292,054
<p>I created an array with this expressions:</p> <pre><code> $taxonomies = get_terms(array( 'taxonomy' =&gt; 'product_cat', 'hide_empty' =&gt; false, )); </code></pre> <p>And I got this as return:</p> <pre><code>Array ( [0] =&gt; WP_Term Object ( [term_id] =&gt; 79 [name] =&gt; Édességek [s...
[ { "answer_id": 292063, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 1, "selected": false, "text": "<p>Sound like a strange thing to do, but I've seen stranger requirements, so I trust you have a good reason for t...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292054", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134715/" ]
I created an array with this expressions: ``` $taxonomies = get_terms(array( 'taxonomy' => 'product_cat', 'hide_empty' => false, )); ``` And I got this as return: ``` Array ( [0] => WP_Term Object ( [term_id] => 79 [name] => Édességek [slug] => edessegek [term_group] => 0 [term_taxonomy_i...
Here's an alternative using the handy [`wp_list_pluck()`](https://developer.wordpress.org/reference/functions/wp_list_pluck/): ``` $terms = get_terms(array( 'taxonomy' => 'category', 'hide_empty' => false, )); $slugs = wp_list_pluck( $terms, 'slug' ); $names = wp_list_pluck( $terms, 'name' ); ``` wh...
292,066
<p>I'm using WooCommerce v3.2.6 and WordPress 4.9.1. I've added an endpoint to the WooCommerce myaccount area (<code>view-subscription</code>):</p> <pre><code>function my_custom_endpoints() { add_rewrite_endpoint( 'view-subscription', EP_ROOT | EP_PAGES ); } add_action( 'init', 'my_custom_endpoints' ); function ...
[ { "answer_id": 306721, "author": "Guhéry Rocourt", "author_id": 145725, "author_profile": "https://wordpress.stackexchange.com/users/145725", "pm_score": 3, "selected": true, "text": "<p>I hope it's not too late, but anyway, I know it will help someone else.</p>\n\n<p><code>echo get_quer...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292066", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39063/" ]
I'm using WooCommerce v3.2.6 and WordPress 4.9.1. I've added an endpoint to the WooCommerce myaccount area (`view-subscription`): ``` function my_custom_endpoints() { add_rewrite_endpoint( 'view-subscription', EP_ROOT | EP_PAGES ); } add_action( 'init', 'my_custom_endpoints' ); function my_custom_query_vars( $va...
I hope it's not too late, but anyway, I know it will help someone else. `echo get_query_var('your-endpoint');` So, for your code, it will be: `echo get_query_var('view-subscription');`
292,075
<p>I'm trying to redirect customers, who are not logged in, when they push the "proceed to checkout button" on my cart page but nothing happens.</p> <p>Here's my code:</p> <pre><code>function custom_redirect_checkout(){ if ( !is_user_logged_in() ){ wp_redirect( 'https://www.domain.co/login/', 301 ); exit; } }...
[ { "answer_id": 306721, "author": "Guhéry Rocourt", "author_id": 145725, "author_profile": "https://wordpress.stackexchange.com/users/145725", "pm_score": 3, "selected": true, "text": "<p>I hope it's not too late, but anyway, I know it will help someone else.</p>\n\n<p><code>echo get_quer...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292075", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135481/" ]
I'm trying to redirect customers, who are not logged in, when they push the "proceed to checkout button" on my cart page but nothing happens. Here's my code: ``` function custom_redirect_checkout(){ if ( !is_user_logged_in() ){ wp_redirect( 'https://www.domain.co/login/', 301 ); exit; } } add_filter( 'woocom...
I hope it's not too late, but anyway, I know it will help someone else. `echo get_query_var('your-endpoint');` So, for your code, it will be: `echo get_query_var('view-subscription');`
292,090
<p>I'm attempting to design a theme for which all posts are always visible in a grid layout, using <code>index.php</code> as my single template. Even accessing a URL matching a single post would display all posts, only with the one matching the URL being highlighted in some way.</p> <p>This works like a charm on the h...
[ { "answer_id": 292120, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 0, "selected": false, "text": "<p>Testing with a standard install and twentysixteen, the problem lies within WP::parse_request. With your <code>...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292090", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135491/" ]
I'm attempting to design a theme for which all posts are always visible in a grid layout, using `index.php` as my single template. Even accessing a URL matching a single post would display all posts, only with the one matching the URL being highlighted in some way. This works like a charm on the homepage (`http://exam...
I ended up using the request filter, just like in the [documentation](https://codex.wordpress.org/Plugin_API/Filter_Reference/request): ``` function filterRequest( $request ) { global $single_post_slug; $dummy_query = new WP_Query(); // the query isn't run if we don't pass any query vars $dummy_query->pa...
292,095
<p>Is any easy method to remove all html comment like <code>&lt;!-- wp_head()--&gt;</code> from source from every pages and posts? Maybe using functions.php? Is any easy method without plugin?</p>
[ { "answer_id": 292100, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 2, "selected": false, "text": "<p>Here's a quick way to remove all comments using output buffering and <a href=\"https://secure.php.ne...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292095", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133900/" ]
Is any easy method to remove all html comment like `<!-- wp_head()-->` from source from every pages and posts? Maybe using functions.php? Is any easy method without plugin?
Here's a quick way to remove all comments using output buffering and [`preg_replace`](https://secure.php.net/manual/en/function.preg-replace.php). We hook in before WordPress starts outputting the HTML to start the buffer. Then we hook in after WordPress stops outputting the HTML to get the buffer and strip the HTML co...
292,105
<p>I have a custom plugin, that creates an admin settings page, with 3 fields:</p> <p>postIDs, pageIDs and Message.</p> <p>I am trying to grab the first post displayed on the homepage list and add the contents of the field "message" to the beginning of the content. I'm doing this within a plugin, and I can't work ou...
[ { "answer_id": 292099, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>The <a href=\"https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect\" rel=\"nofollow noreferre...
2018/01/24
[ "https://wordpress.stackexchange.com/questions/292105", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111198/" ]
I have a custom plugin, that creates an admin settings page, with 3 fields: postIDs, pageIDs and Message. I am trying to grab the first post displayed on the homepage list and add the contents of the field "message" to the beginning of the content. I'm doing this within a plugin, and I can't work out how to hook into...
The earliest action you can use is 'wp'. You can read more about it here: [Action WP](https://codex.wordpress.org/Plugin_API/Action_Reference/wp).
292,149
<p>I am in the process of building a membership/subscription based site for a client of mine and they are using woocommerce subscriptions (<a href="https://woocommerce.com/products/woocommerce-subscriptions" rel="nofollow noreferrer">https://woocommerce.com/products/woocommerce-subscriptions</a>). Now the problem is th...
[ { "answer_id": 292099, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>The <a href=\"https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect\" rel=\"nofollow noreferre...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110204/" ]
I am in the process of building a membership/subscription based site for a client of mine and they are using woocommerce subscriptions (<https://woocommerce.com/products/woocommerce-subscriptions>). Now the problem is the client is building a few promo pages which basically allows the user to purchase an upgrade. Now, ...
The earliest action you can use is 'wp'. You can read more about it here: [Action WP](https://codex.wordpress.org/Plugin_API/Action_Reference/wp).
292,151
<p>I have a custom PHP template - form. I'm trying to send this form in the same page using AJAX without reloading the page. Hide the form after submission and display the <code>thank you</code> message. This form is displayed in a modal. But what happens is that the page is still reloading.</p> <p><strong>HTML</stron...
[ { "answer_id": 292167, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 1, "selected": false, "text": "<p>Your jQuery event is bound to elements with the class <code>submit</code>, but your submit button in the form ...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292151", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54602/" ]
I have a custom PHP template - form. I'm trying to send this form in the same page using AJAX without reloading the page. Hide the form after submission and display the `thank you` message. This form is displayed in a modal. But what happens is that the page is still reloading. **HTML** ``` <form method="POST" action...
Your jQuery event is bound to elements with the class `submit`, but your submit button in the form doesn't have that class. Either add that class to the submit button, or just target the form itself. Simply change ``` $(".button").click(function() { ``` to ``` $("#modalForm").submit(function() { ``` This will fi...
292,164
<p>The AJAX, which is part of Elasticpress, looks like this</p> <pre><code>$.ajax( { url: epas.endpointUrl, type: 'GET', dataType: 'json', crossDomain: true, data: JSON.stringify( query ) } ); </code></pre> <p>Additionally I registered my endpoint</p> <pre><code>add_action( 'rest_api_init', funct...
[ { "answer_id": 292174, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 4, "selected": true, "text": "<p>After some inspecting the <a href=\"https://developer.wordpress.org/reference/classes/wp_rest_reques...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22534/" ]
The AJAX, which is part of Elasticpress, looks like this ``` $.ajax( { url: epas.endpointUrl, type: 'GET', dataType: 'json', crossDomain: true, data: JSON.stringify( query ) } ); ``` Additionally I registered my endpoint ``` add_action( 'rest_api_init', function ( $data ) { register_rest_rou...
After some inspecting the [WP\_REST\_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/), it turned out, that the `get_body()` method was the one I'm looking for. Anyhow, this is what I ended up with: ``` add_action( 'rest_api_init', function() { register_rest_route( 'ep', '/as/', [ ...
292,188
<p>I've been working with Custom Post Types and Custom Taxonomies for ages but one thing I can never get right are the rewrites when applying a shared taxonomy to multiple CPTs.</p> <p>For instance, I have CPTs for 'Events' and 'Courses'. Each has individual taxonomies and also one shared taxonomy.</p> <p>The individ...
[ { "answer_id": 292185, "author": "swissspidy", "author_id": 12404, "author_profile": "https://wordpress.stackexchange.com/users/12404", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/HTTP_API\" rel=\"nofollow noreferrer\">The WordPress HTTP API</a> ha...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292188", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/121233/" ]
I've been working with Custom Post Types and Custom Taxonomies for ages but one thing I can never get right are the rewrites when applying a shared taxonomy to multiple CPTs. For instance, I have CPTs for 'Events' and 'Courses'. Each has individual taxonomies and also one shared taxonomy. The individual taxonomies wo...
The WordPress site was mostly working without a problem except in a dashboard section of the site, where it was having some issues with updating or installing. When I tried to install theme,it gave me error **"Installation failed: Download failed. No working transports found".** Fortunately, i fixed the problem with f...
292,201
<p>A client's website runs on the theme 'enfold' which features the "Enfold Advanced Layout Editor". Currently that editor is broken – probably due to old version vs php or something. Anyways – trying to resolve the issue I was looking at the actual database tables and some 20 empty lines below the content of the page ...
[ { "answer_id": 292185, "author": "swissspidy", "author_id": 12404, "author_profile": "https://wordpress.stackexchange.com/users/12404", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/HTTP_API\" rel=\"nofollow noreferrer\">The WordPress HTTP API</a> ha...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292201", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26059/" ]
A client's website runs on the theme 'enfold' which features the "Enfold Advanced Layout Editor". Currently that editor is broken – probably due to old version vs php or something. Anyways – trying to resolve the issue I was looking at the actual database tables and some 20 empty lines below the content of the page I f...
The WordPress site was mostly working without a problem except in a dashboard section of the site, where it was having some issues with updating or installing. When I tried to install theme,it gave me error **"Installation failed: Download failed. No working transports found".** Fortunately, i fixed the problem with f...
292,209
<p>Here is the real picture I want to produce. </p> <pre><code> &lt;ul&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt; &lt;/li&gt; &lt;li&gt; &lt;/li&gt; ###NOT HERE ### &lt;/ul&gt; &lt;/Ii&gt; ###I want to add some html here ### &lt;/ul&gt; </code></pre> <p>I ...
[ { "answer_id": 292185, "author": "swissspidy", "author_id": 12404, "author_profile": "https://wordpress.stackexchange.com/users/12404", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/HTTP_API\" rel=\"nofollow noreferrer\">The WordPress HTTP API</a> ha...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292209", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120824/" ]
Here is the real picture I want to produce. ``` <ul> <li> <ul> <li> </li> <li> </li> ###NOT HERE ### </ul> </Ii> ###I want to add some html here ### </ul> ``` I am trying as follows: ``` public function end_lvl( &$output, $depth = 0, $args = array()...
The WordPress site was mostly working without a problem except in a dashboard section of the site, where it was having some issues with updating or installing. When I tried to install theme,it gave me error **"Installation failed: Download failed. No working transports found".** Fortunately, i fixed the problem with f...
292,235
<p>I'm new to WP templating and I'm trying to create my own custom WP theme from a single page bootstrap theme. To My problem is so particular, per say (hoping I don't get yelled at for this), I'm having a hard time finding solutions for my problem. </p> <p>I am just making a simple theme with a portfolio page. All m...
[ { "answer_id": 292697, "author": "D. Dan", "author_id": 133528, "author_profile": "https://wordpress.stackexchange.com/users/133528", "pm_score": 0, "selected": false, "text": "<p>To implement a Custom Lightbox solution yourself you need:</p>\n\n<ul>\n<li>A thumbnail image</li>\n<li>An a...
2018/01/25
[ "https://wordpress.stackexchange.com/questions/292235", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/113393/" ]
I'm new to WP templating and I'm trying to create my own custom WP theme from a single page bootstrap theme. To My problem is so particular, per say (hoping I don't get yelled at for this), I'm having a hard time finding solutions for my problem. I am just making a simple theme with a portfolio page. All my files ar...
I got the answer from someone else and got it working. To summarize, the problem was not having the right use of WP functions to call the custom post thumbnail image dynamically. Hence the BueggetteBox.js plugin (a lightbox plugin) functionality would work properly when you clicked on a custom post thumbnail from the g...