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
282,919
<p>I currently use the form below :</p> <pre><code>&lt;form role="search" method="get" class="search-form" action="&lt;?php echo home_url( '/' ); ?&gt;"&gt; &lt;input type="search" class="search-field" placeholder="&lt;?php echo esc_attr_x( 'Type Business or Town', 'placeholder' ) ?&gt;" value="&lt;?php echo ...
[ { "answer_id": 283168, "author": "Misha Rudrastyh", "author_id": 85985, "author_profile": "https://wordpress.stackexchange.com/users/85985", "pm_score": 2, "selected": false, "text": "<p>I think you can do it in two following steps:</p>\n\n<ol>\n<li><p>In HTML code just add a dropdown wi...
2017/10/14
[ "https://wordpress.stackexchange.com/questions/282919", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62291/" ]
I currently use the form below : ``` <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> <input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Type Business or Town', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" title=...
After Misha answered above, a lightbulb came on which lead me to understand something a little more, this is the form which is now working as expected using wp\_dropdown\_categories and some args. I had previously done it this way, but it seems the main problem previously was that it was searching for the ID in the U...
282,920
<p>How I can remove all internal or external links on my posts at once? just remove link and leave anchor text.</p>
[ { "answer_id": 282923, "author": "Dejan Gavrilovic", "author_id": 129636, "author_profile": "https://wordpress.stackexchange.com/users/129636", "pm_score": 0, "selected": false, "text": "<p>Target your links with some CSS. In default twentyseventeen theme it's</p>\n\n<pre><code>.entry-co...
2017/10/14
[ "https://wordpress.stackexchange.com/questions/282920", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/83204/" ]
How I can remove all internal or external links on my posts at once? just remove link and leave anchor text.
Not sure about the database but you can do it easily with `the_content` filter, just add the code below to your current (child) theme `functions.php` file: ``` add_filter( 'the_content', 'misha_remove_all_a' ); function misha_remove_all_a( $content ){ return preg_replace('#<a.*?>(.*?)</a>#is', '\1', $content); }...
282,929
<p>I want to add Google Analytics code snippet between the <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> tags of some relevant pages of my WordPress website. Adding the code snippet to the header.php file will affect all the pages of the website what I do not want. How should I proceed?</p>
[ { "answer_id": 282930, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 2, "selected": false, "text": "<p>The header.php is the right place, but you'll need one more thing: a condition. This way you can decide on whi...
2017/10/14
[ "https://wordpress.stackexchange.com/questions/282929", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129204/" ]
I want to add Google Analytics code snippet between the `<head>` and `</head>` tags of some relevant pages of my WordPress website. Adding the code snippet to the header.php file will affect all the pages of the website what I do not want. How should I proceed?
While you can add the snippet directly to `header.php`, a better choice is probably the `wp_head` action which should be triggered in any well-made, modern theme. Using this hook allows you to insert the snippet without actually modifying your theme. It might look something like this: ``` function wpse_282929_conditi...
282,940
<p>I have created <strong>custom Post type</strong>. Now I am using <strong>excerpt</strong> to show some limited words in the archive page. but I am showing same posts on the homepage in a <strong>content slider (Owl Carousel)</strong> which is giving me problem cuz <strong>excerpt size</strong>. </p> <ol> <li><p>So,...
[ { "answer_id": 282930, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 2, "selected": false, "text": "<p>The header.php is the right place, but you'll need one more thing: a condition. This way you can decide on whi...
2017/10/14
[ "https://wordpress.stackexchange.com/questions/282940", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128689/" ]
I have created **custom Post type**. Now I am using **excerpt** to show some limited words in the archive page. but I am showing same posts on the homepage in a **content slider (Owl Carousel)** which is giving me problem cuz **excerpt size**. 1. So, I have decided to use **first 160 words of the post** to show on th...
While you can add the snippet directly to `header.php`, a better choice is probably the `wp_head` action which should be triggered in any well-made, modern theme. Using this hook allows you to insert the snippet without actually modifying your theme. It might look something like this: ``` function wpse_282929_conditi...
282,953
<p>I am developing a Custom wordpress theme. In my home page I have created a custom loop to show latest posts in a grid view.. I am trying to add a pagination there and the pagination shows also. But the pagination is loading same posts grids every time. This loop has also counter added where I wanted to add advertise...
[ { "answer_id": 282973, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>If you need an \"inner loop\" pagination, you should use your own query variable to \"carry\" the number ...
2017/10/14
[ "https://wordpress.stackexchange.com/questions/282953", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109213/" ]
I am developing a Custom wordpress theme. In my home page I have created a custom loop to show latest posts in a grid view.. I am trying to add a pagination there and the pagination shows also. But the pagination is loading same posts grids every time. This loop has also counter added where I wanted to add advertisemen...
Between your question and comments, you say that the purpose of changing the main query is to exclude the most recent post from the main loop on your static home page, becuase it is being displayed as a "hero" post on its own before the rest. The easiest way to do this is actually using the main loop, and use the `pre...
283,001
<p>The below is just a scenario to provide context so you understand what im trying to accomplish, However please keep your answers related to the title if possible and a css solution/function. </p> <p>I have a podcast site that im working on. And i have "next" and "prev" buttons on the podcast post pages that take th...
[ { "answer_id": 283002, "author": "L.Milo", "author_id": 129596, "author_profile": "https://wordpress.stackexchange.com/users/129596", "pm_score": 1, "selected": false, "text": "<p>From the context of your question I understand that you don't use <code>next_post_link</code> and <code>prev...
2017/10/15
[ "https://wordpress.stackexchange.com/questions/283001", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110570/" ]
The below is just a scenario to provide context so you understand what im trying to accomplish, However please keep your answers related to the title if possible and a css solution/function. I have a podcast site that im working on. And i have "next" and "prev" buttons on the podcast post pages that take the user in ...
From the context of your question I understand that you don't use `next_post_link` and `previous_post_link` for the implementation of the *Next* and *Prev* buttons, so you have to use CSS to hide them appropriately. `next_post_link` and `previous_post_link` simply don't display the links if the current post is the las...
283,086
<pre><code>$args = array( 'post_type' =&gt; 'events', 'order' =&gt; 'ASC', ); $wp_query = new WP_Query($args); ?&gt; &lt;script type="application/ld+json"&gt; { "@context":"http://schema.org", "@type":"ItemList", "itemListElement":[ &lt;?php while ( have_posts() ) : the_post(); ?&gt; ...
[ { "answer_id": 283002, "author": "L.Milo", "author_id": 129596, "author_profile": "https://wordpress.stackexchange.com/users/129596", "pm_score": 1, "selected": false, "text": "<p>From the context of your question I understand that you don't use <code>next_post_link</code> and <code>prev...
2017/10/16
[ "https://wordpress.stackexchange.com/questions/283086", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129093/" ]
``` $args = array( 'post_type' => 'events', 'order' => 'ASC', ); $wp_query = new WP_Query($args); ?> <script type="application/ld+json"> { "@context":"http://schema.org", "@type":"ItemList", "itemListElement":[ <?php while ( have_posts() ) : the_post(); ?> { "@type":"ListI...
From the context of your question I understand that you don't use `next_post_link` and `previous_post_link` for the implementation of the *Next* and *Prev* buttons, so you have to use CSS to hide them appropriately. `next_post_link` and `previous_post_link` simply don't display the links if the current post is the las...
283,109
<p>In the list of posts in the 'All Posts' screen, is there a way to display both date -and- time in the Date column? If you hover over the date, the time is part of abbr tag title, but I'd like to display the time, directly. I see that I could unset the current Date column and put in a custom Date column. Just wond...
[ { "answer_id": 283113, "author": "Milan Petrovic", "author_id": 126702, "author_profile": "https://wordpress.stackexchange.com/users/126702", "pm_score": 0, "selected": false, "text": "<p>You can do it with some JavaScript:</p>\n\n<pre><code>jQuery(\".column-date abbr\").each(function(){...
2017/10/16
[ "https://wordpress.stackexchange.com/questions/283109", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94243/" ]
In the list of posts in the 'All Posts' screen, is there a way to display both date -and- time in the Date column? If you hover over the date, the time is part of abbr tag title, but I'd like to display the time, directly. I see that I could unset the current Date column and put in a custom Date column. Just wondering ...
Add this code to `functions.php` of your active theme: ``` function wpse_posts_list_date_format( $time, $post ) { return $post->post_date; } add_filter( 'post_date_column_time', 'wpse_posts_list_date_format', 10, 2 ); ``` The callback function receives 4 parameters, but we need only 2.
283,115
<p>Using gravity forms as a front end file up-loader, users can upload gallery images via a form which then saves to a ACF ( advanced custom forms ) gallery field.</p> <p>It works to a point, the form uploads the images and they are stored in gravity form entry (you can view the images just fine). </p> <p>The second ...
[ { "answer_id": 283157, "author": "Marcelo Henriques Cortez", "author_id": 44437, "author_profile": "https://wordpress.stackexchange.com/users/44437", "pm_score": 0, "selected": false, "text": "<p>I had a similiar problem and found a solution for my specific problem using 'media_handle_up...
2017/10/16
[ "https://wordpress.stackexchange.com/questions/283115", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62291/" ]
Using gravity forms as a front end file up-loader, users can upload gallery images via a form which then saves to a ACF ( advanced custom forms ) gallery field. It works to a point, the form uploads the images and they are stored in gravity form entry (you can view the images just fine). The second part of the code ...
An even easier option is to use my [Gravity Forms Media Library](https://gravitywiz.com/documentation/gravity-forms-media-library/) plugin. Here's the meat and potatoes of the functionality: ``` public function maybe_upload_to_media_library( $entry, $form ) { $has_change = false; foreach( $form['fields'] as ...
283,127
<p>I'm trying to make home widgets 1, 2, and 3 appear horizontally next to one another. Currently, they are propagating on top of each other, rather than next to each other. I've coded the widgets to include some external links, a facebook link, and a donation link. Unfortunately, this is a project for a class and incl...
[ { "answer_id": 283147, "author": "Anson W Han", "author_id": 129547, "author_profile": "https://wordpress.stackexchange.com/users/129547", "pm_score": 1, "selected": false, "text": "<p>The widgets are rendered as 'divs' in the html, which by default appear as blocks that would stack as y...
2017/10/16
[ "https://wordpress.stackexchange.com/questions/283127", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm trying to make home widgets 1, 2, and 3 appear horizontally next to one another. Currently, they are propagating on top of each other, rather than next to each other. I've coded the widgets to include some external links, a facebook link, and a donation link. Unfortunately, this is a project for a class and include...
Use `CSS3 flexbox` to control layout of widgets. First, wrap widget divisions in a container division `<div class="widgets-container">`. Add a unique class to each widget division ( in our example: *widget-1*, *widget-2*, and *widget-3* ). Example code: ``` <div class="widgets-container"> <div class="widget-1"> ...
283,130
<p>The Featured Image Box is not showing inside the WP admin area for my custom post type (in normal post it does).</p> <p>Things i've already done: <strong>add the theme support</strong> within action hook with <code>after_setup_theme</code></p> <pre><code>// Register Theme Features function custom_theme_features() ...
[ { "answer_id": 283478, "author": "Ray Gulick", "author_id": 30, "author_profile": "https://wordpress.stackexchange.com/users/30", "pm_score": 0, "selected": false, "text": "<p>Do you have a template tag on your listing page?</p>\n\n<p>Template tag for listing page:\nget_the_post_thumbnai...
2017/10/16
[ "https://wordpress.stackexchange.com/questions/283130", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129738/" ]
The Featured Image Box is not showing inside the WP admin area for my custom post type (in normal post it does). Things i've already done: **add the theme support** within action hook with `after_setup_theme` ``` // Register Theme Features function custom_theme_features() { // Add theme support for Post Formats...
I think it's possible the 2 separate enabling statements may be interfering with each other. The purpose of having an array is to combine them into one enabling statement. Try the following in your functions file. Instead of: ``` add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails', array( ...
283,135
<p>I'm not exactly sure of the best way to ask what I am trying to achieve, so I'm going to describe it here. If someone can identify a more succinct way to ask this, or if it's been answered in a different way, please let me know!</p> <p>For example sake, I going to describe a photographer's WordPress site, where the...
[ { "answer_id": 283478, "author": "Ray Gulick", "author_id": 30, "author_profile": "https://wordpress.stackexchange.com/users/30", "pm_score": 0, "selected": false, "text": "<p>Do you have a template tag on your listing page?</p>\n\n<p>Template tag for listing page:\nget_the_post_thumbnai...
2017/10/16
[ "https://wordpress.stackexchange.com/questions/283135", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129742/" ]
I'm not exactly sure of the best way to ask what I am trying to achieve, so I'm going to describe it here. If someone can identify a more succinct way to ask this, or if it's been answered in a different way, please let me know! For example sake, I going to describe a photographer's WordPress site, where there would b...
I think it's possible the 2 separate enabling statements may be interfering with each other. The purpose of having an array is to combine them into one enabling statement. Try the following in your functions file. Instead of: ``` add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails', array( ...
283,138
<p>This is my code for showing categories on post meta:</p> <pre><code>$categories_list = get_the_category_list( ', ', 'ixn' ); printf( '&lt;span class="cat-links"&gt;' . ( 'Category: %1$s', 'ixn' ) . '&lt;/span&gt;', $categories_list ); </code></pre> <p>('ixn' is the theme name)</p> <p>Is there a simple way to hi...
[ { "answer_id": 283478, "author": "Ray Gulick", "author_id": 30, "author_profile": "https://wordpress.stackexchange.com/users/30", "pm_score": 0, "selected": false, "text": "<p>Do you have a template tag on your listing page?</p>\n\n<p>Template tag for listing page:\nget_the_post_thumbnai...
2017/10/17
[ "https://wordpress.stackexchange.com/questions/283138", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80031/" ]
This is my code for showing categories on post meta: ``` $categories_list = get_the_category_list( ', ', 'ixn' ); printf( '<span class="cat-links">' . ( 'Category: %1$s', 'ixn' ) . '</span>', $categories_list ); ``` ('ixn' is the theme name) Is there a simple way to hide a specific category, called "site" from th...
I think it's possible the 2 separate enabling statements may be interfering with each other. The purpose of having an array is to combine them into one enabling statement. Try the following in your functions file. Instead of: ``` add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails', array( ...
283,161
<p>How i can restrict portion of post/page content when user bought specific product?</p> <p>for example:</p> <pre><code> some content ... [wcm_restrict product_id="5"] this content only show for users that bought product 5 [/wcm_restrict] ... some other content </code></pre> <p>I trie...
[ { "answer_id": 283202, "author": "Reza Ramezanpour", "author_id": 129731, "author_profile": "https://wordpress.stackexchange.com/users/129731", "pm_score": 3, "selected": true, "text": "<p>Well, I answering my question.</p>\n\n<p>As @Milan Petrovic mentioned in comments, it's easy to do....
2017/10/17
[ "https://wordpress.stackexchange.com/questions/283161", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129731/" ]
How i can restrict portion of post/page content when user bought specific product? for example: ``` some content ... [wcm_restrict product_id="5"] this content only show for users that bought product 5 [/wcm_restrict] ... some other content ``` I tried many plug-ins unfortunately doe...
Well, I answering my question. As @Milan Petrovic mentioned in comments, it's easy to do. just creating shortcode and check if user bought specific product. Here is the code: ``` /** * [wcr_shortcode description] * @param array pid product id from short code * @return content shortcode content if us...
283,172
<p>Programmatically, I want to activate / deactivate a plugin of this specific blog/site in a WordPress Multisite. Any help will be gladly appreciated, thank you!</p>
[ { "answer_id": 283182, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 3, "selected": true, "text": "<p>Use a combination of <code>switch_to_blog()</code>, <code>activate_plugins()</code>, and <code>deactivate_...
2017/10/17
[ "https://wordpress.stackexchange.com/questions/283172", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106934/" ]
Programmatically, I want to activate / deactivate a plugin of this specific blog/site in a WordPress Multisite. Any help will be gladly appreciated, thank you!
Use a combination of `switch_to_blog()`, `activate_plugins()`, and `deactivate_plugins()`. You can put this in functions.php, but you'll want to remove it once it runs: ``` // hook to admin init add_action('admin_init', 'wpse_swap_plugins'); function wpse_swap_plugins() { // set blog ID per your needs $blog_i...
283,227
<p>I'm not sure if im going about this the right way or not, seems to be alot of people doing this, but with completely different ways of doing it from queries in templates to functions so im not sure which route to go down. </p> <p>I have a custom post type (business) which has featured posts, Each of these posts h...
[ { "answer_id": 283266, "author": "FluffyKitten", "author_id": 63360, "author_profile": "https://wordpress.stackexchange.com/users/63360", "pm_score": 2, "selected": true, "text": "<p>You have a couple of issues with the code you are trying. </p>\n\n<p><strong>To check the query is for yo...
2017/10/17
[ "https://wordpress.stackexchange.com/questions/283227", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62291/" ]
I'm not sure if im going about this the right way or not, seems to be alot of people doing this, but with completely different ways of doing it from queries in templates to functions so im not sure which route to go down. I have a custom post type (business) which has featured posts, Each of these posts have a "featu...
You have a couple of issues with the code you are trying. **To check the query is for your CPT archive**: You are using `$query->is_post_type()` but it doesn't work (as far as I know, its not even a function). Instead you can use either: ``` if (is_post_type_archive('business')) {...} ``` *or* (if its not only on ...
283,228
<p>I try to query custom post type called <code>news</code> by a category called <code>Alumni</code> with <code>ID=160</code>.</p> <p>When I use such arguments, as a result, I get all my custom posts <strong>without</strong> <code>Alumni</code> category:</p> <pre><code>$args = array( 'posts_per_page' =&gt; -1, 'p...
[ { "answer_id": 283230, "author": "Randomer11", "author_id": 62291, "author_profile": "https://wordpress.stackexchange.com/users/62291", "pm_score": 0, "selected": false, "text": "<p>Have you tried using something like this in the array, Had a similar problem earlier which this solved. <...
2017/10/17
[ "https://wordpress.stackexchange.com/questions/283228", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116478/" ]
I try to query custom post type called `news` by a category called `Alumni` with `ID=160`. When I use such arguments, as a result, I get all my custom posts **without** `Alumni` category: ``` $args = array( 'posts_per_page' => -1, 'post_type' => 'news', 'orderby' => 'date', 'order' => 'DESC', 'category__not...
Are these custom taxonomies or the regular categories? if they are just categories you should use: ``` $args = array( 'posts_per_page' => -1, 'post_type' => 'news', 'orderby' => 'date', 'order' => 'DESC', 'category_name' => 'Alumni' ); $loop = new WP_Query( $args ); <?php while ( $loop->have_posts() ) : $l...
283,239
<p>I need the site footer to sit across the bottom of the site at all times.</p> <p>Currently, it sits across the site bottom when there is content on the page, but with no content on the page it (.site-footer) rises from the bottom to the middle of the visible page as represented in this image:</p> <p><kbd> <a href=...
[ { "answer_id": 283240, "author": "Kelly", "author_id": 94686, "author_profile": "https://wordpress.stackexchange.com/users/94686", "pm_score": 4, "selected": true, "text": "<p>A quick search shows this question has been asked and answered many times.</p>\n\n<p>From StackOverflow: <a href...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283239", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94686/" ]
I need the site footer to sit across the bottom of the site at all times. Currently, it sits across the site bottom when there is content on the page, but with no content on the page it (.site-footer) rises from the bottom to the middle of the visible page as represented in this image: `[![Footer in the middle of the...
A quick search shows this question has been asked and answered many times. From StackOverflow: [Make footer stick to bottom of page correctly](https://stackoverflow.com/questions/3443606/make-footer-stick-to-bottom-of-page-correctly) From StackOverflow: [How to get the footer to stick to the bottom of your web page.]...
283,256
<p>I've built my own custom 'recent posts' widget to display some more content than the default core WP recent posts widget does. I'm struggling with controlling my list of entries. Currently, the widget always returns 1 additional post to the list selected. So if I select 1 post to show, it will actually show 2, and s...
[ { "answer_id": 283285, "author": "Anson W Han", "author_id": 129547, "author_profile": "https://wordpress.stackexchange.com/users/129547", "pm_score": 1, "selected": false, "text": "<p>Anytime you call WP_Query, be sure to filter for only published posts. \nAlso as a general guide, for a...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283256", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105819/" ]
I've built my own custom 'recent posts' widget to display some more content than the default core WP recent posts widget does. I'm struggling with controlling my list of entries. Currently, the widget always returns 1 additional post to the list selected. So if I select 1 post to show, it will actually show 2, and so f...
Anytime you call WP\_Query, be sure to filter for only published posts. Also as a general guide, for any custom queries that you expect or could have more than one result for, try to always pass arguments for: 1. Publish status 2. Limit / number of results 3. Field to sort by 4. Sort order Refer to the codex page (<...
283,291
<pre><code>wp_enqueue_style( 'style', THEMEROOT . '/css/style.css' ); wp_enqueue_style( 'responsive', THEMEROOT . '/css/responsive.css' ); </code></pre> <p>I am using the above method to enqueue stylesheet, but what I want is not achieved.</p> <p>Whatever I write in <code>responsive.css</code> should be prioritized(tha...
[ { "answer_id": 283292, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 4, "selected": true, "text": "<p>If you want to make sure the second stylesheet loads after the first, you can use the third argument of <code>w...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283291", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
``` wp_enqueue_style( 'style', THEMEROOT . '/css/style.css' ); wp_enqueue_style( 'responsive', THEMEROOT . '/css/responsive.css' ); ``` I am using the above method to enqueue stylesheet, but what I want is not achieved. Whatever I write in `responsive.css` should be prioritized(that means CSS written here should ove...
If you want to make sure the second stylesheet loads after the first, you can use the third argument of `wp_enqueue_style` to set a dependency, eg: ``` wp_enqueue_style( 'styles', THEMEROOT . '/css/style.css', array() ); wp_enqueue_style( 'responsive', THEMEROOT . '/css/responsive.css', array('styles') ); ``` As for...
283,294
<p>I create a custom field to a image gallery called <strong>views</strong></p> <p><a href="https://i.stack.imgur.com/hGeTJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hGeTJ.jpg" alt="enter image description here"></a></p> <p>My problem is how can I retrieve the field in my template gallery? Se...
[ { "answer_id": 283292, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 4, "selected": true, "text": "<p>If you want to make sure the second stylesheet loads after the first, you can use the third argument of <code>w...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283294", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129841/" ]
I create a custom field to a image gallery called **views** [![enter image description here](https://i.stack.imgur.com/hGeTJ.jpg)](https://i.stack.imgur.com/hGeTJ.jpg) My problem is how can I retrieve the field in my template gallery? See img, I'd like to display **views** below caption where the red arrow is pointin...
If you want to make sure the second stylesheet loads after the first, you can use the third argument of `wp_enqueue_style` to set a dependency, eg: ``` wp_enqueue_style( 'styles', THEMEROOT . '/css/style.css', array() ); wp_enqueue_style( 'responsive', THEMEROOT . '/css/responsive.css', array('styles') ); ``` As for...
283,309
<p>i have a little big problem with meta queries. I Designed a query to retrieve posts where any of these words exists in the custom field pickup_address. the field has this string in its meta value: 43 Longview Drive, Papamoa</p> <p><strong>EDIT</strong></p> <p>this is the meta query that Im using:</p> <pre><code>$...
[ { "answer_id": 283292, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 4, "selected": true, "text": "<p>If you want to make sure the second stylesheet loads after the first, you can use the third argument of <code>w...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283309", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129847/" ]
i have a little big problem with meta queries. I Designed a query to retrieve posts where any of these words exists in the custom field pickup\_address. the field has this string in its meta value: 43 Longview Drive, Papamoa **EDIT** this is the meta query that Im using: ``` $args = array( 'post_type' => 'posts', ...
If you want to make sure the second stylesheet loads after the first, you can use the third argument of `wp_enqueue_style` to set a dependency, eg: ``` wp_enqueue_style( 'styles', THEMEROOT . '/css/style.css', array() ); wp_enqueue_style( 'responsive', THEMEROOT . '/css/responsive.css', array('styles') ); ``` As for...
283,316
<p>I'm of the understanding that Wordpress' .htaccess, like below:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; # END W...
[ { "answer_id": 283318, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 1, "selected": false, "text": "<p>It calls <code>index.php</code>, not <code>index.php?page=..</code>.</p>\n\n<p>I'm not sure how WordPress does...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283316", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27866/" ]
I'm of the understanding that Wordpress' .htaccess, like below: ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress ``` sends all q...
It's not really rewriting the URL in the conventional sense, URL parsing happens entirely within PHP. You can access the query vars in the global `$wp_query->query_vars`, or with the [`get_query_var`](https://codex.wordpress.org/Function_Reference/get_query_var) function. Also note that [`parse_request`](https://code...
283,331
<p>Want to enforce the visitor to load the new version of your stylesheets and scripts</p>
[ { "answer_id": 283332, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 2, "selected": false, "text": "<p>Sounds like you are talking about cachebusting. Changing the querystring makes the browser interpret the URL ...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283331", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64554/" ]
Want to enforce the visitor to load the new version of your stylesheets and scripts
If you want to enforce the visitor to load the new version of your stylesheets and scripts, then (as @majick suggested) changing the version via query string is the way to go. This is just how the caching works. My suggestion would be to make sure you update the theme version on every major, or crucial CSS and JS upda...
283,334
<p>Someone very kindly helped me out on another question, which has now lead to this problem of two functions causing a database error. From what I've read it could have something to do with <code>LEFT JOIN</code> and/or no <code>wp_reset_query()</code> or <code>wp_reset_postdata()</code>. The error I'm getting is ...
[ { "answer_id": 283348, "author": "Milan Petrovic", "author_id": 126702, "author_profile": "https://wordpress.stackexchange.com/users/126702", "pm_score": 4, "selected": true, "text": "<p>You JOIN two elements both with the same table. When you need to join one table more than once, you n...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283334", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62291/" ]
Someone very kindly helped me out on another question, which has now lead to this problem of two functions causing a database error. From what I've read it could have something to do with `LEFT JOIN` and/or no `wp_reset_query()` or `wp_reset_postdata()`. The error I'm getting is : ``` WordPress database error: [Not un...
You JOIN two elements both with the same table. When you need to join one table more than once, you need to make each join unique by giving the table alias. When WP makes the whole query, it takes that into account, but you have added your own code that doesn't do that. So, first function: ``` function cf_search_join...
283,342
<p>Im trying to update my front end post form which allows me to save my custom taxonomy parent term, but now I need to save the child term that's selected.</p> <p>NHB is for Neighborhood which are child terms for the city-type taxonomy. Here's my code on top for the relevant fields -- </p> <pre><code> $city_type = w...
[ { "answer_id": 283962, "author": "Tom", "author_id": 3482, "author_profile": "https://wordpress.stackexchange.com/users/3482", "pm_score": 2, "selected": false, "text": "<p>With saving child terms, I believe you can add them to the <code>$term_array</code> group where the parent lives. F...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283342", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24067/" ]
Im trying to update my front end post form which allows me to save my custom taxonomy parent term, but now I need to save the child term that's selected. NHB is for Neighborhood which are child terms for the city-type taxonomy. Here's my code on top for the relevant fields -- ``` $city_type = wp_get_object_terms($P...
Ok I figured it out using @TomMorton suggestion. I had to updated my code to this which updates the terms -- ``` $city_for_update = get_term_by('slug', $city_type_value, 'city-type'); $term_array = array(); while ($city_for_update->parent != 0) { $city_for_update = get_term_by('id', $city_for_update->parent, 'ci...
283,352
<p>I have a problem with a WordPress hook. I want to call an action in another actions callback, but it doesn't seem to work. I want to call <code>add_meta_tag</code> action only if the page is saved. This is what I have:</p> <pre><code>function saveCustomField($post_id) { add_action( 'wp_head', 'add_meta_tag' ); ...
[ { "answer_id": 283361, "author": "Greg36", "author_id": 64017, "author_profile": "https://wordpress.stackexchange.com/users/64017", "pm_score": 0, "selected": false, "text": "<p>The <code>save_post</code> hook is fired after the data is saved to the database - whenever post or page is cr...
2017/10/18
[ "https://wordpress.stackexchange.com/questions/283352", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129869/" ]
I have a problem with a WordPress hook. I want to call an action in another actions callback, but it doesn't seem to work. I want to call `add_meta_tag` action only if the page is saved. This is what I have: ``` function saveCustomField($post_id) { add_action( 'wp_head', 'add_meta_tag' ); } add_action( 'save_post'...
You're thinking about this entirely wrong. A meta tag isn't something you add when a post gets saved, it's something that gets added to the output when a post is *viewed*. So instead of trying to hook the action inside `save_post`, you hook it on every page load, and *inside* the hook you check if your custom field ex...
283,386
<p>Please assist, I am trying to load this Jquery on my Wordpress website with no luck.</p> <p>I have used this script just BEFORE the <code>&lt;/body&gt;</code> tag in my functions.php :</p> <pre><code>&lt;script type="text/javascript" src="&lt;?php bloginfo("template_url"); ?&gt;/js/menu-hover.js"&gt;&lt;/script...
[ { "answer_id": 283416, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 1, "selected": false, "text": "<ol>\n<li><a href=\"https://pippinsplugins.com/why-loading-your-own-jquery-is-irresponsible/\" rel=\"nofol...
2017/10/19
[ "https://wordpress.stackexchange.com/questions/283386", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129843/" ]
Please assist, I am trying to load this Jquery on my Wordpress website with no luck. I have used this script just BEFORE the `</body>` tag in my functions.php : ``` <script type="text/javascript" src="<?php bloginfo("template_url"); ?>/js/menu-hover.js"></script> ``` I have used this code in the of my functions....
1. [Don't enqueue your own version of jQuery](https://pippinsplugins.com/why-loading-your-own-jquery-is-irresponsible/). You're just going to cause conflict issues with other plugins and there's nothing in your script that requires a different version. 2. Even if you were, [just load the https:// version](https://twitt...
283,393
<p>I'm really new to php editing but I'm trying to learn. My woocommerce products that are set to "hidden" under catalog visibility are still showing up under search results. How do I keep hidden products out of my search results? I found this thread (<a href="https://wordpress.stackexchange.com/questions/231118/wp-que...
[ { "answer_id": 283397, "author": "Milan Petrovic", "author_id": 126702, "author_profile": "https://wordpress.stackexchange.com/users/126702", "pm_score": 2, "selected": false, "text": "<p>This code can't be added anywhere you want, and it can't be added to functions.php or any other php ...
2017/10/19
[ "https://wordpress.stackexchange.com/questions/283393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129888/" ]
I'm really new to php editing but I'm trying to learn. My woocommerce products that are set to "hidden" under catalog visibility are still showing up under search results. How do I keep hidden products out of my search results? I found this thread ([WP\_Query: Exclude hidden products from WooCommerce product list](http...
This code can't be added anywhere you want, and it can't be added to functions.php or any other php file like this. This is a element for the array used to create the WordPress query object. It has to be added via WP\_Query class or get\_posts and query\_posts functions, or via the filter to modify the main page query....
283,405
<p>I know that there are a few ways of doing this but for everything that I have tried I can only manage to get the first category. For example:</p> <pre><code>&lt;?php echo get_the_category_list(); ?&gt; </code></pre> <p>Only shows one. Like:</p> <pre><code>&lt;?php foreach((get_the_category()) as $category){ ...
[ { "answer_id": 283406, "author": "Dejan Gavrilovic", "author_id": 129636, "author_profile": "https://wordpress.stackexchange.com/users/129636", "pm_score": 0, "selected": false, "text": "<p>This code should work.\nPlease check if you have post assigned to your categories.\nCategory shoul...
2017/10/19
[ "https://wordpress.stackexchange.com/questions/283405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115742/" ]
I know that there are a few ways of doing this but for everything that I have tried I can only manage to get the first category. For example: ``` <?php echo get_the_category_list(); ?> ``` Only shows one. Like: ``` <?php foreach((get_the_category()) as $category){ echo $category->name."<br>"; e...
It should be noted that both ``` <?php echo get_the_category_list(); ?> ``` and ``` <?php foreach((get_the_category()) as $category){ echo $category->name."<br>"; echo category_description($category); } ?> ``` display ALL categories that are assigned to the current post in the loop...
283,453
<p>I want to query posts using the <code>get_posts()</code> function and am having trouble getting the query to work properly. The <code>$country</code>, <code>$us_state</code>, <code>$ca_state</code>, <code>$mx_state</code> values will be pulled from a Gravity Forms entry.</p> <p>Here is the query:</p> <pre><code>$p...
[ { "answer_id": 283406, "author": "Dejan Gavrilovic", "author_id": 129636, "author_profile": "https://wordpress.stackexchange.com/users/129636", "pm_score": 0, "selected": false, "text": "<p>This code should work.\nPlease check if you have post assigned to your categories.\nCategory shoul...
2017/10/19
[ "https://wordpress.stackexchange.com/questions/283453", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58519/" ]
I want to query posts using the `get_posts()` function and am having trouble getting the query to work properly. The `$country`, `$us_state`, `$ca_state`, `$mx_state` values will be pulled from a Gravity Forms entry. Here is the query: ``` $post_type = 'reps'; $state_meta_key = 'rep_state'; $country_meta_key = 'rep_c...
It should be noted that both ``` <?php echo get_the_category_list(); ?> ``` and ``` <?php foreach((get_the_category()) as $category){ echo $category->name."<br>"; echo category_description($category); } ?> ``` display ALL categories that are assigned to the current post in the loop...
283,463
<p>I am trying to get the tags from the post (there will only be one tag), then create a new variable with that tag name but with the spaces replaced with dashes. </p> <p>This is what a have so far, but I cannot get it to display the value of the tag (both with spaces and without) instead of "Array". In the code below...
[ { "answer_id": 283464, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 1, "selected": false, "text": "<p>If you use <code>str_replace</code> on an array, you get an array back. So <code>$newname</code> is right...
2017/10/19
[ "https://wordpress.stackexchange.com/questions/283463", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119096/" ]
I am trying to get the tags from the post (there will only be one tag), then create a new variable with that tag name but with the spaces replaced with dashes. This is what a have so far, but I cannot get it to display the value of the tag (both with spaces and without) instead of "Array". In the code below, I'm only...
Lets break this apart using your question title: > > Get the tags as an array, convert the tag into a string, and then replace spaces with dash > > > Get the tags as an array ------------------------ `get_the_tags` is the correct function, you now have one of 2 things: * an array of term objects ( a tag is a te...
283,504
<p>I'm fairly new to WordPress and I'm trying to figure out how to best set up permissions. </p> <p>I want to restrict groups of people to only edit certain pages (IT department to only edit IT pages, HR department to only edit HR pages and so on). </p> <p>From what I've read you take away permissions to 'edit others...
[ { "answer_id": 283464, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 1, "selected": false, "text": "<p>If you use <code>str_replace</code> on an array, you get an array back. So <code>$newname</code> is right...
2017/10/20
[ "https://wordpress.stackexchange.com/questions/283504", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128158/" ]
I'm fairly new to WordPress and I'm trying to figure out how to best set up permissions. I want to restrict groups of people to only edit certain pages (IT department to only edit IT pages, HR department to only edit HR pages and so on). From what I've read you take away permissions to 'edit others pages' from a ro...
Lets break this apart using your question title: > > Get the tags as an array, convert the tag into a string, and then replace spaces with dash > > > Get the tags as an array ------------------------ `get_the_tags` is the correct function, you now have one of 2 things: * an array of term objects ( a tag is a te...
283,528
<p>I'm adding custom options to my theme using the customizer api. For example:</p> <pre><code>$wp_customize-&gt;add_setting( 'header_textcolor' , array( 'default' =&gt; '#000000' ) ); $wp_customize-&gt;add_setting( 'footer_textcolor' , array( 'default' =&gt; '#333333' ) ); </code></pre> <p>Is it possibl...
[ { "answer_id": 283551, "author": "Misha Rudrastyh", "author_id": 85985, "author_profile": "https://wordpress.stackexchange.com/users/85985", "pm_score": 0, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>$all_settings = get_theme_mods();\nprint_r( $all_settings );\n</code></pr...
2017/10/20
[ "https://wordpress.stackexchange.com/questions/283528", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111085/" ]
I'm adding custom options to my theme using the customizer api. For example: ``` $wp_customize->add_setting( 'header_textcolor' , array( 'default' => '#000000' ) ); $wp_customize->add_setting( 'footer_textcolor' , array( 'default' => '#333333' ) ); ``` Is it possible to return an array of all my custom ...
Yes. You can get an array of all registered settings via `$wp_customize->settings()`. If you want to display them all you could do this: ``` if ( is_customize_preview() ) { global $wp_customize; $theme_mods = array(); foreach ( $wp_customize->settings() as $setting ) { if ( 'theme_mod' === $setting...
283,546
<p>I am trying to implement auto set featured image from my post content and if there is no image in the post content then set a default featured image automatically..</p> <p>I have tried different code from different source but nothing seems to be working. My post content image is set from other source and these are ...
[ { "answer_id": 283548, "author": "Den Isahac", "author_id": 113233, "author_profile": "https://wordpress.stackexchange.com/users/113233", "pm_score": -1, "selected": false, "text": "<p>I guess this is something you're looking for, first it checks if post thumbnail is present, otherwise d...
2017/10/20
[ "https://wordpress.stackexchange.com/questions/283546", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109213/" ]
I am trying to implement auto set featured image from my post content and if there is no image in the post content then set a default featured image automatically.. I have tried different code from different source but nothing seems to be working. My post content image is set from other source and these are not hosted...
Ok guys.. I got it finally working with my below code. ``` function wpse55748_filter_post_thumbnail_html( $html ) { // If there is no post thumbnail, // Return a default image global $post; $pID = $post->ID; $thumb = 'large'; $imgsrc = FALSE; if (has_post_thumbnail()) { $imgsrc = ...
283,558
<p>I have created a dashboard widget and this widget will show content which i'll add from an specific page. So, i created a option page and made a textarea field with wordpress editor.</p> <pre><code>wp_editor(html_entity_decode(stripcslashes($widget_content)), 'widget_wp_content'); </code></pre> <p>But when i am ca...
[ { "answer_id": 283566, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": true, "text": "<p>You need to run it through <code>do_shortcode()</code>. <code>do_shortcode()</code> 'runs' any shortcode...
2017/10/20
[ "https://wordpress.stackexchange.com/questions/283558", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102820/" ]
I have created a dashboard widget and this widget will show content which i'll add from an specific page. So, i created a option page and made a textarea field with wordpress editor. ``` wp_editor(html_entity_decode(stripcslashes($widget_content)), 'widget_wp_content'); ``` But when i am calling this field value in ...
You need to run it through `do_shortcode()`. `do_shortcode()` 'runs' any shortcodes in text passed to it: ``` echo do_shortcode( html_entity_decode( stripslashes( $val['content'] ) ) ); ```
283,575
<p>I have a site-plugin to centralize most of the theme customization. I want to override the default <em>footer.php</em> template with a <em>customfooter.php</em> (removes the <em>Proudly Powered by WordPress</em>) stored inside the /plugins directory structure. I found <a href="https://wordpress.stackexchange.com/que...
[ { "answer_id": 283566, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": true, "text": "<p>You need to run it through <code>do_shortcode()</code>. <code>do_shortcode()</code> 'runs' any shortcode...
2017/10/21
[ "https://wordpress.stackexchange.com/questions/283575", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130012/" ]
I have a site-plugin to centralize most of the theme customization. I want to override the default *footer.php* template with a *customfooter.php* (removes the *Proudly Powered by WordPress*) stored inside the /plugins directory structure. I found [this resource on StackExchange](https://wordpress.stackexchange.com/que...
You need to run it through `do_shortcode()`. `do_shortcode()` 'runs' any shortcodes in text passed to it: ``` echo do_shortcode( html_entity_decode( stripslashes( $val['content'] ) ) ); ```
283,628
<p>I have created a child theme for my parent theme. Just added <code>style.css</code> and <code>functions.php</code> files in child theme.</p> <p>Original Theme Name: Verb Lite (Directory name verb-lite)</p> <p>I created new folder <code>verb-lite-child</code> in themes folder, added the following files.</p> <p><co...
[ { "answer_id": 283629, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 0, "selected": false, "text": "<p>There is wrong <code>$handle</code> for the parent theme you use. Change <code>parent-style</code> to <em>V...
2017/10/22
[ "https://wordpress.stackexchange.com/questions/283628", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114693/" ]
I have created a child theme for my parent theme. Just added `style.css` and `functions.php` files in child theme. Original Theme Name: Verb Lite (Directory name verb-lite) I created new folder `verb-lite-child` in themes folder, added the following files. `style.css` file ``` /* Theme Name: Verb Lite Child Them...
If I open syyle.css from original theme I see `*/ /* Themely is based off of Understrap which uses the Underscores starter theme merged with the Bootstrap Framework. The default styles can be found in /css/theme.css and /css.theme.min.css.` The styles loaded when I enqueued `theme.css` ad `theme.min.css` files. My...
283,664
<p>Why doesn't the <a href="https://developer.wordpress.org/reference/classes/wp_term_query/__construct/" rel="nofollow noreferrer">get_terms()</a> call return 10 max results as requested? I'm baffled.</p> <pre><code> $args = array( 'taxonomy' =&gt; 'video_tag', 'parent' =&gt; 0,...
[ { "answer_id": 283667, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 0, "selected": false, "text": "<p>Note this condition on the limit part of the <code>WP_Term_Query</code><a href=\"https://core.trac.wordpress....
2017/10/22
[ "https://wordpress.stackexchange.com/questions/283664", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50675/" ]
Why doesn't the [get\_terms()](https://developer.wordpress.org/reference/classes/wp_term_query/__construct/) call return 10 max results as requested? I'm baffled. ``` $args = array( 'taxonomy' => 'video_tag', 'parent' => 0, 'number' => 10 ); e...
So here's some info for any other people with this issue. `get_terms` will not use the `number` parameter under certain conditions, such as if you pass in a `parent` parameter or if the `hierarchical` parameter is `true`. In these cases I have tried two workarounds, neither very good. 1. You can call `get_terms` then...
283,743
<p>This is my first post here, I am very new to PHP so bare with me. </p> <p>I need to add USPS's variable shipping rates for priority mail based on cart total. I have tried plugins but none of them work right with the USPS shipping plugin client insists on using and I have maxed budget for buying any other plugins. <...
[ { "answer_id": 283690, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 2, "selected": false, "text": "<p>What's keeping you from using the <a href=\"https://docs.woocommerce.com/document/product-csv-importer-exporte...
2017/10/23
[ "https://wordpress.stackexchange.com/questions/283743", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129936/" ]
This is my first post here, I am very new to PHP so bare with me. I need to add USPS's variable shipping rates for priority mail based on cart total. I have tried plugins but none of them work right with the USPS shipping plugin client insists on using and I have maxed budget for buying any other plugins. I have cr...
What's keeping you from using the [officially documented way to import products from csv](https://docs.woocommerce.com/document/product-csv-importer-exporter/)? If you're running on an older version, there's [an extension](https://woocommerce.com/products/product-csv-import-suite/) that does the same thing.
283,828
<p>In order to avoid poor performance with multiple <code>&lt;script&gt;</code> tags I do concatenation of scripts regularly and produce one single <code>bundle.min.js</code> JS file and <code>'jsbundle'</code> identifier.</p> <p>Problem is, things added subsequently, like plugins, may depend on registered one or more...
[ { "answer_id": 284521, "author": "Levi Dulstein", "author_id": 101988, "author_profile": "https://wordpress.stackexchange.com/users/101988", "pm_score": 0, "selected": false, "text": "<p>The solution proposed by Alexander looks reasonable. You can keep all minified dependencies (libs.js ...
2017/10/24
[ "https://wordpress.stackexchange.com/questions/283828", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20317/" ]
In order to avoid poor performance with multiple `<script>` tags I do concatenation of scripts regularly and produce one single `bundle.min.js` JS file and `'jsbundle'` identifier. Problem is, things added subsequently, like plugins, may depend on registered one or more libraries that **are present**, but packed in ge...
To have the JavaScript Libraries not to load since you already created a bundle of them, do the following: Asumming the following, usual enqueue: ``` function the_js() { wp_enqueue_script('bundle_js', get_template_directory_uri() . '/js/bundle.js', array(), false, false); } add_action('wp_enqueue_scripts', 'the_...
283,830
<p>I want to loop my posts into a 2 column grid, but if there is an odd number of posts, there is an empty space on the even side of the grid. </p> <p>How could I get an image to appear in this empty space <em>only</em> if there are an odd number of posts? So it would be:</p> <pre><code>Post 1 | Post 2 Post 3 | img ...
[ { "answer_id": 284521, "author": "Levi Dulstein", "author_id": 101988, "author_profile": "https://wordpress.stackexchange.com/users/101988", "pm_score": 0, "selected": false, "text": "<p>The solution proposed by Alexander looks reasonable. You can keep all minified dependencies (libs.js ...
2017/10/24
[ "https://wordpress.stackexchange.com/questions/283830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54745/" ]
I want to loop my posts into a 2 column grid, but if there is an odd number of posts, there is an empty space on the even side of the grid. How could I get an image to appear in this empty space *only* if there are an odd number of posts? So it would be: ``` Post 1 | Post 2 Post 3 | img ``` I tried using [the co...
To have the JavaScript Libraries not to load since you already created a bundle of them, do the following: Asumming the following, usual enqueue: ``` function the_js() { wp_enqueue_script('bundle_js', get_template_directory_uri() . '/js/bundle.js', array(), false, false); } add_action('wp_enqueue_scripts', 'the_...
283,839
<p>I have created a custom posttype labeled 'Richards' using a site-specific plugin with the following code.</p> <pre><code>function add_richards_posttype() { $labels = array( 'name' =&gt; _x( 'Richards', 'Post Type General Name' ), 'singular_name' =&gt; _x( 'Richard', 'Post Ty...
[ { "answer_id": 283840, "author": "Tom", "author_id": 3482, "author_profile": "https://wordpress.stackexchange.com/users/3482", "pm_score": 0, "selected": false, "text": "<p>Permalinks may need to be refreshed. Once you've saved your code, head to WP-Admin > Settings > Permalinks and clic...
2017/10/24
[ "https://wordpress.stackexchange.com/questions/283839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130199/" ]
I have created a custom posttype labeled 'Richards' using a site-specific plugin with the following code. ``` function add_richards_posttype() { $labels = array( 'name' => _x( 'Richards', 'Post Type General Name' ), 'singular_name' => _x( 'Richard', 'Post Type Singular Name' ),...
This seems like a [similar question](https://wordpress.stackexchange.com/questions/243373/use-wordpress-page-instead-of-post-type-archive/243376#243376), but I'll also put it here. ``` 'has_archive' => 'richards' ``` Then flush permalinks (Settings > Permalinks).
283,867
<p>I want to compare two timestamps in a <code>meta_query</code> instead of <a href="https://wordpress.stackexchange.com/q/283851/25187">comparing two dates</a> in the "Y-m-d" format, each of them stored separately in custom fields, but no success. The first timestamp is an event start date/time, the second is the loca...
[ { "answer_id": 283872, "author": "Iurie", "author_id": 25187, "author_profile": "https://wordpress.stackexchange.com/users/25187", "pm_score": 3, "selected": true, "text": "<p>This is the magic: with timestamps, insteed of <code>'type' =&gt; 'DATE'</code> must be used <code>'type' =&gt; ...
2017/10/24
[ "https://wordpress.stackexchange.com/questions/283867", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25187/" ]
I want to compare two timestamps in a `meta_query` instead of [comparing two dates](https://wordpress.stackexchange.com/q/283851/25187) in the "Y-m-d" format, each of them stored separately in custom fields, but no success. The first timestamp is an event start date/time, the second is the local date/time, also as a ti...
This is the magic: with timestamps, insteed of `'type' => 'DATE'` must be used `'type' => 'NUMERIC'`.
283,874
<p>I want to authenticate against <em>both</em>:</p> <ul> <li>the WooCommerce consumer key, for system queries <em>and</em></li> <li>JSON Web Tokens (JWT), for user queries</li> </ul> <p>I have installed <a href="https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/" rel="nofollow noreferrer">JWT Authenti...
[ { "answer_id": 283961, "author": "lofidevops", "author_id": 31388, "author_profile": "https://wordpress.stackexchange.com/users/31388", "pm_score": 4, "selected": true, "text": "<p>Yes this is possible by structuring your requests appropriately.</p>\n\n<p>For system requests use OAuth 1....
2017/10/24
[ "https://wordpress.stackexchange.com/questions/283874", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31388/" ]
I want to authenticate against *both*: * the WooCommerce consumer key, for system queries *and* * JSON Web Tokens (JWT), for user queries I have installed [JWT Authentication for WP REST API](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/). But after activating the plugin, previously working querie...
Yes this is possible by structuring your requests appropriately. For system requests use OAuth 1.0 (consumer key as before), but encode it to include the OAuth credentials *in the URL* not in the headers. Having the OAuth credentials in the `Authorisation` header triggers the JWT error. ``` GET https://DOMAIN/wp-json...
283,890
<p>I want to get all posts from my custom post type in groups by posts of each year.</p> <ul> <li>2017 (5) </li> <li>2016 (9)</li> <li>2015 (7)</li> <li>2014 (19)</li> <li>2013 (3)</li> </ul>
[ { "answer_id": 284577, "author": "James", "author_id": 122472, "author_profile": "https://wordpress.stackexchange.com/users/122472", "pm_score": 0, "selected": false, "text": "<p>This should return an array of arrays, by year, with a count.</p>\n\n<pre><code>$args = [\n 'post_type' =&...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283890", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130230/" ]
I want to get all posts from my custom post type in groups by posts of each year. * 2017 (5) * 2016 (9) * 2015 (7) * 2014 (19) * 2013 (3)
You can get list with below code : ``` <?php wp_get_archives('type=yearly&format=option&post_type=resources&show_post_count=true'); ?> ```
283,893
<p>I loaded some contents by ajax, When i try something like this:</p> <pre><code>$resp = array( 'success' =&gt; true, 'data' =&gt; 'the content here' ); </code></pre> <p>it's working without any issues but if i used something like this:</p> <pre><code>$resp = array( 'success' =&gt; true, 'data' =&gt...
[ { "answer_id": 283896, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 4, "selected": true, "text": "<p><code>get_template_part()</code> includes the PHP file, which will break <code>$resp</code>. You need to...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283893", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125375/" ]
I loaded some contents by ajax, When i try something like this: ``` $resp = array( 'success' => true, 'data' => 'the content here' ); ``` it's working without any issues but if i used something like this: ``` $resp = array( 'success' => true, 'data' => get_template_part( 'templates/update', 'profile...
`get_template_part()` includes the PHP file, which will break `$resp`. You need to use [output buffering](http://php.net/manual/en/book.outcontrol.php) to capture the output into a variable: ``` ob_start(); get_template_part( 'templates/update', 'profile' ); $data = ob_get_clean(); $resp = array( 'success' => tru...
283,897
<p>I am going to develop WordPress theme using <a href="https://underscores.me/" rel="nofollow noreferrer">Underscores</a> and Bootstrap.</p> <p>So should I copy <a href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.css" rel="nofollow noreferrer">all bootstrap codes</a> in to style.css or shoul...
[ { "answer_id": 283903, "author": "Digvijayad", "author_id": 118765, "author_profile": "https://wordpress.stackexchange.com/users/118765", "pm_score": 2, "selected": true, "text": "<p>Neither, \nIn wordpress styles and scripts should be properly en-queued through your functions.php file r...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283897", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/123092/" ]
I am going to develop WordPress theme using [Underscores](https://underscores.me/) and Bootstrap. So should I copy [all bootstrap codes](https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.css) in to style.css or should I include it using `@import url("https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-b...
Neither, In wordpress styles and scripts should be properly en-queued through your functions.php file rather than hard-coding them in your html. The wordpress way of adding a new css file, be it `bootstrap.css` or any other is to use `wp_enqueue_scripts` hook. The following code should be in your theme's `function...
283,928
<p>I am developing a custom code in wordpress and in order to debug that I need to know if I can add custom text in wpdebug log Please help me if i can do it</p>
[ { "answer_id": 283903, "author": "Digvijayad", "author_id": 118765, "author_profile": "https://wordpress.stackexchange.com/users/118765", "pm_score": 2, "selected": true, "text": "<p>Neither, \nIn wordpress styles and scripts should be properly en-queued through your functions.php file r...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283928", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am developing a custom code in wordpress and in order to debug that I need to know if I can add custom text in wpdebug log Please help me if i can do it
Neither, In wordpress styles and scripts should be properly en-queued through your functions.php file rather than hard-coding them in your html. The wordpress way of adding a new css file, be it `bootstrap.css` or any other is to use `wp_enqueue_scripts` hook. The following code should be in your theme's `function...
283,965
<p>I have a custom HTML form with input types and checkboxes. When I submit this form I want to send a mail will all the form details from the same php. How do I send the email from WordPress? I am pretty new and would thank for ur help.</p>
[ { "answer_id": 283968, "author": "Tom", "author_id": 3482, "author_profile": "https://wordpress.stackexchange.com/users/3482", "pm_score": 4, "selected": true, "text": "<p><code>wp_mail</code> is the function you are looking for. </p>\n\n<p>You can take the posted form data (<code>$_POST...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283965", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130289/" ]
I have a custom HTML form with input types and checkboxes. When I submit this form I want to send a mail will all the form details from the same php. How do I send the email from WordPress? I am pretty new and would thank for ur help.
`wp_mail` is the function you are looking for. You can take the posted form data (`$_POST['email']`, for example) and then use it to build and execute the `wp_mail` function. The example below was taken from <https://developer.wordpress.org/reference/functions/wp_mail/#user-contributed-notes> ``` $to = $_POST['email...
283,971
<p>I am facing an issue when i use get_the_content() function. It displays the post content but the image in beginning of the content has some extra text around. My code is:</p> <pre><code>&lt;div class="thecontent" itemprop="articleBody"&gt; &lt;?php echo get_the_content(); ?&gt; &lt;/div&gt; </code></pre> <p>Ou...
[ { "answer_id": 283972, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 3, "selected": true, "text": "<p>To make sure the shortcode executes, save the content to a variable, then run <code>do_shortcode</code> on...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283971", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119633/" ]
I am facing an issue when i use get\_the\_content() function. It displays the post content but the image in beginning of the content has some extra text around. My code is: ``` <div class="thecontent" itemprop="articleBody"> <?php echo get_the_content(); ?> </div> ``` Output: [![enter image description here](htt...
To make sure the shortcode executes, save the content to a variable, then run `do_shortcode` on the saved variable. ``` <div class="thecontent" itemprop="articleBody"> <?php $content = get_the_content(); echo do_shortcode($content); ?> </div> ``` The difference is, echoing just literally echoes whatever has ...
283,988
<p>I am building a website for a public school district. All of our school buildings have common pages with the same name (i.e. Library, Nurse, Attendance, etc) that are nested under their parent building's page. While trying to update our site navigation, I've noticed that for some reason the Menus -> Pages -> View ...
[ { "answer_id": 285005, "author": "jaswrks", "author_id": 81760, "author_profile": "https://wordpress.stackexchange.com/users/81760", "pm_score": -1, "selected": false, "text": "<p>The function you're looking for is <a href=\"https://developer.wordpress.org/reference/functions/wp_list_pag...
2017/10/25
[ "https://wordpress.stackexchange.com/questions/283988", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43563/" ]
I am building a website for a public school district. All of our school buildings have common pages with the same name (i.e. Library, Nurse, Attendance, etc) that are nested under their parent building's page. While trying to update our site navigation, I've noticed that for some reason the Menus -> Pages -> View All a...
For those who run into this in the future, the issue was due to pagination and the parent appearing on a different page than the children. Removing pagination from the View All menu fixed the nesting. There is a [ticket](https://core.trac.wordpress.org/ticket/18282) opened 7 years ago reporting this bug and it has yet...
284,083
<p>a friend received a notification from her host about infected files and asked me to look at it. I don't know wordpress or php so I'm a little lost in what I am looking for. The is the websitescan.txt. I don't know what I am looking at, hoping someone could give me some direction as to what this report is saying a...
[ { "answer_id": 284086, "author": "Md. Amanur Rahman", "author_id": 109213, "author_profile": "https://wordpress.stackexchange.com/users/109213", "pm_score": -1, "selected": false, "text": "<p>Just Using FTP or File manager Delete these infected files.. Then login to wp admin and add Word...
2017/10/26
[ "https://wordpress.stackexchange.com/questions/284083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130359/" ]
a friend received a notification from her host about infected files and asked me to look at it. I don't know wordpress or php so I'm a little lost in what I am looking for. The is the websitescan.txt. I don't know what I am looking at, hoping someone could give me some direction as to what this report is saying and wha...
If you have a good full backup of your website, restore your site from it (recommended). Install and set up `WordFence` plugin (as in case of no backup). If you don't have good backup: Immediately delete all files from this list. Get a clean copy of your version of WordPress, and clean copy of your theme. Copy over e...
284,112
<p>I noticed that my edit post WP editor expands automatically when writing. However my WP editor instances I use for my other Custom post types don't.</p> <p>I investigated a bit I and I see that the iframe including the textarea in the built-in edit post has a body which has a "wp-autoresize" class. The ones of my c...
[ { "answer_id": 284465, "author": "Kumar", "author_id": 32466, "author_profile": "https://wordpress.stackexchange.com/users/32466", "pm_score": 3, "selected": true, "text": "<p>Finally I got around this.</p>\n\n<p>You need to modify tinymce args passed to wp_editor function. WordPress hav...
2017/10/26
[ "https://wordpress.stackexchange.com/questions/284112", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23404/" ]
I noticed that my edit post WP editor expands automatically when writing. However my WP editor instances I use for my other Custom post types don't. I investigated a bit I and I see that the iframe including the textarea in the built-in edit post has a body which has a "wp-autoresize" class. The ones of my custom post...
Finally I got around this. You need to modify tinymce args passed to wp\_editor function. WordPress have a argument `wp_autoresize_on` to allow the editor to be resized automatically. So instead of these: ``` 'tinymce' => array( 'toolbar1'=> 'bold,italic,underline,link,unlink,forecolor', 'toolbar2'...
284,122
<p>I'd like to develop pagination into my theme, FluX, as well as some other things, which I'll outline soon on GitHub. But pagination for my articles template is really high on the list. Can anyone tell me the best way to go about this? It needs to be number-based with buttons for previous and next, and work with the ...
[ { "answer_id": 284165, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>Most of pagination logic in core naturally deals with native data structures, such as post loops, comments, and so ...
2017/10/27
[ "https://wordpress.stackexchange.com/questions/284122", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130378/" ]
I'd like to develop pagination into my theme, FluX, as well as some other things, which I'll outline soon on GitHub. But pagination for my articles template is really high on the list. Can anyone tell me the best way to go about this? It needs to be number-based with buttons for previous and next, and work with the cur...
Paginations mostly rely on the global `$wp_query` variable to generate the data. Using `get_posts()` will not generate that, because it returns an array of posts, not an instance of the `WP_Query()` class itself. As a result, you don't have access to class's methods, such as `$query->max_num_pages`. You can use a plug...
284,146
<p>Our website is being flooded with thousands of page requests. The access logs looks like this:</p> <pre><code>**.**.250.*9 - - [24/Oct/2017:09:16:32 -0400] "GET /about-our-company/?screw-you HTTP/1.0" 200 14959 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko" **.**.250.*9 - - [24/Oct/2017...
[ { "answer_id": 284148, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 2, "selected": false, "text": "<p>First of all, report whoever is doing it.</p>\n\n<p>You obviously could block anything with a query-string tha...
2017/10/27
[ "https://wordpress.stackexchange.com/questions/284146", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130404/" ]
Our website is being flooded with thousands of page requests. The access logs looks like this: ``` **.**.250.*9 - - [24/Oct/2017:09:16:32 -0400] "GET /about-our-company/?screw-you HTTP/1.0" 200 14959 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko" **.**.250.*9 - - [24/Oct/2017:09:16:32 -040...
First of all, report whoever is doing it. You obviously could block anything with a query-string that contains `screw-you`, but that'll only help in this case. Maybe Drop any requests with HTTP/1.0 (browser don't use it, and "good" bots like google don't either, but if you need to provide access to special tools, you...
284,164
<p>The shop page of WooCommerce is based on the <code>archive-product.php</code> file. In this file, a loop is called: </p> <pre><code> &lt;?php woocommerce_product_loop_start(); ?&gt; &lt;?php woocommerce_product_subcategories(); ?&gt; &lt;?php while ( have_posts() ) : the_post(); ?&gt; ...
[ { "answer_id": 284171, "author": "BarrieO", "author_id": 129008, "author_profile": "https://wordpress.stackexchange.com/users/129008", "pm_score": 2, "selected": true, "text": "<p>The solution was for the following for <strong>the7 template</strong>:\n<a href=\"https://i.stack.imgur.com/...
2017/10/27
[ "https://wordpress.stackexchange.com/questions/284164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129008/" ]
The shop page of WooCommerce is based on the `archive-product.php` file. In this file, a loop is called: ``` <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php /...
The solution was for the following for **the7 template**: [![Solution](https://i.stack.imgur.com/up3GK.png)](https://i.stack.imgur.com/up3GK.png) If anybody knows how to implement this in the `functions.php` file so I don't have to update this when my theme updates, shoot!
284,177
<p>Any reason why wp_cache_set not to work? I have spun my wheels trying to figure out why these are not working. Any suggestions? These functions are supposed to help me cache the results to a key/object and then leverage the key/object to display the info. However, they are not storing key/object </p> <pre><code>$re...
[ { "answer_id": 284188, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 4, "selected": false, "text": "<p>The <code>wp_cache_*()</code> functions are non-persistent caches which means that they only last during th...
2017/10/27
[ "https://wordpress.stackexchange.com/questions/284177", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130304/" ]
Any reason why wp\_cache\_set not to work? I have spun my wheels trying to figure out why these are not working. Any suggestions? These functions are supposed to help me cache the results to a key/object and then leverage the key/object to display the info. However, they are not storing key/object ``` $related_post_i...
The `wp_cache_*()` functions are non-persistent caches which means that they only last during the current page request. This would be beneficial if you're requesting the same information multiple times during page load. For example, if you're showing recent posts in the header, content section, and sidebar ( calling th...
284,182
<p>Looking for possible solutions, because I'm pretty much lost as to why it happens.</p> <p>In WP Admin, all my pages, when I want to modify them, are OK. But one throws a 500 error.</p> <p>What could be the problem? The same code is loaded in all pages, AFAIK.</p> <p>So how can one 500, when the others are ok?</p>...
[ { "answer_id": 284184, "author": "Tex0gen", "author_id": 97070, "author_profile": "https://wordpress.stackexchange.com/users/97070", "pm_score": 2, "selected": false, "text": "<p>It means you have a PHP syntax error. You need to consult the logs or turn on debug mode. In wp-config.php in...
2017/10/27
[ "https://wordpress.stackexchange.com/questions/284182", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8895/" ]
Looking for possible solutions, because I'm pretty much lost as to why it happens. In WP Admin, all my pages, when I want to modify them, are OK. But one throws a 500 error. What could be the problem? The same code is loaded in all pages, AFAIK. So how can one 500, when the others are ok? Plugins are: * ACF * Cont...
It means you have a PHP syntax error. You need to consult the logs or turn on debug mode. In wp-config.php in your root wordpress directory, find the line as follows: ``` define( 'WP_DEBUG', false ); ``` and change it to: ``` define( 'WP_DEBUG', true ); ``` Refresh your page that appears blank to find the error....
284,234
<p><code>the_author_link()</code> displays author name with hyperlink. I only want authors link to display and not authors name with hyperlink. how i suppose to do that?. thanks</p>
[ { "answer_id": 284236, "author": "Temani Afif", "author_id": 128913, "author_profile": "https://wordpress.stackexchange.com/users/128913", "pm_score": 3, "selected": true, "text": "<p>You may consider using this function :</p>\n\n<pre><code>get_the_author_meta('url')\n</code></pre>\n\n<p...
2017/10/28
[ "https://wordpress.stackexchange.com/questions/284234", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125227/" ]
`the_author_link()` displays author name with hyperlink. I only want authors link to display and not authors name with hyperlink. how i suppose to do that?. thanks
You may consider using this function : ``` get_the_author_meta('url') ``` You can see [here](https://developer.wordpress.org/reference/functions/get_the_author_link/) the implementation of the function `get_the_author_link()` and you will see how they construct the link with name.
284,269
<p>I want to register a new css document that I'm storing inside a PHP file (so that I can create variable css rules). I tried doing this:</p> <pre><code>function tps_admin_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_register_script('admin-variable-style', $plugin_url.'css/style-variable.php'); wp_enqueue...
[ { "answer_id": 284270, "author": "Eckstein", "author_id": 23492, "author_profile": "https://wordpress.stackexchange.com/users/23492", "pm_score": 0, "selected": false, "text": "<p>That answer was to put this in my php file:</p>\n\n<pre><code>require_once('../../../../wp-load.php');\n</co...
2017/10/28
[ "https://wordpress.stackexchange.com/questions/284269", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23492/" ]
I want to register a new css document that I'm storing inside a PHP file (so that I can create variable css rules). I tried doing this: ``` function tps_admin_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_register_script('admin-variable-style', $plugin_url.'css/style-variable.php'); wp_enqueue_script('admin...
You could also look to create a special CSS file that you setup an htaccess rewrite rule for. For example `wp-content/yourtheme/custom.css` And then add a rule in your htaccess: ``` RewriteEngine On RewriteRule ^/wp-content/yourtheme/custom.css$ /wp-content/yourtheme/styles.php [L] ``` You can then call wp-load in...
284,283
<p>Is there any function to change the image Author(Uploaded By) in WordPress library?</p> <p><a href="https://i.stack.imgur.com/Ol1u8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ol1u8.jpg" alt="enter image description here"></a></p>
[ { "answer_id": 284290, "author": "shamim khan", "author_id": 98304, "author_profile": "https://wordpress.stackexchange.com/users/98304", "pm_score": 1, "selected": true, "text": "<p>You can use <a href=\"https://codex.wordpress.org/Function_Reference/wp_update_post\" rel=\"nofollow noref...
2017/10/29
[ "https://wordpress.stackexchange.com/questions/284283", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129715/" ]
Is there any function to change the image Author(Uploaded By) in WordPress library? [![enter image description here](https://i.stack.imgur.com/Ol1u8.jpg)](https://i.stack.imgur.com/Ol1u8.jpg)
You can use [wp\_update\_post()](https://codex.wordpress.org/Function_Reference/wp_update_post) ``` $my_post = array( 'ID' => $post_id, 'post_author' => $user_id, ); wp_update_post( $my_post ); ``` Or change image's author via a function using GravityForms uploader ``` add_action("gform_user_registered", "image_aut...
284,284
<p>I created a CPT with slug <code>plist</code> via cutom plugin I made.</p> <p>In my local host the archive work but in live server it return blank page.</p> <p>Here is the 'include' archive page code</p> <pre><code>/** * Add Price List archive template * @since 1.0.0 */ add_filter( 'archive_template', 'get_pl...
[ { "answer_id": 284290, "author": "shamim khan", "author_id": 98304, "author_profile": "https://wordpress.stackexchange.com/users/98304", "pm_score": 1, "selected": true, "text": "<p>You can use <a href=\"https://codex.wordpress.org/Function_Reference/wp_update_post\" rel=\"nofollow noref...
2017/10/29
[ "https://wordpress.stackexchange.com/questions/284284", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68492/" ]
I created a CPT with slug `plist` via cutom plugin I made. In my local host the archive work but in live server it return blank page. Here is the 'include' archive page code ``` /** * Add Price List archive template * @since 1.0.0 */ add_filter( 'archive_template', 'get_plist_archive_template' ) ; function get_...
You can use [wp\_update\_post()](https://codex.wordpress.org/Function_Reference/wp_update_post) ``` $my_post = array( 'ID' => $post_id, 'post_author' => $user_id, ); wp_update_post( $my_post ); ``` Or change image's author via a function using GravityForms uploader ``` add_action("gform_user_registered", "image_aut...
284,325
<p>I have the following domains/subdomains. They are all related to each other, yet they must be on different domains/subdomains</p> <pre><code>example.com www.example.com (redirects to example.com) sub1.example.com sub2.example.com example.net www.example.net (redirects to example.net) sub1.example.net sub2.ex...
[ { "answer_id": 284324, "author": "Jlil", "author_id": 83204, "author_profile": "https://wordpress.stackexchange.com/users/83204", "pm_score": 2, "selected": true, "text": "<p>You can do that using <a href=\"https://wordpress.org/plugins/custom-permalinks/\" rel=\"nofollow noreferrer\">Cu...
2017/10/29
[ "https://wordpress.stackexchange.com/questions/284325", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34253/" ]
I have the following domains/subdomains. They are all related to each other, yet they must be on different domains/subdomains ``` example.com www.example.com (redirects to example.com) sub1.example.com sub2.example.com example.net www.example.net (redirects to example.net) sub1.example.net sub2.example.net ```...
You can do that using [Custom Permalinks](https://wordpress.org/plugins/custom-permalinks/) Plugin, you need to add a full slug manually `[shows/2017/any]`. It also allow you customize your permalink: `[anyname/another/2017/example/slug]`. You should still using this plugin, if you deactivate it, all permalinks will ...
284,352
<p>My current theme comments are displayed using following code.</p> <pre><code> &lt;ol class="comment-list"&gt; &lt;?php wp_list_comments( array( 'style' =&gt; 'ol', 'short_ping' =&gt; true, ) ); ?&gt; ...
[ { "answer_id": 284353, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 0, "selected": false, "text": "<p>You could create your own walker and customize its structure. Note that using a filter will affect <em>\"al...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284352", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/123092/" ]
My current theme comments are displayed using following code. ``` <ol class="comment-list"> <?php wp_list_comments( array( 'style' => 'ol', 'short_ping' => true, ) ); ?> </ol> ``` I need to remove "a...
Deep down the function uses [`get_comment_author_link()`](https://developer.wordpress.org/reference/functions/get_comment_author_link/) to output the author name. That function is filterable. Inside the function it checks if the author has a URL and wraps the name in a link to it if it exists. We can use the `get_comme...
284,360
<p>Please assist. I have followed a tutorial to create a custom template with a sidebar. The sidebar has been implemented successfully and the page template is called "Custom page Template Wizard". The issue I am having is getting the sidebar to appear left and content on the right. The theme I am using is Ultra7</p> ...
[ { "answer_id": 284353, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 0, "selected": false, "text": "<p>You could create your own walker and customize its structure. Note that using a filter will affect <em>\"al...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284360", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129843/" ]
Please assist. I have followed a tutorial to create a custom template with a sidebar. The sidebar has been implemented successfully and the page template is called "Custom page Template Wizard". The issue I am having is getting the sidebar to appear left and content on the right. The theme I am using is Ultra7 The iss...
Deep down the function uses [`get_comment_author_link()`](https://developer.wordpress.org/reference/functions/get_comment_author_link/) to output the author name. That function is filterable. Inside the function it checks if the author has a URL and wraps the name in a link to it if it exists. We can use the `get_comme...
284,364
<p>I have been working with WordPress since last 5 years almost. But so far I didn't get a standard solution to secure a WordPress site.</p> <p>I have a clients hosting account which has 11 WordPress websites that keeps getting hacked every year almost. Even Finally I had to leave the Hostgator or they suspended that ...
[ { "answer_id": 284353, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 0, "selected": false, "text": "<p>You could create your own walker and customize its structure. Note that using a filter will affect <em>\"al...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284364", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109213/" ]
I have been working with WordPress since last 5 years almost. But so far I didn't get a standard solution to secure a WordPress site. I have a clients hosting account which has 11 WordPress websites that keeps getting hacked every year almost. Even Finally I had to leave the Hostgator or they suspended that account be...
Deep down the function uses [`get_comment_author_link()`](https://developer.wordpress.org/reference/functions/get_comment_author_link/) to output the author name. That function is filterable. Inside the function it checks if the author has a URL and wraps the name in a link to it if it exists. We can use the `get_comme...
284,381
<p>Is there any way to force to show the price of the Product Variation I set as defaul in product page settings, instead of lower and higher prices?</p> <p>I've got this code to show just one price, but the shown price is not the price of the default variation:</p> <pre><code>/******************************* SHO...
[ { "answer_id": 284739, "author": "Alexander Z.", "author_id": 123792, "author_profile": "https://wordpress.stackexchange.com/users/123792", "pm_score": 2, "selected": false, "text": "<p>This is solution for the minimal price as default for the variable products:</p>\n\n<pre><code>add_fil...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284381", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107273/" ]
Is there any way to force to show the price of the Product Variation I set as defaul in product page settings, instead of lower and higher prices? I've got this code to show just one price, but the shown price is not the price of the default variation: ``` /******************************* SHOW ONLY ONE PRICE FOR ...
Try this code: ``` add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2); function custom_variation_price( $price, $product ) { $available_variations = $product->get_available_variations(); $selectedPrice = ''; $dump = ''; foreach ( $available_variations as $variation ) { ...
284,428
<p>I'm not sure if this is specific to my site or not, but if anyone knows how to override this behavior, that would be most appreciated! I have WordPress installed in the root directory of my server. There is also an unrelated sub-directory we'll call 'restricted-dir'. I have added an .htaccess file inside that direct...
[ { "answer_id": 284739, "author": "Alexander Z.", "author_id": 123792, "author_profile": "https://wordpress.stackexchange.com/users/123792", "pm_score": 2, "selected": false, "text": "<p>This is solution for the minimal price as default for the variable products:</p>\n\n<pre><code>add_fil...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284428", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31889/" ]
I'm not sure if this is specific to my site or not, but if anyone knows how to override this behavior, that would be most appreciated! I have WordPress installed in the root directory of my server. There is also an unrelated sub-directory we'll call 'restricted-dir'. I have added an .htaccess file inside that directory...
Try this code: ``` add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2); function custom_variation_price( $price, $product ) { $available_variations = $product->get_available_variations(); $selectedPrice = ''; $dump = ''; foreach ( $available_variations as $variation ) { ...
284,431
<p>I'm currently using Sage 8.5.1 theme and have some password protected pages. The client would like to have the word "Protected" removed but not the title. I've used this code snippet </p> <pre><code>add_filter( 'protected_title_format', 'remove_protected_text' ); function remove_protected_text() { return __('%s...
[ { "answer_id": 284433, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 1, "selected": false, "text": "<p>You don't want to translate the title, so there's no need to use __() here and you won't translate '%s', becau...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284431", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/127349/" ]
I'm currently using Sage 8.5.1 theme and have some password protected pages. The client would like to have the word "Protected" removed but not the title. I've used this code snippet ``` add_filter( 'protected_title_format', 'remove_protected_text' ); function remove_protected_text() { return __('%s'); } ``` Bu...
You don't want to translate the title, so there's no need to use \_\_() here and you won't translate '%s', because that's a placeholder. ``` add_filter( 'protected_title_format', 'remove_protected_text' ); function remove_protected_text() { return '%s'; } ``` should work.
284,445
<p>The following code generates a label for a facet (<a href="https://electricgates.staging.wpengine.com/product-category/home-automation/?fwp_category=home-automation" rel="nofollow noreferrer">see sidebar</a>).</p> <p>I would like to add a conditional statement that prevents the label generation is the facet if empt...
[ { "answer_id": 284536, "author": "Tony M", "author_id": 71192, "author_profile": "https://wordpress.stackexchange.com/users/71192", "pm_score": 1, "selected": false, "text": "<p>Your code seems identical to FacetWP's. The only variable I can think of is code placement. You might not be p...
2017/10/30
[ "https://wordpress.stackexchange.com/questions/284445", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57057/" ]
The following code generates a label for a facet ([see sidebar](https://electricgates.staging.wpengine.com/product-category/home-automation/?fwp_category=home-automation)). I would like to add a conditional statement that prevents the label generation is the facet if empty. ``` $(document).on('facetwp-loaded', functi...
Your code seems identical to FacetWP's. The only variable I can think of is code placement. You might not be placing the code where it belongs (functions.php or a plugin). A quick fix would be adding their code to your theme's functions.php: ``` function fwp_add_facet_labels() { ?> <script> (function($) {...
284,508
<p>I am currently developing a website which needs user input on posts. An admin will feed the data and regular visitors can notify the errors/additions to specific post. I am using a hidden login form which contains a contributor username and password to let the public login to the admin and make necessary changes. It...
[ { "answer_id": 284536, "author": "Tony M", "author_id": 71192, "author_profile": "https://wordpress.stackexchange.com/users/71192", "pm_score": 1, "selected": false, "text": "<p>Your code seems identical to FacetWP's. The only variable I can think of is code placement. You might not be p...
2017/10/31
[ "https://wordpress.stackexchange.com/questions/284508", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130640/" ]
I am currently developing a website which needs user input on posts. An admin will feed the data and regular visitors can notify the errors/additions to specific post. I am using a hidden login form which contains a contributor username and password to let the public login to the admin and make necessary changes. Its a...
Your code seems identical to FacetWP's. The only variable I can think of is code placement. You might not be placing the code where it belongs (functions.php or a plugin). A quick fix would be adding their code to your theme's functions.php: ``` function fwp_add_facet_labels() { ?> <script> (function($) {...
284,518
<pre><code>\inc\admin\inc\images </code></pre> <p>In the admin, images are kept in the above path. say: <code>image_1.png</code></p> <p>I have to call these images in the Wordpress Post admin in the "<strong>Edit</strong>" mode.</p> <p>what is the correct method to include image source?</p> <p><strong>I am trying t...
[ { "answer_id": 284523, "author": "socki03", "author_id": 43511, "author_profile": "https://wordpress.stackexchange.com/users/43511", "pm_score": 0, "selected": false, "text": "<p>So, if your question is, how to include these images in a content area wysiwyg, then the answer is as simple...
2017/10/31
[ "https://wordpress.stackexchange.com/questions/284518", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
``` \inc\admin\inc\images ``` In the admin, images are kept in the above path. say: `image_1.png` I have to call these images in the Wordpress Post admin in the "**Edit**" mode. what is the correct method to include image source? **I am trying to fix it like this →** ``` 'img1' => '<img src="<?php echo get_templa...
Unfortunately your question is still unclear after all the explanations, but based on your efforts, I guess you need to pass the image's URL to a meta field or some sort of array. So, turning your current code into this will fix the issue: ``` 'img1' => '<img src="'.get_template_directory_uri().'/inc/admin/images/la...
284,533
<p>Take this basic query:</p> <pre><code>$posts = new WP_Query(array( 'post_type' =&gt; 'page' 's' =&gt; 'some search query' )); </code></pre> <p>WordPress will split the <code>some search query</code> into 3 separate search terms, which is why I need to make this $wpdb function. I want the same functionality...
[ { "answer_id": 284546, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>WordPress will split the some search query into 3 separate search\n terms, which is why I ne...
2017/10/31
[ "https://wordpress.stackexchange.com/questions/284533", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44937/" ]
Take this basic query: ``` $posts = new WP_Query(array( 'post_type' => 'page' 's' => 'some search query' )); ``` WordPress will split the `some search query` into 3 separate search terms, which is why I need to make this $wpdb function. I want the same functionality, but with the entire query treated as 1 se...
1. It seems that you in your INNER JOIN, you are joining on ``` wp_term_relationships.object_id == wp_posts.post_title ``` which is erroneous, since ***object\_id*** is the post-id in this case-scenario. *I want all IDs (post-ids)* ``` SELECT ID FROM $wpdb->posts ``` *Who have a record in the wp\_term\_relation...
284,556
<p>I'm facing a problem with wp ajax performance. I'm initializing an ajax call from my javascript side but the response takes 3-5 secs to come back. I understand that admin ajax call has to load the whole wp core and that would definitely be a performance hit for us. </p> <p>Is there a way to still use the admin ajax...
[ { "answer_id": 284546, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>WordPress will split the some search query into 3 separate search\n terms, which is why I ne...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284556", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125202/" ]
I'm facing a problem with wp ajax performance. I'm initializing an ajax call from my javascript side but the response takes 3-5 secs to come back. I understand that admin ajax call has to load the whole wp core and that would definitely be a performance hit for us. Is there a way to still use the admin ajax call, but...
1. It seems that you in your INNER JOIN, you are joining on ``` wp_term_relationships.object_id == wp_posts.post_title ``` which is erroneous, since ***object\_id*** is the post-id in this case-scenario. *I want all IDs (post-ids)* ``` SELECT ID FROM $wpdb->posts ``` *Who have a record in the wp\_term\_relation...
284,558
<pre><code>// This will replace the login url add_filter( 'login_url', 'custom_login_url', 10, 2 ); function custom_login_url( $login_url='http://www.example.com/login/', $redirect='http://www.example.com/login/' ) { // Set your $login_page_id return get_permalink(207); } </code></pre>
[ { "answer_id": 284546, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>WordPress will split the some search query into 3 separate search\n terms, which is why I ne...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284558", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130683/" ]
``` // This will replace the login url add_filter( 'login_url', 'custom_login_url', 10, 2 ); function custom_login_url( $login_url='http://www.example.com/login/', $redirect='http://www.example.com/login/' ) { // Set your $login_page_id return get_permalink(207); } ```
1. It seems that you in your INNER JOIN, you are joining on ``` wp_term_relationships.object_id == wp_posts.post_title ``` which is erroneous, since ***object\_id*** is the post-id in this case-scenario. *I want all IDs (post-ids)* ``` SELECT ID FROM $wpdb->posts ``` *Who have a record in the wp\_term\_relation...
284,561
<p>I want to add only 5 or 6 pages in my footer menu, but won't effect that into other menus like as header menu. Whole things need to do with coding not by using php.ini or .htaccess files.</p> <p><strong>Note:</strong> If anyone try to add more than 5 or 6 pages then it will not take without editing the code.</p> <...
[ { "answer_id": 284546, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>WordPress will split the some search query into 3 separate search\n terms, which is why I ne...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284561", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108591/" ]
I want to add only 5 or 6 pages in my footer menu, but won't effect that into other menus like as header menu. Whole things need to do with coding not by using php.ini or .htaccess files. **Note:** If anyone try to add more than 5 or 6 pages then it will not take without editing the code. thanks in advance.
1. It seems that you in your INNER JOIN, you are joining on ``` wp_term_relationships.object_id == wp_posts.post_title ``` which is erroneous, since ***object\_id*** is the post-id in this case-scenario. *I want all IDs (post-ids)* ``` SELECT ID FROM $wpdb->posts ``` *Who have a record in the wp\_term\_relation...
284,563
<p>I am going to move from Blogger to WordPress and I also don't want to set earlier Blogger Permalink structure in WordPress. Now I want to know if there is any way to redirect URLs as mentioned below.</p> <p>Current (In Blogger):</p> <pre><code>http://www.example.com/2017/10/seba-online-form-fill-up-2018.html </cod...
[ { "answer_id": 284565, "author": "Fernando Baltazar", "author_id": 10218, "author_profile": "https://wordpress.stackexchange.com/users/10218", "pm_score": 0, "selected": false, "text": "<p>Well, there are some Data base migrator plugins for that porpuse like <a href=\"https://wordpress.o...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284563", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am going to move from Blogger to WordPress and I also don't want to set earlier Blogger Permalink structure in WordPress. Now I want to know if there is any way to redirect URLs as mentioned below. Current (In Blogger): ``` http://www.example.com/2017/10/seba-online-form-fill-up-2018.html ``` After (In WordPress)...
If `/seba-online-form-fill-up-2018.html` is an actual WordPress URL then this is relatively trivial to do in `.htaccess`. For example, the following one-liner using mod\_rewrite could be used. This should be placed *before* the existing WordPress directives in `.htaccess`: ``` RewriteRule ^\d{4}/\d{1,2}/(.+\.html)$ /$...
284,566
<p>I've created a WP shortcode to list out pages which has controls to filter via category and also two layout formats. My issue is that the shortcode is not displaying all the pages that I have marked categories against. The 'box' layout is only showing 1 page and then the loop stops. The 'list' layout shows 3/4 pages...
[ { "answer_id": 284565, "author": "Fernando Baltazar", "author_id": 10218, "author_profile": "https://wordpress.stackexchange.com/users/10218", "pm_score": 0, "selected": false, "text": "<p>Well, there are some Data base migrator plugins for that porpuse like <a href=\"https://wordpress.o...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284566", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105819/" ]
I've created a WP shortcode to list out pages which has controls to filter via category and also two layout formats. My issue is that the shortcode is not displaying all the pages that I have marked categories against. The 'box' layout is only showing 1 page and then the loop stops. The 'list' layout shows 3/4 pages th...
If `/seba-online-form-fill-up-2018.html` is an actual WordPress URL then this is relatively trivial to do in `.htaccess`. For example, the following one-liner using mod\_rewrite could be used. This should be placed *before* the existing WordPress directives in `.htaccess`: ``` RewriteRule ^\d{4}/\d{1,2}/(.+\.html)$ /$...
284,568
<p>I am building a community site like medium.com.</p> <p>Instead of creating front-end form, I am going to change default role as Contributor or allow subscriber role to insert posts/ CPT....</p> <p>I need to know that, do I have to face security problems?</p>
[ { "answer_id": 284565, "author": "Fernando Baltazar", "author_id": 10218, "author_profile": "https://wordpress.stackexchange.com/users/10218", "pm_score": 0, "selected": false, "text": "<p>Well, there are some Data base migrator plugins for that porpuse like <a href=\"https://wordpress.o...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284568", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/123092/" ]
I am building a community site like medium.com. Instead of creating front-end form, I am going to change default role as Contributor or allow subscriber role to insert posts/ CPT.... I need to know that, do I have to face security problems?
If `/seba-online-form-fill-up-2018.html` is an actual WordPress URL then this is relatively trivial to do in `.htaccess`. For example, the following one-liner using mod\_rewrite could be used. This should be placed *before* the existing WordPress directives in `.htaccess`: ``` RewriteRule ^\d{4}/\d{1,2}/(.+\.html)$ /$...
284,595
<p>I want a certain subfolder excluded from being handled by WP with its 404 - page not found message.</p> <p>My problem is: </p> <ul> <li><code>example.com/Non_WP/myfile.html</code> - <strong>shows correctly</strong> </li> </ul> <p><em>but</em></p> <ul> <li><code>example.com/Non_WP/myfile.php</code> - will trigger...
[ { "answer_id": 284599, "author": "MrWhite", "author_id": 8259, "author_profile": "https://wordpress.stackexchange.com/users/8259", "pm_score": 0, "selected": false, "text": "<p>There's \"something else\" going on. Providing these two files exist (as you say they do) then you shouldn't ha...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284595", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130697/" ]
I want a certain subfolder excluded from being handled by WP with its 404 - page not found message. My problem is: * `example.com/Non_WP/myfile.html` - **shows correctly** *but* * `example.com/Non_WP/myfile.php` - will trigger a **WP 404-page not found** message. Both files, `myfile.html` and `myfile.php` exist i...
Well localized the problem (without understanding it so far) It was **not the .htaccess file**. It was **not plugins or themes** (which I deactivated all to see what happens) But my little php app had their own **session handling** and modified **the header**. Just simple textbook stuff (login etc..) which works fla...
284,606
<p>I have a problem with a custom WP_Query. The query args are:</p> <pre><code>$args = array( 'posts_per_page' =&gt; -1, 'post_type' =&gt; 'adressen', 'orderby' =&gt; 'title', 'order' =&gt; 'ASC', 'meta_query' =&gt; array( 'relation' =&gt; 'AND', array( ...
[ { "answer_id": 284599, "author": "MrWhite", "author_id": 8259, "author_profile": "https://wordpress.stackexchange.com/users/8259", "pm_score": 0, "selected": false, "text": "<p>There's \"something else\" going on. Providing these two files exist (as you say they do) then you shouldn't ha...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284606", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130709/" ]
I have a problem with a custom WP\_Query. The query args are: ``` $args = array( 'posts_per_page' => -1, 'post_type' => 'adressen', 'orderby' => 'title', 'order' => 'ASC', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'adresse_a...
Well localized the problem (without understanding it so far) It was **not the .htaccess file**. It was **not plugins or themes** (which I deactivated all to see what happens) But my little php app had their own **session handling** and modified **the header**. Just simple textbook stuff (login etc..) which works fla...
284,611
<p>Hi I am trying to enqueue bootstrap javascript file. But it depends on JQuery and Popper.js. So, I am loading PopperJS from CDN and I am mentioning both JQuery and PopperJS as dependencies on the Bootstrap enqueue. I am not enqueueing JQuery because if learned that Wordpress loads it if you just mention it as a depe...
[ { "answer_id": 284599, "author": "MrWhite", "author_id": 8259, "author_profile": "https://wordpress.stackexchange.com/users/8259", "pm_score": 0, "selected": false, "text": "<p>There's \"something else\" going on. Providing these two files exist (as you say they do) then you shouldn't ha...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130258/" ]
Hi I am trying to enqueue bootstrap javascript file. But it depends on JQuery and Popper.js. So, I am loading PopperJS from CDN and I am mentioning both JQuery and PopperJS as dependencies on the Bootstrap enqueue. I am not enqueueing JQuery because if learned that Wordpress loads it if you just mention it as a depende...
Well localized the problem (without understanding it so far) It was **not the .htaccess file**. It was **not plugins or themes** (which I deactivated all to see what happens) But my little php app had their own **session handling** and modified **the header**. Just simple textbook stuff (login etc..) which works fla...
284,622
<p>When number of posts on tag pages is less than 3. <br> I want to show more related or random posts, to fill max number of posts per page, which is 10.<br></p> <p>How to achieve that? Is it possible to check number of posts in loop within default wordpress loop? <br></p> <p>I use default wordpress loop which essent...
[ { "answer_id": 284629, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p>Yes, you can, although I would not recommend using random pages, as anything involving randomness is very ba...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284622", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/119931/" ]
When number of posts on tag pages is less than 3. I want to show more related or random posts, to fill max number of posts per page, which is 10. How to achieve that? Is it possible to check number of posts in loop within default wordpress loop? I use default wordpress loop which essentially looks like that....
There are two steps to get this working: 1. Add a counter to your main loop, so you can check how many posts are output. 2. If your counter is less than 3, run a second query and output. So for step 1, set a counter before your loop and increment it each time the loop runs, like so: ``` <?php // create your counter ...
284,635
<p>I am struggling to implement nonces through XML request to php backend using the Wordpress nonce validation when creating forms dynamically. I am ok with the form built version </p> <pre><code>wp_nonce_field( 'delete-comment_'.$comment_id ); </code></pre> <p>So I am trying to use the other nonce options when pass...
[ { "answer_id": 284648, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>The root problem is that none of your nonces match</p>\n\n<ul>\n<li><p>You create a nonce for: <code>'delete...
2017/11/01
[ "https://wordpress.stackexchange.com/questions/284635", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130700/" ]
I am struggling to implement nonces through XML request to php backend using the Wordpress nonce validation when creating forms dynamically. I am ok with the form built version ``` wp_nonce_field( 'delete-comment_'.$comment_id ); ``` So I am trying to use the other nonce options when passing via javascript localiza...
Okay, so I found a working solution which is as simple as I thought the whole process should be. The confusing Wordpress codex made things harder really. The creation and naming of the nonce is as simple as: `wp_create_nonce( 'example' );` This is passed though AJAX and localisation of the script to the PHP. T...
284,666
<p>I recently purchased a theme which includes the option to display a banner in the header. The banner can be displayed using either a static image or javascript. The particular javascript code I'm using is for an Amazon banner ad and is displayed on the frontend via an iframe.</p> <p>Using a static image the banner ...
[ { "answer_id": 285305, "author": "GDY", "author_id": 52227, "author_profile": "https://wordpress.stackexchange.com/users/52227", "pm_score": 0, "selected": false, "text": "<p>Just digged into this problem with dev tools. Somehow it gets computed with display none ... i don't know exactly...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284666", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68414/" ]
I recently purchased a theme which includes the option to display a banner in the header. The banner can be displayed using either a static image or javascript. The particular javascript code I'm using is for an Amazon banner ad and is displayed on the frontend via an iframe. Using a static image the banner displays c...
As already stated in my question, to display the banner ad a width has to be specified for the containing `.headad` element so the correctly sized image can be displayed. This is because the `.headad` element has `position:absolute` applied to it and so has no inherent width. The only way to display the banner ad acro...
284,683
<p>I have written a simple code to do something after a post is updated or published (its related to the varnish purge). I put my code inside post.php file. Everything was just fine before the latest update (4.8.3), after that all my codes were vanished!! of course it is a normal behavior because the post.php file has ...
[ { "answer_id": 284686, "author": "Jlil", "author_id": 83204, "author_profile": "https://wordpress.stackexchange.com/users/83204", "pm_score": 0, "selected": false, "text": "<pre><code>&lt;?php\nadd_action( 'save_post', 'varnish_purge' );\nfunction varnish_purge()\n{\n // code here\n} \n<...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284683", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/122813/" ]
I have written a simple code to do something after a post is updated or published (its related to the varnish purge). I put my code inside post.php file. Everything was just fine before the latest update (4.8.3), after that all my codes were vanished!! of course it is a normal behavior because the post.php file has bee...
You're looking for the `save_post` [action](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post). This allows you to add a function when a post is saved (updated). You can hook into it like this: ``` function your_save_post_function( $post_id ) { } add_action( 'save_post', 'your_save_post_function' ); ...
284,692
<p>I use a third party plugin that saves events locations addresses as a custom <em>locations</em> post type in a separate table - <em>wp_em_locations</em>. </p> <p>Because events are created by multiple authors, they write sometimes differently the name of the same town, using different languages. <strong>How can I f...
[ { "answer_id": 284686, "author": "Jlil", "author_id": 83204, "author_profile": "https://wordpress.stackexchange.com/users/83204", "pm_score": 0, "selected": false, "text": "<pre><code>&lt;?php\nadd_action( 'save_post', 'varnish_purge' );\nfunction varnish_purge()\n{\n // code here\n} \n<...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284692", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25187/" ]
I use a third party plugin that saves events locations addresses as a custom *locations* post type in a separate table - *wp\_em\_locations*. Because events are created by multiple authors, they write sometimes differently the name of the same town, using different languages. **How can I filter dynamically that names...
You're looking for the `save_post` [action](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post). This allows you to add a function when a post is saved (updated). You can hook into it like this: ``` function your_save_post_function( $post_id ) { } add_action( 'save_post', 'your_save_post_function' ); ...
284,696
<p>Is there a way to override woocommerce core functions in functions.php ?</p> <p>for example file location in: wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php</p> <p>there is a following public function</p> <pre><code>public function set_method_title( $value ) { $this-&gt;set_prop( 'nam...
[ { "answer_id": 284702, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 4, "selected": true, "text": "<p>You can't replace just any plugin function with your own code, <em>unless</em>:</p>\n\n<ol>\n<li>The plu...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78475/" ]
Is there a way to override woocommerce core functions in functions.php ? for example file location in: wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php there is a following public function ``` public function set_method_title( $value ) { $this->set_prop( 'name', wc_clean($value) ); $thi...
You can't replace just any plugin function with your own code, *unless*: 1. The plugin is wrapped in a `function_exists()` check. This makes the function *pluggable*, which means that if you define it first the plugin won't try to define it again, and yours will be used. This function is not pluggable. 2. There is a f...
284,699
<pre><code>if(have_posts()): while(have_posts()): the_post(); the_content(); endwhile; endif; </code></pre> <p>Without if condition this below code also works fine:</p> <pre><code>while(have_posts()): the_post(); the_content(); endwhile; </code></pre> <p>Thanks.</p>
[ { "answer_id": 284700, "author": "janh", "author_id": 129206, "author_profile": "https://wordpress.stackexchange.com/users/129206", "pm_score": 2, "selected": false, "text": "<p>You're right, it's not necessary. </p>\n\n<p>However, you'll often want to wrap your post-output in a <code>&l...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284699", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130750/" ]
``` if(have_posts()): while(have_posts()): the_post(); the_content(); endwhile; endif; ``` Without if condition this below code also works fine: ``` while(have_posts()): the_post(); the_content(); endwhile; ``` Thanks.
You only need the `if ( have_posts() ) :` if, as the name of the function suggets, you need to do something different if you don't have posts. This would be something like displaying a "No posts found." message. But you'd only need that on templates that *could* show no posts, like archives and search. For single post...
284,706
<p>Custom form is taking decimal but db inserts whole numbers but with a .0 behind. Why won't it give me the correct decimal number ?</p> <p>Db field</p> <pre><code> fiske_vaegt DECIMAL( 2,1 ) NOT NULL, </code></pre> <p>Form input field</p> <pre><code> &lt;p&gt;&lt;input type="number" step="any" name="fiske_v...
[ { "answer_id": 284708, "author": "sakibmoon", "author_id": 23214, "author_profile": "https://wordpress.stackexchange.com/users/23214", "pm_score": 3, "selected": true, "text": "<p>Within <code>$wpdb-&gt;insert</code>, you are using <code>%d</code> which is used to store integer, use <cod...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284706", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129518/" ]
Custom form is taking decimal but db inserts whole numbers but with a .0 behind. Why won't it give me the correct decimal number ? Db field ``` fiske_vaegt DECIMAL( 2,1 ) NOT NULL, ``` Form input field ``` <p><input type="number" step="any" name="fiske_vaegt" id="fiske_vaegt" />kg</p> ``` CHECK the fiske...
Within `$wpdb->insert`, you are using `%d` which is used to store integer, use `%f` instead which will store float/decimal values. ``` $registrering = $wpdb->insert( $wpdb->prefix . 'registreringer', array( 'fiske_vaegt' => $fiske_vaegt ), array( '%f' ) ); ```
284,719
<p>I get my posts of an cpt like this: <a href="http://www.mywebsite.com/wp-json/wp/v2/cpt" rel="nofollow noreferrer">http://www.mywebsite.com/wp-json/wp/v2/cpt</a></p> <p>at this posts there are shown post_meta values.</p> <p>Does anyone know a way to order the posts by the meta like this: <a href="http://www.mywebs...
[ { "answer_id": 284722, "author": "Isu", "author_id": 102934, "author_profile": "https://wordpress.stackexchange.com/users/102934", "pm_score": 1, "selected": false, "text": "<p>Since wordpress 4.7, it has build in Rest Api 2. And since then there is no args like that. \nSo you can write ...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284719", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130761/" ]
I get my posts of an cpt like this: <http://www.mywebsite.com/wp-json/wp/v2/cpt> at this posts there are shown post\_meta values. Does anyone know a way to order the posts by the meta like this: <http://www.mywebsite.com/wp-json/wp/v2/cpt?orderby=my_meta_field> I found some solutions, but none of them are working fo...
You can use this filter to change order : ``` $type = "cptCode"; add_filter("rest_" . $type . "_query", function ($args, $query) { $args["orderby"] = "meta_value"; $args["meta_key"] = "my_meta_field"; return $args; }, 10, 2); ``` You can also test `$_GET` to change the order conditionally.
284,720
<p>I want to use his image zoom function on my wordpress site: <a href="https://github.com/spinningarrow/zoom-vanilla.js" rel="nofollow noreferrer">Medium's Image Zoom in vanilla JS</a></p> <p>but I'm not sure how to add</p> <pre><code>data-action="zoom" </code></pre> <p>attribute to all images attached in posts. Wh...
[ { "answer_id": 284724, "author": "Drupalizeme", "author_id": 115005, "author_profile": "https://wordpress.stackexchange.com/users/115005", "pm_score": 3, "selected": true, "text": "<p>You have a number of options.</p>\n\n<p>You could use the <code>add_filter( 'the_content', 'add_data_att...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284720", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/76748/" ]
I want to use his image zoom function on my wordpress site: [Medium's Image Zoom in vanilla JS](https://github.com/spinningarrow/zoom-vanilla.js) but I'm not sure how to add ``` data-action="zoom" ``` attribute to all images attached in posts. What function I need to use? Can somebody help me?
You have a number of options. You could use the `add_filter( 'the_content', 'add_data_attributes' );` And after that find the images attached to the post. Or you can use the `image_send_to_editor` filter more [here](https://developer.wordpress.org/reference/hooks/image_send_to_editor/).
284,767
<p>I am creating a child theme for my site and inside my functions.php I added a code to load a specific css file ONLY where it is the HOME page:</p> <pre><code> // enqueue styles for child theme function wowdental_enqueue_styles() { // enqueue parent styles wp_enqueue_style('Divi', get_template_directory_uri() .'/...
[ { "answer_id": 284770, "author": "Laxmana", "author_id": 40948, "author_profile": "https://wordpress.stackexchange.com/users/40948", "pm_score": 1, "selected": false, "text": "<p>From the <a href=\"https://developer.wordpress.org/reference/functions/wp_enqueue_style/\" rel=\"nofollow nor...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284767", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130781/" ]
I am creating a child theme for my site and inside my functions.php I added a code to load a specific css file ONLY where it is the HOME page: ``` // enqueue styles for child theme function wowdental_enqueue_styles() { // enqueue parent styles wp_enqueue_style('Divi', get_template_directory_uri() .'/style.css', ge...
You'll need to put the if statement around the line that enqueues in the first place. ``` // enqueue styles for child theme function wowdental_enqueue_styles() { // enqueue parent styles wp_enqueue_style('Divi', get_template_directory_uri() .'/style.css', get_the_time() ); // Flip3d css // flip3...
284,773
<p>I'm doing a plugin using Shortcodes. I have some classes which extend an abstract class calls Shortcode.</p> <pre><code>abstract class Shortcode { public $tag; public $attrs; public $function; public function __construct($tag) { $this-&gt;attrs = array(); $this-&gt;tag = $tag; ...
[ { "answer_id": 284809, "author": "plushyObject", "author_id": 76522, "author_profile": "https://wordpress.stackexchange.com/users/76522", "pm_score": 0, "selected": false, "text": "<p>You should think about setting up an Amazon S3 or something like that. You can scale if things get bigge...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284773", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128094/" ]
I'm doing a plugin using Shortcodes. I have some classes which extend an abstract class calls Shortcode. ``` abstract class Shortcode { public $tag; public $attrs; public $function; public function __construct($tag) { $this->attrs = array(); $this->tag = $tag; $this->function ...
I would suggest that you use a CDN to host your image files. For starters you could move the images over to the new hosting though. Or is it many terrabytes of images? If so, I don't think it's a good idea to have them in Wordpress. Regarding hosting the image library, have you considered using a CDN? There are a bu...
284,789
<p>how to remove slug from url ?</p> <pre><code>example.com/example/new-post/ </code></pre> <p>how to remove <code>/example/</code>?</p>
[ { "answer_id": 284790, "author": "Mouad DB", "author_id": 119622, "author_profile": "https://wordpress.stackexchange.com/users/119622", "pm_score": -1, "selected": false, "text": "<p>Admin Dashboard > Settings > Permalink: Choose Custom Structure then set your custom structure.</p>\n" ...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284789", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/129421/" ]
how to remove slug from url ? ``` example.com/example/new-post/ ``` how to remove `/example/`?
Whenever you `register_post_type()`, one of the args is `rewrite` where you can reset the URL to something else. Maybe you can play with this -- try leaving it blank? Pro tip: You will have to reset permalinks after you do this.
284,797
<p>how to redirect the error message page "Sorry, you are not allowed to access this page." to the Home page?</p>
[ { "answer_id": 284802, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>I think that is a function of the theme, which will return that message under whatever conditions it d...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284797", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/66393/" ]
how to redirect the error message page "Sorry, you are not allowed to access this page." to the Home page?
Accroding to the file "wp-content/languages/admin-[lang].po" and an additional search inside of a local copy of WP 5.6.1 the phrase is used 17 times. Not in all contexts there is an obvious hook to catch the error screen but in a lot of cases the error screen appears when a user wants to access an area of the backend w...
284,798
<p>I have this code and the $var1 arrives empty to my function i dont know why, i've tested declaring the variable inside the function and it does work but when i try to declare it outside the function and pass it as a parameter with the do_action it doesn't work, any insights on this ? thanks</p> <p>The add_shortcode...
[ { "answer_id": 284799, "author": "David Lee", "author_id": 111965, "author_profile": "https://wordpress.stackexchange.com/users/111965", "pm_score": 3, "selected": true, "text": "<p>You are doing the <code>do_action</code> before the action is add, try moving it:</p>\n\n<pre><code>$name ...
2017/11/02
[ "https://wordpress.stackexchange.com/questions/284798", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130802/" ]
I have this code and the $var1 arrives empty to my function i dont know why, i've tested declaring the variable inside the function and it does work but when i try to declare it outside the function and pass it as a parameter with the do\_action it doesn't work, any insights on this ? thanks The add\_shortcode works f...
You are doing the `do_action` before the action is add, try moving it: ``` $name = "link"; add_shortcode($name, 'aa_link_shortcode'); function shorcode_resources($var1) { global $post; $shortcode_found = false; if (has_shortcode($post->post_content, $var1)) { $shortcode_found = true; } i...
284,801
<p>First off I know there are tons of other "jQuery is not defined" threads and I have gone through them all and can't seem to find a solution. Trying to add jQuery functionality to a custom made theme nav and I cannot seem to get around this problem. Code is working fine in jsfiddle <a href="https://jsfiddle.net/TonyT...
[ { "answer_id": 284803, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 1, "selected": true, "text": "<p>The dependencies argument of <code>wp_enqueue_script()</code> is case sensetive:</p>\n\n<pre><code>wp_en...
2017/11/03
[ "https://wordpress.stackexchange.com/questions/284801", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130812/" ]
First off I know there are tons of other "jQuery is not defined" threads and I have gone through them all and can't seem to find a solution. Trying to add jQuery functionality to a custom made theme nav and I cannot seem to get around this problem. Code is working fine in jsfiddle <https://jsfiddle.net/TonyTheOnly/h7xw...
The dependencies argument of `wp_enqueue_script()` is case sensetive: ``` wp_enqueue_script('customjs', get_template_directory_uri() . '/js/paramo.js', array('jQuery'), '1.0.0', true); ``` That `array('jQuery')` needs to be `array( 'jquery' )`. You can see the handles for bundled scripts on the documentation page f...
284,819
<p>I have been using, <a href="https://de.wordpress.org/plugins/http2-server-push/" rel="nofollow noreferrer">this plugin</a> and its says </p> <blockquote> <p>WordPress 4.6 <a href="https://make.wordpress.org/core/2016/07/06/resource-hints-in-4-6/" rel="nofollow noreferrer">introduced native support</a> for resourc...
[ { "answer_id": 284832, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 2, "selected": true, "text": "<p>Support for resource hints in WordPress is done through <a href=\"https://w3c.github.io/resource-hints/\" rel=...
2017/11/03
[ "https://wordpress.stackexchange.com/questions/284819", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38602/" ]
I have been using, [this plugin](https://de.wordpress.org/plugins/http2-server-push/) and its says > > WordPress 4.6 [introduced native support](https://make.wordpress.org/core/2016/07/06/resource-hints-in-4-6/) for resource hints. > By default, this plugin defers to WordPress 4.6 and theme/plugin developers to res...
Support for resource hints in WordPress is done through [`rel` attribute of `<link>` elements](https://w3c.github.io/resource-hints/) whithin the HTML docuemnt, not with HTTP/2 server push (which uses `Link` headers in the HTTP response). You can use [`wp_resource_hints` filter](https://developer.wordpress.org/referenc...