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 |
|---|---|---|---|---|---|---|
129,019 | <p>I'd like to scan a plugin's directory for files with specific extensions, like php, css and js.</p>
<p>I know there is <code>scandir()</code> function in <code>WP_Theme</code> class that's perfect for this work. The problem is that it's declared <code>private</code> so I can't use it outside of the class.</p>
<p>A... | [
{
"answer_id": 129038,
"author": "Rahil Wazir",
"author_id": 36349,
"author_profile": "https://wordpress.stackexchange.com/users/36349",
"pm_score": 2,
"selected": false,
"text": "<p>You can use PHP5 <a href=\"http://www.php.net/manual/en/class.recursiveiteratoriterator.php\" rel=\"nofol... | 2014/01/08 | [
"https://wordpress.stackexchange.com/questions/129019",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1343/"
] | I'd like to scan a plugin's directory for files with specific extensions, like php, css and js.
I know there is `scandir()` function in `WP_Theme` class that's perfect for this work. The problem is that it's declared `private` so I can't use it outside of the class.
Any advice what's the best way to do this? Is there... | Thank you everyone for the inputs and advice.
I've decided to copy over the `WP_Theme::scandir()` function itself. I understand what's going on there and there is no other native WP function to scan directories for files with specific extensions (with an option scanning sub-folders).
P.S. I could not figure out how t... |
129,048 | <p>I have a simple dependency check at the start of some plugins - which check if another plugin is installed and active (using <code>class_exists()</code>).</p>
<p>This works well in the normal WordPress flow - as the plugin that includes the required class is set to instantiate earlier and I also re-order the availa... | [
{
"answer_id": 129049,
"author": "Q Studio",
"author_id": 7968,
"author_profile": "https://wordpress.stackexchange.com/users/7968",
"pm_score": 0,
"selected": false,
"text": "<p>How about using WP_INSTALLING? - this check is placed above the main plugin Class...</p>\n\n<pre><code>if ( ! ... | 2014/01/08 | [
"https://wordpress.stackexchange.com/questions/129048",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7968/"
] | I have a simple dependency check at the start of some plugins - which check if another plugin is installed and active (using `class_exists()`).
This works well in the normal WordPress flow - as the plugin that includes the required class is set to instantiate earlier and I also re-order the available plugins so this p... | Instead of re-ordering your plugins to load in a specific order, have each of them that requires some other plugin to be loaded to defer their initialization until the "plugins\_loaded" action hook.
In other words, when a plugin with a dependency is included and ran, it shouldn't do anything directly. Instead, it shou... |
129,073 | <p>I am using wordpresss cms. I am trying to get things right with Google's rich snippets tool. Though, I have able to set <code>updated</code>, <code>author</code> and 'entry-title' correctly I am still having trouble setting my title in a correct way. In the <a href="http://www.google.com/webmasters/tools/richsnippet... | [
{
"answer_id": 129049,
"author": "Q Studio",
"author_id": 7968,
"author_profile": "https://wordpress.stackexchange.com/users/7968",
"pm_score": 0,
"selected": false,
"text": "<p>How about using WP_INSTALLING? - this check is placed above the main plugin Class...</p>\n\n<pre><code>if ( ! ... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129073",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25508/"
] | I am using wordpresss cms. I am trying to get things right with Google's rich snippets tool. Though, I have able to set `updated`, `author` and 'entry-title' correctly I am still having trouble setting my title in a correct way. In the [rich snippets testing tool](http://www.google.com/webmasters/tools/richsnippets) I ... | Instead of re-ordering your plugins to load in a specific order, have each of them that requires some other plugin to be loaded to defer their initialization until the "plugins\_loaded" action hook.
In other words, when a plugin with a dependency is included and ran, it shouldn't do anything directly. Instead, it shou... |
129,083 | <p>How can i change value of $menu_class parameter in wp_nav_menu() so that I can give a special css class to one of items in menu for example
"Home"?
here is some code but they didn't show me the message at all: </p>
<pre><code>function clear_nav_menu_item_id($id, $item, $args) {
echo "nav_menu_item_id";
}
add_... | [
{
"answer_id": 129049,
"author": "Q Studio",
"author_id": 7968,
"author_profile": "https://wordpress.stackexchange.com/users/7968",
"pm_score": 0,
"selected": false,
"text": "<p>How about using WP_INSTALLING? - this check is placed above the main plugin Class...</p>\n\n<pre><code>if ( ! ... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129083",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43030/"
] | How can i change value of $menu\_class parameter in wp\_nav\_menu() so that I can give a special css class to one of items in menu for example
"Home"?
here is some code but they didn't show me the message at all:
```
function clear_nav_menu_item_id($id, $item, $args) {
echo "nav_menu_item_id";
}
add_filter('nav... | Instead of re-ordering your plugins to load in a specific order, have each of them that requires some other plugin to be loaded to defer their initialization until the "plugins\_loaded" action hook.
In other words, when a plugin with a dependency is included and ran, it shouldn't do anything directly. Instead, it shou... |
129,106 | <p>I want to loop members where profile custom fields has a condition, let me explain, I have latitude and longitude as custom fields on members buddypress site, and I need to loop just members who has set latitude and longitude, using bp_has_member</p>
<pre><code>if ( bp_has_members( 'per_page=0' ) ) : ?>
endif;
<... | [
{
"answer_id": 129119,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 3,
"selected": true,
"text": "<p>Buddypress' <code>bp_has_members()</code> function accepts several parameters to alter the output. T... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129106",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32051/"
] | I want to loop members where profile custom fields has a condition, let me explain, I have latitude and longitude as custom fields on members buddypress site, and I need to loop just members who has set latitude and longitude, using bp\_has\_member
```
if ( bp_has_members( 'per_page=0' ) ) : ?>
endif;
```
I have tri... | Buddypress' `bp_has_members()` function accepts several parameters to alter the output. Take a look at the [Accepted Parameters](http://codex.buddypress.org/developer/loops-reference/the-members-loop/#accepted-parameters) section on the codex page regarding the members loop. The two parameter `meta_key` and `meta_value... |
129,110 | <p>I have declared a new post type and it is visible on the admin menu:
function create_post_type() {</p>
<pre><code> register_post_type( 'employer_fm',
array(
'labels' => array(
'name' => _x('Employer', 'Employers'),
'singular_name' => _x('Employer ', 'domain'),
),
'p... | [
{
"answer_id": 129111,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": false,
"text": "<p>A possibility is, that you add via plugin a filter, there check the rights and only users with his User ID in eac... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129110",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35767/"
] | I have declared a new post type and it is visible on the admin menu:
function create\_post\_type() {
```
register_post_type( 'employer_fm',
array(
'labels' => array(
'name' => _x('Employer', 'Employers'),
'singular_name' => _x('Employer ', 'domain'),
),
'public' => true,
... | A possibility is, that you add via plugin a filter, there check the rights and only users with his User ID in each post can change this posts.
The follow example doing this, but you must enhance a check for your custom post type, if you will only allow this on your CPT.
```
/**
* Plugin Name: Display only own posts
... |
129,121 | <p>It is possible to have 2 posting pages on a page? I have a static home page and I want to create 2 more pages for my blog which are "News" and "Recent Projects".</p>
| [
{
"answer_id": 129111,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": false,
"text": "<p>A possibility is, that you add via plugin a filter, there check the rights and only users with his User ID in eac... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129121",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44931/"
] | It is possible to have 2 posting pages on a page? I have a static home page and I want to create 2 more pages for my blog which are "News" and "Recent Projects". | A possibility is, that you add via plugin a filter, there check the rights and only users with his User ID in each post can change this posts.
The follow example doing this, but you must enhance a check for your custom post type, if you will only allow this on your CPT.
```
/**
* Plugin Name: Display only own posts
... |
129,127 | <p>I am using a simple if/elseif/else bit of code to generate a header image for my page, I can't seem to understand why it isn't working properly. It determines the category of the page being displayed and displays a header accordingly. Here's the code in my header.php: </p>
<pre><code><?php if (is_category('dino ... | [
{
"answer_id": 129131,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p><code>is_category</code> will not process the logic inside the argument list. This:</p>\n\n<pre><code>is_cate... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129127",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44564/"
] | I am using a simple if/elseif/else bit of code to generate a header image for my page, I can't seem to understand why it isn't working properly. It determines the category of the page being displayed and displays a header accordingly. Here's the code in my header.php:
```
<?php if (is_category('dino run') || has_cate... | `is_category` will not process the logic inside the argument list. This:
```
is_category('glorkian' || 'glork')
```
The condition is true on all category pages. What *I think* is happening is that PHP does parse that argument string, but is always going to be true. Try this:
```
var_dump('glorkian' || 'glork');
``... |
129,141 | <p>I need to replace the special characters å,ä,ö (with a or o) in my WP database for all image attachments. How can I apply this search and replace only to affect these links?</p>
<p>Edit: Solved</p>
| [
{
"answer_id": 129142,
"author": "Manolo",
"author_id": 36778,
"author_profile": "https://wordpress.stackexchange.com/users/36778",
"pm_score": 1,
"selected": false,
"text": "<p>Just do this with your string:</p>\n\n<pre><code>$yourString = preg_replace ( '/å/' , 'a' , $yourString )\n$yo... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129141",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3390/"
] | I need to replace the special characters å,ä,ö (with a or o) in my WP database for all image attachments. How can I apply this search and replace only to affect these links?
Edit: Solved | Solved -
```
UPDATE wp_postmeta SET meta_value = REPLACE(REPLACE(REPLACE(meta_value, 'å', 'a') , 'ä', 'a') , 'ö', 'o')
WHERE LOWER(RIGHT(meta_value, 5)) = '.jpeg'
OR LOWER(RIGHT(meta_value, 4)) IN ('.jpg', '.gif', '.png')
``` |
129,144 | <p>I have exported all my content to WordPress XML file via WordPress>Tools>Export as I needed to edit 300 posts at a time. Now, my concern is how to re import the file to override the default one?
By re-importing the file via WordPress Tools it does only import new posts, so it's not adapted to that particular case w... | [
{
"answer_id": 129142,
"author": "Manolo",
"author_id": 36778,
"author_profile": "https://wordpress.stackexchange.com/users/36778",
"pm_score": 1,
"selected": false,
"text": "<p>Just do this with your string:</p>\n\n<pre><code>$yourString = preg_replace ( '/å/' , 'a' , $yourString )\n$yo... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129144",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42866/"
] | I have exported all my content to WordPress XML file via WordPress>Tools>Export as I needed to edit 300 posts at a time. Now, my concern is how to re import the file to override the default one?
By re-importing the file via WordPress Tools it does only import new posts, so it's not adapted to that particular case with... | Solved -
```
UPDATE wp_postmeta SET meta_value = REPLACE(REPLACE(REPLACE(meta_value, 'å', 'a') , 'ä', 'a') , 'ö', 'o')
WHERE LOWER(RIGHT(meta_value, 5)) = '.jpeg'
OR LOWER(RIGHT(meta_value, 4)) IN ('.jpg', '.gif', '.png')
``` |
129,162 | <p>I have a simple filter running on the main query on the front page, it should be excluding all posts with a particular meta value (by only including posts who do not have the meta_key set, or those whose meta_key value does not match what we're excluding). But, for whatever reason, it is not behaving as expected.</p... | [
{
"answer_id": 129170,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, it behaves weird. No, shoot me, I can't get a fix on precisely why and how (stacked joins are probably it).</p... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129162",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43598/"
] | I have a simple filter running on the main query on the front page, it should be excluding all posts with a particular meta value (by only including posts who do not have the meta\_key set, or those whose meta\_key value does not match what we're excluding). But, for whatever reason, it is not behaving as expected.
``... | Yes, it behaves weird. No, shoot me, I can't get a fix on precisely why and how (stacked joins are probably it).
I say flip it. The only posts you don't want to see are those with `true` custom key. Query for their IDs separately, feed result into `post__not_in`, ditch this meta query entirely. |
129,180 | <p>What I would like to do is to add a few custom fields to the general settings.
This is the code that I'm using. It works alright but I just cant figure how to add more fields.</p>
<p>I would like to create two fields for now, one for the telephone number and the second one for address:</p>
<pre><code>function regi... | [
{
"answer_id": 129197,
"author": "Foxsk8",
"author_id": 44844,
"author_profile": "https://wordpress.stackexchange.com/users/44844",
"pm_score": -1,
"selected": false,
"text": "<p>Better way is use a wordpress options plugins. One of the best is Advanced Custom Fields. </p>\n\n<p><a href=... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129180",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41331/"
] | What I would like to do is to add a few custom fields to the general settings.
This is the code that I'm using. It works alright but I just cant figure how to add more fields.
I would like to create two fields for now, one for the telephone number and the second one for address:
```
function register_fields()
{
r... | Well the second bit of code is technically the correct way to do it. However, at the end of the `add_settings_field()` you can pass arguments.
Please view the [WordPress Add\_Settings\_Field](http://codex.wordpress.org/Function_Reference/add_settings_field) function reference. This will help you in getting the best un... |
129,186 | <p>Our WordPress installation runs only images within posts. Generally medium, lightweight images but we are also publishing larger images, sometimes gif animations which take enormous time to load.</p>
<p>When a post has a description it is a bit different. The visitor has something to read and then the images pops o... | [
{
"answer_id": 129197,
"author": "Foxsk8",
"author_id": 44844,
"author_profile": "https://wordpress.stackexchange.com/users/44844",
"pm_score": -1,
"selected": false,
"text": "<p>Better way is use a wordpress options plugins. One of the best is Advanced Custom Fields. </p>\n\n<p><a href=... | 2014/01/09 | [
"https://wordpress.stackexchange.com/questions/129186",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44946/"
] | Our WordPress installation runs only images within posts. Generally medium, lightweight images but we are also publishing larger images, sometimes gif animations which take enormous time to load.
When a post has a description it is a bit different. The visitor has something to read and then the images pops out when lo... | Well the second bit of code is technically the correct way to do it. However, at the end of the `add_settings_field()` you can pass arguments.
Please view the [WordPress Add\_Settings\_Field](http://codex.wordpress.org/Function_Reference/add_settings_field) function reference. This will help you in getting the best un... |
129,207 | <p>I'm basically using this bit of code in my <code>functions.php</code> to order my custom post types by title in ascending order.</p>
<pre><code>function set_custom_post_types_admin_order($wp_query) {
if (is_admin()) {
$post_type = $wp_query->query['post_type'];
if ( $post_type == 'games') {
$wp... | [
{
"answer_id": 129208,
"author": "realph",
"author_id": 14355,
"author_profile": "https://wordpress.stackexchange.com/users/14355",
"pm_score": 0,
"selected": false,
"text": "<p>Double pipes <code>||</code> save the day!</p>\n<pre><code>if ( $post_type == 'games' || $post_type == 'consol... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129207",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14355/"
] | I'm basically using this bit of code in my `functions.php` to order my custom post types by title in ascending order.
```
function set_custom_post_types_admin_order($wp_query) {
if (is_admin()) {
$post_type = $wp_query->query['post_type'];
if ( $post_type == 'games') {
$wp_query->set('orderby', 'titl... | Use a switch statement and combine your matching cases.
```
function set_custom_post_types_admin_order( $query ) {
// If not admin or main query, bail.
if( !is_admin() || !$query->is_main_query() )
return;
$post_type = $query->query['post_type'];
switch( $post_type ) {
case 'games':... |
129,212 | <p>I'm building a single page website and that means that all the links need to call for post content dynamically. I found <a href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-load-in-and-animate-content-with-jQuery/" rel="nofollow">this tutorial</a> and with the help from some folks from StackOverflow I m... | [
{
"answer_id": 129208,
"author": "realph",
"author_id": 14355,
"author_profile": "https://wordpress.stackexchange.com/users/14355",
"pm_score": 0,
"selected": false,
"text": "<p>Double pipes <code>||</code> save the day!</p>\n<pre><code>if ( $post_type == 'games' || $post_type == 'consol... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129212",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44845/"
] | I'm building a single page website and that means that all the links need to call for post content dynamically. I found [this tutorial](http://net.tutsplus.com/tutorials/javascript-ajax/how-to-load-in-and-animate-content-with-jQuery/) and with the help from some folks from StackOverflow I managed to create pages that d... | Use a switch statement and combine your matching cases.
```
function set_custom_post_types_admin_order( $query ) {
// If not admin or main query, bail.
if( !is_admin() || !$query->is_main_query() )
return;
$post_type = $query->query['post_type'];
switch( $post_type ) {
case 'games':... |
129,223 | <p>Basically, I'm trying to follow <a href="http://www.advancedcustomfields.com/resources/tutorials/creating-wp-archive-custom-field-filter/" rel="nofollow">this tutorial</a> to add an action to the <code>pre_get_posts</code> and create a custom meta_query so I can alter the query within the URL and display babies,chil... | [
{
"answer_id": 129224,
"author": "Foxsk8",
"author_id": 44844,
"author_profile": "https://wordpress.stackexchange.com/users/44844",
"pm_score": 0,
"selected": false,
"text": "<p>Here is code, that works. </p>\n\n<pre><code><?php\n $type = explode(',', $_GET['type']);\n $paged ... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129223",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14355/"
] | Basically, I'm trying to follow [this tutorial](http://www.advancedcustomfields.com/resources/tutorials/creating-wp-archive-custom-field-filter/) to add an action to the `pre_get_posts` and create a custom meta\_query so I can alter the query within the URL and display babies,children and home books like so:
>
> <htt... | First, keep in mind that `pre_get_posts` is a hook that is run on every single query that WP runs, so be very, very careful when utilizing it. That said, it is absolutely the best tool for what you want to do, and certainly better than writing a separate custom query in the page template.
I've added some additional co... |
129,229 | <p>I am creating a product in wordpress and here i am installing the custom theme and plugins during wp installation.</p>
<p>No problem until here. But the admin wants to login automatically during the installation ends without prompting for log in and want to redirect to the page what i wish to give.</p>
<p>Any help... | [
{
"answer_id": 129242,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 1,
"selected": false,
"text": "<p>Your problem seems to be that you hook in too early (aside from the problem that you're editing a core file), so l... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129229",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17849/"
] | I am creating a product in wordpress and here i am installing the custom theme and plugins during wp installation.
No problem until here. But the admin wants to login automatically during the installation ends without prompting for log in and want to redirect to the page what i wish to give.
Any help?
I tried to put... | Your problem seems to be that you hook in too early (aside from the problem that you're editing a core file), so let's take a look at `wp-admin/install.php`:
No hooks at all, but at the end of the page when everything was properly rendered, there's a call for `wp_print_scripts( 'user-profile' )`. And gladly there we'l... |
129,240 | <p>I can login into the Dashboard and see the menu of the left, it shows that there are 7 plugin updates and a WordPress update required but on the right I have a blank screen, I can see the update to WordPress button along the top but when you click on it nothing happens. I have read several posts and update the confi... | [
{
"answer_id": 129271,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": false,
"text": "<p>You have active a plugin or theme, that include scripts or styles via function <code>wp_enqueue_style</code> and ... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129240",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44956/"
] | I can login into the Dashboard and see the menu of the left, it shows that there are 7 plugin updates and a WordPress update required but on the right I have a blank screen, I can see the update to WordPress button along the top but when you click on it nothing happens. I have read several posts and update the config f... | You have active a plugin or theme, that include scripts or styles via function `wp_enqueue_style` and `wp_enqueue_script`. Since version 3.3 is it not possible to enqueue script and styles without a hook. Find the source and fix this, is easy to do that. The [codex](http://codex.wordpress.org/Function_Reference/wp_enqu... |
129,259 | <p>I am using SMOF options to control variables in the backend. As it is just now I have the css options being generated in the header file and they work, however I wish to add them to a style.php.</p>
<p>I have set this up however the variable data is not being displayed and the css options are empty.i.e </p>
<pre>... | [
{
"answer_id": 129271,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": false,
"text": "<p>You have active a plugin or theme, that include scripts or styles via function <code>wp_enqueue_style</code> and ... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129259",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43041/"
] | I am using SMOF options to control variables in the backend. As it is just now I have the css options being generated in the header file and they work, however I wish to add them to a style.php.
I have set this up however the variable data is not being displayed and the css options are empty.i.e
```
.site-header, .h... | You have active a plugin or theme, that include scripts or styles via function `wp_enqueue_style` and `wp_enqueue_script`. Since version 3.3 is it not possible to enqueue script and styles without a hook. Find the source and fix this, is easy to do that. The [codex](http://codex.wordpress.org/Function_Reference/wp_enqu... |
129,261 | <p>I waste a lot of time installing WordPress then populating it with dummy stuff for each new project. I started creating a new theme for each project (instead of creating a whole new install) but it's not good either since each project has its own specifics in terms of content.</p>
<p>Is there a time-saving, profess... | [
{
"answer_id": 129271,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": false,
"text": "<p>You have active a plugin or theme, that include scripts or styles via function <code>wp_enqueue_style</code> and ... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129261",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11634/"
] | I waste a lot of time installing WordPress then populating it with dummy stuff for each new project. I started creating a new theme for each project (instead of creating a whole new install) but it's not good either since each project has its own specifics in terms of content.
Is there a time-saving, professional solu... | You have active a plugin or theme, that include scripts or styles via function `wp_enqueue_style` and `wp_enqueue_script`. Since version 3.3 is it not possible to enqueue script and styles without a hook. Find the source and fix this, is easy to do that. The [codex](http://codex.wordpress.org/Function_Reference/wp_enqu... |
129,275 | <p>I'm having problems to get author_id in this code. Don't show nothing. Some can help me?</p>
<pre><code><?php global $query_string;
query_posts( $query_string . '&orderby=rand' ); ?>
<?php while(have_posts()): the_post();
$author_id = the_author_meta('ID');
echo 'Autor:'.$author_id;
$ofertas = array(... | [
{
"answer_id": 129277,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": true,
"text": "<p>Check the value in the <code>get_query_var()</code> function. An example, that works:--</p>\n\n<pre><code>$author ... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129275",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41267/"
] | I'm having problems to get author\_id in this code. Don't show nothing. Some can help me?
```
<?php global $query_string;
query_posts( $query_string . '&orderby=rand' ); ?>
<?php while(have_posts()): the_post();
$author_id = the_author_meta('ID');
echo 'Autor:'.$author_id;
$ofertas = array();
// Second Loop
$i = 0;... | Check the value in the `get_query_var()` function. An example, that works:--
```
$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
echo $author->ID;
```
If you like only the author of post, inside the loop, then use the template tag [`get_the_author()`](https://codex.wordpress.org/Function_Reference/g... |
129,284 | <p>So I'm making a simple file uploader with wordpress where users don't need to go into wp-admin to add a file.</p>
<p>I have it working great, it uploads the file to the correct folder..etc but the only problem I'm running into is its returning the wrong file url.</p>
<p>For example when uploading a file it goes to... | [
{
"answer_id": 129288,
"author": "terraling",
"author_id": 35739,
"author_profile": "https://wordpress.stackexchange.com/users/35739",
"pm_score": 0,
"selected": false,
"text": "<p>I did something similar a little while ago, and without rehashing everything line-by-line to remember how e... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129284",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37896/"
] | So I'm making a simple file uploader with wordpress where users don't need to go into wp-admin to add a file.
I have it working great, it uploads the file to the correct folder..etc but the only problem I'm running into is its returning the wrong file url.
For example when uploading a file it goes to **'/wp-content/u... | For `wp_insert_attachment` and `wp_generate_attachment_metadata`, change `$file_name` in the following way.
```
$file_name = $upload_dir['path'] . '/' . basename($file_name);
```
Wordpress codex for both function ( [here](http://codex.wordpress.org/Function_Reference/wp_insert_attachment) and [here](http://codex.wor... |
129,285 | <p>I have a Custom Post Type called "book" and a custom taxonomy for this CPT called "books". One term's slug of this taxonomy is "accepting-yourself". Here's the code of the "accepting-yourself" archive page (URL: my_site/books/accepting-yourself/):</p>
<pre><code>if ( have_posts() ) :
while ( have_posts() ) : t... | [
{
"answer_id": 129287,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": true,
"text": "<p>Your code should hook the CPT registration to <code>init</code>, though I don't know if that is part of the i... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129285",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11634/"
] | I have a Custom Post Type called "book" and a custom taxonomy for this CPT called "books". One term's slug of this taxonomy is "accepting-yourself". Here's the code of the "accepting-yourself" archive page (URL: my\_site/books/accepting-yourself/):
```
if ( have_posts() ) :
while ( have_posts() ) : the_post();
... | Your code should hook the CPT registration to `init`, though I don't know if that is part of the issue.
Your code is relatively simple, and it works just fine for me when I test it.
Unless you've altered the main query, on the `/books/accepting-yourself` archive page the Loop you've posted should return:
1. The pub... |
129,330 | <p>I'm considering having different headers depending on the area of the site. So thought it might be possible to tap into the template hierarchy (or at the very least, re-use some of the code) and filter the output.</p>
<p>Is this something that anyone has tried? Or could anyone point me in the direction of the code ... | [
{
"answer_id": 129331,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 0,
"selected": false,
"text": "<p>I've done this different ways.</p>\n\n<ol>\n<li>You can use a custom field and meta box</li>\n<li><a href=\... | 2014/01/10 | [
"https://wordpress.stackexchange.com/questions/129330",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25940/"
] | I'm considering having different headers depending on the area of the site. So thought it might be possible to tap into the template hierarchy (or at the very least, re-use some of the code) and filter the output.
Is this something that anyone has tried? Or could anyone point me in the direction of the code which sele... | `get_header()` accepts an argument, using it you can call a different headers.
The only thing that `get_header()` does, is to include in the template where is called the file `'header.php'` from child theme (if present) or from theme.
If you use the argument `$name`, like so: `get_header( $name)`, the function will l... |
129,339 | <p>I was wondering if its possible to have my theme <code>style.css</code> in a <code>css</code> folder rather than in the root? I assume that the Theme Metadata has to be in the theme root, but could the actual styles be moved? Is this a piece of meta data I would add to the theme meta?</p>
| [
{
"answer_id": 129341,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 5,
"selected": true,
"text": "<p>You can just register another stylesheet instead of <code>style.css</code>:</p>\n\n<pre><code>add_action( 'wp_enqueue_... | 2014/01/11 | [
"https://wordpress.stackexchange.com/questions/129339",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25940/"
] | I was wondering if its possible to have my theme `style.css` in a `css` folder rather than in the root? I assume that the Theme Metadata has to be in the theme root, but could the actual styles be moved? Is this a piece of meta data I would add to the theme meta? | You can just register another stylesheet instead of `style.css`:
```
add_action( 'wp_enqueue_scripts', 'enqueue_theme_css' );
function enqueue_theme_css()
{
wp_enqueue_style(
'default',
get_template_directory_uri() . '/css/default.css'
);
}
```
This is, in [my opinion](https://wordpress.stac... |
129,342 | <p>I have <a href="http://spencerboucher.com" rel="nofollow">a WordPress blog</a>, but I am also hosting a standalone static <a href="http://spencerboucher.com/map" rel="nofollow">HTML page</a> on the same domain/server (LaughingSquid, if it makes a difference). I'm <em>very</em> new to WordPress and PHP, so I am wonde... | [
{
"answer_id": 129343,
"author": "André Maldonado",
"author_id": 41329,
"author_profile": "https://wordpress.stackexchange.com/users/41329",
"pm_score": -1,
"selected": false,
"text": "<p>You can add a page directly from the wordpress admin. This page will have the same layout of the res... | 2014/01/11 | [
"https://wordpress.stackexchange.com/questions/129342",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44992/"
] | I have [a WordPress blog](http://spencerboucher.com), but I am also hosting a standalone static [HTML page](http://spencerboucher.com/map) on the same domain/server (LaughingSquid, if it makes a difference). I'm *very* new to WordPress and PHP, so I am wondering if there is a relatively simple way to use PHP to add the... | Spencer,
You can create a custom page template file for your theme which consists of your HTML page markup. You will need to include your topbar, hopefully it is in your header.php template file in which case you can use `<?php get_header(); ?>` to include it. Then when you add your page you will be able to select thi... |
129,361 | <p>In my plugin folder I have two file 1. hello-ajax.php 2. myajax.js</p>
<p>and by shortcode I add this form on frontend</p>
<pre><code><form id="theForm" method="post">
<input id="name" name="name" value = "name" type="text" />
<input name="action" type="hidden" value="the_ajax_hook" />&nbsp... | [
{
"answer_id": 129386,
"author": "helgatheviking",
"author_id": 6477,
"author_profile": "https://wordpress.stackexchange.com/users/6477",
"pm_score": 3,
"selected": true,
"text": "<p>Most of your code looks ok to me. Is your script loaded? (Verify by viewing page source). Per Milo's sug... | 2014/01/11 | [
"https://wordpress.stackexchange.com/questions/129361",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38118/"
] | In my plugin folder I have two file 1. hello-ajax.php 2. myajax.js
and by shortcode I add this form on frontend
```
<form id="theForm" method="post">
<input id="name" name="name" value = "name" type="text" />
<input name="action" type="hidden" value="the_ajax_hook" /> <!-- this puts the action the_ajax_hook i... | Most of your code looks ok to me. Is your script loaded? (Verify by viewing page source). Per Milo's suggestion, this is how to properly enqueue your plugin's scripts:
```
// Enqueue your scripts
function load_my_scripts(){
wp_enqueue_script( 'my-ajax-handle', plugin_dir_url( __FILE__ ) . 'myajax.js', array( 'jqu... |
129,372 | <p>The title says it all. I need working pagination, correct post count etc. Basically a new page for posts but with a filter for post formats.</p>
<p>Things I have tried so far:</p>
<p>1) Created a new rewrite rule for <strong>/no-formats/</strong> that gets the id of the page that loads home.php and appends an argu... | [
{
"answer_id": 129419,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 3,
"selected": true,
"text": "<p>For me I'd used a little different approach:</p>\n\n<ol>\n<li>use an <a href=\"http://make.wordpress.org/plugi... | 2014/01/11 | [
"https://wordpress.stackexchange.com/questions/129372",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18760/"
] | The title says it all. I need working pagination, correct post count etc. Basically a new page for posts but with a filter for post formats.
Things I have tried so far:
1) Created a new rewrite rule for **/no-formats/** that gets the id of the page that loads home.php and appends an argument (?no\_post\_format=true).... | For me I'd used a little different approach:
1. use an [endpoint](http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/) to create an url like `http://example.com/no-formats/`
2. hooking `pre_get_posts` to set the proper query if needed
3. [filter `template_include`](http://codex.wordpress.org/Plugin_API... |
129,397 | <p>I've asked a related question previously, but I think I've finally worked out the crux of my issue.</p>
<p>I'm using <a href="http://www.advancedcustomfields.com/" rel="noreferrer">Advanced Custom Fields</a> and have a number of custom fields attached to my post type. I'm trying to alter the URL to receive posts vi... | [
{
"answer_id": 129403,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p><code>LIKE</code> does not take array value. Your options probably are:</p>\n\n<ol>\n<li>Add meta query for each ty... | 2014/01/11 | [
"https://wordpress.stackexchange.com/questions/129397",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14355/"
] | I've asked a related question previously, but I think I've finally worked out the crux of my issue.
I'm using [Advanced Custom Fields](http://www.advancedcustomfields.com/) and have a number of custom fields attached to my post type. I'm trying to alter the URL to receive posts via their custom field and value.
And I... | I just figured out myself how to do it
Take a look at this example:
```
$args = array();
$args['relation'] = 'OR';
foreach ( $tag_ids as $t ) {
$args[] = array(
'key' => 'afz_entry_tags',
'value' => serialize( strval( $t->id ) ),
'compare' => 'LIKE'
);
}
$query->set( 'meta_query... |
129,416 | <p>I've been doing a lot of research and I've yet to work this out. Can you add in a custom option in the <code>Attachment Display Settings</code> (part of <code>Insert Media</code> dialog in post editor)?</p>
<p>What I'm after is the ability to add an anchor with a class around all images in posts. </p>
| [
{
"answer_id": 131114,
"author": "rspny",
"author_id": 43606,
"author_profile": "https://wordpress.stackexchange.com/users/43606",
"pm_score": 1,
"selected": false,
"text": "<p>This will add a field in the attachment edit screen for applying a class to the img tag.</p>\n\n<pre><code>func... | 2014/01/11 | [
"https://wordpress.stackexchange.com/questions/129416",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44989/"
] | I've been doing a lot of research and I've yet to work this out. Can you add in a custom option in the `Attachment Display Settings` (part of `Insert Media` dialog in post editor)?
What I'm after is the ability to add an anchor with a class around all images in posts. | This will add a field in the attachment edit screen for applying a class to the img tag.
```
function IMGattachment_fields($form_fields, $post) {
$form_fields["imageClass"]["label"] = __("Image Class");
$form_fields["imageClass"]["value"] = get_post_meta($post->ID, "_imageClass", true);
return $form_fields... |
129,446 | <p>I want to list all records in one custom taxonomy start with only A or B. Below code is to list all record with all letters.</p>
<p>Here is the code to list all record with one custom taxonomy with all letters in groups.
Example,
<img src="https://i.stack.imgur.com/Q52Cx.png" alt="enter image description here"></p>... | [
{
"answer_id": 131114,
"author": "rspny",
"author_id": 43606,
"author_profile": "https://wordpress.stackexchange.com/users/43606",
"pm_score": 1,
"selected": false,
"text": "<p>This will add a field in the attachment edit screen for applying a class to the img tag.</p>\n\n<pre><code>func... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129446",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45031/"
] | I want to list all records in one custom taxonomy start with only A or B. Below code is to list all record with all letters.
Here is the code to list all record with one custom taxonomy with all letters in groups.
Example,

```
<?php
// Template Nam... | This will add a field in the attachment edit screen for applying a class to the img tag.
```
function IMGattachment_fields($form_fields, $post) {
$form_fields["imageClass"]["label"] = __("Image Class");
$form_fields["imageClass"]["value"] = get_post_meta($post->ID, "_imageClass", true);
return $form_fields... |
129,453 | <p>The normal behavior of this code is move to next post in order by id. Need to change this ascendent order to go instead to a random post (published).</p>
<pre><code><div class="navigation">
<?php if (!empty($prevID)) { ?>
<div class="alignleft">
<a href="<?php ech... | [
{
"answer_id": 129475,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": true,
"text": "<p>The code you posted does nothing but display. The code you need to alter is whatever is creating <code>$prevI... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129453",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44982/"
] | The normal behavior of this code is move to next post in order by id. Need to change this ascendent order to go instead to a random post (published).
```
<div class="navigation">
<?php if (!empty($prevID)) { ?>
<div class="alignleft">
<a href="<?php echo get_permalink($prevID); ?>"
... | The code you posted does nothing but display. The code you need to alter is whatever is creating `$prevID` and `$nextID`, but that might not be entirely relevant.
Basically, you just need to grab a random post.
```
$rl = new WP_Query(
array(
'posts_per_page' => 1,
'orderby' => 'rand',
'fields' => 'ids'
... |
129,467 | <p>I have created a plugin with a top level page. I created a sub menu underneath that. When I run the plugin on my site everything works. But when I test it on a separate site I get an error and I'm not sure why.</p>
<p>This is the the code that is in question and the error that is getting thrown. I can't for the lif... | [
{
"answer_id": 129475,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": true,
"text": "<p>The code you posted does nothing but display. The code you need to alter is whatever is creating <code>$prevI... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129467",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43000/"
] | I have created a plugin with a top level page. I created a sub menu underneath that. When I run the plugin on my site everything works. But when I test it on a separate site I get an error and I'm not sure why.
This is the the code that is in question and the error that is getting thrown. I can't for the life of me fi... | The code you posted does nothing but display. The code you need to alter is whatever is creating `$prevID` and `$nextID`, but that might not be entirely relevant.
Basically, you just need to grab a random post.
```
$rl = new WP_Query(
array(
'posts_per_page' => 1,
'orderby' => 'rand',
'fields' => 'ids'
... |
129,481 | <p>Hello on my wordpress site I have a custom template for category A with slug (cat-a). I created a category-cat-a.php file to give this category a custom layout and this works without a problem. </p>
<p>I am wondering is there any easy way to apply this same layout to all subcategories of A (I don't really want to h... | [
{
"answer_id": 129485,
"author": "Robin Westerlundh",
"author_id": 44439,
"author_profile": "https://wordpress.stackexchange.com/users/44439",
"pm_score": 0,
"selected": false,
"text": "<p>I dont know if it's the best way but one possibility that comes to mind is to hook the template_red... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129481",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36782/"
] | Hello on my wordpress site I have a custom template for category A with slug (cat-a). I created a category-cat-a.php file to give this category a custom layout and this works without a problem.
I am wondering is there any easy way to apply this same layout to all subcategories of A (I don't really want to have to cre... | If `a` is the category slug, then following code would work -
```
add_action('template_include', 'wpse129481_template_include');
function wpse129481_template_include($t)
{
// is category archive page
if( is_category() )
{
// current queried category id from queried object
$child_id = get_qu... |
129,486 | <p>I've setup a custom query for my posts (single.php) with pagination, which by the way is working great with the default permalink structure. </p>
<p>domain.com/p=ID&paged=2</p>
<p>if I switch the permalinks to /%postname%/ the page/2/ redirects to the first page.</p>
<pre><code><?php
$paged = (get_query_v... | [
{
"answer_id": 129487,
"author": "Robin Westerlundh",
"author_id": 44439,
"author_profile": "https://wordpress.stackexchange.com/users/44439",
"pm_score": 1,
"selected": false,
"text": "<p>If this is not the main loop. aka (Blog Page) Wordpress will interprets the /2 as a subpage name an... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129486",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27376/"
] | I've setup a custom query for my posts (single.php) with pagination, which by the way is working great with the default permalink structure.
domain.com/p=ID&paged=2
if I switch the permalinks to /%postname%/ the page/2/ redirects to the first page.
```
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged... | If anyone comes across this issue, you can add this to your functions.php code
```
add_filter('redirect_canonical','pif_disable_redirect_canonical');
function pif_disable_redirect_canonical($redirect_url) {
if (is_singular()) $redirect_url = false;
return $redirect_url;
}
```
[Source](http://wordpress.org/suppo... |
129,501 | <p>I am looking at this generate password function:</p>
<pre><code>function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
if ( $special_chars )
$chars .= '!@#$%^&*()';
if ( $... | [
{
"answer_id": 129502,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 2,
"selected": false,
"text": "<p><code>random_password</code> is just a <strong>name</strong> for the event, not a function.</p>\n\n<p>You can registe... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129501",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45053/"
] | I am looking at this generate password function:
```
function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
if ( $special_chars )
$chars .= '!@#$%^&*()';
if ( $extra_special_char... | To fully understand how WP works, you need to understand that WP is an event-driven platform(Though it's a loose term, but I think it does help to understand better). You need to think like which event is occurring right now.
In this case, a password is generated.
Next question is, How can you change this generated y... |
129,523 | <p>I hope this question has its place here. </p>
<p>I've always thought that connecting different Custom Post Types together is a rather common need, like in popular tutorial examples of custom taxonomy usage (books/authors/titles, films/actors/directors, etc). I personally use "Posts 2 Posts", but support stopped. </... | [
{
"answer_id": 130340,
"author": "Bjorn",
"author_id": 19413,
"author_profile": "https://wordpress.stackexchange.com/users/19413",
"pm_score": 2,
"selected": false,
"text": "<p>I wouldn't worry about it too much, as a couple of great developers <a href=\"http://scribu.net/wordpress/plugi... | 2014/01/12 | [
"https://wordpress.stackexchange.com/questions/129523",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11634/"
] | I hope this question has its place here.
I've always thought that connecting different Custom Post Types together is a rather common need, like in popular tutorial examples of custom taxonomy usage (books/authors/titles, films/actors/directors, etc). I personally use "Posts 2 Posts", but support stopped.
On Google ... | As a programmer, I would start writing my own code to connect my post types. It's not a quick way, it's not easy, but it's a lot of fun.
**The post types**
We start by creating two simple post types, `Author` and `Books`:
```
add_action('init', 'p2p2_register_author');
add_action('init', 'p2p2_register_book');
func... |
129,547 | <pre><code> $message = sprintf(__('Dear: %s'), $user_login) . "\r\n\r\n";
$message .= __('As per your request on ') . date_i18n('j F Y', time());"\r\n\r\n";
$message .= __('Please visit the following link to reset your email address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?act... | [
{
"answer_id": 129551,
"author": "Naveen",
"author_id": 32819,
"author_profile": "https://wordpress.stackexchange.com/users/32819",
"pm_score": 0,
"selected": false,
"text": "<p>I have included these lines before sending email. now it is working fine</p>\n\n<pre><code>$headers = 'MIME-V... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129547",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32819/"
] | ```
$message = sprintf(__('Dear: %s'), $user_login) . "\r\n\r\n";
$message .= __('As per your request on ') . date_i18n('j F Y', time());"\r\n\r\n";
$message .= __('Please visit the following link to reset your email address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key... | ```
function set_contenttype($content_type){
return 'text/html';
}
add_filter('wp_mail_content_type','set_contenttype');
if ( $message && !wp_mail($user_email, $title, nl2br($message), $headers) )
```
You should set the mail content type as "text/html". |
129,553 | <p>Let’s say I have one post with tittle "Dummy one" and that post is filed under "Category one" and i have other post eg : "dummy two, dummy tree, etc" and category two, category three etc.</p>
<p>and now I create other post with title "helper for category one"
how to display permalink to "helper for category one" in... | [
{
"answer_id": 129562,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 1,
"selected": false,
"text": "<p>As long as all modifications have been made in your child theme, updates to WordPress and your parent theme... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129553",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43992/"
] | Let’s say I have one post with tittle "Dummy one" and that post is filed under "Category one" and i have other post eg : "dummy two, dummy tree, etc" and category two, category three etc.
and now I create other post with title "helper for category one"
how to display permalink to "helper for category one" in all post ... | As long as all modifications have been made in your child theme, updates to WordPress and your parent theme will not effect your modifications.
However, if you have made any changes to the WordPress core files or your parent theme, they will be lost when WordPress and/or your parent theme are updated. |
129,574 | <p>I find it very inconvenient and hard to understand that the default behavior of the Wordpress db-interface is to convert all integer (and float?) types to strings. </p>
<p>e.g </p>
<pre><code>$wp_posts = $wpdb->get_results('SELECT * from wp_posts');
$unexpected_type = gettype($wp_posts[0]->ID) == 'string';
... | [
{
"answer_id": 129575,
"author": "Eric Holmes",
"author_id": 23454,
"author_profile": "https://wordpress.stackexchange.com/users/23454",
"pm_score": 2,
"selected": false,
"text": "<p>As the other people have mentioned in the comments, due to the libraries that source uses, strings are re... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6248/"
] | I find it very inconvenient and hard to understand that the default behavior of the Wordpress db-interface is to convert all integer (and float?) types to strings.
e.g
```
$wp_posts = $wpdb->get_results('SELECT * from wp_posts');
$unexpected_type = gettype($wp_posts[0]->ID) == 'string';
```
Please confirm my sus... | Because the MySQL interface library used prior to PHP 5.3 returns everything as strings. The new (optional) interface, MySQL Native Driver, can return integer types if enabled at compile time.
For details, look into libmysql and mysqlnd. |
129,589 | <p>When I use add_action( 'the_content'...</p>
<p>The content of the page just won't load. Also the content I am trying appears in all kinds of places in the page. Why?</p>
<p>Is there a way to force it to only appear under my post?</p>
<pre><code>function __construct()
{
add_action( 'wp_footer', array(&$thi... | [
{
"answer_id": 129593,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": false,
"text": "<p><code>the_content</code> is not an action, it is a filter. You should be concatenating a string and returnin... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129589",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36110/"
] | When I use add\_action( 'the\_content'...
The content of the page just won't load. Also the content I am trying appears in all kinds of places in the page. Why?
Is there a way to force it to only appear under my post?
```
function __construct()
{
add_action( 'wp_footer', array(&$this, 'loadRatingsJs') );
add... | `the_content` is not an action, it is a filter. You should be concatenating a string and returning it. It sounds like you are `echo`ing content directly.
That is:
```
// wrong
function test_content($content) {
echo 'this is wrong';
}
add_filter('the_content','test_content');
// right
function test_content($conte... |
129,626 | <p>New users who create their own blog in WP Multisite get administrator privilages after registration. However, I don't want them to have so many privilages. I know there is a way to change their role on registration to 'contributor' or 'author' however after a whole day of search I really don't know where to find it... | [
{
"answer_id": 129642,
"author": "semyou",
"author_id": 34677,
"author_profile": "https://wordpress.stackexchange.com/users/34677",
"pm_score": 0,
"selected": false,
"text": "<p>You have to go to MySites > Network Admin > Sites</p>\n\n<p>Then select the Site you want to modify. </p>\n\n<... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129626",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7212/"
] | New users who create their own blog in WP Multisite get administrator privilages after registration. However, I don't want them to have so many privilages. I know there is a way to change their role on registration to 'contributor' or 'author' however after a whole day of search I really don't know where to find it. Co... | I understand that your question is about to establish a default role for a site, such as 'contributor' or 'author', but also when the site does not exists yet.
I found a code snippet that changes the role when the user creates a blog:
```
function user_role_to_new_blog($blog_id, $user_id) {
add_user_to_blog($blog... |
129,629 | <p>I am building a custom image slider. </p>
<p>I have a custom post type called 'slide' with an associated custom taxonomy called 'slideshows'.</p>
<p>When you create a new 'slideshow' it add to a custom table in the DB called wp_slideshowsmeta with columns for "meta_id, slideshows_id, meta_key, and meta_value".</p>... | [
{
"answer_id": 129642,
"author": "semyou",
"author_id": 34677,
"author_profile": "https://wordpress.stackexchange.com/users/34677",
"pm_score": 0,
"selected": false,
"text": "<p>You have to go to MySites > Network Admin > Sites</p>\n\n<p>Then select the Site you want to modify. </p>\n\n<... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129629",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9916/"
] | I am building a custom image slider.
I have a custom post type called 'slide' with an associated custom taxonomy called 'slideshows'.
When you create a new 'slideshow' it add to a custom table in the DB called wp\_slideshowsmeta with columns for "meta\_id, slideshows\_id, meta\_key, and meta\_value".
Each slideshow... | I understand that your question is about to establish a default role for a site, such as 'contributor' or 'author', but also when the site does not exists yet.
I found a code snippet that changes the role when the user creates a blog:
```
function user_role_to_new_blog($blog_id, $user_id) {
add_user_to_blog($blog... |
129,630 | <p>So I downloaded a plugin that sets your <code>max_file_upload</code> to 250 MB and I set my php.ini to the same. I own server so it is not a server issue - I have many apps that upload very large video files.</p>
<p>When I am trying to upload a file, no matter how large (up to 200MB tested), it shows that the file ... | [
{
"answer_id": 129646,
"author": "Chris Wiegman",
"author_id": 34454,
"author_profile": "https://wordpress.stackexchange.com/users/34454",
"pm_score": 1,
"selected": false,
"text": "<p>In your php.ini make sure you're changing both of the following lines.</p>\n\n<pre><code>upload_max_fil... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129630",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32393/"
] | So I downloaded a plugin that sets your `max_file_upload` to 250 MB and I set my php.ini to the same. I own server so it is not a server issue - I have many apps that upload very large video files.
When I am trying to upload a file, no matter how large (up to 200MB tested), it shows that the file uploads in the progre... | In your php.ini make sure you're changing both of the following lines.
```
upload_max_filesize = 250M
post_max_size = 250M
```
If you are using FastCGI as your PHP engine you'll also need to up its limit in Apache. Try adding FcgidMaxRequestLen to your VirtualHost (see <http://httpd.apache.org/mod_fcgid/mod/mod_fcgi... |
129,639 | <p>I am using Theme My Login and have noticed that, even though I am customising my own <code>login-form.php</code> template and simply including the appropriate form on a blank page with <code>theme_my_login();</code>, the text <code>Log In</code> is always appearing and is <em>not even in a selectable DOM element</em... | [
{
"answer_id": 143107,
"author": "Rob",
"author_id": 51123,
"author_profile": "https://wordpress.stackexchange.com/users/51123",
"pm_score": -1,
"selected": false,
"text": "<p>For those looking for this in the future... In the includes folder, in the <code>class-theme-my-login-template.p... | 2014/01/13 | [
"https://wordpress.stackexchange.com/questions/129639",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8967/"
] | I am using Theme My Login and have noticed that, even though I am customising my own `login-form.php` template and simply including the appropriate form on a blank page with `theme_my_login();`, the text `Log In` is always appearing and is *not even in a selectable DOM element*:
```
Log In
<div class="login" id="theme... | I would just use CSS to hide it:
```
#theme-my-login1 #header-element {
display:none;
}
```
Add to the login page by using a function / filter e.g.
```
function custom_login_css() {
echo '<style type="text/css">#theme-my-login1 #header-element {
display:none;}</style>';
}
add_action('login_head', 'custom_login_c... |
129,666 | <p>I am using WordPress with Twitter Bootstrap 3 and have an issue when it comes to images with captions. </p>
<p>Images with captions are given a height and width attribute which stops them from being responsive.</p>
<p>I tried the following code below but this only works for images without captions:</p>
<pre><code... | [
{
"answer_id": 160860,
"author": "HanSoloShotFirst",
"author_id": 59474,
"author_profile": "https://wordpress.stackexchange.com/users/59474",
"pm_score": 0,
"selected": false,
"text": "<p>I used the below solution. It was found <a href=\"http://coolestguidesontheplanet.com/responsively-r... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129666",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11465/"
] | I am using WordPress with Twitter Bootstrap 3 and have an issue when it comes to images with captions.
Images with captions are given a height and width attribute which stops them from being responsive.
I tried the following code below but this only works for images without captions:
```
function change_uploaded_im... | Here is another possibility, it alters the image markup when you select an image to add to your content in the editor
```
add_filter( 'image_send_to_editor', 'remove_img_attribute', 10, 8 );
function remove_img_attribute( $html, $id, $caption, $title, $align, $url, $size, $alt )
{
$imagetpl = '<figur... |
129,680 | <p>I'd like to use <a href="http://semantic-ui.com/" rel="nofollow">Semantic UI</a> to aid development of a Wordpress template for a project. </p>
<p>For a submenu I intend to use one of the <a href="http://semantic-ui.com/collections/menu.html" rel="nofollow">Secondary sub menus</a> found just at the bottom of the Po... | [
{
"answer_id": 129923,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 3,
"selected": true,
"text": "<p>You are definitely on the right track, but <a href=\"http://codex.wordpress.org/Function_Reference/wp_nav_menu\" ... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129680",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36334/"
] | I'd like to use [Semantic UI](http://semantic-ui.com/) to aid development of a Wordpress template for a project.
For a submenu I intend to use one of the [Secondary sub menus](http://semantic-ui.com/collections/menu.html) found just at the bottom of the Pointing section.
The problem I'm facing is that WP doesn't see... | You are definitely on the right track, but [`wp_nav_menu`](http://codex.wordpress.org/Function_Reference/wp_nav_menu) will output a menu with a lot of containers and classnames; to keep it semantic in the terms of Semantic UI, you'll be in good hands if you build the structure yourself.
Get the name of the registered ... |
129,691 | <p>I'm currently building a site where I need to filter/order/query a custom post type by date data. I can't use the post published date for this, but can't decide what would be the most efficient way to attach this to a post for further querying/filtering on the front-end of the site.</p>
<p>As far as I can see my op... | [
{
"answer_id": 129923,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 3,
"selected": true,
"text": "<p>You are definitely on the right track, but <a href=\"http://codex.wordpress.org/Function_Reference/wp_nav_menu\" ... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129691",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45120/"
] | I'm currently building a site where I need to filter/order/query a custom post type by date data. I can't use the post published date for this, but can't decide what would be the most efficient way to attach this to a post for further querying/filtering on the front-end of the site.
As far as I can see my options are ... | You are definitely on the right track, but [`wp_nav_menu`](http://codex.wordpress.org/Function_Reference/wp_nav_menu) will output a menu with a lot of containers and classnames; to keep it semantic in the terms of Semantic UI, you'll be in good hands if you build the structure yourself.
Get the name of the registered ... |
129,710 | <p>Let me try to explain what happened to me :</p>
<p>I have a shortcode plugin which display child pages of the current page (a mod of <a href="http://wpist.me/wp/child-pages-shortcode/" rel="nofollow">http://wpist.me/wp/child-pages-shortcode/</a>, very useful).</p>
<p>In the display function, it uses get_posts(), w... | [
{
"answer_id": 129923,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 3,
"selected": true,
"text": "<p>You are definitely on the right track, but <a href=\"http://codex.wordpress.org/Function_Reference/wp_nav_menu\" ... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129710",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43179/"
] | Let me try to explain what happened to me :
I have a shortcode plugin which display child pages of the current page (a mod of <http://wpist.me/wp/child-pages-shortcode/>, very useful).
In the display function, it uses get\_posts(), with very basic code, conform to the codex examples (<http://codex.wordpress.org/Funct... | You are definitely on the right track, but [`wp_nav_menu`](http://codex.wordpress.org/Function_Reference/wp_nav_menu) will output a menu with a lot of containers and classnames; to keep it semantic in the terms of Semantic UI, you'll be in good hands if you build the structure yourself.
Get the name of the registered ... |
129,721 | <p>I need display a special menu in each category page in wordpress,</p>
<p>for example I have 3 category: horse,dog,cat</p>
<p>So I must have 3 menu in Menu Settings <strong>locations</strong> with name: horse,dog,cat</p>
<p>with this code in <code>functions.php</code> I get all categories name:</p>
<pre><code>$ca... | [
{
"answer_id": 129750,
"author": "RachieVee",
"author_id": 42783,
"author_profile": "https://wordpress.stackexchange.com/users/42783",
"pm_score": 1,
"selected": false,
"text": "<p>From using var_dump($arr) it looked like it was still spitting out an array that WordPress didn't know what... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129721",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45138/"
] | I need display a special menu in each category page in wordpress,
for example I have 3 category: horse,dog,cat
So I must have 3 menu in Menu Settings **locations** with name: horse,dog,cat
with this code in `functions.php` I get all categories name:
```
$category_ids = get_all_category_ids();
foreach($category_ids ... | You're going about this wrongly, I think. The `theme_location` parameter for `wp_nav_menu()` is a *template* location - i.e. a *physical* location in the template, as defined/registered by the Theme. It's not designed for an arbitrary number of locations based on arbitrary user content.
If you want to output category-... |
129,737 | <p>This shouldn't be that difficult (I wouldn't think) ... I just want to have a section of my theme (directors) that has the name of the director / their bio in the title and post respectively (done). </p>
<p><em>But</em>, I would also like to have a meta-box on their post for their work (title / client / date / vide... | [
{
"answer_id": 129750,
"author": "RachieVee",
"author_id": 42783,
"author_profile": "https://wordpress.stackexchange.com/users/42783",
"pm_score": 1,
"selected": false,
"text": "<p>From using var_dump($arr) it looked like it was still spitting out an array that WordPress didn't know what... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129737",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9786/"
] | This shouldn't be that difficult (I wouldn't think) ... I just want to have a section of my theme (directors) that has the name of the director / their bio in the title and post respectively (done).
*But*, I would also like to have a meta-box on their post for their work (title / client / date / video link / thumb ) ... | You're going about this wrongly, I think. The `theme_location` parameter for `wp_nav_menu()` is a *template* location - i.e. a *physical* location in the template, as defined/registered by the Theme. It's not designed for an arbitrary number of locations based on arbitrary user content.
If you want to output category-... |
129,745 | <p>This is more of a theory question than a question with a direct answer. </p>
<p>I've been working with different actions for firing functions when a post is updated or deleted and when users are updated or deleted. For the actions, <code>publish_post</code> and <code>before_delete_post</code> for the posts and <cod... | [
{
"answer_id": 129750,
"author": "RachieVee",
"author_id": 42783,
"author_profile": "https://wordpress.stackexchange.com/users/42783",
"pm_score": 1,
"selected": false,
"text": "<p>From using var_dump($arr) it looked like it was still spitting out an array that WordPress didn't know what... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129745",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1670/"
] | This is more of a theory question than a question with a direct answer.
I've been working with different actions for firing functions when a post is updated or deleted and when users are updated or deleted. For the actions, `publish_post` and `before_delete_post` for the posts and `personal_options_update`, `edit_use... | You're going about this wrongly, I think. The `theme_location` parameter for `wp_nav_menu()` is a *template* location - i.e. a *physical* location in the template, as defined/registered by the Theme. It's not designed for an arbitrary number of locations based on arbitrary user content.
If you want to output category-... |
129,758 | <p>I want to plain to cache a page menu, that takes about 50 queries on page load. </p>
<p>At the moment I have cache setting code with <code>Transient API</code></p>
<pre><code>$housemenu = get_transient('housemenu_key');
if (!$housemenu) {
$housemenu = wp_nav_menu(
array(
'me... | [
{
"answer_id": 129760,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>By default <code>wp_nav_menu()</code> echoes result and returns nothing. You need to set <code>'echo' => false</... | 2014/01/14 | [
"https://wordpress.stackexchange.com/questions/129758",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44844/"
] | I want to plain to cache a page menu, that takes about 50 queries on page load.
At the moment I have cache setting code with `Transient API`
```
$housemenu = get_transient('housemenu_key');
if (!$housemenu) {
$housemenu = wp_nav_menu(
array(
'menu' => '',
'menu... | `wp_nav_menu()` doesn't return anything by default, it just echoes out formatted html.
For `wp_nav_menu()` to return a value you will need to pass `'echo' => false` into it's arguments, like so:
```
$housemenu = wp_nav_menu( array(
'menu' => '',
'menu_class' => 'sf-menu',
'menu_id' => 'nav',
'walker' ... |
129,777 | <p>I wanted to use WordPress menu management then show it on outside wordpress installion php file with html but I got this error </p>
<pre><code>PHP Fatal error: Call to a member function get_queried_object() on a non-object in .../blog/wp-includes/nav-menu-template.php on line 395
</code></pre>
<p>Here how I do it... | [
{
"answer_id": 129784,
"author": "Will",
"author_id": 44795,
"author_profile": "https://wordpress.stackexchange.com/users/44795",
"pm_score": 0,
"selected": false,
"text": "<p>That should work fine. Likely problems are either the incorrect path[1] at the top or no menu named <code>landin... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129777",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2462/"
] | I wanted to use WordPress menu management then show it on outside wordpress installion php file with html but I got this error
```
PHP Fatal error: Call to a member function get_queried_object() on a non-object in .../blog/wp-includes/nav-menu-template.php on line 395
```
Here how I do it in on php file with test.... | You can use this code and it will really help you a lot
```
<?php
require( '../wp-load.php' );
get_header(newtheme);
echo 'new content outside WordPress';
get_footer();
?>
``` |
129,818 | <p>I have a custom post type called 'doel'.
I have made a page template to display all the doel items</p>
<p>In this page template I loop the 'doel' post type and after 6 of them, I want to have a pagination.
Only, the pagination does not appear.</p>
<p>I started browsing on the internet and it seemed to be a common ... | [
{
"answer_id": 129822,
"author": "Akash Arora",
"author_id": 45180,
"author_profile": "https://wordpress.stackexchange.com/users/45180",
"pm_score": 3,
"selected": true,
"text": "<p>Simply replace the wp_pagenavi(); by </p>\n\n<pre><code>if(function_exists('wp_pagenavi')) \n{\n wp_pa... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129818",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34616/"
] | I have a custom post type called 'doel'.
I have made a page template to display all the doel items
In this page template I loop the 'doel' post type and after 6 of them, I want to have a pagination.
Only, the pagination does not appear.
I started browsing on the internet and it seemed to be a common problem after ver... | Simply replace the wp\_pagenavi(); by
```
if(function_exists('wp_pagenavi'))
{
wp_pagenavi(array( 'query' => $loop) );
wp_reset_postdata();
}
``` |
129,831 | <p>I copied my site:
www.old_site.com</p>
<p>to a new address:
www.new_site.com</p>
<p>All links in new_site point to the old site.</p>
<p>What do I have to change so that new site points to new site?
Thank you.</p>
| [
{
"answer_id": 129833,
"author": "Shafi Zahid",
"author_id": 38515,
"author_profile": "https://wordpress.stackexchange.com/users/38515",
"pm_score": 0,
"selected": false,
"text": "<p>Use this <a href=\"http://wordpress.org/plugins/wp-migrate-db\" rel=\"nofollow\">plugin</a> for change ol... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129831",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16266/"
] | I copied my site:
www.old\_site.com
to a new address:
www.new\_site.com
All links in new\_site point to the old site.
What do I have to change so that new site points to new site?
Thank you. | What web addresses are in your Dashboard > Settings > general?
if it is the old site, try changing it, if changing is impossible, try putting the following code at the top op wp-config.php:
```
define('WP_HOME','http://www.new_site.com');
define('WP_SITEURL','http://www.new_site.com');
```
Are the site urls correct?... |
129,843 | <p>I have this code :</p>
<pre><code>$querystr = "
SELECT *
FROM {$wpdb->prefix}posts
INNER JOIN {$wpdb->prefix}postmeta m1
ON ( {$wpdb->prefix}posts.ID = m1.post_id )
INNER JOIN {$wpdb->prefix}postmeta m2
ON ( {$wpdb->prefix}posts.ID = m2.post_id )
WHERE
{$wpdb->prefix}posts.post_type = 'produit... | [
{
"answer_id": 129987,
"author": "J.D.",
"author_id": 27757,
"author_profile": "https://wordpress.stackexchange.com/users/27757",
"pm_score": 4,
"selected": true,
"text": "<p>If you haven't studied up on WordPress's own unit testing tools and how to use them with plugins, I'd recommend t... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129843",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44321/"
] | I have this code :
```
$querystr = "
SELECT *
FROM {$wpdb->prefix}posts
INNER JOIN {$wpdb->prefix}postmeta m1
ON ( {$wpdb->prefix}posts.ID = m1.post_id )
INNER JOIN {$wpdb->prefix}postmeta m2
ON ( {$wpdb->prefix}posts.ID = m2.post_id )
WHERE
{$wpdb->prefix}posts.post_type = 'produits'
OR {$wpdb->prefix}posts.post_... | If you haven't studied up on WordPress's own unit testing tools and how to use them with plugins, I'd recommend that you do that. Here's a tutorial I wrote, to get you started: <http://codesymphony.co/writing-wordpress-plugin-unit-test> |
129,898 | <p>I have a child theme with two custom post types 'jazz clubs' and 'jazz festival'. I would like the <code>single.php</code> to either display different content dependent on whether the post is from jazz clubs or jazz festival. </p>
<p>The problem is, how can I create this using <code>single.php</code> file. Have tri... | [
{
"answer_id": 129867,
"author": "ucon89",
"author_id": 44538,
"author_profile": "https://wordpress.stackexchange.com/users/44538",
"pm_score": 0,
"selected": false,
"text": "<p>Open directory, <code>wp-content/pluggins</code>. You will see <code>contact-form-7</code> folder. Delete and ... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129898",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/39296/"
] | I have a child theme with two custom post types 'jazz clubs' and 'jazz festival'. I would like the `single.php` to either display different content dependent on whether the post is from jazz clubs or jazz festival.
The problem is, how can I create this using `single.php` file. Have tried creating `single-jazz-clubs.p... | Probably the folder is there already.
With your ftp client, browse to wp-content > plugins.
Do you see it there? then delete it and try again.
You can also download the plugin folder from the Wordpress plugin page to your computer and ftp it to the `wp-content/plugins` folder.
This way it won't give any problems becau... |
129,900 | <p>I have an attachment in a post and I want to attach it to another post without detaching it from the first post, using the WP API.</p>
| [
{
"answer_id": 129903,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>When inside of the media uploaded in the post edit screen, just search for your previously attached media and emb... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129900",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/39121/"
] | I have an attachment in a post and I want to attach it to another post without detaching it from the first post, using the WP API. | It is not so simple to do this. In my code change post\_parent field from the attachment with new post Id.
```
//take all image-attachments from a post to create post for each
$images =& get_children( array (
'post_parent' => $event_id,
'post_type' => 'attachment',
... |
129,915 | <p>I'm really struggling with this... I created a few Custom Post Types, let's say...</p>
<ul>
<li>Books</li>
<li>CD's</li>
<li>Maps</li>
</ul>
<p>Now I also have a whole bunch of existing categories and some of these would apply to more than one Custom Post Type. For example, the "Available" category could be assi... | [
{
"answer_id": 129918,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Try removing the parameter:</p>\n\n<pre><code>'category' => get_theme_option('featured_posts_category')\n</cod... | 2014/01/15 | [
"https://wordpress.stackexchange.com/questions/129915",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11092/"
] | I'm really struggling with this... I created a few Custom Post Types, let's say...
* Books
* CD's
* Maps
Now I also have a whole bunch of existing categories and some of these would apply to more than one Custom Post Type. For example, the "Available" category could be assigned to all of these Custom Post Types.
Now... | Your `get_posts` call needs a `posts_per_page` argument if you want more than whatever the default number per page is. Use `-1` to retrieve all matching posts.
```
$featured_posts = get_posts(
array(
'post_type' => array( 'post', 'books', 'cds', 'maps' ),
'category' => get_theme_option('featured_p... |
129,949 | <p>Is there a way to replace the WP_List_Table object of a post type to display said post type differently on the Admin edit.php page?</p>
| [
{
"answer_id": 129951,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>No, you cannot replace the list table. There is no filter, everything is hard-coded.</p>\n\n<p>But you can change the ... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/129949",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2234/"
] | Is there a way to replace the WP\_List\_Table object of a post type to display said post type differently on the Admin edit.php page? | No, you cannot replace the list table. There is no filter, everything is hard-coded.
But you can change the post type *registration*, set `show_ui` to `FALSE` to prevent the built-in page, and add a custom page for the post type listing to show the editable items.
```
add_action( 'wp_loaded', function(){
register... |
129,959 | <p>I'm uising a child theme of twentyfourteen on wordpress 3.8. When in debug mode, I get the following errors regarding a widget.</p>
<blockquote>
<p>Notice: Trying to get property of non-object in
\wordpress\wp-content\themes\tema2014\functions\widgets.php on line
148</p>
</blockquote>
<pre><code>update_post_... | [
{
"answer_id": 129967,
"author": "Akash Arora",
"author_id": 45180,
"author_profile": "https://wordpress.stackexchange.com/users/45180",
"pm_score": 0,
"selected": false,
"text": "<p>Yes I have been noticing the same warning and notices with version 3.8, but there are no notices as in ve... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/129959",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31545/"
] | I'm uising a child theme of twentyfourteen on wordpress 3.8. When in debug mode, I get the following errors regarding a widget.
>
> Notice: Trying to get property of non-object in
> \wordpress\wp-content\themes\tema2014\functions\widgets.php on line
> 148
>
>
>
```
update_post_meta($post->ID, "_sidebar", $_POST... | You should check that the variable exists before using it. [`isset()`](http://us3.php.net/isset) will return true if a variable has been set and is not null.
For example:
```
update_post_meta($post->ID, "_sidebar", $_POST["link"]);
```
will become:
```
if ( isset( $_POST["link"] ) ) {
update_post_meta( $post->ID... |
129,966 | <p>I have a custom post type 'products' and custom taxonomy of 'maker' that i have connected to that cpt 'products'. I have written this code :</p>
<pre><code> <?php $myproducts = new WP_Query(array('post_type' => 'products', 'maker'=>'samsung')); ?>
<?php while($myproducts->have_posts()) : $mypro... | [
{
"answer_id": 129969,
"author": "Shafi Zahid",
"author_id": 38515,
"author_profile": "https://wordpress.stackexchange.com/users/38515",
"pm_score": 0,
"selected": false,
"text": "<p>Use this code to get product by category.</p>\n\n<pre><code><?php $args = array( 'post_type' => 'pr... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/129966",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44772/"
] | I have a custom post type 'products' and custom taxonomy of 'maker' that i have connected to that cpt 'products'. I have written this code :
```
<?php $myproducts = new WP_Query(array('post_type' => 'products', 'maker'=>'samsung')); ?>
<?php while($myproducts->have_posts()) : $myproducts->the_post(); ?>
<a href... | You can simply use a [tax query](http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters) to get all posts attached to *any* `product_cat` term:
```
$args = array(
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'terms' => get_... |
129,989 | <p>The question might be simple. Since I need to fix it soon I had to ask.</p>
<p>Currently I am modifying a free plugin. In that I am having the <em>user login</em> string. </p>
<p>How can I get the role for that login? </p>
<p>I'm using WordPress 3.8.</p>
| [
{
"answer_id": 129993,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>You can use the <a href=\"http://codex.wordpress.org/Function_Reference/get_user_by\" rel=\"nofollow\"><code>... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/129989",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41361/"
] | The question might be simple. Since I need to fix it soon I had to ask.
Currently I am modifying a free plugin. In that I am having the *user login* string.
How can I get the role for that login?
I'm using WordPress 3.8. | You'll want to use `get_user_by()`, which will return a `WP_USER` object which contains roles and capabilities. More info [here](http://codex.wordpress.org/Class_Reference/WP_User).
```
$user = get_user_by( 'login', 'username');
$roles = $user->roles // this will contain an array of the roles the user is in
``` |
130,001 | <p>I'm working on a project involving a lot of widgets, and I'm thinking it'd be really great to have a "More options" section built using jQuery UI Accordion that expands when clicked. </p>
<p>So, I've enqueued 'jquery-ui-accordion' using the 'admin_enqueue_scripts' action:</p>
<pre><code>function add_my_deps() {
... | [
{
"answer_id": 129993,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>You can use the <a href=\"http://codex.wordpress.org/Function_Reference/get_user_by\" rel=\"nofollow\"><code>... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130001",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1682/"
] | I'm working on a project involving a lot of widgets, and I'm thinking it'd be really great to have a "More options" section built using jQuery UI Accordion that expands when clicked.
So, I've enqueued 'jquery-ui-accordion' using the 'admin\_enqueue\_scripts' action:
```
function add_my_deps() {
wp_enqueue_script... | You'll want to use `get_user_by()`, which will return a `WP_USER` object which contains roles and capabilities. More info [here](http://codex.wordpress.org/Class_Reference/WP_User).
```
$user = get_user_by( 'login', 'username');
$roles = $user->roles // this will contain an array of the roles the user is in
``` |
130,009 | <p>I am trying to order the posts in a category by showing the posts with images first and then posts without images last. I have managed to do that by running two queries and now I want to merge the two queries together. </p>
<p>I have the following:</p>
<pre><code><?php
$loop = new WP_Query( array('meta_key' =&g... | [
{
"answer_id": 130015,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 2,
"selected": false,
"text": "<p>Actually there's <code>meta_query</code> (or <a href=\"http://codex.wordpress.org/Class_Reference/WP_Meta_Query\" ... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130009",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45245/"
] | I am trying to order the posts in a category by showing the posts with images first and then posts without images last. I have managed to do that by running two queries and now I want to merge the two queries together.
I have the following:
```
<?php
$loop = new WP_Query( array('meta_key' => '_thumbnail_id', 'cat' =... | While this is not the best way to solve this problem (@kaiser's answer is), to answer the question directly, the actual query results will be in `$loop->posts` and `$loop2->posts`, so ...
```
$mergedloops = array_merge($loop->posts, $loop2->posts);
```
... should work, but you'd need to use a `foreach` loop and not ... |
130,023 | <p>I would like to have a different background image as per PAGE (category)</p>
<p>When the user goes to the <code>home.php</code>, call it A, it shall have a background image, then if I send them to a page B, I would like the background image to change.</p>
<p>Can anyone steer me in the right direction for this, ple... | [
{
"answer_id": 173307,
"author": "Christopher Eller",
"author_id": 44710,
"author_profile": "https://wordpress.stackexchange.com/users/44710",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, this can be done with CSS.</p>\n\n<p>I have done this with page and post IDs.</p>\n\n<p><stron... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130023",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45252/"
] | I would like to have a different background image as per PAGE (category)
When the user goes to the `home.php`, call it A, it shall have a background image, then if I send them to a page B, I would like the background image to change.
Can anyone steer me in the right direction for this, please? I understand it can be ... | Yes, this can be done with CSS.
I have done this with page and post IDs.
***IMPORTANT: The following are base examples and will need to be tested and tuned for your use.*** If you note any error here (with the base CSS examples), please post a note about the error.
To ID pages and posts, go to your Pages or Posts pa... |
130,024 | <p>I currently work with a graphic designer and code primarily HTML/CSS for clients looking to develop a web presence. I don't know much about WordPress. I have a client who wants some minimal changes done to his site, simple things like removing one of the tabs, editing some text, changing some links. His site is host... | [
{
"answer_id": 173307,
"author": "Christopher Eller",
"author_id": 44710,
"author_profile": "https://wordpress.stackexchange.com/users/44710",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, this can be done with CSS.</p>\n\n<p>I have done this with page and post IDs.</p>\n\n<p><stron... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130024",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45251/"
] | I currently work with a graphic designer and code primarily HTML/CSS for clients looking to develop a web presence. I don't know much about WordPress. I have a client who wants some minimal changes done to his site, simple things like removing one of the tabs, editing some text, changing some links. His site is hosted ... | Yes, this can be done with CSS.
I have done this with page and post IDs.
***IMPORTANT: The following are base examples and will need to be tested and tuned for your use.*** If you note any error here (with the base CSS examples), please post a note about the error.
To ID pages and posts, go to your Pages or Posts pa... |
130,032 | <p>On the server there is a static HTML page <code>example.html</code> in my root folder of the WordPress install. Now when a user types <code>www.example.com/example.html</code> I want WordPress to be smart and bypass all normal routing behavior and instead just display that static <code>example.html</code> page.</p>
... | [
{
"answer_id": 173307,
"author": "Christopher Eller",
"author_id": 44710,
"author_profile": "https://wordpress.stackexchange.com/users/44710",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, this can be done with CSS.</p>\n\n<p>I have done this with page and post IDs.</p>\n\n<p><stron... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130032",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45253/"
] | On the server there is a static HTML page `example.html` in my root folder of the WordPress install. Now when a user types `www.example.com/example.html` I want WordPress to be smart and bypass all normal routing behavior and instead just display that static `example.html` page.
This looks so easy to me concept-wise b... | Yes, this can be done with CSS.
I have done this with page and post IDs.
***IMPORTANT: The following are base examples and will need to be tested and tuned for your use.*** If you note any error here (with the base CSS examples), please post a note about the error.
To ID pages and posts, go to your Pages or Posts pa... |
130,039 | <p>So I've been trying for a hour or so now to list comment by it's ID.
I've tried the <code>get_comment($id, $output)</code> function but it didn't work well, so I went back to whatever is shown below, but it just shows all comments. I want it to show just one comment by it's ID. I can't figure out a way to do it.
Wha... | [
{
"answer_id": 130045,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 0,
"selected": false,
"text": "<p>I don't see an argument to <a href=\"http://codex.wordpress.org/Class_Reference/WP_Comment_Query#Parameters\... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130039",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32580/"
] | So I've been trying for a hour or so now to list comment by it's ID.
I've tried the `get_comment($id, $output)` function but it didn't work well, so I went back to whatever is shown below, but it just shows all comments. I want it to show just one comment by it's ID. I can't figure out a way to do it.
What am I doing w... | [The Codex](http://codex.wordpress.org/Class_Reference/WP_Comment_Query) makes it seem like you can query for a specific comment by ID, as does the [GenerateWP query generator](http://generatewp.com/wp_comment_query/), but I couldn't get it to work with either of those examples. Even looking through the `WP_Comment_Que... |
130,043 | <p>When clicking the next_posts_link it just shows the same posts as on page 1. It appears to work fine on the category pages and it is only affecting the homepage (home.php)</p>
<p>Thanks!</p>
<pre><code> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php query_posts('cat=-683... | [
{
"answer_id": 130045,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 0,
"selected": false,
"text": "<p>I don't see an argument to <a href=\"http://codex.wordpress.org/Class_Reference/WP_Comment_Query#Parameters\... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130043",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16517/"
] | When clicking the next\_posts\_link it just shows the same posts as on page 1. It appears to work fine on the category pages and it is only affecting the homepage (home.php)
Thanks!
```
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php query_posts('cat=-683,-3598' . $paged); ?>
```
... | [The Codex](http://codex.wordpress.org/Class_Reference/WP_Comment_Query) makes it seem like you can query for a specific comment by ID, as does the [GenerateWP query generator](http://generatewp.com/wp_comment_query/), but I couldn't get it to work with either of those examples. Even looking through the `WP_Comment_Que... |
130,057 | <p>I have a child theme of Twenty Thirteen and I've setup Custom Post Types for several items. They are showing up in the Dashboard, I can create the Custom Posts and they show up in various categories because I called the <code>$query->set()</code> with the Custom Post Types. I've saved and re-saved Permalinks ma... | [
{
"answer_id": 130045,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 0,
"selected": false,
"text": "<p>I don't see an argument to <a href=\"http://codex.wordpress.org/Class_Reference/WP_Comment_Query#Parameters\... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130057",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11092/"
] | I have a child theme of Twenty Thirteen and I've setup Custom Post Types for several items. They are showing up in the Dashboard, I can create the Custom Posts and they show up in various categories because I called the `$query->set()` with the Custom Post Types. I've saved and re-saved Permalinks many times to flush t... | [The Codex](http://codex.wordpress.org/Class_Reference/WP_Comment_Query) makes it seem like you can query for a specific comment by ID, as does the [GenerateWP query generator](http://generatewp.com/wp_comment_query/), but I couldn't get it to work with either of those examples. Even looking through the `WP_Comment_Que... |
130,067 | <p>I am trying to sync WP with another service that offers an API that allows me to hook up their table's Update, Create, Delete to my sites.</p>
<p>So when they create, update, or delete a row on their server, I get details about that update, including the row ID.</p>
<p>The way I am thinking of syncing is by using ... | [
{
"answer_id": 130070,
"author": "MikeNGarrett",
"author_id": 1670,
"author_profile": "https://wordpress.stackexchange.com/users/1670",
"pm_score": 2,
"selected": false,
"text": "<p>I would highly recommend creating your own table just for this relation. In this way queries can be faster... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130067",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41032/"
] | I am trying to sync WP with another service that offers an API that allows me to hook up their table's Update, Create, Delete to my sites.
So when they create, update, or delete a row on their server, I get details about that update, including the row ID.
The way I am thinking of syncing is by using custom post types... | You can technically add a post column with SQL but I'd caution against it as backup scripts, exports etc. would likely ignore it.
Instead, I would add the content as a post\_meta, either using a Custom Field or through PHP with the update\_post\_meta() function.
To fetch a post based on the meta simply use:
```
$arg... |
130,075 | <p>Is there a way to stop WordPress from automatically inserting <code><br></code> tags when adding returns in the WordPress text editor.</p>
<p>I would like for it to behave more like a code editor where I can structure the code how I like and make it easy to read.</p>
<p>The code I am using in the editor is: ... | [
{
"answer_id": 130089,
"author": "shea",
"author_id": 19726,
"author_profile": "https://wordpress.stackexchange.com/users/19726",
"pm_score": 4,
"selected": false,
"text": "<p>The <code>wpautop()</code> function adds <code><p></code> and <code><br></code> tags to your content... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130075",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38122/"
] | Is there a way to stop WordPress from automatically inserting `<br>` tags when adding returns in the WordPress text editor.
I would like for it to behave more like a code editor where I can structure the code how I like and make it easy to read.
The code I am using in the editor is:
```
[one_third][team_member imag... | The answer by shea is not ideal as in many cases:
* You don't want to strip everything from `<br>, <p>` etc. You want it as a default behavior for your WP visual composer which the above code will delete
* In many cases it is considered as "hacking the core" as this is changing the
default core behavior of WP - for ex... |
130,076 | <p>I have a multisite with domains:</p>
<p>site1.com, site2.com, site3.com, etc. where site.com is the "home domain" of the multisite. As of now there is two issues I am trying to solve at the same time.</p>
<p>If I try example.site2.com (a subdomain that does not exist) it will redirect to site1.com/wp-signup.php (a... | [
{
"answer_id": 130089,
"author": "shea",
"author_id": 19726,
"author_profile": "https://wordpress.stackexchange.com/users/19726",
"pm_score": 4,
"selected": false,
"text": "<p>The <code>wpautop()</code> function adds <code><p></code> and <code><br></code> tags to your content... | 2014/01/16 | [
"https://wordpress.stackexchange.com/questions/130076",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35677/"
] | I have a multisite with domains:
site1.com, site2.com, site3.com, etc. where site.com is the "home domain" of the multisite. As of now there is two issues I am trying to solve at the same time.
If I try example.site2.com (a subdomain that does not exist) it will redirect to site1.com/wp-signup.php (and i have registr... | The answer by shea is not ideal as in many cases:
* You don't want to strip everything from `<br>, <p>` etc. You want it as a default behavior for your WP visual composer which the above code will delete
* In many cases it is considered as "hacking the core" as this is changing the
default core behavior of WP - for ex... |
130,084 | <p>I have widgets that have javascript controls attached to them.</p>
<p>If the widget is present when the widget admin page loads, the controls work correctly.</p>
<p>When I add a new widget, they do not work correctly, I get the markup, but no javascript events take effect.</p>
<p>If I save the new widget, when th... | [
{
"answer_id": 130136,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "<p>Great News,</p>\n\n<p>I've fixed it.</p>\n\n<p>Apologies for missing your gist in my initial comment and giving yo... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130084",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/736/"
] | I have widgets that have javascript controls attached to them.
If the widget is present when the widget admin page loads, the controls work correctly.
When I add a new widget, they do not work correctly, I get the markup, but no javascript events take effect.
If I save the new widget, when the form reloads, the cont... | Great News,
I've fixed it.
Apologies for missing your gist in my initial comment and giving you an answer that you had already implemented. That'll teach me to answer on my phone while on a train!
Your use of ajaxstop is correct. Hell the JS for the most part is working correctly, you could see the css styles being ... |
130,097 | <p>I'm trying to add the ability to insert Custom CSS Classes to menu items. I believe I do this by extending the walker_nav_menu but I'm not sure how to call the custom classes.</p>
<p>This seems like such a simple question but I've googled and searched here and couldn't find anything for simply adding the custom cla... | [
{
"answer_id": 130100,
"author": "Subharanjan",
"author_id": 13615,
"author_profile": "https://wordpress.stackexchange.com/users/13615",
"pm_score": 1,
"selected": false,
"text": "<p>If its a matter of adding icons as per the classes, add it from the back-end and use that class to assign... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130097",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35801/"
] | I'm trying to add the ability to insert Custom CSS Classes to menu items. I believe I do this by extending the walker\_nav\_menu but I'm not sure how to call the custom classes.
This seems like such a simple question but I've googled and searched here and couldn't find anything for simply adding the custom classes.
R... | If its a matter of adding icons as per the classes, add it from the back-end and use that class to assign icons through css.
 |
130,115 | <p>I found this helpful tutorial about integrating paypal buynow button with wordpress using custom post type.</p>
<pre><code> <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="... | [
{
"answer_id": 130118,
"author": "Gareth Gillman",
"author_id": 33936,
"author_profile": "https://wordpress.stackexchange.com/users/33936",
"pm_score": 2,
"selected": false,
"text": "<p>It's far better to use a plugin such as Easy Digital Downloads as there are many steps you will need t... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130115",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3327/"
] | I found this helpful tutorial about integrating paypal buynow button with wordpress using custom post type.
```
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="example@example.com">
<input... | It's far better to use a plugin such as Easy Digital Downloads as there are many steps you will need to code in e.g.
1) Check if user has paid (by checking if they were referred back successfully by Paypal) and then set the option in the admin area to say yes you have paid
2) Check what you have bought and direct you ... |
130,129 | <p>I wonder if it is possible to have the default category WordPress on
all category archives?</p>
<p>Here is my situation: I created a website of video games and I renamed
the default category "multiplatform". But I want all posts in this category are displayed on other categories like the category "PS3" for example.... | [
{
"answer_id": 130130,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 0,
"selected": false,
"text": "<p>You can use the bulk edit feature to add a category to all posts in an existing category. Use the filter by... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130129",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40478/"
] | I wonder if it is possible to have the default category WordPress on
all category archives?
Here is my situation: I created a website of video games and I renamed
the default category "multiplatform". But I want all posts in this category are displayed on other categories like the category "PS3" for example.
If possi... | You need to use pre\_get\_posts hook. Where u can include the default category posts on other category pages.
```
function wpse_pre_get_posts( $q )
{
// its the main query, and its the category page archive
if( $q->is_main_query() && $q->is_category() ) :
// get the default selected category id, fall... |
130,139 | <p>Is there any <em>Conditional Tag</em> to check whether a comment is made by registered user or not?</p>
| [
{
"answer_id": 130130,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 0,
"selected": false,
"text": "<p>You can use the bulk edit feature to add a category to all posts in an existing category. Use the filter by... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130139",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43723/"
] | Is there any *Conditional Tag* to check whether a comment is made by registered user or not? | You need to use pre\_get\_posts hook. Where u can include the default category posts on other category pages.
```
function wpse_pre_get_posts( $q )
{
// its the main query, and its the category page archive
if( $q->is_main_query() && $q->is_category() ) :
// get the default selected category id, fall... |
130,146 | <p>i'm trying to display a message in admin_notices hook upon plugin activation, using both a global variable or a static variable in my class ( $associati_error). i set the variable value into the register_activation_hook function: none of that is working.</p>
<p>i'm very new to wordpress development and php, so excu... | [
{
"answer_id": 130163,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>Take a look at what happens when you activate a plugin. That is, watch the event with something like HttpFox... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130146",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45295/"
] | i'm trying to display a message in admin\_notices hook upon plugin activation, using both a global variable or a static variable in my class ( $associati\_error). i set the variable value into the register\_activation\_hook function: none of that is working.
i'm very new to wordpress development and php, so excuse me ... | Take a look at what happens when you activate a plugin. That is, watch the event with something like HttpFox or Wireshark. After activation the page is redirected back to itself with `$_GET` parameters appended. For example:
```
wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
```
Notice, `activate=tr... |
130,169 | <p>I need to create a PHP script that will receive data from another application via an HTTP post, process that data, and update the WordPress database. This script will run silently (i.e., no HTTP output). What is the best way to set up such a page? I thought about creating a custom template file with the PHP script a... | [
{
"answer_id": 130201,
"author": "Rachel Baker",
"author_id": 8054,
"author_profile": "https://wordpress.stackexchange.com/users/8054",
"pm_score": 3,
"selected": true,
"text": "<p>I would use the Rewrite API and the template_redirect action to respond to API requests. </p>\n\n<p>As an ... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130169",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38193/"
] | I need to create a PHP script that will receive data from another application via an HTTP post, process that data, and update the WordPress database. This script will run silently (i.e., no HTTP output). What is the best way to set up such a page? I thought about creating a custom template file with the PHP script and ... | I would use the Rewrite API and the template\_redirect action to respond to API requests.
As an example, if I wanted to respond to requests directed to the url: example.com/example-path/ with logic in my theme or plugin's endpoint.php file I would create a rewrite rule and template redirect hook like so:
```
add_act... |
130,186 | <p>Images in WordPress posts, as I understand, are uploaded manually. They are uploaded by default to <code>uploads</code> folder. A client of mine reported that, in one of his site, he uploaded all the images in BMP format. Now he realized the consequences of his mistake. He wants to make them JPG now. And there are 4... | [
{
"answer_id": 130211,
"author": "Rachel Baker",
"author_id": 8054,
"author_profile": "https://wordpress.stackexchange.com/users/8054",
"pm_score": 2,
"selected": false,
"text": "<p>Assuming you add the files with the matching filenames in the appropriate <code>wp-content/uploads/</code>... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130186",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22728/"
] | Images in WordPress posts, as I understand, are uploaded manually. They are uploaded by default to `uploads` folder. A client of mine reported that, in one of his site, he uploaded all the images in BMP format. Now he realized the consequences of his mistake. He wants to make them JPG now. And there are 40-60 images th... | Assuming you add the files with the matching filenames in the appropriate `wp-content/uploads/` folders you could run a few SQL queries to update the WordPress database to use the `.jpg` files.
Assuming your `wpdb` prefix is `wp` these queries would be:
```
UPDATE wp_posts SET post_mime_type = replace(post_mime_type,... |
130,193 | <p>I have several Custom Post Types and several Categories. Within my <code>pre_get_posts</code> hook (in <code>functions.php</code>), I'm changing the chronological order for very specific Custom Post Type archive pages.</p>
<pre><code>function get_custom_posts( $query ) {
if ( ! is_admin() && $query->... | [
{
"answer_id": 130197,
"author": "Borek",
"author_id": 45286,
"author_profile": "https://wordpress.stackexchange.com/users/45286",
"pm_score": -1,
"selected": false,
"text": "<p>Pagination won't work correctly, unless you set the 'paged' query var appropriately: <a href=\"http://codex.wo... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130193",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11092/"
] | I have several Custom Post Types and several Categories. Within my `pre_get_posts` hook (in `functions.php`), I'm changing the chronological order for very specific Custom Post Type archive pages.
```
function get_custom_posts( $query ) {
if ( ! is_admin() && $query->is_main_query() && empty($query->query_vars['su... | 1) *"need ascending chronological order on Category archive pages, but only if they contain one or more posts from my specified Custom Post Types"*
I don't think this is possible; at least not practical. However, since posting the question I've setup custom taxonomies for my Custom Post Types which negates the need fo... |
130,203 | <p>I'm running into a problem where a particularly huge image is causing my VPS server to reboot because of memory issues. The configuration of this is out of my hands, it's sort of like the host's failsafe.</p>
<p>I have a VPS with 300M memory, which I believe is sufficient for my WordPress installation, at least wit... | [
{
"answer_id": 130204,
"author": "Marc Dingena",
"author_id": 28660,
"author_profile": "https://wordpress.stackexchange.com/users/28660",
"pm_score": 5,
"selected": true,
"text": "<p>The problem isn't so much the uploading itself, as that is a network connection between the client and th... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130203",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28660/"
] | I'm running into a problem where a particularly huge image is causing my VPS server to reboot because of memory issues. The configuration of this is out of my hands, it's sort of like the host's failsafe.
I have a VPS with 300M memory, which I believe is sufficient for my WordPress installation, at least with day-to-d... | The problem isn't so much the uploading itself, as that is a network connection between the client and the server. It's not what's eating the server's memory.
When WordPress starts 'cruncing' the images, that is where PHP comes in and start resizing and cropping the uploaded images. It is before this moment you need t... |
130,206 | <p>I'm trying to adapt <a href="http://tommcfarlin.com/programmatically-create-a-post-in-wordpress/" rel="nofollow">Tom McFarlin's tutorial on programatically creating a page</a> into a function that will create multiple pages by passing in an array of info. The page gets created in Wordpress, but the page information... | [
{
"answer_id": 130204,
"author": "Marc Dingena",
"author_id": 28660,
"author_profile": "https://wordpress.stackexchange.com/users/28660",
"pm_score": 5,
"selected": true,
"text": "<p>The problem isn't so much the uploading itself, as that is a network connection between the client and th... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130206",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45324/"
] | I'm trying to adapt [Tom McFarlin's tutorial on programatically creating a page](http://tommcfarlin.com/programmatically-create-a-post-in-wordpress/) into a function that will create multiple pages by passing in an array of info. The page gets created in Wordpress, but the page information is all empty. | The problem isn't so much the uploading itself, as that is a network connection between the client and the server. It's not what's eating the server's memory.
When WordPress starts 'cruncing' the images, that is where PHP comes in and start resizing and cropping the uploaded images. It is before this moment you need t... |
130,215 | <p>I have a plugin and I am creating a css file in wp_content.</p>
<p>I used this:</p>
<pre><code>$this->content_dir = WP_CONTENT_DIR . "/some_folder";
$path = $this->content_dir . 'options.css';
$css='some string';
global $wp_filesystem;
if(!$wp_filesystem->put_contents( $path, $css, 0644) ) {
return ... | [
{
"answer_id": 160919,
"author": "berdi",
"author_id": 59498,
"author_profile": "https://wordpress.stackexchange.com/users/59498",
"pm_score": 3,
"selected": false,
"text": "<p>Initialize the WP filesystem and no more using file_put_contents function. Try this:</p>\n\n<pre><code>[...]\n\... | 2014/01/17 | [
"https://wordpress.stackexchange.com/questions/130215",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45321/"
] | I have a plugin and I am creating a css file in wp\_content.
I used this:
```
$this->content_dir = WP_CONTENT_DIR . "/some_folder";
$path = $this->content_dir . 'options.css';
$css='some string';
global $wp_filesystem;
if(!$wp_filesystem->put_contents( $path, $css, 0644) ) {
return __('Failed to create css file... | Initialize the WP filesystem and no more using file\_put\_contents function. Try this:
```
[...]
global $wp_filesystem;
// Initialize the WP filesystem, no more using 'file-put-contents' function
if (empty($wp_filesystem)) {
require_once (ABSPATH . '/wp-admin/includes/file.php');
WP_Filesystem();
}
if(!$wp_f... |
130,232 | <p>I'm using JSON api plugin to pull data from wordpress into an app I am making. I need a unique identifier to make sure I don't have any duplicates WHILE also using the identifier as a way to sort from newest post to oldest post. As of right now I'm confused because I pull the 10 most recent posts. I then take the ID... | [
{
"answer_id": 130233,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": false,
"text": "<p>If you look at the <a href=\"https://codex.wordpress.org/Database_Description\" rel=\"nofollow\">description... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130232",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24032/"
] | I'm using JSON api plugin to pull data from wordpress into an app I am making. I need a unique identifier to make sure I don't have any duplicates WHILE also using the identifier as a way to sort from newest post to oldest post. As of right now I'm confused because I pull the 10 most recent posts. I then take the ID an... | If you look at the [description for the different tables used by WordPress](https://codex.wordpress.org/Database_Description), the columns described as "auto\_increment" will be unique.
I am not sure what you are doing though. The URL structure you are using is not one that I recognize. That is, the syntax I think you... |
130,240 | <p>I've decided to take the advice of protecting the <code>/wp-admin</code> directory using .htaccess on a website which keeps getting hacked.</p>
<p>Whenever I upload .htaccess to <code>/wp-admin</code>, my browser says <code>/wp-admin</code> has a redirect loop.</p>
<p>This is <code>/wp-admin/.htaccess</code>:</p>
... | [
{
"answer_id": 130243,
"author": "Raja67",
"author_id": 45335,
"author_profile": "https://wordpress.stackexchange.com/users/45335",
"pm_score": 4,
"selected": true,
"text": "<p>Redirection depends on server configuration. You need to add</p>\n\n<pre><code>ErrorDocument 401 default\n</cod... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130240",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3206/"
] | I've decided to take the advice of protecting the `/wp-admin` directory using .htaccess on a website which keeps getting hacked.
Whenever I upload .htaccess to `/wp-admin`, my browser says `/wp-admin` has a redirect loop.
This is `/wp-admin/.htaccess`:
>
>
> ```
> AuthUserFile /.../.htpasswd
> AuthType Basic
> Aut... | Redirection depends on server configuration. You need to add
```
ErrorDocument 401 default
```
to your main .htaccess to prevent redirection.
You can refer the article [Password-protect-wp-admin](http://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/) for more details |
130,242 | <p>My use of the_category works fine, but I want to change the tooltip, which says "View all posts in (category name)".</p>
<p>How can I change this tooltip?</p>
<p>I guess this might be something similar to <a href="https://wordpress.stackexchange.com/questions/50876/can-the-category-display-a-post-count?rq=1">this<... | [
{
"answer_id": 130243,
"author": "Raja67",
"author_id": 45335,
"author_profile": "https://wordpress.stackexchange.com/users/45335",
"pm_score": 4,
"selected": true,
"text": "<p>Redirection depends on server configuration. You need to add</p>\n\n<pre><code>ErrorDocument 401 default\n</cod... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130242",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16266/"
] | My use of the\_category works fine, but I want to change the tooltip, which says "View all posts in (category name)".
How can I change this tooltip?
I guess this might be something similar to [this](https://wordpress.stackexchange.com/questions/50876/can-the-category-display-a-post-count?rq=1).
Thank you | Redirection depends on server configuration. You need to add
```
ErrorDocument 401 default
```
to your main .htaccess to prevent redirection.
You can refer the article [Password-protect-wp-admin](http://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/) for more details |
130,248 | <p>I am pretty new in WordPress (I came from Joomla) and I have the following doubt related the <strong>Theme Location</strong> of the main menu.</p>
<p>For example, using the preinstalled <strong>Twenty Twelve</strong> theme, if in the backend I go into: <strong>Appearance ---> Menus ---> Manage Location</strong> I c... | [
{
"answer_id": 130257,
"author": "Steve",
"author_id": 3206,
"author_profile": "https://wordpress.stackexchange.com/users/3206",
"pm_score": 4,
"selected": true,
"text": "<p>Menu locations are defined in functions.php</p>\n\n<p>You can read <a href=\"http://codex.wordpress.org/Navigation... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130248",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29275/"
] | I am pretty new in WordPress (I came from Joomla) and I have the following doubt related the **Theme Location** of the main menu.
For example, using the preinstalled **Twenty Twelve** theme, if in the backend I go into: **Appearance ---> Menus ---> Manage Location** I can assign my **main-menu** only to a specific **t... | Menu locations are defined in functions.php
You can read [the codex](http://codex.wordpress.org/Navigation_Menus) for more information on how to define menu locations in functions.php
**Register Menus**
Firstly, in your theme's functions.php, you need to write a function to register the names of your menus. (This is... |
130,268 | <pre><code><?php
wp_nav_menu(
array(
'theme_location' =>'main_menu',
'container' => false,
'menu_id'=> 'nav'
)
);
?>
</code></pre>
<p>After updating WordPress to 3.8 menu id is not working. Where is the problem ?
I like to get menu as </p>
<pre><code><ul id="nav"... | [
{
"answer_id": 130257,
"author": "Steve",
"author_id": 3206,
"author_profile": "https://wordpress.stackexchange.com/users/3206",
"pm_score": 4,
"selected": true,
"text": "<p>Menu locations are defined in functions.php</p>\n\n<p>You can read <a href=\"http://codex.wordpress.org/Navigation... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130268",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45342/"
] | ```
<?php
wp_nav_menu(
array(
'theme_location' =>'main_menu',
'container' => false,
'menu_id'=> 'nav'
)
);
?>
```
After updating WordPress to 3.8 menu id is not working. Where is the problem ?
I like to get menu as
```
<ul id="nav">
<li><a href="">Home</a></li>
<li><a href="">Ab... | Menu locations are defined in functions.php
You can read [the codex](http://codex.wordpress.org/Navigation_Menus) for more information on how to define menu locations in functions.php
**Register Menus**
Firstly, in your theme's functions.php, you need to write a function to register the names of your menus. (This is... |
130,271 | <pre><code><div class="sidebar_area">
<h4>Sponsor</h4>
<div class="sidebar_content">
<ul>
<li><a href="#">This is new post</a></li>
<li><a href="#">This is new post</a></li>
<li><a href="#">This is new ... | [
{
"answer_id": 130257,
"author": "Steve",
"author_id": 3206,
"author_profile": "https://wordpress.stackexchange.com/users/3206",
"pm_score": 4,
"selected": true,
"text": "<p>Menu locations are defined in functions.php</p>\n\n<p>You can read <a href=\"http://codex.wordpress.org/Navigation... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130271",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45342/"
] | ```
<div class="sidebar_area">
<h4>Sponsor</h4>
<div class="sidebar_content">
<ul>
<li><a href="#">This is new post</a></li>
<li><a href="#">This is new post</a></li>
<li><a href="#">This is new post</a></li>
<li><a href="#">This is new post</a></li>
<li><a href="#">This is n... | Menu locations are defined in functions.php
You can read [the codex](http://codex.wordpress.org/Navigation_Menus) for more information on how to define menu locations in functions.php
**Register Menus**
Firstly, in your theme's functions.php, you need to write a function to register the names of your menus. (This is... |
130,293 | <p>I am trying to add a CSS style to a WordPress theme that I am developing as is shown in this tutorial: <a href="http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/">http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/</a> but seem... | [
{
"answer_id": 130294,
"author": "Borek",
"author_id": 45286,
"author_profile": "https://wordpress.stackexchange.com/users/45286",
"pm_score": 4,
"selected": true,
"text": "<p>You are using <code>plugins_url</code> - therefore pointing to completly different directory than your current t... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130293",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29275/"
] | I am trying to add a CSS style to a WordPress theme that I am developing as is shown in this tutorial: <http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/> but seems don't work and I cant' understand why.
So this is the **head.php** file of my personal theme:
```
<!DOCTYPE... | You are using `plugins_url` - therefore pointing to completly different directory than your current theme. If you are just trying to enqueue a theme style do it like this:
```
function load_theme_styles() {
wp_enqueue_style('main-css', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');
}
add_act... |
130,299 | <p>I have a number of pages which are automatically generated. I then use a custom settings box to allow users to exchange the content on those pages.</p>
<p>Problem being, I don't want users to be able to delete these specific pages. One of those pages is the "Disclaimer". The reason I'm doing this is because I'm cre... | [
{
"answer_id": 130294,
"author": "Borek",
"author_id": 45286,
"author_profile": "https://wordpress.stackexchange.com/users/45286",
"pm_score": 4,
"selected": true,
"text": "<p>You are using <code>plugins_url</code> - therefore pointing to completly different directory than your current t... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130299",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | I have a number of pages which are automatically generated. I then use a custom settings box to allow users to exchange the content on those pages.
Problem being, I don't want users to be able to delete these specific pages. One of those pages is the "Disclaimer". The reason I'm doing this is because I'm creating a mu... | You are using `plugins_url` - therefore pointing to completly different directory than your current theme. If you are just trying to enqueue a theme style do it like this:
```
function load_theme_styles() {
wp_enqueue_style('main-css', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');
}
add_act... |
130,314 | <p>There is a long-standing WordPress core bug (<a href="https://core.trac.wordpress.org/ticket/16373">#16373</a>) in which, if custom query variables are registered and present in the query string, the query will not set <code>is_front_page()</code> true, even if <code>'page' == get_option( 'show_on_front' )</code>. F... | [
{
"answer_id": 130320,
"author": "s1lv3r",
"author_id": 27536,
"author_profile": "https://wordpress.stackexchange.com/users/27536",
"pm_score": 4,
"selected": true,
"text": "<p>Did you check what part of <a href=\"https://core.trac.wordpress.org/browser/tags/3.8/src/wp-includes/query.php... | 2014/01/18 | [
"https://wordpress.stackexchange.com/questions/130314",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3966/"
] | There is a long-standing WordPress core bug ([#16373](https://core.trac.wordpress.org/ticket/16373)) in which, if custom query variables are registered and present in the query string, the query will not set `is_front_page()` true, even if `'page' == get_option( 'show_on_front' )`. Full details are in the trac ticket, ... | Did you check what part of [is\_front\_page()](https://core.trac.wordpress.org/browser/tags/3.8/src/wp-includes/query.php#L3605) is causing it to return false?
I could reproduce the problem by following the setup from the trac ticket. In my case inside this function the call to [is\_page()](https://core.trac.wordpress... |
130,325 | <p>Is there anyway to remove version number from the right side of WordPress admin footer?</p>
<p>I know this code will add some text before the version number, but it will not remove it:</p>
<pre><code>function change_footer_version() {
echo 'Anything';
}
add_filter( 'update_footer', 'change_footer_version', 999... | [
{
"answer_id": 130332,
"author": "Will",
"author_id": 44795,
"author_profile": "https://wordpress.stackexchange.com/users/44795",
"pm_score": 6,
"selected": true,
"text": "<p>Add this to your <code>functions.php</code>:</p>\n\n<pre><code>function my_footer_shh() {\n remove_filter( 'up... | 2014/01/19 | [
"https://wordpress.stackexchange.com/questions/130325",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33233/"
] | Is there anyway to remove version number from the right side of WordPress admin footer?
I know this code will add some text before the version number, but it will not remove it:
```
function change_footer_version() {
echo 'Anything';
}
add_filter( 'update_footer', 'change_footer_version', 9999 );
```
And the fo... | Add this to your `functions.php`:
```
function my_footer_shh() {
remove_filter( 'update_footer', 'core_update_footer' );
}
add_action( 'admin_menu', 'my_footer_shh' );
```
or, if you'd like to hide it from everyone except admins:
```
function my_footer_shh() {
if ( ! current_user_can('manage_options') ) {... |
130,347 | <p>I use a gallery shortcode in my index.php (theme directory) to display 3 boxes of images. The images are fetched from my Media.</p>
<pre><code><div class="well well-clear" style="padding-bottom: 0; margin-bottom: 0;">
<?php echo do_shortcode('[gallery ids="165,166,167"]'); ?>
</div>
</code></pre>
... | [
{
"answer_id": 130349,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 3,
"selected": true,
"text": "<h2>Update:</h2>\n\n<p>It looks like there exists an attribute <code>link=\"none\"</code> after all ;-)</p>\n\n<p... | 2014/01/19 | [
"https://wordpress.stackexchange.com/questions/130347",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38347/"
] | I use a gallery shortcode in my index.php (theme directory) to display 3 boxes of images. The images are fetched from my Media.
```
<div class="well well-clear" style="padding-bottom: 0; margin-bottom: 0;">
<?php echo do_shortcode('[gallery ids="165,166,167"]'); ?>
</div>
```
By default these images have a hyperlink... | Update:
-------
It looks like there exists an attribute `link="none"` after all ;-)
For example:
```
[gallery link="none" ids="165,166,167"]
```
So we don't need to reinvent the wheel, like in my previous answers ;-)
Previous: Plugin to handle `link="no"` in the gallery shortcode:
-------------------------------... |
130,364 | <p>I'm new to WordPress and need to create a website including a special form, with which I can upload photos, set my position on an OpenStreetMap and choose from several dropdown menus. </p>
<p>Here you can find an example of how it should look like:
<img src="https://i.stack.imgur.com/IABAz.png" alt="enter image de... | [
{
"answer_id": 136897,
"author": "flowdee",
"author_id": 48490,
"author_profile": "https://wordpress.stackexchange.com/users/48490",
"pm_score": 1,
"selected": false,
"text": "<p>I suggest to give the following code a try:</p>\n\n<pre><code><?php \nadd_action( 'init', 'create_post_typ... | 2014/01/19 | [
"https://wordpress.stackexchange.com/questions/130364",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45158/"
] | I'm new to WordPress and need to create a website including a special form, with which I can upload photos, set my position on an OpenStreetMap and choose from several dropdown menus.
Here you can find an example of how it should look like:

I alre... | I could only solve the problem by creating another custom post type (with another name). Afterwards everything just went fine. I am sorry, but I don't have any explanation for this. |
130,387 | <p>I have tried everything to get Custom Fields to display on my posts using a Child Theme of the Genesis theme framework. I have tried to follow every tutorial I could find relating to it but still I can't get my Custom Fields to show on my posts!</p>
<p>The simplest looking solution I have been trying is using Brad ... | [
{
"answer_id": 130394,
"author": "Borek",
"author_id": 45286,
"author_profile": "https://wordpress.stackexchange.com/users/45286",
"pm_score": 2,
"selected": true,
"text": "<p>How about instead of <code>genesis_custom_field('instrument');</code> use: <code>echo genesis_get_custom_field('... | 2014/01/19 | [
"https://wordpress.stackexchange.com/questions/130387",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43113/"
] | I have tried everything to get Custom Fields to display on my posts using a Child Theme of the Genesis theme framework. I have tried to follow every tutorial I could find relating to it but still I can't get my Custom Fields to show on my posts!
The simplest looking solution I have been trying is using Brad Daltons in... | How about instead of `genesis_custom_field('instrument');` use: `echo genesis_get_custom_field('instrument');`
Plus the `genesis_after_post_title` action hook is deprecated since 1.7.0 and you should use `genesis_entry_header` with correct priorities. For more information please use the reference links below.
Referen... |