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
203,815
<p>I try somehow to get array of pages names. I don't think it's possible in some default method from WP.</p> <pre><code>&lt;?php $args = array( 'authors' =&gt; '', 'child_of' =&gt; 0, 'date_format' =&gt; get_option('date_format'), 'depth' =&gt; 0, 'echo' =&gt; 0, 'exclude' =&...
[ { "answer_id": 203826, "author": "coopersita", "author_id": 21258, "author_profile": "https://wordpress.stackexchange.com/users/21258", "pm_score": 2, "selected": false, "text": "<p>You cad add it via <code>functions.php</code> with a hook, instead of inside the loop (you don't really wa...
2015/09/26
[ "https://wordpress.stackexchange.com/questions/203815", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71139/" ]
I try somehow to get array of pages names. I don't think it's possible in some default method from WP. ``` <?php $args = array( 'authors' => '', 'child_of' => 0, 'date_format' => get_option('date_format'), 'depth' => 0, 'echo' => 0, 'exclude' => '', 'include' => '', '...
You cad add it via `functions.php` with a hook, instead of inside the loop (you don't really want to add a loop to header.php): ``` function add_author_meta() { if (is_single()){ global $post; $author = get_the_author_meta('user_nicename', $post->post_author); echo "<meta name=\"author\" c...
203,876
<p>I want to create a template where the first (latest) post is shown full width respectively without a sidebar. All the following posts should have been displayed normally, like <a href="http://www.kayture.com" rel="nofollow">here</a></p> <pre><code>1st POST 2nd POST | SIDEBAR 3rd POST | SIDEBAR 4th POST | SIDEBAR ....
[ { "answer_id": 203890, "author": "vol4ikman", "author_id": 31075, "author_profile": "https://wordpress.stackexchange.com/users/31075", "pm_score": 0, "selected": false, "text": "<p>You have to create some counter, that will count all your posts in your query.</p>\n\n<p>Than, wrap the fir...
2015/09/27
[ "https://wordpress.stackexchange.com/questions/203876", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81057/" ]
I want to create a template where the first (latest) post is shown full width respectively without a sidebar. All the following posts should have been displayed normally, like [here](http://www.kayture.com) ``` 1st POST 2nd POST | SIDEBAR 3rd POST | SIDEBAR 4th POST | SIDEBAR ... ``` Can you tell me how to do this?
You can also doe like below code snippet: ``` $flag=0; $args = array( 'orderby' => 'title', 'order' => 'DESC',); $query = new WP_Query( $args ); while ( $query->have_posts() ) { { the_post(); if($flag==0) { // you first post's title, content etc $flag=1; } else { //rest of your post's ti...
203,904
<p>I know how to remove items from the left nav bar (hook into <code>admin_menu</code> and do <code>global $menu; unset( $menu[ __( "Posts" ) ] );</code> for example). But it still shows a left nav bar (with nothing on it). I want the entire left nav bar gone.</p> <p>I have tried this and it doesn't work:</p> <pre><c...
[ { "answer_id": 203890, "author": "vol4ikman", "author_id": 31075, "author_profile": "https://wordpress.stackexchange.com/users/31075", "pm_score": 0, "selected": false, "text": "<p>You have to create some counter, that will count all your posts in your query.</p>\n\n<p>Than, wrap the fir...
2015/09/28
[ "https://wordpress.stackexchange.com/questions/203904", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48989/" ]
I know how to remove items from the left nav bar (hook into `admin_menu` and do `global $menu; unset( $menu[ __( "Posts" ) ] );` for example). But it still shows a left nav bar (with nothing on it). I want the entire left nav bar gone. I have tried this and it doesn't work: ``` //This doesn't work (in any hook, or pl...
You can also doe like below code snippet: ``` $flag=0; $args = array( 'orderby' => 'title', 'order' => 'DESC',); $query = new WP_Query( $args ); while ( $query->have_posts() ) { { the_post(); if($flag==0) { // you first post's title, content etc $flag=1; } else { //rest of your post's ti...
203,917
<p>Is there a section on the admin panel of my WordPress installation which just displays what role the current logged in user has?</p> <p>For example, I know I have administrator permissions because I <strong>know</strong> that but I can't see it confirmed anywhere.</p> <p>Also, if I set myself up as an Editor, how ...
[ { "answer_id": 203919, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 2, "selected": false, "text": "<p>As you suggested, here's how you can display the roles next to the username in the admin bar:</p>\n\n<pre>...
2015/09/28
[ "https://wordpress.stackexchange.com/questions/203917", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81083/" ]
Is there a section on the admin panel of my WordPress installation which just displays what role the current logged in user has? For example, I know I have administrator permissions because I **know** that but I can't see it confirmed anywhere. Also, if I set myself up as an Editor, how do I quickly check I am defini...
As you suggested, here's how you can display the roles next to the username in the admin bar: ``` function wpse_203917_admin_bar_menu( $wp_admin_bar ) { if ( ! $node = $wp_admin_bar->get_node( 'my-account' ) ) return; $roles = wp_get_current_user()->roles; $node->title .= sprintf( ' (%s)', implod...
203,924
<p>I'm working on my first OOP (MVC) based plugin.</p> <p>Everything works perfect, enqueue front/back-end styles, admin menu pages, shortcodes creation, etc...</p> <p>I load my main plugin class using the <code>init</code> hook.</p> <p>From the controller I instantiate the class <code>Custom_VC_Elements</code> (wit...
[ { "answer_id": 203940, "author": "phatskat", "author_id": 20143, "author_profile": "https://wordpress.stackexchange.com/users/20143", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>vc_before_init hook works perfect from the main plugin file, so outside all plugin classes.<...
2015/09/28
[ "https://wordpress.stackexchange.com/questions/203924", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80876/" ]
I'm working on my first OOP (MVC) based plugin. Everything works perfect, enqueue front/back-end styles, admin menu pages, shortcodes creation, etc... I load my main plugin class using the `init` hook. From the controller I instantiate the class `Custom_VC_Elements` (with constructor active). ``` class Custom_VC_El...
I found the solution... First I thought the problem had something to do with wrapping the hook inside a class.. But after some more testing (sometimes you need to take a step back), it appears the hook `vc_before_init` has already fired on the `init` hook with the (default) priority of 10... My current theme (Salient)...
203,937
<p>I am trying to add a Phone Number mandatory field to the Shipping Details page of the Woocommerce checkout but it should only be mandatory if an alternative shipping address is selected.</p> <p>Woocommerce see this as a bespoke modification which is outside of their support remit and have suggested I post the quest...
[ { "answer_id": 204008, "author": "Rob Wassell", "author_id": 81096, "author_profile": "https://wordpress.stackexchange.com/users/81096", "pm_score": 3, "selected": true, "text": "<p>I went back through this myself and I have answered my own question.</p>\n\n<p>By following the Woocommerc...
2015/09/28
[ "https://wordpress.stackexchange.com/questions/203937", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81096/" ]
I am trying to add a Phone Number mandatory field to the Shipping Details page of the Woocommerce checkout but it should only be mandatory if an alternative shipping address is selected. Woocommerce see this as a bespoke modification which is outside of their support remit and have suggested I post the question here. ...
I went back through this myself and I have answered my own question. By following the Woocommerce documentation, I actually confused myself and the second mandatory check isn't applicable as we can use this primary function to set required from false to true. This automatically adds the red asterisk and makes the fiel...
203,951
<p>It seems that all web resources based on the subject of removing a custom post type slug ie</p> <pre><code>yourdomain.com/CPT-SLUG/post-name </code></pre> <p>are now very outdated solutions often referencing pre WP version 3.5 installs. A common one is to:</p> <pre><code>'rewrite' =&gt; array( 'slug' =&gt; false,...
[ { "answer_id": 204166, "author": "Jan Beck", "author_id": 18760, "author_profile": "https://wordpress.stackexchange.com/users/18760", "pm_score": 4, "selected": false, "text": "<p>I tried to figure this out not long ago and the short answer from what I know is <strong>no</strong>. Not fr...
2015/09/28
[ "https://wordpress.stackexchange.com/questions/203951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18726/" ]
It seems that all web resources based on the subject of removing a custom post type slug ie ``` yourdomain.com/CPT-SLUG/post-name ``` are now very outdated solutions often referencing pre WP version 3.5 installs. A common one is to: ``` 'rewrite' => array( 'slug' => false, 'with_front' => false ), ``` within...
The following code will work, but you just have to keep in mind that conflicts can happen easily if the slug for your custom post type is the same as a page or post's slug... First, we will remove the slug from the permalink: ``` function na_remove_slug( $post_link, $post, $leavename ) { if ( 'events' != $post->...
203,977
<p>I am using a customized <code>mini-cart.php</code> file, in which there is this line of code:</p> <pre><code>$product_name = apply_filters( 'woocommerce_cart_item_name', $_product-&gt;get_title(), $cart_item, $cart_item_key ); </code></pre> <p>I sell two types of products, "shorts" and "longshorts". I don't w...
[ { "answer_id": 203982, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 1, "selected": false, "text": "<p>You need to add a function in your theme's <code>functions.php</code> file that will find and remove those two...
2015/09/28
[ "https://wordpress.stackexchange.com/questions/203977", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81047/" ]
I am using a customized `mini-cart.php` file, in which there is this line of code: ``` $product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ); ``` I sell two types of products, "shorts" and "longshorts". I don't want to see these two words in my cart wi...
You need to add a function in your theme's `functions.php` file that will find and remove those two words "shorts" and "longshorts" from a php string. Then you can add that function as a filter to the `woocommerce_cart_item_name` event that is being applied in your `mini-cart.php` Try something like: ``` function wpse...
204,022
<p>I am working on a custom registration form. How can I assign a role of "participant" to the new user? I tried many methods but did not succeed; the role change is not reflected in the admin user's list. </p>
[ { "answer_id": 237479, "author": "Charles Xavier", "author_id": 101716, "author_profile": "https://wordpress.stackexchange.com/users/101716", "pm_score": -1, "selected": false, "text": "<p>go to setting > general > New User Default Role change to participant</p>\n" }, { "answer_i...
2015/09/29
[ "https://wordpress.stackexchange.com/questions/204022", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81139/" ]
I am working on a custom registration form. How can I assign a role of "participant" to the new user? I tried many methods but did not succeed; the role change is not reflected in the admin user's list.
One way of doing it is, when you are submitting the registration form, define a value for the 'role' and then pass it with `wp_insert_user` [Codex](https://codex.wordpress.org/Function_Reference/wp_insert_user). Like this: ``` $fields_user = get_fields_user(); //get the values from the form and put them in an array. ...
204,038
<p>I am looking for a guide/guidance to create a proper custom wordpress repository for themes and plugins hosted on a website hosting account. I do not want to host it on github.com or anywhere else. I searched in google but without any success so far. Anyone could help?</p>
[ { "answer_id": 237479, "author": "Charles Xavier", "author_id": 101716, "author_profile": "https://wordpress.stackexchange.com/users/101716", "pm_score": -1, "selected": false, "text": "<p>go to setting > general > New User Default Role change to participant</p>\n" }, { "answer_i...
2015/09/29
[ "https://wordpress.stackexchange.com/questions/204038", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15801/" ]
I am looking for a guide/guidance to create a proper custom wordpress repository for themes and plugins hosted on a website hosting account. I do not want to host it on github.com or anywhere else. I searched in google but without any success so far. Anyone could help?
One way of doing it is, when you are submitting the registration form, define a value for the 'role' and then pass it with `wp_insert_user` [Codex](https://codex.wordpress.org/Function_Reference/wp_insert_user). Like this: ``` $fields_user = get_fields_user(); //get the values from the form and put them in an array. ...
204,062
<p>I currently have a site running on HTTPS with an SSL plugin activated</p> <p>Website: <code>https://www.greenwichsentinel.com</code></p> <p>SSL Plugin: Really Simple SSL</p> <p>Wordpress Version: 4.0.7 (Multisite)</p> <p>Everything seem configured correctly, however when trying to log into the site or view any d...
[ { "answer_id": 204099, "author": "Mike D", "author_id": 81182, "author_profile": "https://wordpress.stackexchange.com/users/81182", "pm_score": 0, "selected": false, "text": "<p>I used a redirect in <code>.htaccess</code> to a site recently and it seems to be working just fine.</p>\n\n<p...
2015/09/29
[ "https://wordpress.stackexchange.com/questions/204062", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78020/" ]
I currently have a site running on HTTPS with an SSL plugin activated Website: `https://www.greenwichsentinel.com` SSL Plugin: Really Simple SSL Wordpress Version: 4.0.7 (Multisite) Everything seem configured correctly, however when trying to log into the site or view any dashboard panel i get caught in a redirect ...
you'd be better not using a plugin and editing the .htaccess file (in root of website) something like this at the top: ``` RewriteEngine On RewriteCond %{HTTP_HOST} ^somesite.com [NC] RewriteRule ^(.*)$ https://www.somesite.com/$1 [L,R=301] ``` so your .htaccess file might look something like this: ``` RewriteEngin...
204,111
<p>I have a custom post type called <code>Event</code> which is registered like this:</p> <pre><code>add_action('init', 'register_custom_post_types'); function register_custom_post_types() { $event_capabilities = array( 'publish_posts' =&gt; 'publish_events', 'edit_posts' =&gt; 'edit_events', 'ed...
[ { "answer_id": 204439, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>The challenge we try to take on here is how to:</p>\n\n<ul>\n<li><p>not remove or replace the current <em>Page...
2015/09/30
[ "https://wordpress.stackexchange.com/questions/204111", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14870/" ]
I have a custom post type called `Event` which is registered like this: ``` add_action('init', 'register_custom_post_types'); function register_custom_post_types() { $event_capabilities = array( 'publish_posts' => 'publish_events', 'edit_posts' => 'edit_events', 'edit_others_posts' => 'edit_other...
The challenge we try to take on here is how to: * not remove or replace the current *Page Attribute* meta box * keep the hierarchical information in the drop-down. We assume we're on the single page edit screen, and want to add the `event` post type to the `page` *parent drop-down*. The drop-down is displayed using ...
204,114
<p>I have set up some CPTs and storing a meta key/val for each of them. When I get those posts, I need to order them by the meta value, but, <strong>the order of the meta values will be defined in an array by me</strong>. The <strong>default ordering for meta values is either alphabetical or numerical</strong>, which I...
[ { "answer_id": 204116, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 2, "selected": false, "text": "<p>If the value of the meta field is a single value (not serialized), this filter could work:</p>\n<pre><code>ad...
2015/09/30
[ "https://wordpress.stackexchange.com/questions/204114", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4740/" ]
I have set up some CPTs and storing a meta key/val for each of them. When I get those posts, I need to order them by the meta value, but, **the order of the meta values will be defined in an array by me**. The **default ordering for meta values is either alphabetical or numerical**, which I do not want. I'll explain i...
If the value of the meta field is a single value (not serialized), this filter could work: ``` add_filter( 'posts_orderby', 'custom_posts_orderby' ); function custom_posts_orderby( $orderby_statement ) { $custom_order = array( 'Apple', 'Banana', 'Guava', 'Melon' ); $custom_order = "'" . implode ( "', '", $cu...
204,250
<p>My posts contain a meta-field that holds an external id. I'm trying to create a function with a loop that goes through all posts and puts all the meta-keys in an array and returns this array. </p> <p>This is what i came up with, but it seems i'm missing something. Does anyone have a clue?</p> <pre><code>function g...
[ { "answer_id": 204260, "author": "Mitul", "author_id": 74728, "author_profile": "https://wordpress.stackexchange.com/users/74728", "pm_score": 0, "selected": false, "text": "<p>Please pass the 3rd argument true.</p>\n\n<p>like</p>\n\n<pre><code>get_post_meta($post_id, 'json_id', true);\n...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81263/" ]
My posts contain a meta-field that holds an external id. I'm trying to create a function with a loop that goes through all posts and puts all the meta-keys in an array and returns this array. This is what i came up with, but it seems i'm missing something. Does anyone have a clue? ``` function gather_ids () { $...
Your function is unreliable and totally overboard and really really expensive. Furthermore, as already stated by @MarkKaplun, you are not calling `the_post()` which causes the `$post` global not to be updated to the current post being looped through, so the value from `get_post_meta()` will always have the same value. ...
204,253
<p>Obviously WordPress knows where the plugins that are installed are located. </p> <p>Compared to other CMS software, the specifications for the location of a WordPress plugin are very loose. If I'm not mistaken, a plugin file is not required to be in the standard plugin folder, and it can be in a subfolder of the pl...
[ { "answer_id": 204260, "author": "Mitul", "author_id": 74728, "author_profile": "https://wordpress.stackexchange.com/users/74728", "pm_score": 0, "selected": false, "text": "<p>Please pass the 3rd argument true.</p>\n\n<p>like</p>\n\n<pre><code>get_post_meta($post_id, 'json_id', true);\n...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204253", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80462/" ]
Obviously WordPress knows where the plugins that are installed are located. Compared to other CMS software, the specifications for the location of a WordPress plugin are very loose. If I'm not mistaken, a plugin file is not required to be in the standard plugin folder, and it can be in a subfolder of the plugin folde...
Your function is unreliable and totally overboard and really really expensive. Furthermore, as already stated by @MarkKaplun, you are not calling `the_post()` which causes the `$post` global not to be updated to the current post being looped through, so the value from `get_post_meta()` will always have the same value. ...
204,263
<p>i make a wordpress theme i make a grid structure show below i have this grid structure </p> <p><a href="https://i.stack.imgur.com/QOiNk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QOiNk.jpg" alt="Grid Structure"></a></p> <p>it contain two rows and every row has three column i want to show m...
[ { "answer_id": 204379, "author": "Hafiz Usman aftab", "author_id": 79858, "author_profile": "https://wordpress.stackexchange.com/users/79858", "pm_score": 0, "selected": false, "text": "<p>at last i found a solution of my question if some one else have same issue then use this </p>\n\n<p...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204263", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/79858/" ]
i make a wordpress theme i make a grid structure show below i have this grid structure [![Grid Structure](https://i.stack.imgur.com/QOiNk.jpg)](https://i.stack.imgur.com/QOiNk.jpg) it contain two rows and every row has three column i want to show my wordpress random posts in this grid this is my code ``` ...
Here is the template layout and code for your original question. I am using [wp\_get\_recent\_posts](https://codex.wordpress.org/Function_Reference/wp_get_recent_posts) as it gives me recent posts from the category as you wanted, if not change orderby to rand for random posts, as wp\_get\_recent\_posts return posts by ...
204,265
<p>I'm exhaustively searching for a method to provide <strong>Next and Previous Post Links</strong> in a different way from which it usually appears in <strong>Single Post</strong>.</p> <p><strong>By DEFAULT it:</strong></p> <ul> <li><p>Is chronological ordered</p></li> <li><p>Links to posts from all blog categories<...
[ { "answer_id": 204270, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 4, "selected": true, "text": "<p>To get next/prev posts, usually all you need is to se to <code>true</code> the parameter that indicates that n...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204265", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81268/" ]
I'm exhaustively searching for a method to provide **Next and Previous Post Links** in a different way from which it usually appears in **Single Post**. **By DEFAULT it:** * Is chronological ordered * Links to posts from all blog categories **But I NEED it:** * ALPHABETICALLY ordered * Linking to posts on SAME CATE...
To get next/prev posts, usually all you need is to se to `true` the parameter that indicates that next/prev post should be in the same taxonomy term in the get next/prev post functions, you don't need to deal with any filter. For example: To get next and prev post objects: ``` // First parameter for these functions ...
204,281
<p>I have created a custom post type called <code>Event</code> and I have enabled support for featured images in my <code>functions.php</code> file, but still my custom user role can not see the featured image meta box on the edit page for an event. If a user logges in as administrator the <code>Featured Image</code> m...
[ { "answer_id": 204538, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p>Users that are only assigned to your <code>event_admin</code> role, don't have the <code>upload_files</code> ...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204281", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14870/" ]
I have created a custom post type called `Event` and I have enabled support for featured images in my `functions.php` file, but still my custom user role can not see the featured image meta box on the edit page for an event. If a user logges in as administrator the `Featured Image` meta box is displayed without any err...
I finally tracked the problem down to an activated plugin called [`Revisionary`](https://sv.wordpress.org/plugins/revisionary/). The function that is responsible for hiding the `postimagediv` element is `act_hide_admin_divs` located in `revisionary/admin/admin_rvy.php`. What the function does is to hide metaboxes with ...
204,295
<p>How can I get the Title of a Home Page to appear?</p> <p>I am using the Quark "out-of-the-box" <strong>Front Page Template</strong>.</p> <p>Home Page "view source":</p> <pre><code>&lt;article id="post-1" class="post-1 page type-page status-publish hentry"&gt; &lt;div class="entry-content"&gt; </code></pre> <...
[ { "answer_id": 204304, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>To return the name of your page, simply:</p>\n\n<pre><code>&lt;header class=\"entry-header\"&gt;\n &lt;h1 clas...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204295", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62808/" ]
How can I get the Title of a Home Page to appear? I am using the Quark "out-of-the-box" **Front Page Template**. Home Page "view source": ``` <article id="post-1" class="post-1 page type-page status-publish hentry"> <div class="entry-content"> ``` Inner Page "view source": ``` <article id="post-2" class="post...
``` $id_frontpage = get_option('page_on_front'); echo get_the_title( $id_frontpage ); ``` If you need the ID of the page that displays posts use `get_option('page_for_posts')`.
204,306
<p>I need to change the product position of an addon called "misura anello" in the products (i use product add-ons plugin), i want to place it above the price, like the attributes...</p> <p>i post to attach to images...</p> <p><a href="https://i.stack.imgur.com/0QGmu.jpg" rel="nofollow noreferrer"><img src="https://i...
[ { "answer_id": 219100, "author": "Awert", "author_id": 89601, "author_profile": "https://wordpress.stackexchange.com/users/89601", "pm_score": 0, "selected": false, "text": "<p>Search for class-product-addon-display.php in plugin folder.\nYou need function __construct().</p>\n\n<p>For me...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204306", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77095/" ]
I need to change the product position of an addon called "misura anello" in the products (i use product add-ons plugin), i want to place it above the price, like the attributes... i post to attach to images... [![using product addons](https://i.stack.imgur.com/0QGmu.jpg)](https://i.stack.imgur.com/0QGmu.jpg) [![usin...
For anyone wanting to do this outside of the plugin, to future proof this from updates, you can use the global var in place of the $this ``` add_action( 'woocommerce_after_add_to_cart_button', array( $GLOBALS['Product_Addon_Display'], 'display' ), 10 ); add_action( 'woocommerce_before_add_to_cart_button', array( $GL...
204,310
<p>All 404 implementations seem to revolve around showing related content. I think we can do one better by automatically searching for the missing post... How can this be done?</p>
[ { "answer_id": 204311, "author": "rothschild86", "author_id": 81286, "author_profile": "https://wordpress.stackexchange.com/users/81286", "pm_score": 3, "selected": true, "text": "<p>This can be done in two easy steps.</p>\n\n<ol>\n<li><p>Upgrade your site search with a plug in, such as ...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81286/" ]
All 404 implementations seem to revolve around showing related content. I think we can do one better by automatically searching for the missing post... How can this be done?
This can be done in two easy steps. 1. Upgrade your site search with a plug in, such as Relevanssi (optional). 2. Add the following code in functions.php or via Code Snippets (thx to @Howdy\_McGee and Russell Jamieson for ideas!) ``` function wpse_204310() { global $wp_query; if( is_404() && !is_rob...
204,313
<p>i have 2 categories that have book in adult, So i need when any user open this category to show him pop up message like :-</p> <blockquote> <p>The content you are about to view are of a mature matter. Please be advised that the content may not be suitable for those under the age of 18</p> </blockquote> <p>And wh...
[ { "answer_id": 204319, "author": "tushonline", "author_id": 15946, "author_profile": "https://wordpress.stackexchange.com/users/15946", "pm_score": 0, "selected": false, "text": "<p><strong>Option 1)</strong> You'll need to use conditional tags to determine which category page is being s...
2015/10/01
[ "https://wordpress.stackexchange.com/questions/204313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81259/" ]
i have 2 categories that have book in adult, So i need when any user open this category to show him pop up message like :- > > The content you are about to view are of a mature matter. Please be advised that the content may not be suitable for those under the age of 18 > > > And when click yes,, we can show this ...
**1)** Open your `templates/content-product_cat.php` file. **2)** Locate the following piece of code: ``` <li <?php wc_product_cat_class(); ?>> <?php do_action( 'woocommerce_before_subcategory', $category ); ?> <a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>"> ``` **3)** Replace the line `...
204,368
<p>I want to use $wpdb to get user's firstname. I know how to do it with php and mysql query, but I want to use $wpdb.</p> <p>The problem is that I don't know how to use it. I tried to create simple query to display user fist_name by user_id and than echo it. This is what I ended up with:</p> <pre><code>$mywpdb1 = $...
[ { "answer_id": 204369, "author": "Paul", "author_id": 49716, "author_profile": "https://wordpress.stackexchange.com/users/49716", "pm_score": 2, "selected": false, "text": "<p>You should'nt really be using wp query here, use <a href=\"https://codex.wordpress.org/Function_Reference/get_us...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204368", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78089/" ]
I want to use $wpdb to get user's firstname. I know how to do it with php and mysql query, but I want to use $wpdb. The problem is that I don't know how to use it. I tried to create simple query to display user fist\_name by user\_id and than echo it. This is what I ended up with: ``` $mywpdb1 = $wpdb->get_var( ...
You should'nt really be using wp query here, use [get\_user\_meta();](https://codex.wordpress.org/Function_Reference/get_user_meta) Example: ``` $first_name = get_user_meta(2, 'first_name', true); ```
204,405
<p>As administrator, if I make a new user, I can choose to email my new users a link which they click to go to wp-login.php where they are invited to set their password for the first time. (Wordpress used to email out a password, but I can see why they changed that!)</p> <p>Users arrive at wp-login which records the ...
[ { "answer_id": 204429, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 3, "selected": true, "text": "<p>You can add an extra help message box, on the <em>reset password</em> screen:</p>\n\n<p><a href=\"https://i.st...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37897/" ]
As administrator, if I make a new user, I can choose to email my new users a link which they click to go to wp-login.php where they are invited to set their password for the first time. (Wordpress used to email out a password, but I can see why they changed that!) Users arrive at wp-login which records the username in...
You can add an extra help message box, on the *reset password* screen: [![help text](https://i.stack.imgur.com/D2ZAj.jpg)](https://i.stack.imgur.com/D2ZAj.jpg) with the following: ``` /** * Display an extra help message box on the 'reset password' screen * * @link http://wordpress.stackexchange.com/a/204429/...
204,408
<p>I've created an image field using Image URL via the ACF plugin. This field appears across my pages. This field enables admin to change the background image for a selected class.</p> <p>Here's the code I have inserted between the <code>&lt;head&gt;&lt;/head&gt;</code> tags: </p> <pre><code>&lt;?php while ( hav...
[ { "answer_id": 204409, "author": "Stijn De Lathouwer", "author_id": 45458, "author_profile": "https://wordpress.stackexchange.com/users/45458", "pm_score": 0, "selected": false, "text": "<p>What is ACF returning? An object? Or a URL? With an object, you have to get the correct URL/size o...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204408", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37548/" ]
I've created an image field using Image URL via the ACF plugin. This field appears across my pages. This field enables admin to change the background image for a selected class. Here's the code I have inserted between the `<head></head>` tags: ``` <?php while ( have_posts() ) : the_post(); $background = ...
In the `header.php` template, you cannot access the `$post` variable. So you will have to map it using `$wp_query`, as mentioned on ACF forum [here](http://support.advancedcustomfields.com/forums/topic/selection-option-used-in-header/). Try this: ``` <?php global $wp_query; $post = $wp_query->post; $background = ...
204,427
<p>Is There Any Way to get the template Name By full URL for example</p> <p>If the full url is</p> <pre><code>www.example.com/hello-world </code></pre> <p>I need a function that return the template name (<code>page.php</code>)</p> <p>I know that WordPress matches every url with regular expression to determine the q...
[ { "answer_id": 204431, "author": "Joel", "author_id": 65652, "author_profile": "https://wordpress.stackexchange.com/users/65652", "pm_score": 1, "selected": false, "text": "<p>You should be able to use <a href=\"https://codex.wordpress.org/Function_Reference/get_page_template_slug\" rel=...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7984/" ]
Is There Any Way to get the template Name By full URL for example If the full url is ``` www.example.com/hello-world ``` I need a function that return the template name (`page.php`) I know that WordPress matches every url with regular expression to determine the query and decide which template to include. That's ...
You can make use of the global `$template` which holds the complete path of the current template being use to display a page. From there you can manipulate the value to get the name of the template As example, the value of `$template` looks like this: (*This is on my localhost on my PC*) ``` E:\xammp\htdocs\wordpress...
204,438
<p>I am using this code in <code>functions.php</code> to so it will show on the front of my site and show the read more, but the read more is not showing, your help would be appreciated.</p> <pre><code> function new_excerpt_more( $more ) { return ' &lt;a href="'. get_permalink( get_the_ID() ) . ' ' . __...
[ { "answer_id": 204441, "author": "shanebp", "author_id": 16575, "author_profile": "https://wordpress.stackexchange.com/users/16575", "pm_score": 1, "selected": false, "text": "<p>The <code>excerpt_more</code> filter only handles the linked text - not the link itself. </p>\n\n<p>Try:</p>\...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204438", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68271/" ]
I am using this code in `functions.php` to so it will show on the front of my site and show the read more, but the read more is not showing, your help would be appreciated. ``` function new_excerpt_more( $more ) { return ' <a href="'. get_permalink( get_the_ID() ) . ' ' . __('<br/><br/> Read More') . '...
The `excerpt_more` filter only handles the linked text - not the link itself. Try: ``` function new_excerpt_more( $more ) { return '<br/><br/>Read More'; } add_filter( 'excerpt_more', 'new_excerpt_more'); ```
204,446
<p>I want to create a new sidebar widget area in the header of my child theme. What would be the best way to do this?</p> <p>Here is the code for one of the sidebars in the parent theme:</p> <pre><code>&lt;?php add_action( 'widgets_init', 'ci_widgets_init' ); if ( ! function_exists( 'ci_widgets_init' ) ) : functi...
[ { "answer_id": 204469, "author": "dswebsme", "author_id": 62906, "author_profile": "https://wordpress.stackexchange.com/users/62906", "pm_score": 1, "selected": false, "text": "<p>Short answer is yes, adding the widget directly in the child theme functions.php file is perfectly acceptabl...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204446", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68414/" ]
I want to create a new sidebar widget area in the header of my child theme. What would be the best way to do this? Here is the code for one of the sidebars in the parent theme: ``` <?php add_action( 'widgets_init', 'ci_widgets_init' ); if ( ! function_exists( 'ci_widgets_init' ) ) : function ci_widgets_init() { ...
Well, this is what worked for me. In my `functions.php` file I put the following code: ``` function header_widgets_init() { register_sidebar( array( 'name' => 'Header Sidebar', 'id' => 'header_sidebar', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_ti...
204,447
<p><em>Side note: I've been designing in wordpress for only a few months, and don't know where else or how else to ask this, so my language may seem somewhat inaccurate.</em></p> <p>I'm using the Jupiter theme within Wordpress to create my site, which is essentially a textbook. One of the chapters has content I've cre...
[ { "answer_id": 204465, "author": "dswebsme", "author_id": 62906, "author_profile": "https://wordpress.stackexchange.com/users/62906", "pm_score": 1, "selected": true, "text": "<p>A couple of things before I get into the code:</p>\n\n<p>1) It would probably be a cleaner solution to solve ...
2015/10/02
[ "https://wordpress.stackexchange.com/questions/204447", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81344/" ]
*Side note: I've been designing in wordpress for only a few months, and don't know where else or how else to ask this, so my language may seem somewhat inaccurate.* I'm using the Jupiter theme within Wordpress to create my site, which is essentially a textbook. One of the chapters has content I've created with the "ta...
A couple of things before I get into the code: 1) It would probably be a cleaner solution to solve this in the theme via extended functionality (PHP modifications) as you gain more experience with WordPress. 2) If you are able to use numbers (1,2,3) instead of words (one,two,three) you can clean up the javascript sol...
204,454
<p>I'm building an application for a client that is accessed via an <em>email address</em> and a <em>project number</em> - a custom field.</p> <p>I created a really simple form from scratch (i.e. not using <code>wp_login_form</code>), and I validate the posted values with <code>WP_QUERY</code>.</p> <p>My problem is t...
[ { "answer_id": 204457, "author": "dswebsme", "author_id": 62906, "author_profile": "https://wordpress.stackexchange.com/users/62906", "pm_score": 1, "selected": false, "text": "<p>This has been covered quite thoroughly here:</p>\n\n<p><a href=\"https://wordpress.stackexchange.com/a/10522...
2015/10/03
[ "https://wordpress.stackexchange.com/questions/204454", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/59093/" ]
I'm building an application for a client that is accessed via an *email address* and a *project number* - a custom field. I created a really simple form from scratch (i.e. not using `wp_login_form`), and I validate the posted values with `WP_QUERY`. My problem is that when the form values are incorrect, or blank, the...
This has been covered quite thoroughly here: <https://wordpress.stackexchange.com/a/105224/62906> I've linked directly to the most informative and complete answer of the group (IMO).
204,485
<p>The security settings of a website we have was done according to Wordpress Recommendations and we did not have any single hacking attempts for months. Especially that wp-login.php and wp-admin are only limited by IP Address as follows:</p> <pre><code>&lt;Files wp-login.php&gt; order deny,allow allow from a.b.c.d d...
[ { "answer_id": 204486, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 3, "selected": true, "text": "<p>WordPress is also an XML-RPC server. So I guess these bots tried to gain access through the XML-RPC protocol v...
2015/10/03
[ "https://wordpress.stackexchange.com/questions/204485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81361/" ]
The security settings of a website we have was done according to Wordpress Recommendations and we did not have any single hacking attempts for months. Especially that wp-login.php and wp-admin are only limited by IP Address as follows: ``` <Files wp-login.php> order deny,allow allow from a.b.c.d deny from all </Files...
WordPress is also an XML-RPC server. So I guess these bots tried to gain access through the XML-RPC protocol via the `xmlrpc.php` file in your WordPress root directory. It's possible to login and most likely your security plugin is picking up failed login attempts when `wp_authenticate()` is called and the `wp_login_f...
204,488
<p>In the admin panel, if I go to "Users -> Your Profile" I don't have the inputs to set the password. I can only generate it, but I want to set it by hand. Is that some kind of bug, or was this intentionally removed from wordpress.</p> <p><a href="https://i.stack.imgur.com/tvxe9.png" rel="nofollow noreferrer"><img sr...
[ { "answer_id": 204486, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 3, "selected": true, "text": "<p>WordPress is also an XML-RPC server. So I guess these bots tried to gain access through the XML-RPC protocol v...
2015/10/03
[ "https://wordpress.stackexchange.com/questions/204488", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47802/" ]
In the admin panel, if I go to "Users -> Your Profile" I don't have the inputs to set the password. I can only generate it, but I want to set it by hand. Is that some kind of bug, or was this intentionally removed from wordpress. [![enter image description here](https://i.stack.imgur.com/tvxe9.png)](https://i.stack.im...
WordPress is also an XML-RPC server. So I guess these bots tried to gain access through the XML-RPC protocol via the `xmlrpc.php` file in your WordPress root directory. It's possible to login and most likely your security plugin is picking up failed login attempts when `wp_authenticate()` is called and the `wp_login_f...
204,502
<p>I change a user via SQL in wordpress:</p> <pre><code>SET @old_user='old_user'; SET @new_user='new_user'; UPDATE wp_users SET user_login = replace(user_login, @old_user, @new_user); UPDATE wp_users SET user_nicename = replace(user_nicename, @old_user, @new_user); UPDATE wp_usermeta SET meta_value = replace(meta_val...
[ { "answer_id": 204503, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 3, "selected": true, "text": "<p>You probably haven't changed the display name, which is probably what is being displayed. \"nicename\" is ...
2015/10/03
[ "https://wordpress.stackexchange.com/questions/204502", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70476/" ]
I change a user via SQL in wordpress: ``` SET @old_user='old_user'; SET @new_user='new_user'; UPDATE wp_users SET user_login = replace(user_login, @old_user, @new_user); UPDATE wp_users SET user_nicename = replace(user_nicename, @old_user, @new_user); UPDATE wp_usermeta SET meta_value = replace(meta_value, @old_user,...
You probably haven't changed the display name, which is probably what is being displayed. "nicename" is used for the author's posts page url and not for display. ``` UPDATE wp_users SET display_name = replace(display_name, @old_user, @new_user); ```
204,504
<p>My code is as follows:</p> <pre><code>$custom_args = array( 'orderby' =&gt; 'name', 'order' =&gt; 'ASC', 'depth' =&gt; 1, 'number' =&gt; 4, ); wp_list_categories($custom_args); </code></pre> <p>I'd like to create a list of categories and to show ...
[ { "answer_id": 204505, "author": "kiarashi", "author_id": 68619, "author_profile": "https://wordpress.stackexchange.com/users/68619", "pm_score": 0, "selected": false, "text": "<p>Structure is as follows:</p>\n\n<pre><code>&lt;ul class=\"main-menu\"&gt; \n &lt;li&gt;&lt;a href=\"\"&g...
2015/10/03
[ "https://wordpress.stackexchange.com/questions/204504", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68619/" ]
My code is as follows: ``` $custom_args = array( 'orderby' => 'name', 'order' => 'ASC', 'depth' => 1, 'number' => 4, ); wp_list_categories($custom_args); ``` I'd like to create a list of categories and to show only the parent category, I use `'dept...
You should add `'child_of' => 0,` That way you will display only Main categories aka children of 0. ``` $custom_args = array( 'orderby' => 'name', 'order' => 'ASC', 'child_of' => 0, 'depth' => 1, 'number' => 4, ); wp_list_categories($custom...
204,536
<p>I am an Admin of wordpress website and I have created one user with Editor role, I have installed one plugin Pretty Link(<a href="https://wordpress.org/plugins/pretty-link/" rel="nofollow">https://wordpress.org/plugins/pretty-link/</a>) this plugin shows its menu on Admin page but not on Editors page. </p> <p>I wan...
[ { "answer_id": 204562, "author": "dswebsme", "author_id": 62906, "author_profile": "https://wordpress.stackexchange.com/users/62906", "pm_score": 0, "selected": false, "text": "<p>The free version of this plugin does not appear to support dynamic role assignment. Only users with an acces...
2015/10/04
[ "https://wordpress.stackexchange.com/questions/204536", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78442/" ]
I am an Admin of wordpress website and I have created one user with Editor role, I have installed one plugin Pretty Link(<https://wordpress.org/plugins/pretty-link/>) this plugin shows its menu on Admin page but not on Editors page. I want to display this menu option on Editor page also, so how to do this? I am using...
**Check these links below.** This is where the permissions are being set for your pretty link plugin admin menu: **[pretty-link/prli-main.php -> line 16](https://github.com/wp-plugins/pretty-link/blob/master/prli-main.php#L16) -** **it's set to `administrator` you want `edit_posts`** **[pretty-link/prli-main.php -> ...
204,564
<p>It seems a lot of plugin developers take the time to add filter/action hooks to let users tweak their products’ functionality. Which is great, but what they often don’t do is provide a list of hooks and how many arguments they take. </p> <p>Has anyone found the best automated way to point at a plugin (or theme) dir...
[ { "answer_id": 204822, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 3, "selected": false, "text": "<p>There is no script or plugin that I know of to do what you want. As you have stated, there are scripts ...
2015/10/04
[ "https://wordpress.stackexchange.com/questions/204564", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80980/" ]
It seems a lot of plugin developers take the time to add filter/action hooks to let users tweak their products’ functionality. Which is great, but what they often don’t do is provide a list of hooks and how many arguments they take. Has anyone found the best automated way to point at a plugin (or theme) directory and...
There is no script or plugin that I know of to do what you want. As you have stated, there are scripts (*even global variables*) which you can use to print filters and actions currently being used. As for dormant filters and actions, I have written two very basic functions (*with some help here and there*) which finds...
204,615
<p>on my newssite i have the first post in a full-width column, after that all older post are in three columns per row. But now i want that wordpress put after every three columns a and to keeps the elements into rows. I tried to adjust the following solutions: <a href="https://stackoverflow.com/questions/29922657/ad...
[ { "answer_id": 204617, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>If HHVM has bugs with core PHP functionality then it is not ready to be used for production sites.</p>\n"...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204615", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/75019/" ]
on my newssite i have the first post in a full-width column, after that all older post are in three columns per row. But now i want that wordpress put after every three columns a and to keeps the elements into rows. I tried to adjust the following solutions: [Solution 1](https://stackoverflow.com/questions/29922657/add...
If HHVM has bugs with core PHP functionality then it is not ready to be used for production sites.
204,626
<p>I am using this code, but nothing is being shown on the front page. It seems the shortcode is registered correctly though. </p> <pre><code>function choose_ashtopbar() { ?&gt;&lt;img src="/images/flag_globe2.png" class="ttupmg" /&gt;&lt;div class="dmzeus"&gt;&lt;ul&gt;&lt;li class="f-selection"&gt;London&lt;ul&gt;&l...
[ { "answer_id": 204629, "author": "dswebsme", "author_id": 62906, "author_profile": "https://wordpress.stackexchange.com/users/62906", "pm_score": 1, "selected": false, "text": "<p>Your code works as expected. Two things you need to check:</p>\n\n<p>1) In order for shortcodes to render as...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40727/" ]
I am using this code, but nothing is being shown on the front page. It seems the shortcode is registered correctly though. ``` function choose_ashtopbar() { ?><img src="/images/flag_globe2.png" class="ttupmg" /><div class="dmzeus"><ul><li class="f-selection">London<ul><li>New York</li><li>Paris</li><li>Milan</li></ul...
~~As `birgire` mentioned in the comments, "you're missing the `return` part" to which you replied "how do I add that without escaping the HTML code?"~~ **EDIT**: Just a clarification. Your code should have worked, as pointed out by dswebsme. I just tested with and without a return, and both work (although returning wo...
204,627
<p>I'm setting up a plugin that requires passing of a variable from a stand alone jQuery file to options.php. I have (I think) set up the scripts to be used in my plugin file like so:</p> <pre><code>function ndw_js_init(){ wp_enqueue_script('jquery'); wp_register_script( 'ndw_js', plugin_dir_url( __FILE__ ) . ...
[ { "answer_id": 204629, "author": "dswebsme", "author_id": 62906, "author_profile": "https://wordpress.stackexchange.com/users/62906", "pm_score": 1, "selected": false, "text": "<p>Your code works as expected. Two things you need to check:</p>\n\n<p>1) In order for shortcodes to render as...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204627", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35299/" ]
I'm setting up a plugin that requires passing of a variable from a stand alone jQuery file to options.php. I have (I think) set up the scripts to be used in my plugin file like so: ``` function ndw_js_init(){ wp_enqueue_script('jquery'); wp_register_script( 'ndw_js', plugin_dir_url( __FILE__ ) . '/ndw_js.js', ...
~~As `birgire` mentioned in the comments, "you're missing the `return` part" to which you replied "how do I add that without escaping the HTML code?"~~ **EDIT**: Just a clarification. Your code should have worked, as pointed out by dswebsme. I just tested with and without a return, and both work (although returning wo...
204,657
<p>Today I got a client that wanted custom template for each page and section within. I proposed Laravel custom sh3t, but he wanted WordPress, as it seems more easy to main( <em>not from my experience</em> ).</p> <p>.. So far so good. I'm a little confused there. </p> <p>So I decided that my parent entity would be pa...
[ { "answer_id": 204661, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Custom post types can have selectable templates, you'll just have to implement them yourself. The way WordPress do...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204657", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81454/" ]
Today I got a client that wanted custom template for each page and section within. I proposed Laravel custom sh3t, but he wanted WordPress, as it seems more easy to main( *not from my experience* ). .. So far so good. I'm a little confused there. So I decided that my parent entity would be page, so I can apply diffe...
Typically I wouldn't follow such a strong answer like the one @Milo provided with a post like this. Since I already had this code written for another project I thought I'd share. The code below does everything @Milo summarized in his answer and I've ported this across projects before with great success. Here's the ch...
204,678
<p>I would like some very simple and limited Geo targeting functionality.</p> <p>I want to display a different footer depending on whether the visitor is from US or not. Ideally the code should be something like this:</p> <pre><code>&lt;?php if ( visitor is from usa ): ?&gt; &lt;?php get_footer('us'); ?&gt; &lt;?php ...
[ { "answer_id": 204684, "author": "Aric Watson", "author_id": 81449, "author_profile": "https://wordpress.stackexchange.com/users/81449", "pm_score": 1, "selected": false, "text": "<p>I used this service a long time ago and it was <em>relatively</em> painless to set up:\n<a href=\"https:/...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204678", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80031/" ]
I would like some very simple and limited Geo targeting functionality. I want to display a different footer depending on whether the visitor is from US or not. Ideally the code should be something like this: ``` <?php if ( visitor is from usa ): ?> <?php get_footer('us'); ?> <?php else: ?> <?php get_footer('other-cou...
I personally really like the GEO service provided by [ip-api.com](http://ip-api.com/docs/api:serialized_php) It is very simple to use and a sample PHP code to grab the `countryCode` would give you what you need very simply. You can do MUCH more and you can read the full doc on it but for your specific needs listed, he...
204,688
<p>I'm using my own taxonomy for blog posts and would like to remove Categories and Tags from the Dashboard. I've removed them from the Admin Menu and the meta boxes on the Edit Posts page from this question here: <a href="https://wordpress.stackexchange.com/questions/110782/remove-categories-tags-from-admin-menu">Remo...
[ { "answer_id": 204705, "author": "fatwombat", "author_id": 81482, "author_profile": "https://wordpress.stackexchange.com/users/81482", "pm_score": 1, "selected": false, "text": "<p>That actually requires you to rewrite the table itself.</p>\n\n<p>The following link can help you with this...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204688", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38890/" ]
I'm using my own taxonomy for blog posts and would like to remove Categories and Tags from the Dashboard. I've removed them from the Admin Menu and the meta boxes on the Edit Posts page from this question here: [Remove Categories / Tags From Admin Menu](https://wordpress.stackexchange.com/questions/110782/remove-catego...
Just like @fatwombat suggested you need to rewrite the table. If you can't modify the @Milo solution, here is a snippet that will remove the columns: ``` function my_manage_columns( $columns ) { unset($columns['categories'], $columns['tags']); return $columns; } function my_column_init() { add_filter( 'ma...
204,693
<p>I want to force users to accept the terms and conditions of the site when they log in for the first time. I found a couple plugins that would show the terms, but they don't prevent you from ignoring the form and moving on to other site pages. Is there a way to prevent the user from going anywhere until they have acc...
[ { "answer_id": 204705, "author": "fatwombat", "author_id": 81482, "author_profile": "https://wordpress.stackexchange.com/users/81482", "pm_score": 1, "selected": false, "text": "<p>That actually requires you to rewrite the table itself.</p>\n\n<p>The following link can help you with this...
2015/10/05
[ "https://wordpress.stackexchange.com/questions/204693", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69989/" ]
I want to force users to accept the terms and conditions of the site when they log in for the first time. I found a couple plugins that would show the terms, but they don't prevent you from ignoring the form and moving on to other site pages. Is there a way to prevent the user from going anywhere until they have accept...
Just like @fatwombat suggested you need to rewrite the table. If you can't modify the @Milo solution, here is a snippet that will remove the columns: ``` function my_manage_columns( $columns ) { unset($columns['categories'], $columns['tags']); return $columns; } function my_column_init() { add_filter( 'ma...
204,697
<p>I've set up some code to download zip files that exist in a folder above the web root. The download will be triggered from a user account page within WordPress. They don't need to be bank-level secure, but I'd like to prevent direct file access from outside the site and make them accessible only for users with the c...
[ { "answer_id": 204716, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": -1, "selected": false, "text": "<p>Instead of using a form just use a link like ..../download.php?file=abc.zip. Check the user credentials ...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204697", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54702/" ]
I've set up some code to download zip files that exist in a folder above the web root. The download will be triggered from a user account page within WordPress. They don't need to be bank-level secure, but I'd like to prevent direct file access from outside the site and make them accessible only for users with the corr...
What you have there is production ready. However, there is room for some minor improvements, so I will point those out for you. Also see my notes below regarding X-Sendfile and X-Accel-Redirect. --- Replace these lines: ``` ob_clean(); flush(); ``` with the following: ``` while (@ob_end_clean()); ``` *The point...
204,699
<p>I'm trying to add a top level menu to the left sidebar of the WordPress admin panel.</p> <p>Here's the code I currently have:</p> <pre><code>add_action( 'admin_menu', 'linked_url' ); function linked_url() { add_menu_page( 'linked_url', 'Menu Title', 'read', 'my_slug', '', 'dashicons-text', 1 ); } add_action( 'adm...
[ { "answer_id": 204708, "author": "Robert hue", "author_id": 22461, "author_profile": "https://wordpress.stackexchange.com/users/22461", "pm_score": 2, "selected": false, "text": "<p>You can do that with jQuery. We can open this link in new tab/window by adding <code>target=\"_blank\"</co...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204699", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81477/" ]
I'm trying to add a top level menu to the left sidebar of the WordPress admin panel. Here's the code I currently have: ``` add_action( 'admin_menu', 'linked_url' ); function linked_url() { add_menu_page( 'linked_url', 'Menu Title', 'read', 'my_slug', '', 'dashicons-text', 1 ); } add_action( 'admin_menu' , 'linkedurl...
You can do that with jQuery. We can open this link in new tab/window by adding `target="_blank"` attribute dynamically on link which has URL `https://www.example.com`. Here is the example function for that. ``` function wpse_my_custom_script() { ?> <script type="text/javascript"> jQuery(document).ready...
204,712
<p>I am struggling with SMS sending in WordPress without plugin, I have a, API, but that API is not working. Example:</p> <pre><code>function mysite_woocommerce_order_status_processing( $order_id ) { $mobile="123456"; $url="****/api.php?username=******&amp;password=1234&amp;source=UPDATE&amp;dmobile=".$mobil...
[ { "answer_id": 204713, "author": "Robert hue", "author_id": 22461, "author_profile": "https://wordpress.stackexchange.com/users/22461", "pm_score": 1, "selected": false, "text": "<p>I think this is the error. The last variable <code>$msg</code> is incorrectly inserted. Here is the correc...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204712", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/73468/" ]
I am struggling with SMS sending in WordPress without plugin, I have a, API, but that API is not working. Example: ``` function mysite_woocommerce_order_status_processing( $order_id ) { $mobile="123456"; $url="****/api.php?username=******&password=1234&source=UPDATE&dmobile=".$mobile."&message='.$msg.' "; ...
I think this is the error. The last variable `$msg` is incorrectly inserted. Here is the corrected code. ``` function mysite_woocommerce_order_status_processing( $order_id ) { $mobile="123456"; $url="****/api.php?username=******&password=1234&source=UPDATE&dmobile=".$mobile."&message='".$msg."'"; $respo...
204,722
<p>I want to redirect the url if it contains the string like <code>/blog/abcd.../</code> to blog listing page i.e. <code>/blog page</code>. I used a to code in htaccess file. </p> <p><code>Redirect 301 /blog/abcd http://www.example.com/blog</code></p> <p>But the browser says <code>Too many redirect</code> error. I th...
[ { "answer_id": 204713, "author": "Robert hue", "author_id": 22461, "author_profile": "https://wordpress.stackexchange.com/users/22461", "pm_score": 1, "selected": false, "text": "<p>I think this is the error. The last variable <code>$msg</code> is incorrectly inserted. Here is the correc...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204722", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/53934/" ]
I want to redirect the url if it contains the string like `/blog/abcd.../` to blog listing page i.e. `/blog page`. I used a to code in htaccess file. `Redirect 301 /blog/abcd http://www.example.com/blog` But the browser says `Too many redirect` error. I think Wordpress also do a redirection for blog single post that...
I think this is the error. The last variable `$msg` is incorrectly inserted. Here is the corrected code. ``` function mysite_woocommerce_order_status_processing( $order_id ) { $mobile="123456"; $url="****/api.php?username=******&password=1234&source=UPDATE&dmobile=".$mobile."&message='".$msg."'"; $respo...
204,728
<p>I've tried to add my custom image size like:</p> <p><code>add_image_size('224_226', 224, 226, false);</code></p> <p>I need resize all images to same size what i define in style, when i've uploaded file - Wordpress resize it to '224x174' but i need size 224x226. </p> <p>I don't need a crop image.</p> <p>Guys tell...
[ { "answer_id": 204713, "author": "Robert hue", "author_id": 22461, "author_profile": "https://wordpress.stackexchange.com/users/22461", "pm_score": 1, "selected": false, "text": "<p>I think this is the error. The last variable <code>$msg</code> is incorrectly inserted. Here is the correc...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204728", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81491/" ]
I've tried to add my custom image size like: `add_image_size('224_226', 224, 226, false);` I need resize all images to same size what i define in style, when i've uploaded file - Wordpress resize it to '224x174' but i need size 224x226. I don't need a crop image. Guys tell me what to do?
I think this is the error. The last variable `$msg` is incorrectly inserted. Here is the corrected code. ``` function mysite_woocommerce_order_status_processing( $order_id ) { $mobile="123456"; $url="****/api.php?username=******&password=1234&source=UPDATE&dmobile=".$mobile."&message='".$msg."'"; $respo...
204,738
<p>I have used the following function for breadcrumbs on every site to date, but todays site has 3 custom post types and the client would like the breadcrumbs working, e.g. instead of "home / wines / naire blanco" we just get "home / / naire blanco".</p> <pre><code>function the_breadcrumb() { echo '&lt;ol cla...
[ { "answer_id": 221476, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 5, "selected": true, "text": "<p>The issue with most breadcrumb functions is that it relies on the <code>$post</code> object on all pages...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204738", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34820/" ]
I have used the following function for breadcrumbs on every site to date, but todays site has 3 custom post types and the client would like the breadcrumbs working, e.g. instead of "home / wines / naire blanco" we just get "home / / naire blanco". ``` function the_breadcrumb() { echo '<ol class="breadcrumb" it...
The issue with most breadcrumb functions is that it relies on the `$post` object on all pages. Not only is the `$post` global totally unreliable (*see my post [here](https://wordpress.stackexchange.com/q/167706/31545)*), it might not even contain the data that we need, even if the `$post` global is not compromised The...
204,744
<p>I want to fetch a list of posts with the most recent comments. However I don't wish to simply get the latest comments and have duplicate posts, but I want to group the posts (by their ID). I tried the following (ff it is important: the code is in the widget() methode of a widget class):</p> <pre><code>function dist...
[ { "answer_id": 221476, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 5, "selected": true, "text": "<p>The issue with most breadcrumb functions is that it relies on the <code>$post</code> object on all pages...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204744", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81196/" ]
I want to fetch a list of posts with the most recent comments. However I don't wish to simply get the latest comments and have duplicate posts, but I want to group the posts (by their ID). I tried the following (ff it is important: the code is in the widget() methode of a widget class): ``` function distinct() { r...
The issue with most breadcrumb functions is that it relies on the `$post` object on all pages. Not only is the `$post` global totally unreliable (*see my post [here](https://wordpress.stackexchange.com/q/167706/31545)*), it might not even contain the data that we need, even if the `$post` global is not compromised The...
204,768
<p>I can't get the Featured Image metabox and taxonomy to show up on the edit page for the default post and page post types. it does work for the custom post type I've created using a plugin. It just doesn't work with the default ones.</p> <p>Also been checking the screen options on the top right of the edit page and ...
[ { "answer_id": 204804, "author": "fatwombat", "author_id": 81482, "author_profile": "https://wordpress.stackexchange.com/users/81482", "pm_score": 0, "selected": false, "text": "<p>Have you got the following in your functions.php file - it might solve the problem:</p>\n\n<pre><code>add_t...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204768", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81322/" ]
I can't get the Featured Image metabox and taxonomy to show up on the edit page for the default post and page post types. it does work for the custom post type I've created using a plugin. It just doesn't work with the default ones. Also been checking the screen options on the top right of the edit page and the checkb...
Have you got the following in your functions.php file - it might solve the problem: ``` add_theme_support( 'post-thumbnails' ); ```
204,773
<p>I basically want the output of <code>get_stylesheet_directory_uri()</code>, but without http(s) and the domain.</p>
[ { "answer_id": 204777, "author": "Chris Cox", "author_id": 1718, "author_profile": "https://wordpress.stackexchange.com/users/1718", "pm_score": 2, "selected": false, "text": "<p>The easiest way to do this would be to regex it. Use preg_replace() or similar to trim the output of get_site...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204773", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40796/" ]
I basically want the output of `get_stylesheet_directory_uri()`, but without http(s) and the domain.
Use [`parse_url()`](http://php.net/manual/en/function.parse-url.php), because it exists exactly for that reason: ``` $path = parse_url( get_stylesheet_directory_uri(), PHP_URL_PATH ); ``` Chris Cox’ solution will fail when the `wp-content` directory runs under a different domain than the rest of the site.
204,779
<p>By default the WordPress Media Library allows you to filter results by their type or date. How can I add a third drop down to list and filter by author?</p> <p>Currently we have this:</p> <p><a href="https://i.stack.imgur.com/cHyP3.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/cHyP3.jpg" alt="enter ima...
[ { "answer_id": 204819, "author": "sbounty", "author_id": 81512, "author_profile": "https://wordpress.stackexchange.com/users/81512", "pm_score": 1, "selected": false, "text": "<p>If you need this for your own site then instead of code you can go to list view and click on author name unde...
2015/10/06
[ "https://wordpress.stackexchange.com/questions/204779", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26666/" ]
By default the WordPress Media Library allows you to filter results by their type or date. How can I add a third drop down to list and filter by author? Currently we have this: [![enter image description here](https://i.stack.imgur.com/cHyP3.jpg)](https://i.stack.imgur.com/cHyP3.jpg) I'd like to have the following: ...
In your question you showed the image which is grid-view and that codex belongs to list-view. So I am confused here for which section you are talking about. **Grid View :** not possible unless you change the core as they don't provide any hook and the whole media section was created by jquery, backbone and unserscore....
204,833
<p>I am learning how to work with Wordpress, and im trying to build my own website in it.</p> <p>Since my website is a onepages, i would like to be able to load all my pages ( they then count as sections ) to get loaded on the frontpage, with there templates.</p> <p>i now have a index.php that loops through the pages...
[ { "answer_id": 204868, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>Create a directory <code>page-templates</code> in your theme for <a href=\"https://developer.wordpress.org/themes/tem...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204833", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81545/" ]
I am learning how to work with Wordpress, and im trying to build my own website in it. Since my website is a onepages, i would like to be able to load all my pages ( they then count as sections ) to get loaded on the frontpage, with there templates. i now have a index.php that loops through the pages but doesnt load ...
You could do this exchanging each page name for the page you want to use. I just tested and it seems to work. I'm sure there are downsides (speed for one). ``` <?php /** * Template Name: OnePager */ <?php get_header(); ?> <!-- Page One - How it Works --> <section id="section1"> <div class="container"...
204,848
<p>Hi I have question about file names. If I have custom post type, and for template I can create for example <code>single-portfolio.php</code> and get content of portfolio posts into this file, but i need to get that post not in same file I want get it on individual files for example <code>single-portfolio-post1.php</...
[ { "answer_id": 204849, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 1, "selected": false, "text": "<p>You can use the dynamic filter <code>{type}_template</code> (where <code>{type}</code> is the current quer...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204848", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71310/" ]
Hi I have question about file names. If I have custom post type, and for template I can create for example `single-portfolio.php` and get content of portfolio posts into this file, but i need to get that post not in same file I want get it on individual files for example `single-portfolio-post1.php` something like this...
You can use the dynamic filter `{type}_template` (where `{type}` is the current query type e.g. `single`, `index` etc.) found in [`get_query_template()`](https://developer.wordpress.org/reference/functions/get_query_template/): ``` function wpse_204848_get_id_template( $template ) { if ( $post = get_queried_object...
204,851
<p>I have a blog that is located on a subdomain blog.example.com and I have a main website located on example.com. They both use the same wordpress template. </p> <p>I'd like to transfer my blog from the subdomain to the directory of the example.com preserving 'recent posts', 'categories' and other blog-ish features. ...
[ { "answer_id": 204849, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 1, "selected": false, "text": "<p>You can use the dynamic filter <code>{type}_template</code> (where <code>{type}</code> is the current quer...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204851", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81554/" ]
I have a blog that is located on a subdomain blog.example.com and I have a main website located on example.com. They both use the same wordpress template. I'd like to transfer my blog from the subdomain to the directory of the example.com preserving 'recent posts', 'categories' and other blog-ish features. I know t...
You can use the dynamic filter `{type}_template` (where `{type}` is the current query type e.g. `single`, `index` etc.) found in [`get_query_template()`](https://developer.wordpress.org/reference/functions/get_query_template/): ``` function wpse_204848_get_id_template( $template ) { if ( $post = get_queried_object...
204,861
<p>PHP:</p> <pre><code>&lt;?php $posts_query = new WP_Query('post_type="posts&amp;posts_per_page=-1"'); if ($posts_query-&gt;have_posts()) : while ($posts_query-&gt;have_posts()) : $posts_query-&gt;the_post(); ?&gt; &lt;?php if( $posts_query-&gt;current_post%5 == 0 ) { echo "\n" . '&lt;div class="column"&gt;'...
[ { "answer_id": 204910, "author": "Jeff Mattson", "author_id": 93714, "author_profile": "https://wordpress.stackexchange.com/users/93714", "pm_score": 0, "selected": false, "text": "<p>Make sure your posts are all published and that they are not in the trash can.</p>\n" }, { "answ...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204861", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70016/" ]
PHP: ``` <?php $posts_query = new WP_Query('post_type="posts&posts_per_page=-1"'); if ($posts_query->have_posts()) : while ($posts_query->have_posts()) : $posts_query->the_post(); ?> <?php if( $posts_query->current_post%5 == 0 ) { echo "\n" . '<div class="column">'; } elseif( $posts_que...
There seems to be a syntax in your Query: ``` post_type="posts&posts_per_page=-1" ``` would mean that your post type is ***posts&posts\_per\_page=-1*** I think you mean ``` $posts_query = new WP_Query('post_type=post&posts_per_page=-1'); ``` (The post type is not posts, but **post**) In this case Wordpress woul...
204,879
<p>Refer to the title, I'm trying to create a shortcode for Blog Post with Pagination. I'm able to show the blog post but the pagination is not working. I tried using the code below and the link to second page is www.mysite.com/postname/page/2 . But it goes back to www.mysite.com/postname/ when I click on the paginatio...
[ { "answer_id": 205072, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p><code>paged</code> is the query var for archive pagination, and <code>/page/n/</code> is the format for archive pa...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204879", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26988/" ]
Refer to the title, I'm trying to create a shortcode for Blog Post with Pagination. I'm able to show the blog post but the pagination is not working. I tried using the code below and the link to second page is www.mysite.com/postname/page/2 . But it goes back to www.mysite.com/postname/ when I click on the pagination l...
It is still somewhat a mystery what you need looking at all the comments and the question content. Here are two approaches that should work FOR PAGES --------- I have written a complete function that will paginate any (*or almost any*) query except on single post pages. It also works out of the box for static front...
204,888
<p>I’ve created .htaccess password in order to add a layer of security to a WordPress installation. The .htpasswd file is located one level above the installation. </p> <p>Yet, I’ve seen brute force attack attempts that seem to bypass this login and directly try to login in WordPress wpadmin, using the correct usernam...
[ { "answer_id": 204925, "author": "Nikolay Nikolov", "author_id": 81561, "author_profile": "https://wordpress.stackexchange.com/users/81561", "pm_score": 1, "selected": false, "text": "<p>What web server you use? If use nginx, you can try this to secure your wp-admin :</p>\n\n<pre><code>l...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204888", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14075/" ]
I’ve created .htaccess password in order to add a layer of security to a WordPress installation. The .htpasswd file is located one level above the installation. Yet, I’ve seen brute force attack attempts that seem to bypass this login and directly try to login in WordPress wpadmin, using the correct username (which i...
What web server you use? If use nginx, you can try this to secure your wp-admin : ``` location ~ ^/(wp-login\.php$) { root /var/www/wordpress/; allow 127.0.0.1; allow Your-ip-address; allow Your-second-ip-address; deny all; ``` Other way to secure your wp-admin from brute force attacks is to add...
204,902
<p>I am confused as to how I'm supposed to switch parent themes in my child theme css. Right now my website protovest.com is using responsive theme but I want to change it to a theme called tesseract. Here is my code:</p> <pre><code>/* Theme Name: Responsive Child Proto-Vest Description: Responsive Theme Used ...
[ { "answer_id": 204925, "author": "Nikolay Nikolov", "author_id": 81561, "author_profile": "https://wordpress.stackexchange.com/users/81561", "pm_score": 1, "selected": false, "text": "<p>What web server you use? If use nginx, you can try this to secure your wp-admin :</p>\n\n<pre><code>l...
2015/10/07
[ "https://wordpress.stackexchange.com/questions/204902", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81587/" ]
I am confused as to how I'm supposed to switch parent themes in my child theme css. Right now my website protovest.com is using responsive theme but I want to change it to a theme called tesseract. Here is my code: ``` /* Theme Name: Responsive Child Proto-Vest Description: Responsive Theme Used to Style Protove...
What web server you use? If use nginx, you can try this to secure your wp-admin : ``` location ~ ^/(wp-login\.php$) { root /var/www/wordpress/; allow 127.0.0.1; allow Your-ip-address; allow Your-second-ip-address; deny all; ``` Other way to secure your wp-admin from brute force attacks is to add...
204,911
<p>I've created a custom post type named "accommodation" and taxonomy for it named "categories" using the file "taxonomy-accommodation-categories.php" - this is working fine in my WordPress theme.</p> <p>But I want to add this in a separate plugin instead, does anyone know how I can do this?</p> <p>Appreciate any hel...
[ { "answer_id": 204917, "author": "Mitul", "author_id": 74728, "author_profile": "https://wordpress.stackexchange.com/users/74728", "pm_score": 0, "selected": false, "text": "<p>You can create Page template in your plugin and add following filter which will called template from your plugi...
2015/10/08
[ "https://wordpress.stackexchange.com/questions/204911", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81594/" ]
I've created a custom post type named "accommodation" and taxonomy for it named "categories" using the file "taxonomy-accommodation-categories.php" - this is working fine in my WordPress theme. But I want to add this in a separate plugin instead, does anyone know how I can do this? Appreciate any help, thanks.
This works: ``` add_filter('template_include', 'taxonomy_template'); function taxonomy_template( $template ){ if( is_tax('accommodation-categories')){ $template = BASE_DIR .'/templates/taxonomy-accommodation-categories.php'; } return $template; } ```
205,025
<p>This is great for showing just the raw content... <a href="https://wordpress.stackexchange.com/questions/51741/get-post-content-from-outside-the-loop">Get post content from outside the loop</a> But i'd also like to apply shortcodes from various plugins to my content to affect the content. What would I need to do to ...
[ { "answer_id": 205026, "author": "Pete", "author_id": 37346, "author_profile": "https://wordpress.stackexchange.com/users/37346", "pm_score": 0, "selected": false, "text": "<p>This works...</p>\n\n<pre><code>&lt;?php\n$post_id = 956; // &lt;&lt;&lt;&lt; change page id here\n$queried_post...
2015/10/09
[ "https://wordpress.stackexchange.com/questions/205025", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37346/" ]
This is great for showing just the raw content... [Get post content from outside the loop](https://wordpress.stackexchange.com/questions/51741/get-post-content-from-outside-the-loop) But i'd also like to apply shortcodes from various plugins to my content to affect the content. What would I need to do to allow this?
Well, you can do this with much less code: ``` echo apply_filters( 'the_content', get_post_field('post_content', $post_id) ); ``` You can also use [`get_post_field`](https://codex.wordpress.org/Function_Reference/get_post_field) function to get other fields like `post_title`, and so on.
205,080
<p>I am using latest version of <a href="https://wordpress.org/plugins/all-in-one-seo-pack/" rel="nofollow">All In One Seo Package</a>.</p> <p>How can I remove metaboxes from posts for User Role: "Contributors"?</p>
[ { "answer_id": 205026, "author": "Pete", "author_id": 37346, "author_profile": "https://wordpress.stackexchange.com/users/37346", "pm_score": 0, "selected": false, "text": "<p>This works...</p>\n\n<pre><code>&lt;?php\n$post_id = 956; // &lt;&lt;&lt;&lt; change page id here\n$queried_post...
2015/10/09
[ "https://wordpress.stackexchange.com/questions/205080", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81706/" ]
I am using latest version of [All In One Seo Package](https://wordpress.org/plugins/all-in-one-seo-pack/). How can I remove metaboxes from posts for User Role: "Contributors"?
Well, you can do this with much less code: ``` echo apply_filters( 'the_content', get_post_field('post_content', $post_id) ); ``` You can also use [`get_post_field`](https://codex.wordpress.org/Function_Reference/get_post_field) function to get other fields like `post_title`, and so on.
205,083
<p>This is code generated <a href="http://jeremyhixon.com/tool/wordpress-meta-box-generator/" rel="nofollow">here</a> and I made a few very small adjustments for customization. The problem I'm having is that I can't get the default value for the checkbox to be checked. If I manually add <code>checked="checked"</code>, ...
[ { "answer_id": 205096, "author": "Yatix", "author_id": 8441, "author_profile": "https://wordpress.stackexchange.com/users/8441", "pm_score": 2, "selected": false, "text": "<p>Try </p>\n\n<pre><code>metadata_exists( 'post', $post-&gt;ID, 'display_sharing_buttons_save' )\n</code></pre>\n\n...
2015/10/09
[ "https://wordpress.stackexchange.com/questions/205083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35926/" ]
This is code generated [here](http://jeremyhixon.com/tool/wordpress-meta-box-generator/) and I made a few very small adjustments for customization. The problem I'm having is that I can't get the default value for the checkbox to be checked. If I manually add `checked="checked"`, it always loads checked even if it's sav...
Try ``` metadata_exists( 'post', $post->ID, 'display_sharing_buttons_save' ) ``` This functions determine if meta-key exists and return true even with NULL value. So in your case, if it returns FALSE you can show CHECKED by default. [Source](https://developer.wordpress.org/reference/functions/metadata_exists/)
205,094
<p>I have two forms (<code>form1</code> and <code>form2</code>). Once the admin is logged in anywhere, all visitors (not logged in) to my WordPress site should see <code>form1</code> on the page, otherwise they should see <code>form2</code>. I am using this code in a custom page template:</p> <pre><code>if ( current_u...
[ { "answer_id": 205089, "author": "Subharanjan", "author_id": 13615, "author_profile": "https://wordpress.stackexchange.com/users/13615", "pm_score": 4, "selected": false, "text": "<p>You can remove specific styles and java scripts for specific page template like below. Add the code into ...
2015/10/10
[ "https://wordpress.stackexchange.com/questions/205094", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50465/" ]
I have two forms (`form1` and `form2`). Once the admin is logged in anywhere, all visitors (not logged in) to my WordPress site should see `form1` on the page, otherwise they should see `form2`. I am using this code in a custom page template: ``` if ( current_user_can( 'author' ) || current_user_can( 'administrator' )...
I seemed to solve the problem, and it was so simple that I'm shocked I've never seen this mentioned by anyone before. First, I deleted my entire child theme so that I could start over from a fresh place. Then, I used <https://wordpress.org/plugins/one-click-child-theme/> to create a brand new child theme of Salient. ...
205,120
<p>I have a bible page which is page_id of 135 and I am trying to create multiple WordPress rewrite rules. I am trying to obtain something like either of the following:</p> <ul> <li>website/bible/nasb</li> <li>website/bible/nasb/Genesis</li> <li>website/bible/nasb/Genesis/1</li> </ul> <p>I want to be able to access t...
[ { "answer_id": 205129, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 0, "selected": false, "text": "<p>You don't want rewrite tags - these are only useful for defining permalink structures. Instead, keep your ...
2015/10/10
[ "https://wordpress.stackexchange.com/questions/205120", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81729/" ]
I have a bible page which is page\_id of 135 and I am trying to create multiple WordPress rewrite rules. I am trying to obtain something like either of the following: * website/bible/nasb * website/bible/nasb/Genesis * website/bible/nasb/Genesis/1 I want to be able to access the query parameters via WordPress's get\_...
The pattern `(.+)` matches any character, *including the slash*, so any combo of parameters will always match your first rule, with anything that follows being passed as the version query var. Change all instances of `(.+)` to `([^/]+)` to match all characters except the slash.
205,152
<p>I am trying to display a site vistors search query on the search page. The form has custom fields so is not showing if it's "Search" and it doesnt show none of my custom fields.</p> <p>My search form -</p> <pre><code>&lt;!-- Search Form --&gt; &lt;section class="searchMain sm2"&gt; &lt;form method="get" id="searc...
[ { "answer_id": 205129, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 0, "selected": false, "text": "<p>You don't want rewrite tags - these are only useful for defining permalink structures. Instead, keep your ...
2015/10/11
[ "https://wordpress.stackexchange.com/questions/205152", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24067/" ]
I am trying to display a site vistors search query on the search page. The form has custom fields so is not showing if it's "Search" and it doesnt show none of my custom fields. My search form - ``` <!-- Search Form --> <section class="searchMain sm2"> <form method="get" id="searchform2" action="<?php echo home_url()...
The pattern `(.+)` matches any character, *including the slash*, so any combo of parameters will always match your first rule, with anything that follows being passed as the version query var. Change all instances of `(.+)` to `([^/]+)` to match all characters except the slash.
205,177
<p>I am trying to get the 'slug' used for each plugin installed. I have not found a good solution for this. I have created this function to get all the slugs and return them in an array. I am hoping there is a better way. Will this work for all plugins?</p> <pre><code> function l7wau_get_slugs(){ $plugin_a...
[ { "answer_id": 205189, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>I am hoping there is a better way</p>\n</blockquote>\n\n<p>You can write your code a bit...
2015/10/11
[ "https://wordpress.stackexchange.com/questions/205177", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93714/" ]
I am trying to get the 'slug' used for each plugin installed. I have not found a good solution for this. I have created this function to get all the slugs and return them in an array. I am hoping there is a better way. Will this work for all plugins? ``` function l7wau_get_slugs(){ $plugin_array = get_plugins...
> > I am hoping there is a better way > > > You can write your code a bit better, like adding some protection should something fail in your function. One should never take code for granted that it will always work, even if looks like it. Always code with the mindset of that your code **will** fail. I will just si...
205,179
<p>I want to get all child comments ids from parent comment id. Do i have to write custom sql or can i use get_comments() to achieve the following output.</p> <p>eg 1</p> <p>I want to get 2,3,4,5,6,7,8 ids from parent id 1.</p> <pre><code>|- 1 (parent comment) |-- 2 ( child of 1) |--- 3 ( grand child ) |-- 4 ( chil...
[ { "answer_id": 223796, "author": "Arun Basil Lal", "author_id": 90061, "author_profile": "https://wordpress.stackexchange.com/users/90061", "pm_score": 2, "selected": false, "text": "<p>For anyone else trying to find this:</p>\n\n<p>This can be done using the $parent parameter of <a href...
2015/10/11
[ "https://wordpress.stackexchange.com/questions/205179", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57992/" ]
I want to get all child comments ids from parent comment id. Do i have to write custom sql or can i use get\_comments() to achieve the following output. eg 1 I want to get 2,3,4,5,6,7,8 ids from parent id 1. ``` |- 1 (parent comment) |-- 2 ( child of 1) |--- 3 ( grand child ) |-- 4 ( child of 1) |--- 5 ( grand chil...
For anyone else trying to find this: This can be done using the $parent parameter of [get\_comments](https://codex.wordpress.org/Function_Reference/get_comments). Here is the code assuming $parent\_comment\_id is the id of the parent comment. ``` $childcomments = get_comments(array( 'post_id' => get_the_ID()...
205,187
<p>I have a custom Taxonomy called 'owner' and it has multiple posts as owner names (Using as a category) so I can filter posts by 'owner' taxonomy.</p> <p>I'm trying to make an index page of all owner names which starts with letter 'A'. I was able to list all the owners with following code.</p> <pre><code>foreach ( ...
[ { "answer_id": 205758, "author": "gloria", "author_id": 28571, "author_profile": "https://wordpress.stackexchange.com/users/28571", "pm_score": 2, "selected": false, "text": "<p>If you want to only visually limit the number of displayed names, you could use javascript or jQuery and CSS t...
2015/10/11
[ "https://wordpress.stackexchange.com/questions/205187", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81765/" ]
I have a custom Taxonomy called 'owner' and it has multiple posts as owner names (Using as a category) so I can filter posts by 'owner' taxonomy. I'm trying to make an index page of all owner names which starts with letter 'A'. I was able to list all the owners with following code. ``` foreach ( get_terms( 'owner' ) ...
Before we look at pagination, from what I have picked up in your question, you only need terms starting with `A`. If so, you can make use of the `name__like` parameter in `get_terms` to get terms only that starts with `A`. Just a note on that, the operation of the parameter was changed in Wordpress V3.7, so you will ne...
205,193
<p>I search here and on Google and I can't find answer to my question, just hope you will find it relevant.</p> <p>I'm doing a magazine website and I need to display names of contributors as a byline. I'm taking the information from the taxonomy 'Contributor' to display their names. </p> <pre><code>&lt;?php echo get_...
[ { "answer_id": 205758, "author": "gloria", "author_id": 28571, "author_profile": "https://wordpress.stackexchange.com/users/28571", "pm_score": 2, "selected": false, "text": "<p>If you want to only visually limit the number of displayed names, you could use javascript or jQuery and CSS t...
2015/10/11
[ "https://wordpress.stackexchange.com/questions/205193", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6695/" ]
I search here and on Google and I can't find answer to my question, just hope you will find it relevant. I'm doing a magazine website and I need to display names of contributors as a byline. I'm taking the information from the taxonomy 'Contributor' to display their names. ``` <?php echo get_the_term_list( $post->ID...
Before we look at pagination, from what I have picked up in your question, you only need terms starting with `A`. If so, you can make use of the `name__like` parameter in `get_terms` to get terms only that starts with `A`. Just a note on that, the operation of the parameter was changed in Wordpress V3.7, so you will ne...
205,208
<p>My script cannot save the value of the dropdown box. I could not find any helpful documentation on this topic, so I have decided to ask the StackExchange community about it.</p> <pre><code>function _cc_add_our_attachment_meta() { add_meta_box( 'cc-license-attachment-meta-box', 'License of the Attachment', '_cc_o...
[ { "answer_id": 205211, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p><code>get_post_meta</code> returns an array when you set the 3rd parameter to <code>false</code>, so <code>$value<...
2015/10/11
[ "https://wordpress.stackexchange.com/questions/205208", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54201/" ]
My script cannot save the value of the dropdown box. I could not find any helpful documentation on this topic, so I have decided to ask the StackExchange community about it. ``` function _cc_add_our_attachment_meta() { add_meta_box( 'cc-license-attachment-meta-box', 'License of the Attachment', '_cc_our_attachment_...
`get_post_meta` returns an array when you set the 3rd parameter to `false`, so `$value` is an array in your metabox callback and you're treating it as string. I assume an attachment has a single value for license, so you want to set that to `true` instead.
205,260
<p>Is this possible to find out whether <code>add_filter( 'allow_major_auto_core_updates', '__return_true', 1 );</code> already added or not in some other plugin?</p> <p>or </p> <p>can i check this automatic updates set for particular WordPress site ?</p> <p>if they defined automatic updates settings via constant th...
[ { "answer_id": 205211, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p><code>get_post_meta</code> returns an array when you set the 3rd parameter to <code>false</code>, so <code>$value<...
2015/10/12
[ "https://wordpress.stackexchange.com/questions/205260", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/67717/" ]
Is this possible to find out whether `add_filter( 'allow_major_auto_core_updates', '__return_true', 1 );` already added or not in some other plugin? or can i check this automatic updates set for particular WordPress site ? if they defined automatic updates settings via constant then we can get it from via ``` if(...
`get_post_meta` returns an array when you set the 3rd parameter to `false`, so `$value` is an array in your metabox callback and you're treating it as string. I assume an attachment has a single value for license, so you want to set that to `true` instead.
205,277
<p>I am modifying a custom post type's post list screeen and I want to remove all of the stuffs on the tablenav head like what is marked in the following image.</p> <p><a href="https://i.stack.imgur.com/iYfe8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iYfe8.png" alt="enter image description here"></a></...
[ { "answer_id": 205281, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 5, "selected": true, "text": "<p>I don't know what you mean by <em>dirty way</em>, hopefully <strong>not</strong> core editing!</p>\n\n<p>You c...
2015/10/12
[ "https://wordpress.stackexchange.com/questions/205277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32989/" ]
I am modifying a custom post type's post list screeen and I want to remove all of the stuffs on the tablenav head like what is marked in the following image. [![enter image description here](https://i.stack.imgur.com/iYfe8.png)](https://i.stack.imgur.com/iYfe8.png) Is wordpress have special hook for that, or will I n...
I don't know what you mean by *dirty way*, hopefully **not** core editing! You can hide it with CSS. Or you can do it with PHP - see below: Hide the views part ------------------- You can remove the *views* part with ``` add_filter( 'views_edit-post', '__return_null' ); ``` for the `post` post type on the `edit....
205,287
<p>I have tried to to make a custom query, to some extend. it is working fine. But where i cannot make it work, is it to break after every 3 posts and do same thing (print div.row) and run same loop, For now, my code seem to output just 3 odd number posts, whereas i want it to break of after each 3 post. </p> <pre><co...
[ { "answer_id": 205281, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 5, "selected": true, "text": "<p>I don't know what you mean by <em>dirty way</em>, hopefully <strong>not</strong> core editing!</p>\n\n<p>You c...
2015/10/12
[ "https://wordpress.stackexchange.com/questions/205287", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33028/" ]
I have tried to to make a custom query, to some extend. it is working fine. But where i cannot make it work, is it to break after every 3 posts and do same thing (print div.row) and run same loop, For now, my code seem to output just 3 odd number posts, whereas i want it to break of after each 3 post. ``` if ($news->...
I don't know what you mean by *dirty way*, hopefully **not** core editing! You can hide it with CSS. Or you can do it with PHP - see below: Hide the views part ------------------- You can remove the *views* part with ``` add_filter( 'views_edit-post', '__return_null' ); ``` for the `post` post type on the `edit....
205,297
<p>Hi I want to display all the categories of products in a loop to display them in category menu along the numbers of products each category contains. Some thing like that</p> <p><a href="https://i.stack.imgur.com/bvNDW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bvNDW.png" alt="enter image de...
[ { "answer_id": 209815, "author": "asp111", "author_id": 84247, "author_profile": "https://wordpress.stackexchange.com/users/84247", "pm_score": 4, "selected": true, "text": "<p>You just need to add <code>$cat-&gt;count</code> to get the count of all products in that category. Hope this h...
2015/10/12
[ "https://wordpress.stackexchange.com/questions/205297", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78548/" ]
Hi I want to display all the categories of products in a loop to display them in category menu along the numbers of products each category contains. Some thing like that [![enter image description here](https://i.stack.imgur.com/bvNDW.png)](https://i.stack.imgur.com/bvNDW.png) so far I have done this to get all cate...
You just need to add `$cat->count` to get the count of all products in that category. Hope this helps you out. ``` $args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids ); $product_categories = get_terms( 'produ...
205,313
<p>Anybody knows if there's a hook before execution of a search query (not in main loop) in order to change the 's' parameter to avoid Wordpress' phrase splitting? Examples are welcome... thanks</p> <p>P.S.: I've also tried in this way as follow, but the first part of sql query seems to indicate that WP have already ...
[ { "answer_id": 205328, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 1, "selected": false, "text": "<p>You are looking for the <a href=\"https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts\" rel...
2015/10/12
[ "https://wordpress.stackexchange.com/questions/205313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/59735/" ]
Anybody knows if there's a hook before execution of a search query (not in main loop) in order to change the 's' parameter to avoid Wordpress' phrase splitting? Examples are welcome... thanks P.S.: I've also tried in this way as follow, but the first part of sql query seems to indicate that WP have already done the s...
To avoid the splitting of searchphrases, use the `sentence` query variable in the pre\_get\_posts hook: ``` function only_search_for_full_phrase( $query ) { if ( $query->is_search() && $query->is_main_query() ) { $query->set( 'sentence', true ); } } add_action( 'pre_get_posts', 'only_search_for_full_ph...
205,354
<p>Is there a WordPress REST API for Multisite?</p> <p>I know this is fully functional for normal WordPress, but does the API also allow usage of Multisite?</p>
[ { "answer_id": 205492, "author": "Pat J", "author_id": 16121, "author_profile": "https://wordpress.stackexchange.com/users/16121", "pm_score": 3, "selected": false, "text": "<p>I'm using the REST API to pull data about one multisite installation and feed it to sites in another multisite ...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/205354", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3529/" ]
Is there a WordPress REST API for Multisite? I know this is fully functional for normal WordPress, but does the API also allow usage of Multisite?
I'm using the REST API to pull data about one multisite installation and feed it to sites in another multisite installation. Here's some of the code in use: ``` class WPSE205354_Demo { function __construct() { add_filter( 'json_endpoints', array( $this, 'register_routes' ) ); } /** * Registe...
205,390
<p>I'm using Emberjs to build a front end to a WordPress site. It has two javascript files 1. vendor.js and 2. myapp.js. On Ember's dev server, the app works correctly but when I add the production builds to the WordPress app, I'm getting errors which suggest that the <code>vendor.js</code> file is not loaded prior to ...
[ { "answer_id": 205492, "author": "Pat J", "author_id": 16121, "author_profile": "https://wordpress.stackexchange.com/users/16121", "pm_score": 3, "selected": false, "text": "<p>I'm using the REST API to pull data about one multisite installation and feed it to sites in another multisite ...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/205390", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81301/" ]
I'm using Emberjs to build a front end to a WordPress site. It has two javascript files 1. vendor.js and 2. myapp.js. On Ember's dev server, the app works correctly but when I add the production builds to the WordPress app, I'm getting errors which suggest that the `vendor.js` file is not loaded prior to `myapp.js`. No...
I'm using the REST API to pull data about one multisite installation and feed it to sites in another multisite installation. Here's some of the code in use: ``` class WPSE205354_Demo { function __construct() { add_filter( 'json_endpoints', array( $this, 'register_routes' ) ); } /** * Registe...
205,393
<p>I am very new in wordpress theme development. how can i make page template for my store page where my all categories listed with 6 to 10 latest post with that category and category name has a link to category page <code>category.php</code> <strong>for example:</strong></p> <p>in store page</p> <p><strong>category ...
[ { "answer_id": 205407, "author": "RiaanZA", "author_id": 81679, "author_profile": "https://wordpress.stackexchange.com/users/81679", "pm_score": 1, "selected": false, "text": "<p>You first need to grab a list of your categories, and they run a wordpress query for each category.</p>\n\n<p...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/205393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81875/" ]
I am very new in wordpress theme development. how can i make page template for my store page where my all categories listed with 6 to 10 latest post with that category and category name has a link to category page `category.php` **for example:** in store page **category 1** 1. first item with this category 2. second...
i think it is petty straightforward solution first get your all categories list by help of `get_categories()` function and loop though and find the post relative with that. ``` <?php $categories = get_categories(); return all categories foreach( $categories as $cat ){ $query = new WP_query(['cat'=>$ca...
205,405
<p>I've a one-page template and I would like to get the pages according to the menu order, so I think to have a loop to get all pages from the "primary" menu. </p> <p>But on "get_pages" I don't have the option to filter by menu, how can I do that?</p> <pre><code>$mypages = get_pages( array( 'sort_column' =&gt; 'post_...
[ { "answer_id": 205407, "author": "RiaanZA", "author_id": 81679, "author_profile": "https://wordpress.stackexchange.com/users/81679", "pm_score": 1, "selected": false, "text": "<p>You first need to grab a list of your categories, and they run a wordpress query for each category.</p>\n\n<p...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/205405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81884/" ]
I've a one-page template and I would like to get the pages according to the menu order, so I think to have a loop to get all pages from the "primary" menu. But on "get\_pages" I don't have the option to filter by menu, how can I do that? ``` $mypages = get_pages( array( 'sort_column' => 'post_date', 'sort_order' => ...
i think it is petty straightforward solution first get your all categories list by help of `get_categories()` function and loop though and find the post relative with that. ``` <?php $categories = get_categories(); return all categories foreach( $categories as $cat ){ $query = new WP_query(['cat'=>$ca...
205,421
<p>over the last week I have been working on some cron jobs for a real-estate website that has hundreds of updates/deletes and new posts added each day. I am very near the end now and looking to schedule three WordPress events to take care of the process.</p> <p>The code I have linked below runs and send a email to m...
[ { "answer_id": 208095, "author": "futuernorn", "author_id": 83220, "author_profile": "https://wordpress.stackexchange.com/users/83220", "pm_score": 0, "selected": false, "text": "<p>In general using the <a href=\"https://wordpress.org/support/article/editing-wp-config-php/#alternative-cr...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/205421", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81895/" ]
over the last week I have been working on some cron jobs for a real-estate website that has hundreds of updates/deletes and new posts added each day. I am very near the end now and looking to schedule three WordPress events to take care of the process. The code I have linked below runs and send a email to me with the ...
Maybe the problem happens because you don't check if your hook is already scheduled. ``` if ( !wp_next_scheduled( 'first_hook' ) ) { wp_schedule_event(time()+60, 'daily', 'first_hook'); } ```
205,423
<p>I have a custom post type called "<strong>Releases</strong>" set up and paginated perfectly using the following code:</p> <h1><strong>The Loop</strong></h1> <pre><code> &lt;?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; $args = array( 'post_type' =&gt; 'releases', 'posts_per_page' =&...
[ { "answer_id": 208095, "author": "futuernorn", "author_id": 83220, "author_profile": "https://wordpress.stackexchange.com/users/83220", "pm_score": 0, "selected": false, "text": "<p>In general using the <a href=\"https://wordpress.org/support/article/editing-wp-config-php/#alternative-cr...
2015/10/13
[ "https://wordpress.stackexchange.com/questions/205423", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81886/" ]
I have a custom post type called "**Releases**" set up and paginated perfectly using the following code: **The Loop** ============ ``` <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; $args = array( 'post_type' => 'releases', 'posts_per_page' => 3, 'paged' => $paged, 'page' => $paged );...
Maybe the problem happens because you don't check if your hook is already scheduled. ``` if ( !wp_next_scheduled( 'first_hook' ) ) { wp_schedule_event(time()+60, 'daily', 'first_hook'); } ```
205,459
<p>So we are using a couple of custom things in our WP and one of them is a PW-Recovery form. Using this internally we're setting the password with</p> <pre><code>wp_set_password($password, $userId) </code></pre> <p>Lately we realised a problem with passwords containing the apostrophe character <code>"</code></p> <p...
[ { "answer_id": 205469, "author": "ThemesCreator", "author_id": 54067, "author_profile": "https://wordpress.stackexchange.com/users/54067", "pm_score": 1, "selected": false, "text": "<p>I am not sure if this exactly what is happening to you, but this is what the codex says about wp_set_pa...
2015/10/14
[ "https://wordpress.stackexchange.com/questions/205459", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13711/" ]
So we are using a couple of custom things in our WP and one of them is a PW-Recovery form. Using this internally we're setting the password with ``` wp_set_password($password, $userId) ``` Lately we realised a problem with passwords containing the apostrophe character `"` Setting a password with this will leave the...
The resolution is pretty simply. Those functions require the passwords to be properly escaped. So **Instead of this:** ``` wp_set_password('Test"123', $userId); ``` **You have to do this:** ``` wp_set_password(wp_slash('Test"123'), $userId); ``` The same goes for `wp_update_user()` and `wp_signon()`. Further inf...
205,460
<p>I have a custom post type called projects, and its archive is at <code>/projects</code>, on the archive page I get notices <code>Notice: Trying to get property of non-object</code> every time I try to access the <code>$post</code> i.e. <code>$post-&gt;post_name</code>. Is this intended behaviour? Should I just acce...
[ { "answer_id": 205469, "author": "ThemesCreator", "author_id": 54067, "author_profile": "https://wordpress.stackexchange.com/users/54067", "pm_score": 1, "selected": false, "text": "<p>I am not sure if this exactly what is happening to you, but this is what the codex says about wp_set_pa...
2015/10/14
[ "https://wordpress.stackexchange.com/questions/205460", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8698/" ]
I have a custom post type called projects, and its archive is at `/projects`, on the archive page I get notices `Notice: Trying to get property of non-object` every time I try to access the `$post` i.e. `$post->post_name`. Is this intended behaviour? Should I just accept that and always check the availability of `$post...
The resolution is pretty simply. Those functions require the passwords to be properly escaped. So **Instead of this:** ``` wp_set_password('Test"123', $userId); ``` **You have to do this:** ``` wp_set_password(wp_slash('Test"123'), $userId); ``` The same goes for `wp_update_user()` and `wp_signon()`. Further inf...
205,479
<p>Hi I am building a news website. I am trying to automate it. </p> <ol> <li>News url (metabox)</li> <li>Title</li> <li>Content area</li> <li>Image (featured image option on wordpress)</li> </ol> <p>When paste the site url I would like the other metabox to pull the data from the source <a href="http://www.bbc.co.uk/...
[ { "answer_id": 205499, "author": "Spongsta", "author_id": 47571, "author_profile": "https://wordpress.stackexchange.com/users/47571", "pm_score": -1, "selected": false, "text": "<p>Try this one</p>\n\n<pre><code>$tags = get_meta_tags('http://www.bbc.com/news/technology-34527439');\n$t...
2015/10/14
[ "https://wordpress.stackexchange.com/questions/205479", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19073/" ]
Hi I am building a news website. I am trying to automate it. 1. News url (metabox) 2. Title 3. Content area 4. Image (featured image option on wordpress) When paste the site url I would like the other metabox to pull the data from the source <http://www.bbc.co.uk/news/technology-34527439> I want title and descripti...
Here you go: ``` class UrlToTitleConverter{ public function convert($Url){ $response = wp_remote_get($Url); if ( is_array( $response ) ) { $body = $response['body']; $title = substr($body, strpos($body, '<title>')+7); $title = substr($title, 0, strpos($title, '<...
205,487
<p>I have inmy opinion something simple that needs to be done but I can't get it to work.</p> <p>I have a custom post type <code>adm_project</code> with <code>rewrite =&gt; array('slug' =&gt; 'projecten')</code></p> <pre><code>add_action( 'init', 'adm_build_projecten_post_type', 0 ); function adm_build_projecten_post...
[ { "answer_id": 205489, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": -1, "selected": false, "text": "<p>1) Create a template called taxonomy-TAXONOMY_NAME.php)</p>\n\n<p>2) add the following WP Query to th...
2015/10/14
[ "https://wordpress.stackexchange.com/questions/205487", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81939/" ]
I have inmy opinion something simple that needs to be done but I can't get it to work. I have a custom post type `adm_project` with `rewrite => array('slug' => 'projecten')` ``` add_action( 'init', 'adm_build_projecten_post_type', 0 ); function adm_build_projecten_post_type() { register_taxonomy( 'projec...
I've not seen a "clean" way to do this - happy to learn it from someone else if they know. However, the way we've managed this in the past is to setup a page whose slug is 'projecten' with a custom page template that behaves and acts like an archive page. Then add child pages for each term (make sure to select the cu...
205,573
<p>I have a very simple shortcode to print some text using pre tags</p> <pre><code>function term_shortcode( $atts, $content = null ) { return "&lt;pre&gt;" . htmlentities($content) . "&lt;/pre&gt;"; } add_shortcode( 'term', 'term_shortcode' ); </code></pre> <p>But while using the shortcode, if there is an arrow ...
[ { "answer_id": 205584, "author": "Benjamin Love", "author_id": 81800, "author_profile": "https://wordpress.stackexchange.com/users/81800", "pm_score": 1, "selected": false, "text": "<p>I would try using <a href=\"http://php.net/manual/en/function.htmlspecialchars.php\" rel=\"nofollow\"><...
2015/10/15
[ "https://wordpress.stackexchange.com/questions/205573", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32902/" ]
I have a very simple shortcode to print some text using pre tags ``` function term_shortcode( $atts, $content = null ) { return "<pre>" . htmlentities($content) . "</pre>"; } add_shortcode( 'term', 'term_shortcode' ); ``` But while using the shortcode, if there is an arrow symbol in the content, the output gets...
This issue was introduced in WP 4.2.3 with the introduction of the `do_shortcodes_in_html_tags()` function, which does a HTML parse of content to protect against content containing shortcodes authored by untrustworthy contributors/authors who by specially crafting shortcode attributes can create XSS exploits. If that ...
205,577
<p>I want to allow HTML into a plugin input field via a user, I am using the Settings API, but it strips everything HTML out. - Code below -any pointers?</p> <pre><code>function plugin_settings(){ register_Setting( 'ng_settings_group', 'my_settings', 'plugin_prefix validate_input' ); a...
[ { "answer_id": 205584, "author": "Benjamin Love", "author_id": 81800, "author_profile": "https://wordpress.stackexchange.com/users/81800", "pm_score": 1, "selected": false, "text": "<p>I would try using <a href=\"http://php.net/manual/en/function.htmlspecialchars.php\" rel=\"nofollow\"><...
2015/10/15
[ "https://wordpress.stackexchange.com/questions/205577", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70831/" ]
I want to allow HTML into a plugin input field via a user, I am using the Settings API, but it strips everything HTML out. - Code below -any pointers? ``` function plugin_settings(){ register_Setting( 'ng_settings_group', 'my_settings', 'plugin_prefix validate_input' ); add_settings_sec...
This issue was introduced in WP 4.2.3 with the introduction of the `do_shortcodes_in_html_tags()` function, which does a HTML parse of content to protect against content containing shortcodes authored by untrustworthy contributors/authors who by specially crafting shortcode attributes can create XSS exploits. If that ...
205,601
<p>I'm currently building a WordPress theme where my page consists of widgets. One widget is a part of the page. I'd like to be able to use anchor links with them, and to do this, I would like to output the widget's title as an ID of the widget. </p> <p>I know the widget has and ID already but it results in ugly ancho...
[ { "answer_id": 205604, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 1, "selected": true, "text": "<p>Yes you can add an around the title of the widget, you do this in the register_sidebar code which you ...
2015/10/15
[ "https://wordpress.stackexchange.com/questions/205601", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82005/" ]
I'm currently building a WordPress theme where my page consists of widgets. One widget is a part of the page. I'd like to be able to use anchor links with them, and to do this, I would like to output the widget's title as an ID of the widget. I know the widget has and ID already but it results in ugly anchor links - ...
Yes you can add an around the title of the widget, you do this in the register\_sidebar code which you would put in your functions.php ``` add_action( 'widgets_init', 'theme_register_sidebars' ); function theme_register_sidebars() { register_sidebar( array( 'id' => 'mysidebar-sidebar', 'name' => __( 'My Sideb...
205,615
<p>I'm wanting to migrate a site from one WordPress multisite install (Dev) to another (Staging). I've read these posts </p> <p><a href="https://wordpress.stackexchange.com/questions/10538/how-to-migrate-wordpress-blogs-into-multisite-without-using-the-gui-import-expor">How to migrate Wordpress Blogs into Multisite wi...
[ { "answer_id": 205604, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 1, "selected": true, "text": "<p>Yes you can add an around the title of the widget, you do this in the register_sidebar code which you ...
2015/10/15
[ "https://wordpress.stackexchange.com/questions/205615", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48904/" ]
I'm wanting to migrate a site from one WordPress multisite install (Dev) to another (Staging). I've read these posts [How to migrate Wordpress Blogs into Multisite without using the GUI-Import/Export Feature](https://wordpress.stackexchange.com/questions/10538/how-to-migrate-wordpress-blogs-into-multisite-without-usi...
Yes you can add an around the title of the widget, you do this in the register\_sidebar code which you would put in your functions.php ``` add_action( 'widgets_init', 'theme_register_sidebars' ); function theme_register_sidebars() { register_sidebar( array( 'id' => 'mysidebar-sidebar', 'name' => __( 'My Sideb...
205,617
<p>The content of the post is contained in a <code>div</code> which is centered in the page and thus any images in the post would be constrained to the width of that <code>div</code>. The image below illustrates what I would like to achieve. </p> <p>A great example of this can be found in the following link but I can'...
[ { "answer_id": 205604, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 1, "selected": true, "text": "<p>Yes you can add an around the title of the widget, you do this in the register_sidebar code which you ...
2015/10/15
[ "https://wordpress.stackexchange.com/questions/205617", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104703/" ]
The content of the post is contained in a `div` which is centered in the page and thus any images in the post would be constrained to the width of that `div`. The image below illustrates what I would like to achieve. A great example of this can be found in the following link but I can't figure out how the JavaScript ...
Yes you can add an around the title of the widget, you do this in the register\_sidebar code which you would put in your functions.php ``` add_action( 'widgets_init', 'theme_register_sidebars' ); function theme_register_sidebars() { register_sidebar( array( 'id' => 'mysidebar-sidebar', 'name' => __( 'My Sideb...
205,632
<p>When utilizing shortcode (plugin, etc.) near the top of the page, the plugin shortcode displays in the preview. Is there a way to hide text within brackets [text like this] from a preview on a recent posts type of page?</p> <p>The following example shows the shortcode within a blog post preview:</p> <p><a href="ht...
[ { "answer_id": 205635, "author": "beta208", "author_id": 15360, "author_profile": "https://wordpress.stackexchange.com/users/15360", "pm_score": 0, "selected": false, "text": "<p>Excerpt was not showing but would do the trick. On the edit post page, accessing 'Screen Options' and selecti...
2015/10/15
[ "https://wordpress.stackexchange.com/questions/205632", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15360/" ]
When utilizing shortcode (plugin, etc.) near the top of the page, the plugin shortcode displays in the preview. Is there a way to hide text within brackets [text like this] from a preview on a recent posts type of page? The following example shows the shortcode within a blog post preview: [![Example of Brackets withi...
You can do with PHP. Just remove part where is `get_content()` and add this: ``` <?php $content=get_the_content(); $content = preg_replace('#\[[^\]]+\]#', '',$content); echo apply_filters('the_content', $content); ?> ``` That is regular expression added inside content. Th...
205,684
<p>I'm using the comments_template() <a href="https://codex.wordpress.org/Function_Reference/comments_template" rel="nofollow">function</a> to echo out my comments template in the sidebar of each post. This is a requirement of the project.</p> <p>It has been requested that I only echo out the three most recent comment...
[ { "answer_id": 205635, "author": "beta208", "author_id": 15360, "author_profile": "https://wordpress.stackexchange.com/users/15360", "pm_score": 0, "selected": false, "text": "<p>Excerpt was not showing but would do the trick. On the edit post page, accessing 'Screen Options' and selecti...
2015/10/16
[ "https://wordpress.stackexchange.com/questions/205684", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78294/" ]
I'm using the comments\_template() [function](https://codex.wordpress.org/Function_Reference/comments_template) to echo out my comments template in the sidebar of each post. This is a requirement of the project. It has been requested that I only echo out the three most recent comments in the sidebar for each post. I...
You can do with PHP. Just remove part where is `get_content()` and add this: ``` <?php $content=get_the_content(); $content = preg_replace('#\[[^\]]+\]#', '',$content); echo apply_filters('the_content', $content); ?> ``` That is regular expression added inside content. Th...
205,696
<p>I need to delay AngularJS scripts from running so I can set up my application first. I need to initialize the application with ng-app="app". I want to add that attribute to the <strong>&lt; body ></strong></p> <p>&lt; body ng-app="app" >&lt; /body ></p> <pre><code> wp_enqueue_script('plugin-setup', plugin_dir_url(...
[ { "answer_id": 205699, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 1, "selected": false, "text": "<p>change the action to:</p>\n\n<pre><code>add_action('init', array($my_class, 'pluginInit','40'));\n</co...
2015/10/16
[ "https://wordpress.stackexchange.com/questions/205696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82048/" ]
I need to delay AngularJS scripts from running so I can set up my application first. I need to initialize the application with ng-app="app". I want to add that attribute to the **< body >** < body ng-app="app" >< /body > ``` wp_enqueue_script('plugin-setup', plugin_dir_url( __FILE__ ).'js/plugin-setup.js', array('jq...
I think you should use `setTimeout` to pause the execution of the script without blocking the UI. ``` setTimeout(function(){ //your code to be executed after 2 seconds }, 2000); ``` So your code will become. ``` setTimeout(function(){ document.addEventListener("DOMContentLoaded", function(event) { do...
205,709
<p><a href="http://www.giuseppearcidiacono.it/apparecchio_invisibile_invisalign" rel="nofollow">On a page</a> I have embedded a video. On Ipad and also when you resize the browser window (look at the screenshot below), video goes over the sidebar.</p> <p>It should regard some responsive issue.</p> <p>Do you how to re...
[ { "answer_id": 205710, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 0, "selected": false, "text": "<p>You just need to add the following to your css:</p>\n\n<pre><code>iframe {\n height:300px;\n max-width...
2015/10/16
[ "https://wordpress.stackexchange.com/questions/205709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81951/" ]
[On a page](http://www.giuseppearcidiacono.it/apparecchio_invisibile_invisalign) I have embedded a video. On Ipad and also when you resize the browser window (look at the screenshot below), video goes over the sidebar. It should regard some responsive issue. Do you how to resolve it? Thanks
Yes, there are issues with responsiveness. Add your video in a div with class `yt-video`. For example. ``` <div class="yt-video"> <iframe width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/602q_GYXOWA?rel=0"> </div> ``` And add this CSS in your `style.css...
205,730
<p>I am looking to display all tags in select form that are from posts that have been assigned to a specific category.</p> <p>I am using the following code to generate every tag in a select form</p> <pre><code>&lt;div&gt; &lt;?php echo "&lt;select onChange=\"document.location.href=this.options[this.selectedIndex].val...
[ { "answer_id": 205731, "author": "Domain", "author_id": 26523, "author_profile": "https://wordpress.stackexchange.com/users/26523", "pm_score": -1, "selected": false, "text": "<pre><code>&lt;div&gt;\n&lt;?php\necho \"&lt;select onChange=\\\"document.location.href=this.options[this.select...
2015/10/16
[ "https://wordpress.stackexchange.com/questions/205730", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37243/" ]
I am looking to display all tags in select form that are from posts that have been assigned to a specific category. I am using the following code to generate every tag in a select form ``` <div> <?php echo "<select onChange=\"document.location.href=this.options[this.selectedIndex].value;\">"; echo "<option>By product...
From my understanding of the question and your comment: > > I want to display all tags that are from posts that have been assigned to the specific category > > > You would first need to get all the posts that have that tag assigned, loop through said posts and save the unique tags to an array. Finally, loop thro...
205,777
<p>Hello WordPress Developers,</p> <p>I got this erros messages when I check my site like below</p> <p>mysite.com/wp-content/themes/mythemes</p> <p>When I visite that url, it give me this message </p> <blockquote> <p>Fatal error: Call to undefined function get_header() in /users/my-username/www/mysite-folder/wp...
[ { "answer_id": 205788, "author": "Ashok Dhaduk", "author_id": 81215, "author_profile": "https://wordpress.stackexchange.com/users/81215", "pm_score": 0, "selected": false, "text": "<p>As per described by you I thought you had issue with the theme. Can you switch the theme ?</p>\n\n<p>If ...
2015/10/17
[ "https://wordpress.stackexchange.com/questions/205777", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31832/" ]
Hello WordPress Developers, I got this erros messages when I check my site like below mysite.com/wp-content/themes/mythemes When I visite that url, it give me this message > > Fatal error: Call to undefined function get\_header() in > /users/my-username/www/mysite-folder/wp-content/themes/twentyfifteen/index.php...
I got your point What you are trying to do. The solution to your problem is these lines of code to place above all the code of your index file or you may place it on all files of your theme. ``` <?php // Do not allow directly accessing this file. if ( ! defined( 'ABSPATH' ) ) { exit( 'Direct script access denied....
205,778
<p>The snippet below links a user's Easy Digital Download (EDD) download payment to allocating a secondary user role to that user.</p> <p>As per the example below...</p> <ul> <li>If a user buys a EDD download with a download ID of 340 then that user will be allocated a secondary user role of "buyer"... or,</li> <li>I...
[ { "answer_id": 205788, "author": "Ashok Dhaduk", "author_id": 81215, "author_profile": "https://wordpress.stackexchange.com/users/81215", "pm_score": 0, "selected": false, "text": "<p>As per described by you I thought you had issue with the theme. Can you switch the theme ?</p>\n\n<p>If ...
2015/10/17
[ "https://wordpress.stackexchange.com/questions/205778", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37346/" ]
The snippet below links a user's Easy Digital Download (EDD) download payment to allocating a secondary user role to that user. As per the example below... * If a user buys a EDD download with a download ID of 340 then that user will be allocated a secondary user role of "buyer"... or, * If a user buys a EDD download...
I got your point What you are trying to do. The solution to your problem is these lines of code to place above all the code of your index file or you may place it on all files of your theme. ``` <?php // Do not allow directly accessing this file. if ( ! defined( 'ABSPATH' ) ) { exit( 'Direct script access denied....
205,804
<p>I am adding Favicons and Icons to my site manually in a more proper way than what WordPress adds by default. My WordPress is generating the below 4 lines of code automatically. </p> <pre><code>&lt;link rel="icon" href="http://example.com/wp-content/uploads/sites/3/2015/09/cropped-group_logo-32x32.png" sizes="32x32"...
[ { "answer_id": 205806, "author": "Gareth Gillman", "author_id": 33936, "author_profile": "https://wordpress.stackexchange.com/users/33936", "pm_score": 0, "selected": false, "text": "<p>from looking at line 2446 of general-template.php where the meta tags are defined, they are defined in...
2015/10/17
[ "https://wordpress.stackexchange.com/questions/205804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2122/" ]
I am adding Favicons and Icons to my site manually in a more proper way than what WordPress adds by default. My WordPress is generating the below 4 lines of code automatically. ``` <link rel="icon" href="http://example.com/wp-content/uploads/sites/3/2015/09/cropped-group_logo-32x32.png" sizes="32x32"> <link rel="icon...
Finally I found the answer outside of this place, hence I am posting it here as it may be useful to someone like me. Simply add this to your functions.php file ``` remove_action ('wp_head', 'wp_site_icon', 99); ```