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
205,814
<p>I am trying to figure out how to display a video on the homepage for users who have not logged in using the <code>functions.php</code> file. I am using a Genesis theme.</p>
[ { "answer_id": 205816, "author": "Benjamin Love", "author_id": 81800, "author_profile": "https://wordpress.stackexchange.com/users/81800", "pm_score": 2, "selected": false, "text": "<p>I'm assuming you already know how to get your popup video working, and you want to know how to make sur...
2015/10/17
[ "https://wordpress.stackexchange.com/questions/205814", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81706/" ]
I am trying to figure out how to display a video on the homepage for users who have not logged in using the `functions.php` file. I am using a Genesis theme.
I'm assuming you already know how to get your popup video working, and you want to know how to make sure only people who aren't logged in see the video. You can add this to your template file (footer.php is probably best): ``` <?php if (is_front_page() && !is_user_logged_in()) { //video popup content } ?> ```...
205,829
<p>I am using a global variable that is defining in a function runs in <code>after_setup_theme</code>. This variable is not getting update changes in Theme Customizer. </p> <p><strong>Let me explain this with an example:</strong></p> <pre><code>add_action( 'customize_register', "example_customizer_register"); functio...
[ { "answer_id": 205828, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>Your loop on <code>page.php</code> doesn't loop through all the pages on the site. It loops though all the pa...
2015/10/17
[ "https://wordpress.stackexchange.com/questions/205829", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1372/" ]
I am using a global variable that is defining in a function runs in `after_setup_theme`. This variable is not getting update changes in Theme Customizer. **Let me explain this with an example:** ``` add_action( 'customize_register', "example_customizer_register"); function example_customizer_register($wp_customize) ...
Your loop on `page.php` doesn't loop through all the pages on the site. It loops though all the pages returned by the main query and stored in the `$wp_query` global variable, which is how all of the primary WordPress "pages" work including the post archive pages, category, tag pages, etc. For any one "page" only one p...
205,832
<p>I'm using the following code at the top of my index.php page in my theme and it never hits the <code>is_single()</code> code even on single posts. </p> <pre><code>if ( have_posts() ) { echo "****************we have posts"; if ( is_single() ) { echo "******************It's single"; } while...
[ { "answer_id": 205833, "author": "1.21 gigawatts", "author_id": 29247, "author_profile": "https://wordpress.stackexchange.com/users/29247", "pm_score": 1, "selected": false, "text": "<p>It looks like it's not hitting that code because it's redirecting to <code>single.php</code>. I didn't...
2015/10/18
[ "https://wordpress.stackexchange.com/questions/205832", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29247/" ]
I'm using the following code at the top of my index.php page in my theme and it never hits the `is_single()` code even on single posts. ``` if ( have_posts() ) { echo "****************we have posts"; if ( is_single() ) { echo "******************It's single"; } while ( have_posts() ) { ...
Your question and answer comes down to template hierarchy and how it works, and it is really really useful to know the basics here. I'm not going to go into details as I will need to write a short story, but here are the basics: * Wordpress uses a very strict hierarchy for loading templates on a specific page request...
205,872
<p>I need the text seen in light gray at the top of the header to be below the site title/tagline but above the tabbed navigation:</p> <p><a href="http://devtest.lcnlit.org" rel="nofollow">devtest.lcnlit.org</a></p> <p>I would prefer learning to do it the proper way (calling it in a function?), but I will use hard-co...
[ { "answer_id": 205833, "author": "1.21 gigawatts", "author_id": 29247, "author_profile": "https://wordpress.stackexchange.com/users/29247", "pm_score": 1, "selected": false, "text": "<p>It looks like it's not hitting that code because it's redirecting to <code>single.php</code>. I didn't...
2015/10/18
[ "https://wordpress.stackexchange.com/questions/205872", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29370/" ]
I need the text seen in light gray at the top of the header to be below the site title/tagline but above the tabbed navigation: [devtest.lcnlit.org](http://devtest.lcnlit.org) I would prefer learning to do it the proper way (calling it in a function?), but I will use hard-coding if I have to. I currently have the tex...
Your question and answer comes down to template hierarchy and how it works, and it is really really useful to know the basics here. I'm not going to go into details as I will need to write a short story, but here are the basics: * Wordpress uses a very strict hierarchy for loading templates on a specific page request...
205,876
<p><em>FYI: This has been also posted <a href="https://stackoverflow.com/questions/33202955/which-ways-can-be-used-to-log-in-to-wordpress">here</a> since I'm fairly new to this website and didn't know that the Wordpress part existed. Sorry for the repost.</em></p> <p>I'm currently trying to tighten the security for a w...
[ { "answer_id": 205899, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>wrote something long and decided to delete because the Tl;Dr is use a good password and stop pretending t...
2015/10/18
[ "https://wordpress.stackexchange.com/questions/205876", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82137/" ]
*FYI: This has been also posted [here](https://stackoverflow.com/questions/33202955/which-ways-can-be-used-to-log-in-to-wordpress) since I'm fairly new to this website and didn't know that the Wordpress part existed. Sorry for the repost.* I'm currently trying to tighten the security for a website which is running on ...
The answer to my question about other login possibilities was given in [the question posted by birgire](https://wordpress.stackexchange.com/questions/204485/brute-force-attack-even-though-it-is-limited-by-ip). It turns out that after disabling any remote access to `xmlrpc.php` the attacks went down to zero. However t...
205,898
<p>I tried to add PHP code after the post title in single post pages by adding a filter to <code>functions.php</code>, but this did not work:</p> <pre><code>function theme_slug_filter_the_content( $content ) { $custom_content = 'MY CODES'; $custom_content .= $content; return $custom_content; } add_filter( ...
[ { "answer_id": 205955, "author": "Ashok Dhaduk", "author_id": 81215, "author_profile": "https://wordpress.stackexchange.com/users/81215", "pm_score": 0, "selected": false, "text": "<p>See the below code that you needs to write in content.php file</p>\n\n<pre><code>if ( is_single() ) :\n ...
2015/10/19
[ "https://wordpress.stackexchange.com/questions/205898", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82151/" ]
I tried to add PHP code after the post title in single post pages by adding a filter to `functions.php`, but this did not work: ``` function theme_slug_filter_the_content( $content ) { $custom_content = 'MY CODES'; $custom_content .= $content; return $custom_content; } add_filter( 'the_content', 'theme_slu...
You need to use `the_title` filter, not `the_content`. Also make sure you have `the_title()` function somewhere in your single post page. Here is the code: ``` function theme_slug_filter_the_content( $title ) { $custom_title = 'MY CODES'; $custom_title .= $title ; return $custom_title ; } add_filter( 'th...
205,909
<p>I have several pages on my site, and I want to password protect a page which displays the latest posts. Simply going to the admin panel and setting "Visibility: Password protected" isn't doing anything so... Any help?</p> <p>I am using Wordpress 4.3.1 on a local machine, if that's any use.</p> <p>Thanks in advance...
[ { "answer_id": 205955, "author": "Ashok Dhaduk", "author_id": 81215, "author_profile": "https://wordpress.stackexchange.com/users/81215", "pm_score": 0, "selected": false, "text": "<p>See the below code that you needs to write in content.php file</p>\n\n<pre><code>if ( is_single() ) :\n ...
2015/10/19
[ "https://wordpress.stackexchange.com/questions/205909", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82158/" ]
I have several pages on my site, and I want to password protect a page which displays the latest posts. Simply going to the admin panel and setting "Visibility: Password protected" isn't doing anything so... Any help? I am using Wordpress 4.3.1 on a local machine, if that's any use. Thanks in advance!
You need to use `the_title` filter, not `the_content`. Also make sure you have `the_title()` function somewhere in your single post page. Here is the code: ``` function theme_slug_filter_the_content( $title ) { $custom_title = 'MY CODES'; $custom_title .= $title ; return $custom_title ; } add_filter( 'th...
205,940
<p>can anyone give me some idea about how I can use the value of <code>wp_logout_url()</code> within the menu creator page of wordpress? As the menu creation page doesn't support php I cannot just put <code>echo wp_logout_url( home_url() )</code> under custom link.</p> <p>Also I cannot use functions like</p> <pre><co...
[ { "answer_id": 205947, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 4, "selected": true, "text": "<p>Add submenu with a custom link, <code>/wp-login?action=logout</code>, like the image below:</p>\n\n<p><a href=\"ht...
2015/10/19
[ "https://wordpress.stackexchange.com/questions/205940", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50584/" ]
can anyone give me some idea about how I can use the value of `wp_logout_url()` within the menu creator page of wordpress? As the menu creation page doesn't support php I cannot just put `echo wp_logout_url( home_url() )` under custom link. Also I cannot use functions like ``` add_filter( 'wp_nav_menu_items', 'wti_lo...
Add submenu with a custom link, `/wp-login?action=logout`, like the image below: [![enter image description here](https://i.stack.imgur.com/Aw4k3.png)](https://i.stack.imgur.com/Aw4k3.png) Add code like below in `functions.php`: ``` function wpa_remove_menu_item( $items, $menu, $args ) { if ( is_admin() || ! is_...
205,968
<p>IΒ΄m having some difficulty override to default category widgets in my wordpress theme. I created the theme from scratch.</p> <p>I want to remove the <code>&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;</code> from categories in the lists. I want to add my own style using <code>&lt;a href=""&gt;&lt;/a&gt;</code> instead...
[ { "answer_id": 206108, "author": "Hernan", "author_id": 60187, "author_profile": "https://wordpress.stackexchange.com/users/60187", "pm_score": 2, "selected": true, "text": "<p>This is a really tricky and long question, there is no easy way to do this, as I guess you want to override thi...
2015/10/19
[ "https://wordpress.stackexchange.com/questions/205968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80230/" ]
IΒ΄m having some difficulty override to default category widgets in my wordpress theme. I created the theme from scratch. I want to remove the `<ul><li></li></ul>` from categories in the lists. I want to add my own style using `<a href=""></a>` instead ``` <div class="list-group"> <a href="#" class="list-group-item">...
This is a really tricky and long question, there is no easy way to do this, as I guess you want to override this core WordPress function from within your theme. The way to go is a particular case of something [explained here](https://wordpress.stackexchange.com/questions/33207/modify-a-output-of-a-widget), so you can ...
205,975
<p>I have created a custom post type named <code>rooms</code>. I would like to get all <code>rooms</code> posts except for the one with the post id <code>164</code>, and display it using the code below: </p> <pre><code>&lt;div class="room-container container room-grid"&gt; &lt;div class="heading-box"&gt; ...
[ { "answer_id": 205976, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/Class_Reference/WP_Query\" rel=\"nofollow\">WP_Query</a> has a <stron...
2015/10/19
[ "https://wordpress.stackexchange.com/questions/205975", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77627/" ]
I have created a custom post type named `rooms`. I would like to get all `rooms` posts except for the one with the post id `164`, and display it using the code below: ``` <div class="room-container container room-grid"> <div class="heading-box"> <h2>rooms</h2> </div> <?php $my_query = new WP...
I got the working code. rooms doesnt need 'rooms'. Thankyou friends.. ``` <?php $my_query = new WP_Query( array('post_type' => rooms, 'post__not_in' => array(164)) ); while ($my_query->have_posts()) : $my_query->the_post(); $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url( $thumb);...
205,989
<p>As you can see in the post title at <a href="http://fosit.staging.wpengine.com/" rel="nofollow">http://fosit.staging.wpengine.com/</a>, when the post title gets to the margin it doesn't continue on a new line; it continues on the <em>same</em> line.</p> <p>I don't know if this problem is native to twenty twelve or ...
[ { "answer_id": 205991, "author": "Gyanendra Giri", "author_id": 47270, "author_profile": "https://wordpress.stackexchange.com/users/47270", "pm_score": 1, "selected": false, "text": "<p>The issue is due to addition of following line in your child theme. There should be some line height t...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/205989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81348/" ]
As you can see in the post title at <http://fosit.staging.wpengine.com/>, when the post title gets to the margin it doesn't continue on a new line; it continues on the *same* line. I don't know if this problem is native to twenty twelve or if it's due a change I made to the child theme (like when I moved the date of t...
The issue is due to addition of following line in your child theme. There should be some line height to show header properly. ``` .entry-header .entry-title { font-size: 1.6000rem; /* was 1.42857rem; */ font-weight: normal; line-height: 0; /* changed from 1.2 */ } ```
205,992
<p>I have a custom page template and I want it to display on specific pages. The only way I know to do this is to create a shortcode for this custom page template, so that I can use the custom page template by using shortcode. But I don't know how doing this.</p> <p>I saw some article about this, but I forgot the webs...
[ { "answer_id": 205993, "author": "user3818821", "author_id": 81799, "author_profile": "https://wordpress.stackexchange.com/users/81799", "pm_score": 3, "selected": false, "text": "<p>I solved now, by adding this snippet in <code>functions.php</code></p>\n\n<pre><code>function my_form_sho...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/205992", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81799/" ]
I have a custom page template and I want it to display on specific pages. The only way I know to do this is to create a shortcode for this custom page template, so that I can use the custom page template by using shortcode. But I don't know how doing this. I saw some article about this, but I forgot the website link. ...
I solved now, by adding this snippet in `functions.php` ``` function my_form_shortcode() { ob_start(); get_template_part('my_form_template'); return ob_get_clean(); } add_shortcode( 'my_form_shortcode', 'my_form_shortcode' ); ```
205,999
<p>I am trying to setup wordpress development environment for freelancers. I have freelancers working on my site from different locations. Which tools and technologies will support development of my current website and how?</p> <p>I came across vagrant, will it be useful? Also, how can I do version control?</p> <p>I ...
[ { "answer_id": 205993, "author": "user3818821", "author_id": 81799, "author_profile": "https://wordpress.stackexchange.com/users/81799", "pm_score": 3, "selected": false, "text": "<p>I solved now, by adding this snippet in <code>functions.php</code></p>\n\n<pre><code>function my_form_sho...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/205999", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82206/" ]
I am trying to setup wordpress development environment for freelancers. I have freelancers working on my site from different locations. Which tools and technologies will support development of my current website and how? I came across vagrant, will it be useful? Also, how can I do version control? I have decided to g...
I solved now, by adding this snippet in `functions.php` ``` function my_form_shortcode() { ob_start(); get_template_part('my_form_template'); return ob_get_clean(); } add_shortcode( 'my_form_shortcode', 'my_form_shortcode' ); ```
206,021
<p>I am new to custom fields thing. I am working on a movie review site. And wants to add movie story or plot field, I have successfully added the custom field named Story and its content is displaying on single.php. However, can I display same on index.php? Below is my code.</p> <pre><code>&lt;?php $meta = get_post_...
[ { "answer_id": 206024, "author": "Ravi Patel", "author_id": 35477, "author_profile": "https://wordpress.stackexchange.com/users/35477", "pm_score": 0, "selected": false, "text": "<p>Add this code on content.php because of index.php content comes from this file.</p>\n\n<pre><code>if u cal...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206021", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38763/" ]
I am new to custom fields thing. I am working on a movie review site. And wants to add movie story or plot field, I have successfully added the custom field named Story and its content is displaying on single.php. However, can I display same on index.php? Below is my code. ``` <?php $meta = get_post_meta( get_the_ID(...
Try this: ``` if ( ! function_exists( 'customField' ) ) : function customField($name, $id=false, $single=false){ global $post_type, $post; $name=trim($name); $prefix=''; // only if you need this $data=NULL; if($id!==false && !empty($id) && $id > 0) $getMeta=get_post_meta((int)$id, $prefix...
206,022
<p>I have tried to update my plugins in wordpress-admin but for some reason i am receiving an error "Unable to locate WordPress Content directory (wp-content)" I have checked on my server and the folder still exists. What is this cause of this and is there a quick fix?</p>
[ { "answer_id": 206023, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 2, "selected": false, "text": "<p>Adding below code to <code>wp-config.php</code> file will solve your problem:</p>\n\n<pre><code>if(is_admin()) {\...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206022", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82219/" ]
I have tried to update my plugins in wordpress-admin but for some reason i am receiving an error "Unable to locate WordPress Content directory (wp-content)" I have checked on my server and the folder still exists. What is this cause of this and is there a quick fix?
Adding below code to `wp-config.php` file will solve your problem: ``` if(is_admin()) { add_filter('filesystem_method', create_function('$a', 'return "direct";' )); define( 'FS_CHMOD_DIR', 0751 ); } ``` Above is quick fix I found on Wordpress support but problem is with permissions. [For details please follow...
206,030
<p>I'm trying to interpret this action hook name: </p> <pre><code>ws_plugin__s2member_pro_before_sc_authnet_form_after_shortcode_atts </code></pre> <p>What is meaning of BEFORE and AFTER in this hook name? Do the underscores mean anything? </p> <p>It seems that the hook name contains two function names, <code>sc_au...
[ { "answer_id": 206023, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 2, "selected": false, "text": "<p>Adding below code to <code>wp-config.php</code> file will solve your problem:</p>\n\n<pre><code>if(is_admin()) {\...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206030", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82226/" ]
I'm trying to interpret this action hook name: ``` ws_plugin__s2member_pro_before_sc_authnet_form_after_shortcode_atts ``` What is meaning of BEFORE and AFTER in this hook name? Do the underscores mean anything? It seems that the hook name contains two function names, `sc_authnet_form` and `shortcode_atts`, that ...
Adding below code to `wp-config.php` file will solve your problem: ``` if(is_admin()) { add_filter('filesystem_method', create_function('$a', 'return "direct";' )); define( 'FS_CHMOD_DIR', 0751 ); } ``` Above is quick fix I found on Wordpress support but problem is with permissions. [For details please follow...
206,054
<p>I am trying to hide a specific post from a page template? Does anyone have experience with this, would prefer to not have to use a plugin. Was thinking of using wp_post ID but am unsure of how to go about it.</p>
[ { "answer_id": 206023, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 2, "selected": false, "text": "<p>Adding below code to <code>wp-config.php</code> file will solve your problem:</p>\n\n<pre><code>if(is_admin()) {\...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206054", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71177/" ]
I am trying to hide a specific post from a page template? Does anyone have experience with this, would prefer to not have to use a plugin. Was thinking of using wp\_post ID but am unsure of how to go about it.
Adding below code to `wp-config.php` file will solve your problem: ``` if(is_admin()) { add_filter('filesystem_method', create_function('$a', 'return "direct";' )); define( 'FS_CHMOD_DIR', 0751 ); } ``` Above is quick fix I found on Wordpress support but problem is with permissions. [For details please follow...
206,057
<p>I'm currently working with an XML feed to add posts to a custom post type using wp_insert_post().</p> <p>It's all working fine but I was wondering if there's a way I can check if the post exists and amend any meta values in the post. The posts do have a unique ID associated to them if that helps. This is not a Word...
[ { "answer_id": 206023, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 2, "selected": false, "text": "<p>Adding below code to <code>wp-config.php</code> file will solve your problem:</p>\n\n<pre><code>if(is_admin()) {\...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206057", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/66977/" ]
I'm currently working with an XML feed to add posts to a custom post type using wp\_insert\_post(). It's all working fine but I was wondering if there's a way I can check if the post exists and amend any meta values in the post. The posts do have a unique ID associated to them if that helps. This is not a WordPress ID...
Adding below code to `wp-config.php` file will solve your problem: ``` if(is_admin()) { add_filter('filesystem_method', create_function('$a', 'return "direct";' )); define( 'FS_CHMOD_DIR', 0751 ); } ``` Above is quick fix I found on Wordpress support but problem is with permissions. [For details please follow...
206,069
<p>How would I go about writing an intersect query (using WP Query) that returns a set of posts that are in both category A and category B? </p>
[ { "answer_id": 206070, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 0, "selected": false, "text": "<p>You just need a <code>tax_query</code> with the <code>AND</code> relation. <a href=\"https://codex.wordpress...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206069", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/75166/" ]
How would I go about writing an intersect query (using WP Query) that returns a set of posts that are in both category A and category B?
There is a simple way using a default argument... ``` /* * You need to get the IDs for the Categories you wish to include */ $args = array( 'category__and' => array( 1, 3 ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { // Do something to display your posts ... } else { //...
206,083
<p>I'm trying to create a category template in my theme that will display static content if the user is on the first page of the archive, and then display the posts in the category on the following pages. I'm basically trying to replicate the category behavior on Wired.com where <a href="http://www.wired.com/category/...
[ { "answer_id": 206091, "author": "Khaled Sadek", "author_id": 75122, "author_profile": "https://wordpress.stackexchange.com/users/75122", "pm_score": 0, "selected": false, "text": "<p><strong>Update:</strong></p>\n\n<pre><code>add_action('pre_get_posts', 'category_query_offset', 1 );\nfu...
2015/10/20
[ "https://wordpress.stackexchange.com/questions/206083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82243/" ]
I'm trying to create a category template in my theme that will display static content if the user is on the first page of the archive, and then display the posts in the category on the following pages. I'm basically trying to replicate the category behavior on Wired.com where <http://www.wired.com/category/design> is a...
This is quite an interesting question (*which I have upvoted, specially for your approach and research*). The big curveball here is the first page of the query: * You cannot set the query to return `0` posts on the first page * By moving the page content of every page up by one page, you will loose the last page as th...
206,121
<p>I've created a custom taxonomy register as the code below, but it does not find the taxonomy-specialty.php nor archive.php templates (page not found error).</p> <p>I did following (as recommended by other threads found on SE and the web): - re-save the permalinks - find the taxonomy settings page in wp-admin and w...
[ { "answer_id": 206122, "author": "Por", "author_id": 31832, "author_profile": "https://wordpress.stackexchange.com/users/31832", "pm_score": -1, "selected": false, "text": "<pre><code>'show_ui' =&gt; true,\n'show_admin_column' =&gt; true,\n'query_var' =&gt; 'specialty',...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206121", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51271/" ]
I've created a custom taxonomy register as the code below, but it does not find the taxonomy-specialty.php nor archive.php templates (page not found error). I did following (as recommended by other threads found on SE and the web): - re-save the permalinks - find the taxonomy settings page in wp-admin and when I hover...
The page not found error doesn't mean that the template file is not found/used. Note that a URL returns a 404 status header (not found), then 404.php is used (or index.php if 404.php doesn't exist). I think your real problem is that you have not flushed the rewrite rules after the taxonomy has been registered. To do i...
206,140
<p>I have a form where i would like to add a <code>datetimepicker()</code>. I must be doing something wrong.</p> <p>I have done the following: In my <code>header.php</code></p> <pre><code>&lt;?php wp_enqueue_script("jquery"); ?&gt; </code></pre> <p>In my <code>functions.php</code></p> <pre><code>wp_enqueue_script('...
[ { "answer_id": 206142, "author": "websupporter", "author_id": 48693, "author_profile": "https://wordpress.stackexchange.com/users/48693", "pm_score": 0, "selected": false, "text": "<p>I guess, the scripts are loaded in the footer action while your script is loaded before.</p>\n\n<p>So, w...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206140", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52240/" ]
I have a form where i would like to add a `datetimepicker()`. I must be doing something wrong. I have done the following: In my `header.php` ``` <?php wp_enqueue_script("jquery"); ?> ``` In my `functions.php` ``` wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-style', 'http://ajax.googleapis.co...
You can try this. ``` add_action( 'wp_enqueue_scripts', 'wpcustom_enqueue_script' ); function wpcustom_enqueue_script() { wp_enqueue_style( 'datepicker-style', 'https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' ); wp_enqueue_script( 'js-datepicker', 'https://code.jquery.com/ui/1.12.1/jquery-ui.js', ...
206,147
<p>I have to create Web services for android app using WordPress Database. where user can login and register using android app. that record will be saved in WordPress database. display All the posts of wordpress site in android app using wordpress database table. user can Create and Update User Profile ,Login , Regis...
[ { "answer_id": 206142, "author": "websupporter", "author_id": 48693, "author_profile": "https://wordpress.stackexchange.com/users/48693", "pm_score": 0, "selected": false, "text": "<p>I guess, the scripts are loaded in the footer action while your script is loaded before.</p>\n\n<p>So, w...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206147", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82282/" ]
I have to create Web services for android app using WordPress Database. where user can login and register using android app. that record will be saved in WordPress database. display All the posts of wordpress site in android app using wordpress database table. user can Create and Update User Profile ,Login , Register ,...
You can try this. ``` add_action( 'wp_enqueue_scripts', 'wpcustom_enqueue_script' ); function wpcustom_enqueue_script() { wp_enqueue_style( 'datepicker-style', 'https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' ); wp_enqueue_script( 'js-datepicker', 'https://code.jquery.com/ui/1.12.1/jquery-ui.js', ...
206,155
<p>If I do a query of the post table for post type 'attachment' sometimes the guid field will contain an attachment id, "<a href="http://sitename.com/?attachment_id=1201" rel="nofollow">http://sitename.com/?attachment_id=1201</a>", instead of a URL. How can I convert a string like this into the attachment url?</p>
[ { "answer_id": 206142, "author": "websupporter", "author_id": 48693, "author_profile": "https://wordpress.stackexchange.com/users/48693", "pm_score": 0, "selected": false, "text": "<p>I guess, the scripts are loaded in the footer action while your script is loaded before.</p>\n\n<p>So, w...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206155", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17097/" ]
If I do a query of the post table for post type 'attachment' sometimes the guid field will contain an attachment id, "<http://sitename.com/?attachment_id=1201>", instead of a URL. How can I convert a string like this into the attachment url?
You can try this. ``` add_action( 'wp_enqueue_scripts', 'wpcustom_enqueue_script' ); function wpcustom_enqueue_script() { wp_enqueue_style( 'datepicker-style', 'https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' ); wp_enqueue_script( 'js-datepicker', 'https://code.jquery.com/ui/1.12.1/jquery-ui.js', ...
206,158
<p>Having formulated my $query for a custom taxonomy on a page template, how would I ask if a specific term has posts?</p> <pre><code>$args = array( 'post_type' =&gt; 'exhibitions', 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'exhibition', 'field' =&gt; 'slug' ),...
[ { "answer_id": 206166, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>It sounds like you want <a href=\"https://codex.wordpress.org/Function_Reference/has_term\" rel=\"nofollow\"...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206158", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51609/" ]
Having formulated my $query for a custom taxonomy on a page template, how would I ask if a specific term has posts? ``` $args = array( 'post_type' => 'exhibitions', 'tax_query' => array( array( 'taxonomy' => 'exhibition', 'field' => 'slug' ), ) ); $query = new WP_...
I'm not sure what you exactly need, but normally, by default, `get_terms` returns only terms that actually have posts assigned to them ``` $terms = get_terms( 'exhibition' ); var_dump( $terms ); ``` Apart from this, I really do not know what you exactly need
206,167
<p>Ok, I've literally copy-pasted different enqueueing code from about 5 different sources (Including wordpress), and not a single one works.</p> <p>Here's the code I'm using in functions.php:</p> <pre><code>&lt;?php function my_theme_scripts() { wp_register_script( 'main', get_stylesheet_directo...
[ { "answer_id": 206168, "author": "Burgi", "author_id": 62753, "author_profile": "https://wordpress.stackexchange.com/users/62753", "pm_score": 1, "selected": false, "text": "<p>The codex suggests using the function <code>get_stylesheet_directory()</code> in this instance as the <code>get...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206167", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82293/" ]
Ok, I've literally copy-pasted different enqueueing code from about 5 different sources (Including wordpress), and not a single one works. Here's the code I'm using in functions.php: ``` <?php function my_theme_scripts() { wp_register_script( 'main', get_stylesheet_directory_uri() . '/js/main.js'...
The codex suggests using the function `get_stylesheet_directory()` in this instance as the `get_template_directory_uri()` can get overriden by child themes. * [get\_template\_directory\_uri()](https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri) * [get\_stylesheet\_directory()](https://codex.wo...
206,184
<h2>How do I wrap a div around the actions in the code below?</h2> <p>PHP in functions.php file:</p> <pre><code>remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_title', 5 ); remove_acti...
[ { "answer_id": 206185, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 1, "selected": false, "text": "<p>I would do it with jQuery, something like:</p>\n\n<pre><code>$('.element').wrapInner('&lt;div class=\"...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206184", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64742/" ]
How do I wrap a div around the actions in the code below? --------------------------------------------------------- PHP in functions.php file: ``` remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_templa...
I did the same thing a different way and now it's stacked like I want with a div wrapping the content. This stacks the single product woocommerce output to be as follows: 1. Title 2. Price 3. Add to cart / attributes 4. Excerpt 5. Meta 6. Images 7. Price 8. Add to cart / attributes 9. Tabs 10. Upsell 11. Related So...
206,189
<p>When adding arrays to post meta, using add_post_meta, new sub-arrays are added. I was wondering if there was a way to have those sub-arrays named. </p> <p>so instead of ending up with </p> <pre><code>array([0](2,3), [1](4,5)) </code></pre> <p>I would get</p> <pre><code>array ([meaningful_name](2,3),[meaningful_n...
[ { "answer_id": 206192, "author": "jas", "author_id": 80247, "author_profile": "https://wordpress.stackexchange.com/users/80247", "pm_score": 0, "selected": false, "text": "<p>Some possible ways for using add_post_meta : </p>\n\n<p><a href=\"http://worldpressrevolution.com/working-with-...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206189", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20014/" ]
When adding arrays to post meta, using add\_post\_meta, new sub-arrays are added. I was wondering if there was a way to have those sub-arrays named. so instead of ending up with ``` array([0](2,3), [1](4,5)) ``` I would get ``` array ([meaningful_name](2,3),[meaningful_name2](4,5)) ```
When multiple meta values are used for same meta key, WordPress store the values in different database rows. So every array, is stored in one row. Initial Data ------------ Let's assume you have an array like this: ``` $family = [ 'father' => [ 'John', 'Doe', 40 ], 'mother' => [ 'Jane', 'White', 39 ], 'child...
206,197
<p>I have a custom query:</p> <pre><code>&lt;?php query_posts(array( 'post_type' =&gt; 'properties', 'meta_key' =&gt; 'pd_city', 'orderby' =&gt; 'meta_value', 'order' =&gt; 'ASC', 'posts_per_page' =&gt; 5, 'paged' =&gt; get_query_var('paged') )); ?&gt; </code></pre> <p>But it doesn't seem to be working. The posts on ...
[ { "answer_id": 206204, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 2, "selected": false, "text": "<p>Piter is right, don't use <code>query_posts</code>. </p>\n\n<p>You could do something like:</p>\n\n<pre><code>...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206197", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54304/" ]
I have a custom query: ``` <?php query_posts(array( 'post_type' => 'properties', 'meta_key' => 'pd_city', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => 5, 'paged' => get_query_var('paged') )); ?> ``` But it doesn't seem to be working. The posts on this page should be listed alphabetically by city ...
Piter is right, don't use `query_posts`. You could do something like: ``` $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'properties', 'meta_key' => 'pd_city', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => 5, 'paged' => $page...
206,208
<p>I am using Advanced Custom Fields to get a list of properties as follows:-</p> <pre><code> &lt;?php $args = array( 'posts_per_page'=&gt; -1, 'post_type' =&gt; 'properties', 'meta_key' =&gt; 'development', 'meta_value' =&g...
[ { "answer_id": 206213, "author": "darrinb", "author_id": 6304, "author_profile": "https://wordpress.stackexchange.com/users/6304", "pm_score": 0, "selected": false, "text": "<p>Without knowing whether returns a single value, an array, or a string of values separated by spaces, I'd sugge...
2015/10/21
[ "https://wordpress.stackexchange.com/questions/206208", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81966/" ]
I am using Advanced Custom Fields to get a list of properties as follows:- ``` <?php $args = array( 'posts_per_page'=> -1, 'post_type' => 'properties', 'meta_key' => 'development', 'meta_value' => $development_id ...
Got it working in the end with the below code: ``` <?php $args = array( 'posts_per_page'=> -1, 'post_type' => 'properties', 'meta_key' => 'development', 'meta_value' => $development_id, ); $properties_query = new WP_Query( $args );...
206,235
<p>I have following args to get recent posts,</p> <pre><code>$args = array( 'date_query' =&gt; array( array( 'after' =&gt; '1 week ago' ) ), 'posts_per_page' =&gt; 15, 'ignore_sticky_posts' =&gt; 1, 'meta_key' =&gt; 'post_views_count', 'orderby' =&gt; 'meta_value_num', 'order' =&gt; 'DESC', ...
[ { "answer_id": 206242, "author": "Janith Chinthana", "author_id": 68403, "author_profile": "https://wordpress.stackexchange.com/users/68403", "pm_score": 2, "selected": false, "text": "<p>I am not sure, is this the best way, but I succeed with following code.</p>\n\n<pre><code>$highlight...
2015/10/22
[ "https://wordpress.stackexchange.com/questions/206235", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68403/" ]
I have following args to get recent posts, ``` $args = array( 'date_query' => array( array( 'after' => '1 week ago' ) ), 'posts_per_page' => 15, 'ignore_sticky_posts' => 1, 'meta_key' => 'post_views_count', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'cat' => '-907,-908,-909' ); ``...
Here is another way of doing it, specially if you need to work with the query object. The issue with merging queries is that you loose the correctness of the query object. My idea here is to run two separate queries, one very lean one to get post ID's from the `date_query` query and then merging the two arrays of post...
206,251
<p>I want to sort the result of <code>get_users()</code> by last name, first name, user defined fields or whatever. </p> <p>How can I achieve this while still using <code>get_users()</code>?</p>
[ { "answer_id": 206252, "author": "flomei", "author_id": 65455, "author_profile": "https://wordpress.stackexchange.com/users/65455", "pm_score": 4, "selected": true, "text": "<p><a href=\"https://codex.wordpress.org/Function_Reference/get_users\" rel=\"noreferrer\"><code>get_users()</code...
2015/10/22
[ "https://wordpress.stackexchange.com/questions/206251", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65455/" ]
I want to sort the result of `get_users()` by last name, first name, user defined fields or whatever. How can I achieve this while still using `get_users()`?
[`get_users()`](https://codex.wordpress.org/Function_Reference/get_users) does not allow you to directly sort by whatever you like, but there are ways around it. The Codex for `get_users()` says: > > **orderby** - Sort by 'ID', 'login', 'nicename', 'email', 'url', 'registered', 'display\_name', 'post\_count', 'inclu...
206,285
<p>I would like to use something to filter images within an ACF Gallery. I have added the Enhanced Media Gallery Plugin which will allow me to assign a category to each image, but am not not clear on how to echo out that category list so it can be clicked and filter/display images in the category chosen. </p> <p>Addit...
[ { "answer_id": 206252, "author": "flomei", "author_id": 65455, "author_profile": "https://wordpress.stackexchange.com/users/65455", "pm_score": 4, "selected": true, "text": "<p><a href=\"https://codex.wordpress.org/Function_Reference/get_users\" rel=\"noreferrer\"><code>get_users()</code...
2015/10/22
[ "https://wordpress.stackexchange.com/questions/206285", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81981/" ]
I would like to use something to filter images within an ACF Gallery. I have added the Enhanced Media Gallery Plugin which will allow me to assign a category to each image, but am not not clear on how to echo out that category list so it can be clicked and filter/display images in the category chosen. Additionally, h...
[`get_users()`](https://codex.wordpress.org/Function_Reference/get_users) does not allow you to directly sort by whatever you like, but there are ways around it. The Codex for `get_users()` says: > > **orderby** - Sort by 'ID', 'login', 'nicename', 'email', 'url', 'registered', 'display\_name', 'post\_count', 'inclu...
206,292
<p>I have a site I'm building in wordpress that has ~80GB of high resolution images, and it's exceeding my managed host's storage space. My plan is to move all the images to S3, but I noticed that <code>wp_get_attachment_image()</code> automatically prefixes the src with <code>/wp-content/uploads</code> instead of resp...
[ { "answer_id": 206294, "author": "Rubatharisan Thirumathyam", "author_id": 64091, "author_profile": "https://wordpress.stackexchange.com/users/64091", "pm_score": 2, "selected": true, "text": "<p>It might be a solution to string replace /wp-content/uploads with '' (empty) like for an exa...
2015/10/22
[ "https://wordpress.stackexchange.com/questions/206292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49143/" ]
I have a site I'm building in wordpress that has ~80GB of high resolution images, and it's exceeding my managed host's storage space. My plan is to move all the images to S3, but I noticed that `wp_get_attachment_image()` automatically prefixes the src with `/wp-content/uploads` instead of respecting the path stored in...
It might be a solution to string replace /wp-content/uploads with '' (empty) like for an example: Lets say: wp\_get\_attachment\_image() returns = '/wp-content/uploads/myimage.png'; ``` <?php echo str_replace('/wp-content/uploads/', '', wp_get_attachment_image()); ?> ``` This will result in echo: 'myimage.png' Tr...
206,320
<p>I'm developing a responsive WordPress theme and instead of using frameworks, I've created one my own.</p> <p>I'm trying NOT to repeat myself (meaning, I don't want to write extra markup all the time), so I'm generating the HTML that comes before the <code>.grid-unit div</code> element with a <code>fluid_grid</code>...
[ { "answer_id": 206328, "author": "Chris", "author_id": 7435, "author_profile": "https://wordpress.stackexchange.com/users/7435", "pm_score": 0, "selected": false, "text": "<p>I'm not familiar with <code>fluid_grid</code>, but this looks like a scope issue. You are creating an anonymous f...
2015/10/22
[ "https://wordpress.stackexchange.com/questions/206320", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82363/" ]
I'm developing a responsive WordPress theme and instead of using frameworks, I've created one my own. I'm trying NOT to repeat myself (meaning, I don't want to write extra markup all the time), so I'm generating the HTML that comes before the `.grid-unit div` element with a `fluid_grid` PHP function that takes a funct...
This is basic PHP. Just a note before I continue, never ever globalize variables. Wordpress has already done quite a crappy job regarding this. Globalization is evil, because anyone and anything, knowingly or unknowingly can change a global variable. This makes globals a nightmare to debug. So in short, **NEVER EVER** ...
206,330
<p>Is this possible in WordPress?</p> <p>Like if I use a piece of code to display Post1 image+title and some more code to display six more posts in that category...</p> <p>But then to do the next category I have to paste the whole code in again and change the category.</p> <p>Can I just code "repeat, but change vari...
[ { "answer_id": 206328, "author": "Chris", "author_id": 7435, "author_profile": "https://wordpress.stackexchange.com/users/7435", "pm_score": 0, "selected": false, "text": "<p>I'm not familiar with <code>fluid_grid</code>, but this looks like a scope issue. You are creating an anonymous f...
2015/10/23
[ "https://wordpress.stackexchange.com/questions/206330", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77987/" ]
Is this possible in WordPress? Like if I use a piece of code to display Post1 image+title and some more code to display six more posts in that category... But then to do the next category I have to paste the whole code in again and change the category. Can I just code "repeat, but change variable to \_\_\_ and varia...
This is basic PHP. Just a note before I continue, never ever globalize variables. Wordpress has already done quite a crappy job regarding this. Globalization is evil, because anyone and anything, knowingly or unknowingly can change a global variable. This makes globals a nightmare to debug. So in short, **NEVER EVER** ...
206,353
<p>I want to disable the email notification if a user or an admin changes the password of a user.<br></p> <p>After some Googling I came to find that I need to create a plugin and overwrite the <code>wp_password_change_notification</code> function found in <code>pluggable.php</code>.</p> <p>This is the plugin and functi...
[ { "answer_id": 206354, "author": "Sabbir Hasan", "author_id": 76587, "author_profile": "https://wordpress.stackexchange.com/users/76587", "pm_score": 2, "selected": false, "text": "<p>Copy this following code and save as disable_email.php . Then place that file in \"wp-content/plugins/\"...
2015/10/23
[ "https://wordpress.stackexchange.com/questions/206353", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52240/" ]
I want to disable the email notification if a user or an admin changes the password of a user. After some Googling I came to find that I need to create a plugin and overwrite the `wp_password_change_notification` function found in `pluggable.php`. This is the plugin and function: ``` <?php /* Plugin Name: Stop ema...
To disable user email notification, add this in a plugin or theme: ``` add_filter( 'send_password_change_email', '__return_false' ); ``` FYI [`wp_password_change_notification()`](https://developer.wordpress.org/reference/functions/wp_password_change_notification/) controls admin email notification when a user change...
206,394
<p>I'm correctly developing my own theme and so far I got: index, header, footer, functions and style files. The list will go on as I'm progressing with my theme. But I'm considering to use more than one theme at this site with total different files and I'm thinking of using simply different names for files instead the...
[ { "answer_id": 206397, "author": "Dan Gayle", "author_id": 10, "author_profile": "https://wordpress.stackexchange.com/users/10", "pm_score": 0, "selected": false, "text": "<p>You can use the <code>get_template_part</code> to load different files into your template, using whatever combina...
2015/10/23
[ "https://wordpress.stackexchange.com/questions/206394", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82409/" ]
I'm correctly developing my own theme and so far I got: index, header, footer, functions and style files. The list will go on as I'm progressing with my theme. But I'm considering to use more than one theme at this site with total different files and I'm thinking of using simply different names for files instead the or...
You probably are over complicating things for yourself. You can use the [template\_include](https://codex.wordpress.org/Plugin_API/Filter_Reference/template_include) filter for that ``` add_filter( 'template_include', 'wpse_206394_template', 99 ); function wpse_206394_template( $template ) { if ( template should...
206,395
<p>I moved over a development site to the client's hosting server using the WP Clone plugin. It seemed to work just fine, until I noticed a bunch of odd question marks where things like em-dashes and apostrophes should be.</p> <p>It appears to be a unicode issue, but the only difference I can tell between the two serv...
[ { "answer_id": 206397, "author": "Dan Gayle", "author_id": 10, "author_profile": "https://wordpress.stackexchange.com/users/10", "pm_score": 0, "selected": false, "text": "<p>You can use the <code>get_template_part</code> to load different files into your template, using whatever combina...
2015/10/23
[ "https://wordpress.stackexchange.com/questions/206395", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82411/" ]
I moved over a development site to the client's hosting server using the WP Clone plugin. It seemed to work just fine, until I noticed a bunch of odd question marks where things like em-dashes and apostrophes should be. It appears to be a unicode issue, but the only difference I can tell between the two servers is tha...
You probably are over complicating things for yourself. You can use the [template\_include](https://codex.wordpress.org/Plugin_API/Filter_Reference/template_include) filter for that ``` add_filter( 'template_include', 'wpse_206394_template', 99 ); function wpse_206394_template( $template ) { if ( template should...
206,406
<p>My args array:</p> <pre><code>$args = array ( 'cat' =&gt; '1,3,7', 'posts_per_page' =&gt; '30' ); </code></pre> <p>How to define <code>posts_per_page</code>:</p> <ul> <li><p>category 1 : 7 posts,</p></li> <li><p>category 3 : 10 posts,</p></li> <li><p>category 7 : 13 posts,</p></li> </ul>
[ { "answer_id": 206397, "author": "Dan Gayle", "author_id": 10, "author_profile": "https://wordpress.stackexchange.com/users/10", "pm_score": 0, "selected": false, "text": "<p>You can use the <code>get_template_part</code> to load different files into your template, using whatever combina...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206406", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82085/" ]
My args array: ``` $args = array ( 'cat' => '1,3,7', 'posts_per_page' => '30' ); ``` How to define `posts_per_page`: * category 1 : 7 posts, * category 3 : 10 posts, * category 7 : 13 posts,
You probably are over complicating things for yourself. You can use the [template\_include](https://codex.wordpress.org/Plugin_API/Filter_Reference/template_include) filter for that ``` add_filter( 'template_include', 'wpse_206394_template', 99 ); function wpse_206394_template( $template ) { if ( template should...
206,424
<p>Im trying to convert the post title to an image. i created a php file in the theme folder image.php with the code UPDATE: working code</p> <pre><code>require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php'); $postid = $_GET["postid"]; $string = get_the_title($postid); $im = imagecreate(100, 30); $bg = imagecolorall...
[ { "answer_id": 206431, "author": "Arif", "author_id": 81715, "author_profile": "https://wordpress.stackexchange.com/users/81715", "pm_score": 0, "selected": false, "text": "<p>I think in image.php, post Id is blank, and so not getting anything. moreover - is this the only code in image.p...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206424", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/56404/" ]
Im trying to convert the post title to an image. i created a php file in the theme folder image.php with the code UPDATE: working code ``` require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php'); $postid = $_GET["postid"]; $string = get_the_title($postid); $im = imagecreate(100, 30); $bg = imagecolorallocate($im, 255...
In General ---------- The problem here is that you're calling a WordPress function within a PHP file where WordPress isn't loaded. Including WordPress in your `image.php` file might work if you include the post ID ``` <img src="/wp-content/themes/v2/image.php?post_id=123" /> ``` But imagine if you have 100 images...
206,435
<p>I am changing hosting + domain name for my WordPress site. For example now if its hosted on 201.0.0.1/mysite and now I want to upload it to mysite.com. This is what I did</p> <p>exported database from my cpanel got all files from server using filezilla (public_html folder that has Wordpress root folder as well) set...
[ { "answer_id": 206431, "author": "Arif", "author_id": 81715, "author_profile": "https://wordpress.stackexchange.com/users/81715", "pm_score": 0, "selected": false, "text": "<p>I think in image.php, post Id is blank, and so not getting anything. moreover - is this the only code in image.p...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206435", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81756/" ]
I am changing hosting + domain name for my WordPress site. For example now if its hosted on 201.0.0.1/mysite and now I want to upload it to mysite.com. This is what I did exported database from my cpanel got all files from server using filezilla (public\_html folder that has Wordpress root folder as well) set permalin...
In General ---------- The problem here is that you're calling a WordPress function within a PHP file where WordPress isn't loaded. Including WordPress in your `image.php` file might work if you include the post ID ``` <img src="/wp-content/themes/v2/image.php?post_id=123" /> ``` But imagine if you have 100 images...
206,455
<p>I want to create a user via a standalone script. I want an activation email to be sent out, in the same way that it is when a user is created from the Add User screen. An email is set out with a link to create the password. There is no password in the email.</p> <p>There seem to be various functions for creating ne...
[ { "answer_id": 206458, "author": "shanebp", "author_id": 16575, "author_profile": "https://wordpress.stackexchange.com/users/16575", "pm_score": 3, "selected": false, "text": "<p>You should <a href=\"https://codex.wordpress.org/Function_Reference/wp_create_user\" rel=\"noreferrer\">read ...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206455", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82453/" ]
I want to create a user via a standalone script. I want an activation email to be sent out, in the same way that it is when a user is created from the Add User screen. An email is set out with a link to create the password. There is no password in the email. There seem to be various functions for creating new users. ...
You should [read the codex page re wp\_create\_user](https://codex.wordpress.org/Function_Reference/wp_create_user). You don't describe the context in which your code runs. You shouldn't need all those `require_once` calls. Anyhow, in this line `wp_new_user_notification ( testuser8,null,'both' );` what is `testuser8...
206,465
<p>I'm making my first WordPress theme from scratch, and I currently have two pages: <code>index</code>, and <code>events</code>. The <code>index</code> is static and the <code>events.php</code> is dynamic (loaded with latest events displayed by the title and thumbnail).</p> <p>I also have two posts; one being the def...
[ { "answer_id": 206458, "author": "shanebp", "author_id": 16575, "author_profile": "https://wordpress.stackexchange.com/users/16575", "pm_score": 3, "selected": false, "text": "<p>You should <a href=\"https://codex.wordpress.org/Function_Reference/wp_create_user\" rel=\"noreferrer\">read ...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206465", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80982/" ]
I'm making my first WordPress theme from scratch, and I currently have two pages: `index`, and `events`. The `index` is static and the `events.php` is dynamic (loaded with latest events displayed by the title and thumbnail). I also have two posts; one being the default Hello World, and the second made by me, some text...
You should [read the codex page re wp\_create\_user](https://codex.wordpress.org/Function_Reference/wp_create_user). You don't describe the context in which your code runs. You shouldn't need all those `require_once` calls. Anyhow, in this line `wp_new_user_notification ( testuser8,null,'both' );` what is `testuser8...
206,468
<p>I am working on a Custom Nav Walker and I want to use Description field in wordpress menu in my theme. </p> <p>The field works fine as far as for First Level Menu items but when I add something in sub-menu items' description fields, nothing outputs. </p> <p>I am using following custom nav walker function:</p> <pr...
[ { "answer_id": 206472, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": true, "text": "<p>You are setting your <code>$description</code> to an empty string for any menu item except the top one:</p>\n...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206468", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58787/" ]
I am working on a Custom Nav Walker and I want to use Description field in wordpress menu in my theme. The field works fine as far as for First Level Menu items but when I add something in sub-menu items' description fields, nothing outputs. I am using following custom nav walker function: ``` class description_wa...
You are setting your `$description` to an empty string for any menu item except the top one: ``` if($depth != 0) { $description = $append = $prepend = ""; } ``` Thus, you get no output.
206,471
<p>Here is a the code snippet:</p> <pre><code> add_action( 'admin_menu', 'travel_site' ); function travel_site(){ add_menu_page( 'Travel Site Menu', 'Travel Site', 'manage_options', 'travel-site-menu', 'ts_admin_main_page' ); add_submenu_page("travel-site-menu","View Travel Requests","View Travel Requests"...
[ { "answer_id": 206476, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 2, "selected": false, "text": "<p>There's not really a good way to do this. Checkout the <a href=\"https://github.com/WordPress/WordPress/...
2015/10/24
[ "https://wordpress.stackexchange.com/questions/206471", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9390/" ]
Here is a the code snippet: ``` add_action( 'admin_menu', 'travel_site' ); function travel_site(){ add_menu_page( 'Travel Site Menu', 'Travel Site', 'manage_options', 'travel-site-menu', 'ts_admin_main_page' ); add_submenu_page("travel-site-menu","View Travel Requests","View Travel Requests","manage_optio...
Effectively you can do this by adding a sublevel item with the same menu slug as the top level, while changing the submenu item title. This avoids the look of duplicate menu items, even though the destination of the top level, and the first sub menu item are the same. You have to have at least two sub menu items, and ...
206,485
<p>I'm working on a contact form for a website using an jQuery Ajax call method that then uses WordPress's building in admin-ajax.php to submit the form's values, send them to an email address via wp_mail and then, if successful, send back an array through json_encode. The form works and the email sends but the success...
[ { "answer_id": 206476, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 2, "selected": false, "text": "<p>There's not really a good way to do this. Checkout the <a href=\"https://github.com/WordPress/WordPress/...
2015/10/25
[ "https://wordpress.stackexchange.com/questions/206485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78415/" ]
I'm working on a contact form for a website using an jQuery Ajax call method that then uses WordPress's building in admin-ajax.php to submit the form's values, send them to an email address via wp\_mail and then, if successful, send back an array through json\_encode. The form works and the email sends but the success ...
Effectively you can do this by adding a sublevel item with the same menu slug as the top level, while changing the submenu item title. This avoids the look of duplicate menu items, even though the destination of the top level, and the first sub menu item are the same. You have to have at least two sub menu items, and ...
206,509
<p>Is there a standard way to get all the registered sizes of the featured images? One can register different sizes with <code>add_image_size()</code>. What I need, is to get all the sizes of a featured image of a post. Something like this:</p> <p>$sizes = get_post_feature_image_sizes($postid);</p> <p>...which will r...
[ { "answer_id": 206534, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 5, "selected": true, "text": "<p>I don't remember a function that will do precisely that, but it is easily achieved with API overall:</p>\n\n<ol>\n<l...
2015/10/25
[ "https://wordpress.stackexchange.com/questions/206509", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82471/" ]
Is there a standard way to get all the registered sizes of the featured images? One can register different sizes with `add_image_size()`. What I need, is to get all the sizes of a featured image of a post. Something like this: $sizes = get\_post\_feature\_image\_sizes($postid); ...which will return an array of object...
I don't remember a function that will do precisely that, but it is easily achieved with API overall: 1. Retrieve attachment ID with [`get_post_thumbnail_id()`](https://developer.wordpress.org/reference/functions/get_post_thumbnail_id/) 2. Retrieve available sizes with [`get_intermediate_image_sizes()`](https://develop...
206,516
<p>I'm not strong in WP programming, bu I try to understand what to do to enable SVG in my site. I found that in need to add function below to <code>functions.php</code>:</p> <pre><code>/** * Add SVG capabilities */ function wpcontent_svg_mime_type( $mimes = array() ) { $mimes['svg'] = 'image/svg+xml'; $mimes['...
[ { "answer_id": 206519, "author": "RaajTram", "author_id": 82482, "author_profile": "https://wordpress.stackexchange.com/users/82482", "pm_score": 0, "selected": false, "text": "<p>Adding the following code to my functions.php works great for me. No need to modify the .htaccess file at al...
2015/10/25
[ "https://wordpress.stackexchange.com/questions/206516", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74608/" ]
I'm not strong in WP programming, bu I try to understand what to do to enable SVG in my site. I found that in need to add function below to `functions.php`: ``` /** * Add SVG capabilities */ function wpcontent_svg_mime_type( $mimes = array() ) { $mimes['svg'] = 'image/svg+xml'; $mimes['svgz'] = 'image/svg+xml';...
> > But how to know what is my WP namespace? > > > namespacing a function, in WP land, just means prefixing it with something that makes it more unique and unlikely to conflict with anything else. Generally that means you do both a "vendor" and a "package". For instance, if I'm building a plugin, my function uploa...
206,523
<p>I'm trying to remove current_page_parent class from the blog index menu item (I got a custom page to display all blog posts and it is in the menu) when navigating custom post type archive page and custom post type posts.</p> <p>I've found similar questions but I can't figure out how to solve it. In addition, I don'...
[ { "answer_id": 206536, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 5, "selected": true, "text": "<p>You can use the <a href=\"https://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_css_class\" rel=\"norefe...
2015/10/25
[ "https://wordpress.stackexchange.com/questions/206523", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/60103/" ]
I'm trying to remove current\_page\_parent class from the blog index menu item (I got a custom page to display all blog posts and it is in the menu) when navigating custom post type archive page and custom post type posts. I've found similar questions but I can't figure out how to solve it. In addition, I don't have t...
You can use the [`nav_menu_css_class`](https://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_css_class) filter to add or remove classes from menu items. Each individual menu item will have this filter applied. An array of classes and the menu item object will be passed to the function, and you will `return` ...
206,561
<p>I am learning about shortcodes. I've made 2 shortcodes that makes an accordion with bootstrap. One shortode (accordionGroup) creates the body that contains one or more shortcodes to make the items and it's content (accordionItem).</p> <p>Now I need to create 2 different accordion. The problem is: I need a different...
[ { "answer_id": 206565, "author": "Balas", "author_id": 17849, "author_profile": "https://wordpress.stackexchange.com/users/17849", "pm_score": 0, "selected": false, "text": "<p>I have just read your code and is this correct </p>\n\n<pre><code>$id_container \n</code></pre>\n\n<p>instead <...
2015/10/26
[ "https://wordpress.stackexchange.com/questions/206561", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82502/" ]
I am learning about shortcodes. I've made 2 shortcodes that makes an accordion with bootstrap. One shortode (accordionGroup) creates the body that contains one or more shortcodes to make the items and it's content (accordionItem). Now I need to create 2 different accordion. The problem is: I need a different id for ea...
You could pass the variable via a `global` but it would be neater to trap it in a static variable: ``` function track_acc_id($new_id = false) { static $id; if (!empty($new_id)) { $id = $new_id; } return $id; } //This is the accordion container function accordionGroup( $atts, $content = null ) { extrac...
206,585
<p>I am trying to make my theme translatable so I am using the following command to output text. But its just returning an empty value some reason? No error is displayed</p> <pre><code>&lt;?php __('PLAYER POINTS AT A GLANCE.','gogreensoccer');?&gt; &lt;div class="skill-title"&gt; &lt;h3&gt;&lt;?php __('PLA...
[ { "answer_id": 206589, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": true, "text": "<p>The localizing functions have two variaties, one that echos the string value and the other one that retu...
2015/10/26
[ "https://wordpress.stackexchange.com/questions/206585", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3582/" ]
I am trying to make my theme translatable so I am using the following command to output text. But its just returning an empty value some reason? No error is displayed ``` <?php __('PLAYER POINTS AT A GLANCE.','gogreensoccer');?> <div class="skill-title"> <h3><?php __('PLAYER POINTS AT A GLANCE.','gogreenso...
The localizing functions have two variaties, one that echos the string value and the other one that returns it's string value. Because you would want to display the string (*`echo` it*), you would want the correct function for the specific string which will echo the output. For easy simple strings (*`__('PLAYER POINTS...
206,611
<p>I know that I can display 4 random posts by doing something like:</p> <pre><code>get_posts('orderby=rand&amp;numberposts=4'); </code></pre> <p>&nbsp;</p> <p>What I'm trying to achieve is starting with a random item, but then showing the next 3 posts that are in chronological order.</p> <p>I'm thinking something ...
[ { "answer_id": 206589, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": true, "text": "<p>The localizing functions have two variaties, one that echos the string value and the other one that retu...
2015/10/26
[ "https://wordpress.stackexchange.com/questions/206611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58105/" ]
I know that I can display 4 random posts by doing something like: ``` get_posts('orderby=rand&numberposts=4'); ``` What I'm trying to achieve is starting with a random item, but then showing the next 3 posts that are in chronological order. I'm thinking something along the lines of this: ``` $posts = get_posts('or...
The localizing functions have two variaties, one that echos the string value and the other one that returns it's string value. Because you would want to display the string (*`echo` it*), you would want the correct function for the specific string which will echo the output. For easy simple strings (*`__('PLAYER POINTS...
206,671
<p>The functions <a href="https://codex.wordpress.org/Function_Reference/get_bloginfo" rel="nofollow">get_bloginfo</a>() and bloginfo() both return information about the blog but accessing it each time seems unnecessary. Is there a function that will return the bloginfo as an object with properties? </p> <p><strong>Mo...
[ { "answer_id": 206679, "author": "1.21 gigawatts", "author_id": 29247, "author_profile": "https://wordpress.stackexchange.com/users/29247", "pm_score": 1, "selected": true, "text": "<p>Here is my workaround if one does not exist: </p>\n\n<pre><code>/**\n * Get an object with blog info va...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206671", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29247/" ]
The functions [get\_bloginfo](https://codex.wordpress.org/Function_Reference/get_bloginfo)() and bloginfo() both return information about the blog but accessing it each time seems unnecessary. Is there a function that will return the bloginfo as an object with properties? **More Info:** I have tokens in my markup ...
Here is my workaround if one does not exist: ``` /** * Get an object with blog info values */ function getBlogInfo() { $info = new stdClass(); $info->name = get_bloginfo("name"); $info->description = get_bloginfo("description"); $info->wpurl = get_bloginfo("w...
206,672
<p>The site I am working on is skinnnybantonmusic.com The Lastest News page is suppost to show the blog posts but for some reason none are showing up. (<a href="http://www.skinnybantonmusic.com/latest-news/" rel="nofollow">http://www.skinnybantonmusic.com/latest-news/</a>)</p> <pre><code>&lt;?php get_header(); ?&gt; ...
[ { "answer_id": 206679, "author": "1.21 gigawatts", "author_id": 29247, "author_profile": "https://wordpress.stackexchange.com/users/29247", "pm_score": 1, "selected": true, "text": "<p>Here is my workaround if one does not exist: </p>\n\n<pre><code>/**\n * Get an object with blog info va...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206672", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69541/" ]
The site I am working on is skinnnybantonmusic.com The Lastest News page is suppost to show the blog posts but for some reason none are showing up. (<http://www.skinnybantonmusic.com/latest-news/>) ``` <?php get_header(); ?> <div id="main"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> ...
Here is my workaround if one does not exist: ``` /** * Get an object with blog info values */ function getBlogInfo() { $info = new stdClass(); $info->name = get_bloginfo("name"); $info->description = get_bloginfo("description"); $info->wpurl = get_bloginfo("w...
206,703
<p>I'm a new WordPress developer and recently I've been having problems (on multiple sites) with <code>include_once</code> and <code>require_once</code> for PHP files. If I include <code>(get_theme_directory_uri() . 'subdir/file')</code> the specified file gets included (or required, which leads to fatal errors) but if...
[ { "answer_id": 206754, "author": "thomascharbit", "author_id": 35003, "author_profile": "https://wordpress.stackexchange.com/users/35003", "pm_score": 5, "selected": false, "text": "<p>If you check <a href=\"https://codex.wordpress.org/Function_Reference/get_template_directory_uri\" rel=...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206703", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82567/" ]
I'm a new WordPress developer and recently I've been having problems (on multiple sites) with `include_once` and `require_once` for PHP files. If I include `(get_theme_directory_uri() . 'subdir/file')` the specified file gets included (or required, which leads to fatal errors) but if any WordPress functions are called ...
If you check <https://codex.wordpress.org/Function_Reference/get_template_directory_uri> You will see `get_template_directory_uri()` returns a uri, not a server path. You should use instead the `get_template_directory()` function, which returns the path to the theme, without trailing slash: ``` include get_template_...
206,712
<p>How do I put the homepage link ? Right now it's not correct.</p> <pre><code> &lt;p&gt;&lt;?php _e( 'The page you are looking for is not here. Why don’t you try the &lt;a href="&lt;?php echo esc_url( home_url( '/' ) ); ?&gt;"&gt;homepage&lt;/a&gt;?', 'braveandco' ); ?&gt;&lt;/p&gt; </code></pre>
[ { "answer_id": 206716, "author": "Aric Watson", "author_id": 81449, "author_profile": "https://wordpress.stackexchange.com/users/81449", "pm_score": 1, "selected": false, "text": "<p>Looks like bad syntax - try:</p>\n\n<pre><code> &lt;p&gt;&lt;?php _e( 'The page you are looking for is no...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206712", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82041/" ]
How do I put the homepage link ? Right now it's not correct. ``` <p><?php _e( 'The page you are looking for is not here. Why don’t you try the <a href="<?php echo esc_url( home_url( '/' ) ); ?>">homepage</a>?', 'braveandco' ); ?></p> ```
You are using PHP inside a single quote and a malformed one at that. That won't work. Step one is to get that string right: ``` _e( 'The page you are looking for is not here. Why don’t you try the <a href="'.esc_url( home_url( '/' ) ).'">homepage</a>?', 'braveandco' ); ``` That is pure PHP. Check PHP's manual for [p...
206,719
<p>When I remove get_header() from 404 page, my css doesnt work.</p> <pre><code> &lt;?php /** * The template for displaying 404 pages (Not Found) * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?&gt; &lt;div class="page-content"&gt; &lt;h1 class="page-t...
[ { "answer_id": 206722, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>Of course it doesn't. When you remove <code>get_header()</code> you also remove the code that loads the CSS ...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206719", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82041/" ]
When I remove get\_header() from 404 page, my css doesnt work. ``` <?php /** * The template for displaying 404 pages (Not Found) * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <div class="page-content"> <h1 class="page-title"><?php _e( 'Not Found',...
Of course it doesn't. When you remove `get_header()` you also remove the code that loads the CSS files, not to mention that you remove large blocks of necessary HTML markup. The template you've posted above is very, very broken. You've also left out `get_footer()` which will most likely leave your markup broken as wel...
206,721
<p>I'm trying to get top 10 users in my wordpress blog based on user meta value.</p> <p>I've tried few methods &amp; finally able to get just top one user using below wpdb query. But clueless, how we can get top 10 users.</p> <pre><code>$top10alltime = $wpdb-&gt;get_row( "SELECT MAX( CAST( meta_value AS UNSIGNED ) ) ...
[ { "answer_id": 206722, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>Of course it doesn't. When you remove <code>get_header()</code> you also remove the code that loads the CSS ...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74094/" ]
I'm trying to get top 10 users in my wordpress blog based on user meta value. I've tried few methods & finally able to get just top one user using below wpdb query. But clueless, how we can get top 10 users. ``` $top10alltime = $wpdb->get_row( "SELECT MAX( CAST( meta_value AS UNSIGNED ) ) AS top_user FROM $wpdb->user...
Of course it doesn't. When you remove `get_header()` you also remove the code that loads the CSS files, not to mention that you remove large blocks of necessary HTML markup. The template you've posted above is very, very broken. You've also left out `get_footer()` which will most likely leave your markup broken as wel...
206,724
<p>I try to create a page that shows my posts (a page different than the "posts page" defined in wp-admin).</p> <p>When I copy my <code>index.php</code> into this new page and add </p> <pre><code>&lt;?php query_posts('post_type=post&amp;posts_per_page=5&amp;paged='.get_query_var('paged')); ?&gt; </code></pre> <p>abo...
[ { "answer_id": 206743, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Every page has a \"main query\" which is run before the template is loaded. The results of the main query are how ...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206724", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80031/" ]
I try to create a page that shows my posts (a page different than the "posts page" defined in wp-admin). When I copy my `index.php` into this new page and add ``` <?php query_posts('post_type=post&posts_per_page=5&paged='.get_query_var('paged')); ?> ``` above the ``` <?php if ( have_posts() ) : ?> ... ... `...
The thing is that, contrary to popular belief, `pre_get_posts` does not work for single Page requests.[1](https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) Not even for is\_front\_page(). As for `get posts()`, in order to work I needed to use a syntax like: ``` <?php global $post; $myposts = get_...
206,732
<p>I have a rather silly situation.</p> <p>I tried <a href="https://perishablepress.com/quickly-disable-or-enable-all-wordpress-plugins-via-the-database/" rel="nofollow">this query </a></p> <pre><code>UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins'; </code></pre> <p>which disabled ...
[ { "answer_id": 206733, "author": "Bruno Cantuaria", "author_id": 65717, "author_profile": "https://wordpress.stackexchange.com/users/65717", "pm_score": 0, "selected": false, "text": "<p>Options store all relevant options of your website, including from plugins and themes.</p>\n\n<p>A go...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31610/" ]
I have a rather silly situation. I tried [this query](https://perishablepress.com/quickly-disable-or-enable-all-wordpress-plugins-via-the-database/) ``` UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins'; ``` which disabled all my plugins. I was testing some issues on my site and th...
The `wp_options` table holds a lot of information, whether you deem it important or not really depends on what plugins and information you have set up on your website and how important your website is to you. For example as you've noticed it can hold the information for your active plugins, if you activate an importan...
206,750
<p>I would like to create a page template that will have two containers. Left one should be for text (it is a multilingual website so that is why I need a page template), and the right side should be for images which are the same for all languages. My question is, what do I have to create so a client can insert and ed...
[ { "answer_id": 206777, "author": "Dava Gordon", "author_id": 82586, "author_profile": "https://wordpress.stackexchange.com/users/82586", "pm_score": 0, "selected": false, "text": "<p>As woocommerce is basically just posts have you not tried single-productID.php so single-234.php</p>\n" ...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206750", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47357/" ]
I would like to create a page template that will have two containers. Left one should be for text (it is a multilingual website so that is why I need a page template), and the right side should be for images which are the same for all languages. My question is, what do I have to create so a client can insert and edit ...
Override the template with a [template\_include](https://codex.wordpress.org/Plugin_API/Filter_Reference/template_include) filter.
206,771
<p>The WC_Order_Item_Meta::get_formatted() function returns terms array of the order. Each term is an array of three things:</p> <pre><code>'key' =&gt; $meta-&gt;key // attribute key 'label' =&gt; wc_attribute_label( $attribute_key, $this-&gt;product ) // attribute label 'value' =&gt; apply_filters( 'woocommerce_ord...
[ { "answer_id": 206774, "author": "Scriptonomy", "author_id": 82166, "author_profile": "https://wordpress.stackexchange.com/users/82166", "pm_score": 0, "selected": false, "text": "<p>This is the output of the function:</p>\n\n<pre><code>array(\n 'pa_size' =&gt; array(\n '...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206771", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82584/" ]
The WC\_Order\_Item\_Meta::get\_formatted() function returns terms array of the order. Each term is an array of three things: ``` 'key' => $meta->key // attribute key 'label' => wc_attribute_label( $attribute_key, $this->product ) // attribute label 'value' => apply_filters( 'woocommerce_order_item_display_meta_valu...
This is the output of the function: ``` array( 'pa_size' => array( 'label' => 'Size', 'value' => 'Medium', ) ) ``` You get the slug like this: ``` $terms = WC_Order_Item_Meta::get_formatted(); foreach($terms as $slug => $term){ } ```
206,789
<p>I'm trying to add some custom JS functionality to the default "post" editing screen that depends upon TinyMCE being instantiated and ready to rock. If I try to make the changes before TinyMCE is set up, I (obviously) receive JS errors.</p> <p>Without needing to modify any core files, and ideally using JS/jQuery ev...
[ { "answer_id": 206814, "author": "bonger", "author_id": 57034, "author_profile": "https://wordpress.stackexchange.com/users/57034", "pm_score": 3, "selected": false, "text": "<p>Unless your WP version is truly ancient, you should be able to use the <code>tinymce-editor-init</code> event ...
2015/10/27
[ "https://wordpress.stackexchange.com/questions/206789", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10388/" ]
I'm trying to add some custom JS functionality to the default "post" editing screen that depends upon TinyMCE being instantiated and ready to rock. If I try to make the changes before TinyMCE is set up, I (obviously) receive JS errors. Without needing to modify any core files, and ideally using JS/jQuery events alone ...
Unless your WP version is truly ancient, you should be able to use the `tinymce-editor-init` event triggered on editor `init` by "wp-includes/js/tinymce/plugins/wordpress/plugin.js", eg (assuming your script is loading after jQuery): ``` jQuery( document ).on( 'tinymce-editor-init', function( event, editor ) { // ...
206,810
<p>Can any one re-write this SQL query to perform better? </p> <p>At present this query takes about 29 seconds to execute in <strong>BlueHost</strong> server while it takes 6 seconds in <strong>HostGator</strong>.com server.</p> <p>My intention is to delete all records exists in <strong>wp_postmeta</strong> table of ...
[ { "answer_id": 206814, "author": "bonger", "author_id": 57034, "author_profile": "https://wordpress.stackexchange.com/users/57034", "pm_score": 3, "selected": false, "text": "<p>Unless your WP version is truly ancient, you should be able to use the <code>tinymce-editor-init</code> event ...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206810", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80505/" ]
Can any one re-write this SQL query to perform better? At present this query takes about 29 seconds to execute in **BlueHost** server while it takes 6 seconds in **HostGator**.com server. My intention is to delete all records exists in **wp\_postmeta** table of post type=**'attachment'** and with meta\_key='\_**mycb...
Unless your WP version is truly ancient, you should be able to use the `tinymce-editor-init` event triggered on editor `init` by "wp-includes/js/tinymce/plugins/wordpress/plugin.js", eg (assuming your script is loading after jQuery): ``` jQuery( document ).on( 'tinymce-editor-init', function( event, editor ) { // ...
206,829
<p>I was accidentally using <code>is_admin()</code> to check if a user was an admin and found out that function is not checking that. So I looked for another one and I found <code>is_super_admin()</code> but that checks if you are a admin of a network of sites or owner of a single WordPress install. I have a network si...
[ { "answer_id": 206814, "author": "bonger", "author_id": 57034, "author_profile": "https://wordpress.stackexchange.com/users/57034", "pm_score": 3, "selected": false, "text": "<p>Unless your WP version is truly ancient, you should be able to use the <code>tinymce-editor-init</code> event ...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206829", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29247/" ]
I was accidentally using `is_admin()` to check if a user was an admin and found out that function is not checking that. So I looked for another one and I found `is_super_admin()` but that checks if you are a admin of a network of sites or owner of a single WordPress install. I have a network site and I want to know if ...
Unless your WP version is truly ancient, you should be able to use the `tinymce-editor-init` event triggered on editor `init` by "wp-includes/js/tinymce/plugins/wordpress/plugin.js", eg (assuming your script is loading after jQuery): ``` jQuery( document ).on( 'tinymce-editor-init', function( event, editor ) { // ...
206,830
<p>Hi my client need to add password protect page in wordpress. So i make the visibility of page as password protect and it is working correctly. But client is giving a series of password .He is given password 2314 to 2335 .So the password is any number in between 2314 to 2335 .Now what i do? Is there any method or ca...
[ { "answer_id": 206865, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p><em>Here's just a demo test for fun, just to see if this might be possible:</em></p>\n\n<h2>Demo</h2>\n\n<p>Fi...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70398/" ]
Hi my client need to add password protect page in wordpress. So i make the visibility of page as password protect and it is working correctly. But client is giving a series of password .He is given password 2314 to 2335 .So the password is any number in between 2314 to 2335 .Now what i do? Is there any method or call t...
*Here's just a demo test for fun, just to see if this might be possible:* Demo ---- First we set the post's password, the usual way: [![password](https://i.stack.imgur.com/1zKPe.jpg)](https://i.stack.imgur.com/1zKPe.jpg) Then we create a *custom field* called `wpse_extra_passwords` that takes comma seperated passwo...
206,845
<p>I am trying to display Popular Posts on my website, selected by a mixture of Views and Comment Count. Since views are always way more than Comments, I am multiplying the Comment Count by X, but it doesnt seem to work how I was hoping it would. The Query Result is just ordered by the Meta Value "Views". I assume this...
[ { "answer_id": 206855, "author": "Bruno Cantuaria", "author_id": 65717, "author_profile": "https://wordpress.stackexchange.com/users/65717", "pm_score": 1, "selected": false, "text": "<p>The question seems a bit vague, there a lot of steps creating an API, but I'll try to resume:</p>\n\n...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206845", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71313/" ]
I am trying to display Popular Posts on my website, selected by a mixture of Views and Comment Count. Since views are always way more than Comments, I am multiplying the Comment Count by X, but it doesnt seem to work how I was hoping it would. The Query Result is just ordered by the Meta Value "Views". I assume this is...
The question seems a bit vague, there a lot of steps creating an API, but I'll try to resume: 1. Create an interaction page (You can use the wp-ajax or a page template) 2. Code the function which will read parameters and execute the code 3. Output only the result to browser. You can output json with a code line like: ...
206,852
<p>I am using get_post() to call a single Wordpress post using it's post ID. I have successfully managed to pull the content / title of the post but would like to also pull custom fields also.</p> <p>The code below is how I declare custom fields in a standard wp_query:</p> <pre><code>$customField = (get_post_meta($po...
[ { "answer_id": 206853, "author": "Bruno Cantuaria", "author_id": 65717, "author_profile": "https://wordpress.stackexchange.com/users/65717", "pm_score": 3, "selected": true, "text": "<p>You already know the ID, so just use it:</p>\n\n<pre><code>$customField = get_post_meta($my_id, \"_mcf...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206852", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71177/" ]
I am using get\_post() to call a single Wordpress post using it's post ID. I have successfully managed to pull the content / title of the post but would like to also pull custom fields also. The code below is how I declare custom fields in a standard wp\_query: ``` $customField = (get_post_meta($post->ID, "_mcf_custo...
You already know the ID, so just use it: ``` $customField = get_post_meta($my_id, "_mcf_customField", true); ``` But only for reference, if you want to get the ID from the object: ``` $customField = get_post_meta($post_id->ID, "_mcf_customField", true); ```
206,854
<p>I'm using the following query to check if user id exists in a custom meta field:</p> <pre><code>'meta_query' =&gt; array( array( 'key' =&gt; 'participantes', 'value' =&gt; $user_id, 'compare' =&gt; 'IN', ), ) </code></pre> <p>The field <code>participantes</code> stores user id...
[ { "answer_id": 206861, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 3, "selected": true, "text": "<p>I believe, more robust solution would be to allow multiple values of custom field 'participants'. You can store li...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38553/" ]
I'm using the following query to check if user id exists in a custom meta field: ``` 'meta_query' => array( array( 'key' => 'participantes', 'value' => $user_id, 'compare' => 'IN', ), ) ``` The field `participantes` stores user ids separated by comma, like `345,1,34`. This only...
I believe, more robust solution would be to allow multiple values of custom field 'participants'. You can store like following ``` add_post_meta($post_id,'participants','value1'); add_post_meta($post_id,'participants','value2'); add_post_meta($post_id,'participants','value3'); add_post_meta($post_id,'participants','va...
206,862
<p>I have a function which checks if $_POST is set (a form which submits to the same page). I need to have it initialized before the page is loaded because the function will do a header <strong>redirect</strong> if the validation goes through without errors.</p> <p>So the function is registered like this:</p> <pre><c...
[ { "answer_id": 206867, "author": "Balas", "author_id": 17849, "author_profile": "https://wordpress.stackexchange.com/users/17849", "pm_score": 0, "selected": false, "text": "<p>See my updated answer, now i tried as per your condition and my url is like now</p>\n\n<pre><code> http://ww...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206862", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82394/" ]
I have a function which checks if $\_POST is set (a form which submits to the same page). I need to have it initialized before the page is loaded because the function will do a header **redirect** if the validation goes through without errors. So the function is registered like this: ``` add_action('init', 'signup_va...
actions do not "return" values. If you need to do some heavy computation that you want to avoid redoing at a later stage then you should store the value at a global variable (pure global, static or a field in an object depending on your favorite coding style).
206,880
<p>Based on <a href="https://docs.woothemes.com/document/adjust-the-quantity-input-values/" rel="nofollow">this snippet</a>, which checks the quantity in cart for MAX value: </p> <pre><code>add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); function jk_woocommerce_quantity_in...
[ { "answer_id": 206927, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>SimplePie for a long time is not truly an independent project as it was fully assimilated into wordpress....
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206880", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82637/" ]
Based on [this snippet](https://docs.woothemes.com/document/adjust-the-quantity-input-values/), which checks the quantity in cart for MAX value: ``` add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); function jk_woocommerce_quantity_input_args( $args, $product ) { $args[...
SimplePie for a long time is not truly an independent project as it was fully assimilated into wordpress. Not sure that there is any new development for it, but if there is it is unlikely to be any different than what it is at the latest wordpress core.
206,886
<p>I want to load products deatails on my custom page.Is there any way that i can use the <code>url key</code> like <code>http://localhost/mysite/product/samsung-1</code>.In this url <code>samsung-1</code> is the key for that product.I want to use this and get product details like name,description and attributes.Can i ...
[ { "answer_id": 206890, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 2, "selected": false, "text": "<p>You can use following function</p>\n\n<pre><code>/**\n* Retrieve a product given its slug.\n*/\n\nfunction get_pr...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45724/" ]
I want to load products deatails on my custom page.Is there any way that i can use the `url key` like `http://localhost/mysite/product/samsung-1`.In this url `samsung-1` is the key for that product.I want to use this and get product details like name,description and attributes.Can i do this using `url key` or i have to...
You simply can use the existing function [`get_page_by_path()`](https://codex.wordpress.org/Function_Reference/get_page_by_path) for this, which has a third parameter `$post_type` you can specify. In your case a post from the custom post type `product` is what you want. Basic example: ``` $product_obj = get_page_by_p...
206,894
<p>I am trying to get a list of my Wordpress categories to display on a Page, but haven't cracked this yet. </p> <p>So far, I have been able to create a <strong>custom category page</strong> (category-categoryname.php), to display a list of Page Titles associated with a single category. The code I have used for this i...
[ { "answer_id": 206890, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 2, "selected": false, "text": "<p>You can use following function</p>\n\n<pre><code>/**\n* Retrieve a product given its slug.\n*/\n\nfunction get_pr...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206894", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69746/" ]
I am trying to get a list of my Wordpress categories to display on a Page, but haven't cracked this yet. So far, I have been able to create a **custom category page** (category-categoryname.php), to display a list of Page Titles associated with a single category. The code I have used for this includes the following L...
You simply can use the existing function [`get_page_by_path()`](https://codex.wordpress.org/Function_Reference/get_page_by_path) for this, which has a third parameter `$post_type` you can specify. In your case a post from the custom post type `product` is what you want. Basic example: ``` $product_obj = get_page_by_p...
206,906
<p>Just wanted some advice in relation to adding some custom code to my wordpress site. I am using <code>geoip</code> to check a users country code and redirect them to the relevant site when they land on my homepage.</p> <p>Currently I include this block of <code>php</code> code at the very top of my themes <code>hea...
[ { "answer_id": 206898, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>The answer depends on why are you moving the folder.</p>\n\n<p>If you just need to folder to be moved but...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206906", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26255/" ]
Just wanted some advice in relation to adding some custom code to my wordpress site. I am using `geoip` to check a users country code and redirect them to the relevant site when they land on my homepage. Currently I include this block of `php` code at the very top of my themes `header.php` file. However I'm not sure t...
The answer depends on why are you moving the folder. If you just need to folder to be moved but leave the URLs the same then you will need to adjust yout apache/nginx config files to point to the right directory when serving a request for a url of the type /wp-content/... If you need to adjust the url as well then yo...
206,907
<p>I'm building a multisite in which site admins have no "manage options" capability. The problem is that withut this cap they cannot see the "site identity" tab in the customizer, where they can change the site icon (favicon) as well as the site's name.</p> <p>Is there a way to change the required capability to show ...
[ { "answer_id": 206920, "author": "Pavel S.", "author_id": 82344, "author_profile": "https://wordpress.stackexchange.com/users/82344", "pm_score": 0, "selected": false, "text": "<p>You can remove the <code>title_tagline</code> section from the customizer and add your own section with cust...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206907", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7212/" ]
I'm building a multisite in which site admins have no "manage options" capability. The problem is that withut this cap they cannot see the "site identity" tab in the customizer, where they can change the site icon (favicon) as well as the site's name. Is there a way to change the required capability to show this tab a...
**This is how I've interpreted from the wordpress [docs](https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/get_setting) at least. Originally these settings were made with `add_setting` and it is where the capability was originally set. Fortunately, we can use `get_setting` to change that value. It seems ...
206,916
<p>What will be best way to split large database on single site, not multi-site wp installation? <a href="https://wordpress.org/plugins/hyperdb/" rel="nofollow">HyperDB</a> is maybe for this (just, less than 10 webmasters managed to figure out how to install it, according to active installs).</p> <p>Currently site has...
[ { "answer_id": 206920, "author": "Pavel S.", "author_id": 82344, "author_profile": "https://wordpress.stackexchange.com/users/82344", "pm_score": 0, "selected": false, "text": "<p>You can remove the <code>title_tagline</code> section from the customizer and add your own section with cust...
2015/10/28
[ "https://wordpress.stackexchange.com/questions/206916", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25053/" ]
What will be best way to split large database on single site, not multi-site wp installation? [HyperDB](https://wordpress.org/plugins/hyperdb/) is maybe for this (just, less than 10 webmasters managed to figure out how to install it, according to active installs). Currently site has about 350k posts, it is on good VPS...
**This is how I've interpreted from the wordpress [docs](https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/get_setting) at least. Originally these settings were made with `add_setting` and it is where the capability was originally set. Fortunately, we can use `get_setting` to change that value. It seems ...
206,957
<p>I have some js scripts that are working on my site but I have found that some of the images are not showing up. I only have this issue with WordPress. So I have a pause button that shows as it's supposed to. When you press the button, it pauses the script as it's supposed to. When this happens, a new image is added ...
[ { "answer_id": 206983, "author": "Tobias Beuving", "author_id": 2690, "author_profile": "https://wordpress.stackexchange.com/users/2690", "pm_score": 0, "selected": false, "text": "<p>try a backslash '/' in front of 'images/play.png'</p>\n\n<p>so the url will look like this: '/images/pl...
2015/10/29
[ "https://wordpress.stackexchange.com/questions/206957", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14761/" ]
I have some js scripts that are working on my site but I have found that some of the images are not showing up. I only have this issue with WordPress. So I have a pause button that shows as it's supposed to. When you press the button, it pauses the script as it's supposed to. When this happens, a new image is added to ...
Relative URLs work nicely in wordpress, which is the reason for your failures. In general never use relative URLs for resources as they will most likely fail when a site is using "pretty permalinks". Best thing for what you are doing is to "group" the graphical resources and styling in a CSS (in which resources are re...
206,959
<p>My goal is to have this link structure:</p> <p>mypage.com/item/subitem/code</p> <p>Code are 6 random letters and numbers.</p> <p>I tried with having category and subcategory, but I dislike that because then i have to create post for every code that i have, and there are lots of it.</p> <p>What I want to is to ha...
[ { "answer_id": 206983, "author": "Tobias Beuving", "author_id": 2690, "author_profile": "https://wordpress.stackexchange.com/users/2690", "pm_score": 0, "selected": false, "text": "<p>try a backslash '/' in front of 'images/play.png'</p>\n\n<p>so the url will look like this: '/images/pl...
2015/10/29
[ "https://wordpress.stackexchange.com/questions/206959", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82670/" ]
My goal is to have this link structure: mypage.com/item/subitem/code Code are 6 random letters and numbers. I tried with having category and subcategory, but I dislike that because then i have to create post for every code that i have, and there are lots of it. What I want to is to have a template for page item/sub...
Relative URLs work nicely in wordpress, which is the reason for your failures. In general never use relative URLs for resources as they will most likely fail when a site is using "pretty permalinks". Best thing for what you are doing is to "group" the graphical resources and styling in a CSS (in which resources are re...
206,961
<p>I have this code in <code>functions.php</code> that organize media upload according to its Custom Post Type (CPT).</p> <p>So all images uploaded to a "Product" CPT will be inside <code>wp-content/uploads/product</code> directory.</p> <pre><code>add_filter("upload_dir", function ($args) { $id = (isset($_REQUEST["...
[ { "answer_id": 207603, "author": "Claudio Rimann", "author_id": 66433, "author_profile": "https://wordpress.stackexchange.com/users/66433", "pm_score": 1, "selected": false, "text": "<p>We did something quite similar in our plugin recently.\nHere's how we handle media deletions only when...
2015/10/29
[ "https://wordpress.stackexchange.com/questions/206961", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33361/" ]
I have this code in `functions.php` that organize media upload according to its Custom Post Type (CPT). So all images uploaded to a "Product" CPT will be inside `wp-content/uploads/product` directory. ``` add_filter("upload_dir", function ($args) { $id = (isset($_REQUEST["post_id"]) ? $_REQUEST["post_id"] : ""); ...
A small mistake, the `return` should be outside `if` ``` add_filter("upload_dir", function ($args) { $id = (isset($_REQUEST["post_id"]) ? $_REQUEST["post_id"] : ""); if($id) { $newdir = "/" . get_post_type($id); ... } return $args; }); ```
207,062
<p>In the checkout page, there is a review order table on the bottom. I want to remove the order review in checkout page. What is the remove action ?</p>
[ { "answer_id": 207200, "author": "Rishabh", "author_id": 81621, "author_profile": "https://wordpress.stackexchange.com/users/81621", "pm_score": 1, "selected": true, "text": "<p>Just add following code into your funtions.php</p>\n\n<pre><code>add_filter( β€˜woocommerce_product_tabs’, β€˜sb_w...
2015/10/29
[ "https://wordpress.stackexchange.com/questions/207062", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82041/" ]
In the checkout page, there is a review order table on the bottom. I want to remove the order review in checkout page. What is the remove action ?
Just add following code into your funtions.php ``` add_filter( β€˜woocommerce_product_tabs’, β€˜sb_woo_remove_reviews_tab’, 98); function sb_woo_remove_reviews_tab($tabs) { unset($tabs[β€˜reviews’]); return $tabs; } ```
207,063
<p>I want my cart page to show up on my checkout page. And I want to remove the order review from checkout page. so my cart page will show on the top.</p>
[ { "answer_id": 207068, "author": "Scriptonomy", "author_id": 82166, "author_profile": "https://wordpress.stackexchange.com/users/82166", "pm_score": 0, "selected": false, "text": "<p>I will give you the solution to the first part of your question:</p>\n\n<ul>\n<li>Goto WooCommerce Settin...
2015/10/29
[ "https://wordpress.stackexchange.com/questions/207063", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82041/" ]
I want my cart page to show up on my checkout page. And I want to remove the order review from checkout page. so my cart page will show on the top.
``` To remove order review from checkout page... ``` In your plugin folder Go To woocommerce->includes->wc-template-functions.php Now press ctrl+f and write woocommerce\_order\_review and press enter. You will find a function of the same name. Just remove its body(portion that comes under{}) And its done. ``` To show...
207,131
<p>I'm using WooCommerce.</p> <p>When users go to the lost-password page, type in an email address and press "Reset password", the page just reloads. I'm not sure what wordpress normally does, but I would expect it to show a "email has been sent..." page or text.</p> <p>The e-mail itself is sent just fine.</p> <p>Wh...
[ { "answer_id": 210911, "author": "szabesz", "author_id": 84818, "author_profile": "https://wordpress.stackexchange.com/users/84818", "pm_score": 0, "selected": false, "text": "<p>This is the solution I came up with: we can override the WooCommerce template file and change it. I do not li...
2015/10/30
[ "https://wordpress.stackexchange.com/questions/207131", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82046/" ]
I'm using WooCommerce. When users go to the lost-password page, type in an email address and press "Reset password", the page just reloads. I'm not sure what wordpress normally does, but I would expect it to show a "email has been sent..." page or text. The e-mail itself is sent just fine. What could be wrong? Simi...
I just found another solution to my problem. The problem was that the messages just wasn't displayed properly. By adding this code to my custom CSS (under "Appearance"), the messages are now shown again: ``` .page-id-1154 .woocommerce-message, .page-id-10 .woocommerce-message { display: block !important; } ```
207,134
<p>I am creating a like system in PHP . My code looks like this .</p> <pre><code>&lt;?php class Like_System { private $userid; private $postid; private $user_ko_like_count; private $post_ko_like_count; private $user_ko_dislike_count; private $post_ko_dislike_count; private $user_ip; p...
[ { "answer_id": 210911, "author": "szabesz", "author_id": 84818, "author_profile": "https://wordpress.stackexchange.com/users/84818", "pm_score": 0, "selected": false, "text": "<p>This is the solution I came up with: we can override the WooCommerce template file and change it. I do not li...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/207134", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80671/" ]
I am creating a like system in PHP . My code looks like this . ``` <?php class Like_System { private $userid; private $postid; private $user_ko_like_count; private $post_ko_like_count; private $user_ko_dislike_count; private $post_ko_dislike_count; private $user_ip; public function __...
I just found another solution to my problem. The problem was that the messages just wasn't displayed properly. By adding this code to my custom CSS (under "Appearance"), the messages are now shown again: ``` .page-id-1154 .woocommerce-message, .page-id-10 .woocommerce-message { display: block !important; } ```
207,184
<p>I'm trying to create a feed where posts are pulled based off a set of authors, OR a set of categories, but I haven't had much luck. I've tried using <code>meta_query</code> and <code>tax_query</code>, but neither worked. Basically the query I'm trying to run is:</p> <pre><code>"SELECT * FROM wp_posts WHERE author_i...
[ { "answer_id": 207713, "author": "William Brawner", "author_id": 82780, "author_profile": "https://wordpress.stackexchange.com/users/82780", "pm_score": 0, "selected": false, "text": "<p>Well, it's not pretty and I'm sure there are better ways to do this, but this is what I came up with:...
2015/10/30
[ "https://wordpress.stackexchange.com/questions/207184", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82780/" ]
I'm trying to create a feed where posts are pulled based off a set of authors, OR a set of categories, but I haven't had much luck. I've tried using `meta_query` and `tax_query`, but neither worked. Basically the query I'm trying to run is: ``` "SELECT * FROM wp_posts WHERE author_id = $set_of_authors OR category = $s...
Custom feed slug ---------------- To create a custom feed slug, e.g. ``` example.tld/billyfeed/ ``` we can use the [`add_feed()`](https://codex.wordpress.org/Rewrite_API/add_feed) but we have to flush the rewrite rules to activate it. We can do that e.g. by visiting the *Permalinks* settings page in the backend. ...
207,189
<p>I have created a meta box for a theme I am working on, it is a simple meta box with a check box for featured post. The problem is user can tick that check box for <strong>multiple posts</strong> in the <strong>same category</strong>. </p> <p>I want to disable the meta value from an old post once a new post publishe...
[ { "answer_id": 207713, "author": "William Brawner", "author_id": 82780, "author_profile": "https://wordpress.stackexchange.com/users/82780", "pm_score": 0, "selected": false, "text": "<p>Well, it's not pretty and I'm sure there are better ways to do this, but this is what I came up with:...
2015/10/31
[ "https://wordpress.stackexchange.com/questions/207189", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82260/" ]
I have created a meta box for a theme I am working on, it is a simple meta box with a check box for featured post. The problem is user can tick that check box for **multiple posts** in the **same category**. I want to disable the meta value from an old post once a new post published under that category. So basically ...
Custom feed slug ---------------- To create a custom feed slug, e.g. ``` example.tld/billyfeed/ ``` we can use the [`add_feed()`](https://codex.wordpress.org/Rewrite_API/add_feed) but we have to flush the rewrite rules to activate it. We can do that e.g. by visiting the *Permalinks* settings page in the backend. ...
207,199
<p>I duplicated my Wordpress installation to move to another server. Everything works find except one single file. I created a header-shop.php file to call a certain menu on my shop page. In the first server it was working. In the new one, it doesn't. It seems to me really crazy.</p> <p>Here is the file:</p> <pre><co...
[ { "answer_id": 207713, "author": "William Brawner", "author_id": 82780, "author_profile": "https://wordpress.stackexchange.com/users/82780", "pm_score": 0, "selected": false, "text": "<p>Well, it's not pretty and I'm sure there are better ways to do this, but this is what I came up with:...
2015/10/31
[ "https://wordpress.stackexchange.com/questions/207199", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40793/" ]
I duplicated my Wordpress installation to move to another server. Everything works find except one single file. I created a header-shop.php file to call a certain menu on my shop page. In the first server it was working. In the new one, it doesn't. It seems to me really crazy. Here is the file: ``` <!doctype html> <?...
Custom feed slug ---------------- To create a custom feed slug, e.g. ``` example.tld/billyfeed/ ``` we can use the [`add_feed()`](https://codex.wordpress.org/Rewrite_API/add_feed) but we have to flush the rewrite rules to activate it. We can do that e.g. by visiting the *Permalinks* settings page in the backend. ...
207,219
<p>I am trying to add some text to the <code>customer-order-processing</code> email from WooCommerce, and it should ONLY be added in this particular email and ONLY if chosen payment method is Paypal. I have come so far as the text is added, and only when Paypal is chosen as payment method, but the text is displayed in ...
[ { "answer_id": 207713, "author": "William Brawner", "author_id": 82780, "author_profile": "https://wordpress.stackexchange.com/users/82780", "pm_score": 0, "selected": false, "text": "<p>Well, it's not pretty and I'm sure there are better ways to do this, but this is what I came up with:...
2015/10/31
[ "https://wordpress.stackexchange.com/questions/207219", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82798/" ]
I am trying to add some text to the `customer-order-processing` email from WooCommerce, and it should ONLY be added in this particular email and ONLY if chosen payment method is Paypal. I have come so far as the text is added, and only when Paypal is chosen as payment method, but the text is displayed in every email to...
Custom feed slug ---------------- To create a custom feed slug, e.g. ``` example.tld/billyfeed/ ``` we can use the [`add_feed()`](https://codex.wordpress.org/Rewrite_API/add_feed) but we have to flush the rewrite rules to activate it. We can do that e.g. by visiting the *Permalinks* settings page in the backend. ...
207,225
<p>I would like to filter all the options values, but the option filters are option specific. Is there a way I could do something like</p> <pre><code>add_filter('pre_option_*', 'my_check'); </code></pre> <p>?</p>
[ { "answer_id": 207230, "author": "bonger", "author_id": 57034, "author_profile": "https://wordpress.stackexchange.com/users/57034", "pm_score": 0, "selected": false, "text": "<p>I suppose you could use <code>wp_load_alloptions()</code> and add a filter for each:</p>\n\n<pre><code>foreach...
2015/10/31
[ "https://wordpress.stackexchange.com/questions/207225", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49220/" ]
I would like to filter all the options values, but the option filters are option specific. Is there a way I could do something like ``` add_filter('pre_option_*', 'my_check'); ``` ?
I've tried the same thing and was able to hook into the `pre_option_` filter by using `all` as filter. ``` add_filter('all', 'pre_option_',1,3); function pre_option_($actionHook,$bool=false,$option_name) { if(strpos($actionHook,'pre_option_') === FALSE){ return $bool; } } ```
207,259
<p>I've been trying to get post format to work for a while now, and for some reasons it is still not working the way it should.</p> <p>I am creating a custom theme based on HTML5 Blank theme.</p> <p>First thing I did was to add post_formats to functions.php</p> <pre><code>function add_post_formats() { add_theme_supp...
[ { "answer_id": 207264, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>Post formats are not magic. Your theme needs to actually have a code to generate different HTML (or apply...
2015/11/01
[ "https://wordpress.stackexchange.com/questions/207259", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/76033/" ]
I've been trying to get post format to work for a while now, and for some reasons it is still not working the way it should. I am creating a custom theme based on HTML5 Blank theme. First thing I did was to add post\_formats to functions.php ``` function add_post_formats() { add_theme_support( 'post-formats', array(...
Post formats are not magic. Your theme needs to actually have a code to generate different HTML (or apply different CSS rules) for different format. Having the theme "suuport" post formats is nice for future compatibility of the content, but by itself it doesn't do anything to how the content is displayed.
207,261
<p>For activation hooks codex states that you have to be explicit on globals:</p> <p><a href="https://codex.wordpress.org/Function_Reference/register_activation_hook#A_Note_on_Variable_Scope" rel="nofollow">A note on variables during activation</a></p> <p>But that seems not to be working on uninstall.php</p> <p>If i...
[ { "answer_id": 207263, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": true, "text": "<p>You should prefer the uninstall hook over the file if your main plugin doesn't have side effects (outputs ...
2015/11/01
[ "https://wordpress.stackexchange.com/questions/207261", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/66972/" ]
For activation hooks codex states that you have to be explicit on globals: [A note on variables during activation](https://codex.wordpress.org/Function_Reference/register_activation_hook#A_Note_on_Variable_Scope) But that seems not to be working on uninstall.php If i define a global in my main plugin file like this:...
You should prefer the uninstall hook over the file if your main plugin doesn't have side effects (outputs html or writes to file/DB automatically when loaded). IMO there is too much risk (i.e. non zero) of doing the uninstall.php code wrong and open the file to direct execution from the outside. This also help in havin...
207,280
<p>I'm using <code>wp_remove_get</code> to get the WordPress theme style content <strong>(style.css)</strong> and then get the theme version number. However I don't know exactly what regex I should use to get the version code:</p> <pre><code>&lt;?php $response = wp_remote_get( 'http://example.com/wp-content/theme...
[ { "answer_id": 207263, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": true, "text": "<p>You should prefer the uninstall hook over the file if your main plugin doesn't have side effects (outputs ...
2015/11/01
[ "https://wordpress.stackexchange.com/questions/207280", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82832/" ]
I'm using `wp_remove_get` to get the WordPress theme style content **(style.css)** and then get the theme version number. However I don't know exactly what regex I should use to get the version code: ``` <?php $response = wp_remote_get( 'http://example.com/wp-content/themes/theme-name/style.css' ); if( is_arr...
You should prefer the uninstall hook over the file if your main plugin doesn't have side effects (outputs html or writes to file/DB automatically when loaded). IMO there is too much risk (i.e. non zero) of doing the uninstall.php code wrong and open the file to direct execution from the outside. This also help in havin...
207,281
<p>I am using the code below in a page template.</p> <p>I have a custom post type of BOOK and there are 2 categories, author and contributor.</p> <p>My aim is to display the books in author category first, then below these the books in the contributor category.</p> <p>I think there's a problem with the loop, as the ...
[ { "answer_id": 207282, "author": "Macerier", "author_id": 75321, "author_profile": "https://wordpress.stackexchange.com/users/75321", "pm_score": -1, "selected": false, "text": "<p>you need to use <code>get_post_meta()</code> not <code>get_field()</code></p>\n" }, { "answer_id": ...
2015/11/01
[ "https://wordpress.stackexchange.com/questions/207281", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82833/" ]
I am using the code below in a page template. I have a custom post type of BOOK and there are 2 categories, author and contributor. My aim is to display the books in author category first, then below these the books in the contributor category. I think there's a problem with the loop, as the books display fine, but ...
The solution is simple: in the first loop, you are setting the `$amazon_link` like this: ``` $amazon_link = get_field('amazon_link', $image['ID']); ``` but in the second loop, you are setting a `$link`, like this: ``` $link = get_field('amazon_link', $image['ID']); ``` but you're still trying to echo `$amazon_lin...
207,291
<p>I have this code to use with shortcode at my portfolio pages.</p> <p>Everything is working fine, but I need that next and previous get the same category.</p> <p>This is the code:</p> <pre><code>add_shortcode( 'prev', 'prev_shortcode' ); add_shortcode( 'next', 'next_shortcode' ); function next_shortcode($atts) { ...
[ { "answer_id": 207293, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/Function_Reference/next_post_link\" rel=\"nofollow\"><code>next_post_l...
2015/11/01
[ "https://wordpress.stackexchange.com/questions/207291", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82841/" ]
I have this code to use with shortcode at my portfolio pages. Everything is working fine, but I need that next and previous get the same category. This is the code: ``` add_shortcode( 'prev', 'prev_shortcode' ); add_shortcode( 'next', 'next_shortcode' ); function next_shortcode($atts) { global $post; ob_star...
[`next_post_link()`](https://codex.wordpress.org/Function_Reference/next_post_link) accepts a third argument which will limit the links to the same category. There is an example of this usage in the Codex: ``` next_post_link( '%link', 'Next post in category', TRUE ); ``` > > in\_same\_term (*boolean*) (*optiona...
207,298
<p>I am trying to redirect the category link to the first child post. I am using following code in <code>category.php</code>. This redirects, but link doesn't go to first child post. How can I redirect to the first child post, in ASC order by date?</p> <pre><code>/* Category Template: Template URI: Description: ...
[ { "answer_id": 207299, "author": "flomei", "author_id": 65455, "author_profile": "https://wordpress.stackexchange.com/users/65455", "pm_score": 0, "selected": false, "text": "<p>You could probably use <code>get_posts()</code> to refine what you are looking for/where you want to be redire...
2015/11/01
[ "https://wordpress.stackexchange.com/questions/207298", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82846/" ]
I am trying to redirect the category link to the first child post. I am using following code in `category.php`. This redirects, but link doesn't go to first child post. How can I redirect to the first child post, in ASC order by date? ``` /* Category Template: Template URI: Description: */ if ( have_posts() ) : ...
You are much too late in the page load sequence to redirect. You need to redirect before headers are sent to the browser. The `template_redirect` hook should be a pretty good option: ``` function redirect_cat_wpse_207298() { if (is_category()) { global $post; wp_safe_redirect(get_permalink($post->ID)); d...
207,334
<p>Nowdays a Virus detection plugin is necessary for Wordpress?</p> <p>EDIT: I mean to prevent attacks and violations... for example i'm using this plugin: <a href="https://sucuri.net/wordpress-security/wordpress-security-monitoring" rel="nofollow">https://sucuri.net/wordpress-security/wordpress-security-monitoring</a...
[ { "answer_id": 207299, "author": "flomei", "author_id": 65455, "author_profile": "https://wordpress.stackexchange.com/users/65455", "pm_score": 0, "selected": false, "text": "<p>You could probably use <code>get_posts()</code> to refine what you are looking for/where you want to be redire...
2015/11/02
[ "https://wordpress.stackexchange.com/questions/207334", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82378/" ]
Nowdays a Virus detection plugin is necessary for Wordpress? EDIT: I mean to prevent attacks and violations... for example i'm using this plugin: <https://sucuri.net/wordpress-security/wordpress-security-monitoring> and i recive daily emails about some "Login Failures" using "admin" as Username and some differents pas...
You are much too late in the page load sequence to redirect. You need to redirect before headers are sent to the browser. The `template_redirect` hook should be a pretty good option: ``` function redirect_cat_wpse_207298() { if (is_category()) { global $post; wp_safe_redirect(get_permalink($post->ID)); d...
207,352
<p>We all know the advantage of using cdn caching etc.. For that sake i deregistered the script and registered jquery with cdn link . But the problem is that it is showing error like this</p> <p>Yes Debugging in wordpress is turned on.</p> <p>It shows error like this .</p> <blockquote> <p>Notice: wp_deregister_scr...
[ { "answer_id": 207353, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p>Based on the error...</p>\n\n<pre><code>add_action( 'wp_enqueue_scripts', function(){\n if (is_admin()) re...
2015/11/02
[ "https://wordpress.stackexchange.com/questions/207352", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82119/" ]
We all know the advantage of using cdn caching etc.. For that sake i deregistered the script and registered jquery with cdn link . But the problem is that it is showing error like this Yes Debugging in wordpress is turned on. It shows error like this . > > Notice: wp\_deregister\_script was called incorrectly. Do n...
Based on the error... ``` add_action( 'wp_enqueue_scripts', function(){ if (is_admin()) return; // don't dequeue on the backend wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', array(), null, false ); wp_enqueue_script( 'jque...
207,365
<p>yesterday @jas helped to how to show archive by years in my nav. It works fine, but there is the second one little problem.</p> <p>The @jas's solution filter me posts from all categories by year, I'd need to add filter to just one category.</p> <p>The function which add me years to my navigation is:</p> <pre><cod...
[ { "answer_id": 207368, "author": "stlawrance", "author_id": 82119, "author_profile": "https://wordpress.stackexchange.com/users/82119", "pm_score": 0, "selected": false, "text": "<p>I cannot comment so sorry .\nWhy don't you try using WP_QUERY . </p>\n\n<p>You can learn about WP_Query ei...
2015/11/02
[ "https://wordpress.stackexchange.com/questions/207365", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82177/" ]
yesterday @jas helped to how to show archive by years in my nav. It works fine, but there is the second one little problem. The @jas's solution filter me posts from all categories by year, I'd need to add filter to just one category. The function which add me years to my navigation is: ``` add_filter( 'wp_nav_menu_o...
If I understand you question clearly that we just need to get post in that submenus from only cat id = 4 , this will make your archive.php to work only for cat id = 4 Please add below code to **functions.php**: ``` function wpse75668_filter_pre_get_posts( $query ) { if ( $query->is_main_query() && ! is_admin() ) ...
207,383
<p>I am trying to run the following query to access my WP cf7dbplugin_submits table but it keeps coming up empty. I have added my table into wp-db.php model as such:</p> <pre><code>Added the contact form table- cf7dbplugin_submits to the following at about line 268: var $tables = array('cf7dbplugin_submits','posts...
[ { "answer_id": 207368, "author": "stlawrance", "author_id": 82119, "author_profile": "https://wordpress.stackexchange.com/users/82119", "pm_score": 0, "selected": false, "text": "<p>I cannot comment so sorry .\nWhy don't you try using WP_QUERY . </p>\n\n<p>You can learn about WP_Query ei...
2015/11/02
[ "https://wordpress.stackexchange.com/questions/207383", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82889/" ]
I am trying to run the following query to access my WP cf7dbplugin\_submits table but it keeps coming up empty. I have added my table into wp-db.php model as such: ``` Added the contact form table- cf7dbplugin_submits to the following at about line 268: var $tables = array('cf7dbplugin_submits','posts', . . .) At...
If I understand you question clearly that we just need to get post in that submenus from only cat id = 4 , this will make your archive.php to work only for cat id = 4 Please add below code to **functions.php**: ``` function wpse75668_filter_pre_get_posts( $query ) { if ( $query->is_main_query() && ! is_admin() ) ...
207,405
<p>I was wondering if it's possible to convert this kind of shortcode:</p> <pre><code>[card name="Muscle Band" set="XY" no="121" c="name"][/card] </code></pre> <p>Into this in Visual Mode (in blue-colored text):</p> <blockquote> <p>Muscle Band XY 121</p> </blockquote> <p>Basically, something that detects shortcod...
[ { "answer_id": 207368, "author": "stlawrance", "author_id": 82119, "author_profile": "https://wordpress.stackexchange.com/users/82119", "pm_score": 0, "selected": false, "text": "<p>I cannot comment so sorry .\nWhy don't you try using WP_QUERY . </p>\n\n<p>You can learn about WP_Query ei...
2015/11/03
[ "https://wordpress.stackexchange.com/questions/207405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34465/" ]
I was wondering if it's possible to convert this kind of shortcode: ``` [card name="Muscle Band" set="XY" no="121" c="name"][/card] ``` Into this in Visual Mode (in blue-colored text): > > Muscle Band XY 121 > > > Basically, something that detects shortcode that's in the above format and changes it into the se...
If I understand you question clearly that we just need to get post in that submenus from only cat id = 4 , this will make your archive.php to work only for cat id = 4 Please add below code to **functions.php**: ``` function wpse75668_filter_pre_get_posts( $query ) { if ( $query->is_main_query() && ! is_admin() ) ...