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 |
|---|---|---|---|---|---|---|
175,944 | <p>I'm pretty new to creating my own theme and I seem to have become stuck and would really appreciate it if someone could help me. I have searched and found snippets of advice but nothing that really caters for what I need.</p>
<p><strong>Problem 1</strong></p>
<p>The main blog (home) page is causing me problems as ... | [
{
"answer_id": 175951,
"author": "Nibbers",
"author_id": 66157,
"author_profile": "https://wordpress.stackexchange.com/users/66157",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, I've had a major breakthrough with the multiple loops on the smaller thumbnails and managed to find an an... | 2015/01/25 | [
"https://wordpress.stackexchange.com/questions/175944",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66157/"
] | I'm pretty new to creating my own theme and I seem to have become stuck and would really appreciate it if someone could help me. I have searched and found snippets of advice but nothing that really caters for what I need.
**Problem 1**
The main blog (home) page is causing me problems as I know there must be a better ... | You can do this in one loop without as custom query. A couple of clever functions should get you there
So lets look at a solution. First things first. I would suggest to separate your code completely here for easiness of reading and organisation. Roll back the changes in `content.php` and use this template only for al... |
175,957 | <p>I'm begginer in wordpress (but not begginer in PHP) and I would like to make custom search page as plugin with this url www.example.tld/book-search. It would be simple page for searching books from library system (other database). I want that custom page editable only by editing php file (only way to delete the page... | [
{
"answer_id": 175951,
"author": "Nibbers",
"author_id": 66157,
"author_profile": "https://wordpress.stackexchange.com/users/66157",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, I've had a major breakthrough with the multiple loops on the smaller thumbnails and managed to find an an... | 2015/01/25 | [
"https://wordpress.stackexchange.com/questions/175957",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66560/"
] | I'm begginer in wordpress (but not begginer in PHP) and I would like to make custom search page as plugin with this url www.example.tld/book-search. It would be simple page for searching books from library system (other database). I want that custom page editable only by editing php file (only way to delete the page is... | You can do this in one loop without as custom query. A couple of clever functions should get you there
So lets look at a solution. First things first. I would suggest to separate your code completely here for easiness of reading and organisation. Roll back the changes in `content.php` and use this template only for al... |
175,987 | <p>So there are a million snippets for how to get pages as parents of custom post types.</p>
<p>However, the reverse seems to be questionable. One would think, since everything in WordPress is technically a "post", this would be trivial. However, it is not.</p>
<p>Thus far, I have:</p>
<pre><code>add_filter( 'page_a... | [
{
"answer_id": 176005,
"author": "TTech IT Solutions",
"author_id": 60515,
"author_profile": "https://wordpress.stackexchange.com/users/60515",
"pm_score": -1,
"selected": false,
"text": "<pre><code> add_action('admin_menu', function() { remove_meta_box('pageparentdiv', 'chapter', 'norm... | 2015/01/26 | [
"https://wordpress.stackexchange.com/questions/175987",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/56562/"
] | So there are a million snippets for how to get pages as parents of custom post types.
However, the reverse seems to be questionable. One would think, since everything in WordPress is technically a "post", this would be trivial. However, it is not.
Thus far, I have:
```
add_filter( 'page_attributes_dropdown_pages_arg... | WordPress uses a set of rewrite rules to be able to convert an url into a database query.
The regex that handle urls for pages is very general, IIRC it is something like `(.+.?)/?`, it mathes pratically everything has not be already matched by other rules.
For this reason is not possible to write a rewrite rule that ... |
176,075 | <p>I'm building a stripe plugin and I'm stuck on this minor major issue.</p>
<p>Problem: the form calls my process.php page to grab the form input variables, handle the Stripe token, and finally call out to Stripe to build a new customer based on all params being completed successfully. Once this sheet is called the w... | [
{
"answer_id": 176079,
"author": "tao",
"author_id": 45169,
"author_profile": "https://wordpress.stackexchange.com/users/45169",
"pm_score": 0,
"selected": false,
"text": "<p>You can achieve what you want using ajax, which, in WordPress, is handled by <code>admin-ajax.php</code>. It's al... | 2015/01/26 | [
"https://wordpress.stackexchange.com/questions/176075",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66612/"
] | I'm building a stripe plugin and I'm stuck on this minor major issue.
Problem: the form calls my process.php page to grab the form input variables, handle the Stripe token, and finally call out to Stripe to build a new customer based on all params being completed successfully. Once this sheet is called the wp function... | WordPress provides [`wp-admin/admin-post.php`](https://core.trac.wordpress.org/browser/branches/4.1/src/wp-admin/admin-post.php) endpoint to work with form submissions.
You should likely point your form to it, add an identifying action, and use hooks in the file to process submission. |
176,095 | <p>I have a custom post type "news_updates" which I have not given custom tags or categories. I have however created a normal tag (not attached to a custom post type), and assigned it to a particular news_updates single post. The tag shows up in the tag list when viewing the post. </p>
<p>However, while I have permali... | [
{
"answer_id": 176119,
"author": "Leo Caseiro",
"author_id": 52791,
"author_profile": "https://wordpress.stackexchange.com/users/52791",
"pm_score": 1,
"selected": false,
"text": "<p>Try give a name for your rewrite, like so:</p>\n\n<pre><code>'rewrite' => array(\n 'slug' =&g... | 2015/01/26 | [
"https://wordpress.stackexchange.com/questions/176095",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66384/"
] | I have a custom post type "news\_updates" which I have not given custom tags or categories. I have however created a normal tag (not attached to a custom post type), and assigned it to a particular news\_updates single post. The tag shows up in the tag list when viewing the post.
However, while I have permalinks set ... | There was a stray flush\_rewrite\_rules() in my functions.php, commenting it out made everything work properly. From there I just had to include the custom post type's posts in the archives page, a la <http://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/> |
176,100 | <p>im trying to achieve a code to include a file into pages, these pages has a parent page.
so instead of repeating the code of the "if statement" i use this function but doesn't work.
i want any page falls under that parent page includes that test.php file</p>
<pre><code>global $post;
if ($post->post_parent == 974... | [
{
"answer_id": 176119,
"author": "Leo Caseiro",
"author_id": 52791,
"author_profile": "https://wordpress.stackexchange.com/users/52791",
"pm_score": 1,
"selected": false,
"text": "<p>Try give a name for your rewrite, like so:</p>\n\n<pre><code>'rewrite' => array(\n 'slug' =&g... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176100",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62696/"
] | im trying to achieve a code to include a file into pages, these pages has a parent page.
so instead of repeating the code of the "if statement" i use this function but doesn't work.
i want any page falls under that parent page includes that test.php file
```
global $post;
if ($post->post_parent == 974) {
include 'test... | There was a stray flush\_rewrite\_rules() in my functions.php, commenting it out made everything work properly. From there I just had to include the custom post type's posts in the archives page, a la <http://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/> |
176,136 | <p>I want to show a global message for all users in their profile page.
I do not want to edit <code>profile.php</code>
what is the <code>hook</code> to do this?</p>
<p>Basically I want to add a <code>div</code> to show a <code>paragraph</code> below the message div id <code><div id="message" class="updated"></... | [
{
"answer_id": 176190,
"author": "David Gard",
"author_id": 10097,
"author_profile": "https://wordpress.stackexchange.com/users/10097",
"pm_score": 0,
"selected": false,
"text": "<p>Unfortunately this is not possible, there just isn't a hook to use in <code>wp-admin/edit-use.php</code>.<... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176136",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43764/"
] | I want to show a global message for all users in their profile page.
I do not want to edit `profile.php`
what is the `hook` to do this?
Basically I want to add a `div` to show a `paragraph` below the message div id `<div id="message" class="updated">` and above the `<form id="your-profile" novalidate="novalidate" me... | add this code to your function.php
```
<?php
function showMessage($message, $errormsg = false)
{
if ($errormsg) {
echo '<div id="message" class="error">';
}
else {
echo '<div id="message" class="updated fade">';
}
echo "<p><strong>$message</strong></p></div>";
}
function showAdmin... |
176,140 | <p>I have a subdirectory multisite setup, it all works fine apart from one small issue...</p>
<p>The sites are setup in the following structure:</p>
<pre><code>http://domain.com/blogs/
http://domain.com/blogs/second/
http://domain.com/blogs/third/
</code></pre>
<p>You can access the admin panels if you use the follo... | [
{
"answer_id": 176190,
"author": "David Gard",
"author_id": 10097,
"author_profile": "https://wordpress.stackexchange.com/users/10097",
"pm_score": 0,
"selected": false,
"text": "<p>Unfortunately this is not possible, there just isn't a hook to use in <code>wp-admin/edit-use.php</code>.<... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176140",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66212/"
] | I have a subdirectory multisite setup, it all works fine apart from one small issue...
The sites are setup in the following structure:
```
http://domain.com/blogs/
http://domain.com/blogs/second/
http://domain.com/blogs/third/
```
You can access the admin panels if you use the following:
```
http://domain.com/blog... | add this code to your function.php
```
<?php
function showMessage($message, $errormsg = false)
{
if ($errormsg) {
echo '<div id="message" class="error">';
}
else {
echo '<div id="message" class="updated fade">';
}
echo "<p><strong>$message</strong></p></div>";
}
function showAdmin... |
176,141 | <p>I want to achieve something like this, I don't know if it is possible and what would be the best way to do it:</p>
<p><img src="https://i.stack.imgur.com/s44NV.jpg" alt="enter image description here"></p>
<p>The way I query the posts is like this:</p>
<pre><code><div class="post">
<?php global $wp_qu... | [
{
"answer_id": 176168,
"author": "David Gard",
"author_id": 10097,
"author_profile": "https://wordpress.stackexchange.com/users/10097",
"pm_score": 2,
"selected": false,
"text": "<h1>Updated Answer</h1>\n<p>After thinking about the comment from @PieterGoosen below I've added a method of ... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176141",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22933/"
] | I want to achieve something like this, I don't know if it is possible and what would be the best way to do it:

The way I query the posts is like this:
```
<div class="post">
<?php global $wp_query;
query_posts( array('post_type' => array( '... | As said in a comment, you can do this in one query. The principle here is to only display the date heading if the post date's month of the previous post does not match that of the previous post
FEW NOTES
---------
Before I start, a few notes:
* **Never** use `query_posts`, except if you really need to break everythi... |
176,158 | <p>I have a multisite installation and I'm working on creating a reporting plugin. One of the things that I would like to do is show the number of sites a user is a member of.</p>
<p>Right now, I'm using something like this in my SQL:</p>
<pre><code>JOIN `wp_usermeta` m ON m.user_id = u.ID AND ( `meta_key` = 'wp_capa... | [
{
"answer_id": 176173,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>You could simply use the <a href=\"http://codex.wordpress.org/Function_Reference/get_blogs_of_user\" rel=\"no... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176158",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62150/"
] | I have a multisite installation and I'm working on creating a reporting plugin. One of the things that I would like to do is show the number of sites a user is a member of.
Right now, I'm using something like this in my SQL:
```
JOIN `wp_usermeta` m ON m.user_id = u.ID AND ( `meta_key` = 'wp_capabilities' OR `meta_ke... | You could simply use the [`get_blogs_of_user()`](http://codex.wordpress.org/Function_Reference/get_blogs_of_user) function:
```
echo count( get_blogs_of_user( $user_ID ) );
```
instead of your custom SQL query. |
176,198 | <p>I want to create a page template that doesn't use footer. Removing <code>get_footer()</code> will not work in this case. Because my theme adds the stylesheets and scrtipts after the footer (before /body) and if I remove <code>get_footer()</code> all the scripts and styles are not loaded which will mess up css stylin... | [
{
"answer_id": 176199,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 3,
"selected": true,
"text": "<p>The correct way to load footer-none.php is:</p>\n\n<pre><code>get_footer(\"none\");\n</code></pre>\n\n<p>Anywa... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176198",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66633/"
] | I want to create a page template that doesn't use footer. Removing `get_footer()` will not work in this case. Because my theme adds the stylesheets and scrtipts after the footer (before /body) and if I remove `get_footer()` all the scripts and styles are not loaded which will mess up css styling on the page.
I tried t... | The correct way to load footer-none.php is:
```
get_footer("none");
```
Anyway, I think it can be better to use `wp_footer()` (required function on any frontend page) directly in the page template file so you don't need to load any empty footer template (assuming you load all required HTML tags in the page template,... |
176,209 | <p>We are using a plugin (<a href="https://github.com/ADeMen/GOOVAIN/" rel="nofollow noreferrer">https://github.com/ADeMen/GOOVAIN/</a>) that is supposed to provide a 'get shortlink' button along with some database updates. </p>
<p>It should look like this.
<img src="https://i.stack.imgur.com/WWBAU.png" alt="shortlink... | [
{
"answer_id": 176199,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 3,
"selected": true,
"text": "<p>The correct way to load footer-none.php is:</p>\n\n<pre><code>get_footer(\"none\");\n</code></pre>\n\n<p>Anywa... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176209",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13183/"
] | We are using a plugin (<https://github.com/ADeMen/GOOVAIN/>) that is supposed to provide a 'get shortlink' button along with some database updates.
It should look like this.

This worked perfectly for a while. We migrated our database and content to a new server. Now... | The correct way to load footer-none.php is:
```
get_footer("none");
```
Anyway, I think it can be better to use `wp_footer()` (required function on any frontend page) directly in the page template file so you don't need to load any empty footer template (assuming you load all required HTML tags in the page template,... |
176,236 | <p>I m trying make a code that list the popular posts by week.
Until now i was able to creat a veiws counter and display the 4 popular
posts.
So what i still need is to make this query more accurate.
I would like get the thumbnails and links and get the most popular
of the week.</p>
<p><strong>Functions.php</str... | [
{
"answer_id": 176248,
"author": "Privateer",
"author_id": 66020,
"author_profile": "https://wordpress.stackexchange.com/users/66020",
"pm_score": 3,
"selected": true,
"text": "<p>Currently, I see no way that you can do that as you have no good reference to pull date based statistics.</p... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176236",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/63593/"
] | I m trying make a code that list the popular posts by week.
Until now i was able to creat a veiws counter and display the 4 popular
posts.
So what i still need is to make this query more accurate.
I would like get the thumbnails and links and get the most popular
of the week.
**Functions.php**
```
remove_action... | Currently, I see no way that you can do that as you have no good reference to pull date based statistics.
**Notice:**
You are storing post views as follows:
```
add_post_meta($postID, $count_key, '0');
```
To be able to grab "Most viewed in period", you would have to do something more complex, probably with an extr... |
176,242 | <p>Lately i m trying improve my SEO, and i found in Google Webmaster Tools that the mains
keywords are 'Comment' & 'Read more' it s a bit frustrating.
How can I say to the search egine dont reference that words!</p>
<p><a href="http://goo.gl/bCWNhB" rel="nofollow">Website</a></p>
<p>Thanks for help!</p>
| [
{
"answer_id": 176261,
"author": "Privateer",
"author_id": 66020,
"author_profile": "https://wordpress.stackexchange.com/users/66020",
"pm_score": 0,
"selected": false,
"text": "<p>If google is showing that, then you should consider getting a solid SEO plugin (or edit your theme) and do ... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176242",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/63593/"
] | Lately i m trying improve my SEO, and i found in Google Webmaster Tools that the mains
keywords are 'Comment' & 'Read more' it s a bit frustrating.
How can I say to the search egine dont reference that words!
[Website](http://goo.gl/bCWNhB)
Thanks for help! | I found a solution to add `rel="nofollow"` to comments. My theme maker gave me this hack that you can add in functions.php (no guarantee it will work for everyone, might depend on your theme):
```
function add_nofollow_to_comments_popup_link() {
return ' rel="nofollow" ';
}
add_filter( 'comments_popup_link_attribu... |
176,243 | <p>This code is going into a sample Plugin I am creating as a test using CPT and print them to a Page. </p>
<p>I have been trying to get print_r() to give me an object. The custom post types are posting - verified. The data is being stored in MySQL - verified. Thus the post type is registering. </p>
<p>Please provide... | [
{
"answer_id": 176244,
"author": "Privateer",
"author_id": 66020,
"author_profile": "https://wordpress.stackexchange.com/users/66020",
"pm_score": 1,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code> $the_query = new WP_Query( array(\n 'post_type' => 'Testimonials'\n ... | 2015/01/27 | [
"https://wordpress.stackexchange.com/questions/176243",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/49678/"
] | This code is going into a sample Plugin I am creating as a test using CPT and print them to a Page.
I have been trying to get print\_r() to give me an object. The custom post types are posting - verified. The data is being stored in MySQL - verified. Thus the post type is registering.
Please provide me with a new s... | Try:
```
$the_query = new WP_Query( array(
'post_type' => 'Testimonials'
) );
```
Looks like you probably just need to change that to :
```
$the_query = new WP_Query(
array( 'post_type' => 'testimonial' )
);
```
You need to use the name you created it with when looking at post\_type |
176,250 | <p>So, I am using this to get the URL:</p>
<pre><code><a href="/category/<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>">
</code></pre>
<p>Which is outputting:</p>
<pre><code>http://example.com/category/whatever%20category/
</code></pre>
<p>instead of:</p>
<p... | [
{
"answer_id": 176253,
"author": "Privateer",
"author_id": 66020,
"author_profile": "https://wordpress.stackexchange.com/users/66020",
"pm_score": 0,
"selected": false,
"text": "<p>Change this:\n echo $category->cat_name</p>\n\n<p>To this:\n echo $category->cat_slug</p>\n\n<p>A be... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176250",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/20926/"
] | So, I am using this to get the URL:
```
<a href="/category/<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>">
```
Which is outputting:
```
http://example.com/category/whatever%20category/
```
instead of:
```
http://example.com/category/whatever-category/
```
How can I mak... | Try this
```
<a href="/category/<?php foreach((get_the_category()) as $category) { echo $category->slug . ' '; } ?>">
```
Hope this helps. |
176,263 | <p>This post is about two things:</p>
<ol>
<li><p>All the results of this query are posting to the header of the Page <em>not</em> on the content area as they should. Do you know of a solution as to why this is happening and the simplest approach to resolve this?</p></li>
<li><p>Can you please critique my query? I wan... | [
{
"answer_id": 176264,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>The main query runs before the template is loaded. WordPress knows what template to load based on the results of t... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176263",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/49678/"
] | This post is about two things:
1. All the results of this query are posting to the header of the Page *not* on the content area as they should. Do you know of a solution as to why this is happening and the simplest approach to resolve this?
2. Can you please critique my query? I want to know everything wrong with it (... | The main query runs before the template is loaded. WordPress knows what template to load based on the results of that query.
If you want to insert an additional query into the content area, either create [a shortcode](http://codex.wordpress.org/Shortcode_API), or add a [filter on `the_content`](http://codex.wordpress.... |
176,311 | <p>I want to remove a widget from page with id '28'. How can I do it? </p>
<p>I have found function for it, but it is private function, so I can't use it.</p>
<p>"wp set sidebars widgets</p>
<p>This function's access is marked as private."</p>
<p><a href="http://codex.wordpress.org/Function_Reference/wp_set_sidebar... | [
{
"answer_id": 176314,
"author": "Layka",
"author_id": 59428,
"author_profile": "https://wordpress.stackexchange.com/users/59428",
"pm_score": 2,
"selected": false,
"text": "<pre><code>function my_theme_sidebars_widgets( $sidebars_widgets ) {\n\nif(is_page(28))\n $sidebars_widgets['si... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176311",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/59428/"
] | I want to remove a widget from page with id '28'. How can I do it?
I have found function for it, but it is private function, so I can't use it.
"wp set sidebars widgets
This function's access is marked as private."
<http://codex.wordpress.org/Function_Reference/wp_set_sidebars_widgets> | ```
function my_theme_sidebars_widgets( $sidebars_widgets ) {
if(is_page(28))
$sidebars_widgets['sidebar-10'][2] = null;
return $sidebars_widgets;
}
add_filter( 'sidebars_widgets', 'my_theme_sidebars_widgets' );
```
ok, I have found a filter for it. I hope this 'null' is fine. |
176,317 | <p>I have found the following piece of code in the <a href="http://ipanelthemes.com/kb/wp-knowledge-base-theme/kb-overview/wp-knowledge-base-theme/" rel="noreferrer">WP Knowledge Base</a> theme in order to show subcategories of a parent category. The problem is that this only works for the first level of hierarchy, so ... | [
{
"answer_id": 176320,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 4,
"selected": true,
"text": "<p>You could use this simple function call which returns either <code>TRUE</code> or <code>FALSE</code> dependi... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176317",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8272/"
] | I have found the following piece of code in the [WP Knowledge Base](http://ipanelthemes.com/kb/wp-knowledge-base-theme/kb-overview/wp-knowledge-base-theme/) theme in order to show subcategories of a parent category. The problem is that this only works for the first level of hierarchy, so I wanted to change the if claus... | You could use this simple function call which returns either `TRUE` or `FALSE` depending on if `$children` is an empty array or not.
```
/**
* Check if given term has child terms
*
* @param Integer $term_id
* @param String $taxonomy
*
* @return Boolean
*/
function category_has_children( $term_id = 0, $taxonomy ... |
176,334 | <p>I have a site which uses <code>post-name</code> permalinks. If I use the built in search I am taken to the url</p>
<pre><code>www.mysite.com/search/searchterm
</code></pre>
<p>I have a form which I am using as a custom search popup built into a page</p>
<pre><code> $url = '/search';
<form id="signup" m... | [
{
"answer_id": 176349,
"author": "mor7ifer",
"author_id": 11740,
"author_profile": "https://wordpress.stackexchange.com/users/11740",
"pm_score": 1,
"selected": false,
"text": "<p>WordPress submits search, by default to <a href=\"http://codex.wordpress.org/Function_Reference/bloginfo\" r... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176334",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51823/"
] | I have a site which uses `post-name` permalinks. If I use the built in search I am taken to the url
```
www.mysite.com/search/searchterm
```
I have a form which I am using as a custom search popup built into a page
```
$url = '/search';
<form id="signup" method="post" action="' . $url . '">
<input ... | WordPress submits search, by default to [`bloginfo( 'wpurl' )`](http://codex.wordpress.org/Function_Reference/bloginfo) with search parameter of `s` set to the search term.. You should be able to do this yourself. You will need to use `GET` on the form and set `name="s"` in your search field.
That said, I agree with t... |
176,345 | <p>I am building sites where I secretly give authoring role capability to visitors by auto-logging them into a generic account; they never see the admin bar, and are prevented from seeing the dashboard (with Remove Dashboard Access plugin). </p>
<p>Everything works fine except I would like to have the site automatical... | [
{
"answer_id": 176353,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>What you are trying to do is not very secure. You have to remember that there is no such thing as logged-... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176345",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14945/"
] | I am building sites where I secretly give authoring role capability to visitors by auto-logging them into a generic account; they never see the admin bar, and are prevented from seeing the dashboard (with Remove Dashboard Access plugin).
Everything works fine except I would like to have the site automatically log out... | One approach can be to log the time a user is logging in at by using:
```
function user_last_login($user_login, $user) {
update_user_meta($user - > ID, 'last_login', time());
}
add_action('wp_login', 'user_last_login', 10, 2);
```
and then checking if the time is passed:
```
add_action('get_header', 'processOnPa... |
176,360 | <p>Here's the scenario, I have a site with thousands of YouTube video posts which are stored in a custom field 'video_url' which is being used in a custom video player.</p>
<p>The custom player I'm using now doesn't take the entire YouTube URL but instead just the video ID. What I need to do is figure out how to grab ... | [
{
"answer_id": 176367,
"author": "deflime",
"author_id": 18907,
"author_profile": "https://wordpress.stackexchange.com/users/18907",
"pm_score": 0,
"selected": false,
"text": "<p>If you have any, even basic experience with PHP, this can be rather straight forward to setup.</p>\n\n<p>Have... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176360",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35798/"
] | Here's the scenario, I have a site with thousands of YouTube video posts which are stored in a custom field 'video\_url' which is being used in a custom video player.
The custom player I'm using now doesn't take the entire YouTube URL but instead just the video ID. What I need to do is figure out how to grab the YouTu... | Credits to Chandan Chaudhary <https://gist.github.com/ckchaudhary/8629242#file-get-youtube-video-id-from-url>
Add the following to the functions.php file.
```
function extractUTubeVidId($url){
/*
* type1: http://www.youtube.com/watch?v=9Jr6OtgiOIw
* type2: http://www.youtube.com/watch?v=9Jr6OtgiOIw&featur... |
176,373 | <p>I'm working on custom plugin that will pull property information from our non-wordpress database. That is working just fine. Where I'm having problems is getting the whole front end piece to work. </p>
<p>I have my plugin setup with a custom post type called property (url: <a href="http://localhost/property" re... | [
{
"answer_id": 176376,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>And there is your issue — WordPress <em>does</em> need to understand URL. Otherwise it is indeed 404 because it doe... | 2015/01/28 | [
"https://wordpress.stackexchange.com/questions/176373",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66727/"
] | I'm working on custom plugin that will pull property information from our non-wordpress database. That is working just fine. Where I'm having problems is getting the whole front end piece to work.
I have my plugin setup with a custom post type called property (url: <http://localhost/property>). On the archive-propert... | And there is your issue — WordPress *does* need to understand URL. Otherwise it is indeed 404 because it doesn't correspond to anything WP “knows”.
You need to create that understanding, for example by using [Rewrite API](http://codex.wordpress.org/Rewrite_API). Also since your data is external and isn't really a part... |
176,392 | <pre><code>$args = array( 'numberposts' => '10', 'post_type' => 'newposttype');
$recent_posts = wp_get_recent_posts( $args );
</code></pre>
<p>I know it's not a simple thing to ask but how could I set the numberposts depending on the screen width?</p>
<p>That is: for a desktop visitor I show 10 posts and for a ... | [
{
"answer_id": 176396,
"author": "jetlej",
"author_id": 9862,
"author_profile": "https://wordpress.stackexchange.com/users/9862",
"pm_score": 2,
"selected": false,
"text": "<p>There is no way to determine the screen size with PHP (which you would need to do in order to alter that variabl... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66240/"
] | ```
$args = array( 'numberposts' => '10', 'post_type' => 'newposttype');
$recent_posts = wp_get_recent_posts( $args );
```
I know it's not a simple thing to ask but how could I set the numberposts depending on the screen width?
That is: for a desktop visitor I show 10 posts and for a mobile visitor I show 3 posts. | Yes, there is no way to get screen size with PHP, because it runs on *server*, while the screen is something related to client (browser).
However, in OP you say:
>
> for a **desktop** visitor I show 10 posts and for a **mobile** visitor I show 3 posts
>
>
>
and even if you can't get the screen size, you can unde... |
176,408 | <p>How can I completely disable the limit on feed items in my RSS feed that WordPress generates? I know you can modify the limit but I want to programmatically disable the limit completely.</p>
| [
{
"answer_id": 176409,
"author": "Shreyo Gi",
"author_id": 65741,
"author_profile": "https://wordpress.stackexchange.com/users/65741",
"pm_score": -1,
"selected": false,
"text": "<p>This is a sample of generating RSS in a template style. </p>\n\n<pre><code><?php \n/* \nTemplate Name: ... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176408",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5844/"
] | How can I completely disable the limit on feed items in my RSS feed that WordPress generates? I know you can modify the limit but I want to programmatically disable the limit completely. | Right now, as [wp-includes/feed-rss2.php](http://core.svn.wordpress.org/trunk/wp-includes/feed-rss2.php) is written, there are no ways of doing such thing by using a feed-page-specific hook or filter, so you have to either:
1. Edit this file manually (which will be broken after every update)
2. Make a page template wi... |
176,465 | <p>I am running Linux CentOS 5.8 and I have my web pages using WordPress 4.0. </p>
<p>I am trying to uplad jpg photos to server via WordPress, but it randomly fails. I uploaded few photos, and then I get errors like: </p>
<pre><code>“4.JPG” has failed to upload due to an error
The uploaded file was only partially upl... | [
{
"answer_id": 198806,
"author": "user77871",
"author_id": 77871,
"author_profile": "https://wordpress.stackexchange.com/users/77871",
"pm_score": 0,
"selected": false,
"text": "<p>I ran into the same problem and tried doing a google search and came up with so many technical suggestions ... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176465",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64066/"
] | I am running Linux CentOS 5.8 and I have my web pages using WordPress 4.0.
I am trying to uplad jpg photos to server via WordPress, but it randomly fails. I uploaded few photos, and then I get errors like:
```
“4.JPG” has failed to upload due to an error
The uploaded file was only partially uploaded.
```
Then I t... | I managed to resolve this problem with changing Apache server configuration: there is a KeepAlive flag which needs to be turned Off.
More about this flag:
[Apache Optimization: KeepAlive On or Off?](https://abdussamad.com/archives/169-Apache-optimization:-KeepAlive-On-or-Off.html) |
176,481 | <p>I set up an OAuth client for WP-API following the instructions for <a href="https://github.com/WP-API/OAuth1/blob/master/docs/spec.md" rel="nofollow">WP-API/OAuth1 on github</a>. </p>
<p>I was disappointed to realise afterwards that all of the site's content remains available over the API, including all sorts of no... | [
{
"answer_id": 176482,
"author": "djb",
"author_id": 7905,
"author_profile": "https://wordpress.stackexchange.com/users/7905",
"pm_score": 2,
"selected": false,
"text": "<p>This is how I did it, but I feel it could be better. For one thing, this results in HTTP 500... 403 would be prefer... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176481",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7905/"
] | I set up an OAuth client for WP-API following the instructions for [WP-API/OAuth1 on github](https://github.com/WP-API/OAuth1/blob/master/docs/spec.md).
I was disappointed to realise afterwards that all of the site's content remains available over the API, including all sorts of not-really-public metadata like user r... | This is how I did it, but I feel it could be better. For one thing, this results in HTTP 500... 403 would be preferable
```
add_filter( 'json_authentication_errors', function( $authenticated ) {
if( !$authenticated ) {
return new WP_Error('Access Denied');
}
}, 99 );
```
(I understand this'll work fo... |
176,487 | <p>Let's say I want to create a new admin panel for WordPress. Which should be separate from the one we have now. How do you think I should start?</p>
<p>I want to build /wp-admin/ from scratch for administrators.
Which means, the new admin panel should have everything /wp-admin/ has.
Why need to build a new panel? ... | [
{
"answer_id": 176569,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 3,
"selected": true,
"text": "<p>In fact, the <strong><a href=\"http://wp-api.org/\" rel=\"nofollow\">WP API</a></strong> (also named <em>WP REST AP... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176487",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43555/"
] | Let's say I want to create a new admin panel for WordPress. Which should be separate from the one we have now. How do you think I should start?
I want to build /wp-admin/ from scratch for administrators.
Which means, the new admin panel should have everything /wp-admin/ has.
Why need to build a new panel? Because th... | In fact, the **[WP API](http://wp-api.org/)** (also named *WP REST API* or *WP JSON API* aims for that (aside from other goals). You can find the project in the [repo](https://wordpress.org/plugins/json-api/) and [on GitHub](https://github.com/WP-API/WP-API).
The "API" mainly provides data access and (CRUD actions) vi... |
176,488 | <p>How to add Post Tags inside a new element in header.php?</p>
<p>I'm probably overlooking an obvious function in the WordPress Codex. </p>
<p>I have tried adding these to header.php:</p>
<pre><code><meta name="page-tags" content="<?php the_tags(); ?>">
</code></pre>
<p>=> produces some unwanted html ... | [
{
"answer_id": 176490,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": true,
"text": "<p>Use <code>get_the_tags()</code> instead of <code>the_tags()</code>, <a href=\"http://codex.wordpress... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176488",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/54537/"
] | How to add Post Tags inside a new element in header.php?
I'm probably overlooking an obvious function in the WordPress Codex.
I have tried adding these to header.php:
```
<meta name="page-tags" content="<?php the_tags(); ?>">
```
=> produces some unwanted html (I do not want to change core in the wp-includes fold... | Use `get_the_tags()` instead of `the_tags()`, [`get_the_tags()`](http://codex.wordpress.org/Function_Reference/get_the_tags) does the following for you:
>
> Returns an array of objects, one object for each tag assigned to the post.
>
>
>
with which you can work with to achieve what you want. See the [examples](ht... |
176,503 | <p>I can't seem to figure out how to include tags in a wordpress search. For example, if I search for 'apple', I would like to get back posts with 'apple' in the title or the content (default wordpress functionality) <strong>as well as</strong> posts that contain the tag 'apple'; When I add the <code>'tag' => $keywo... | [
{
"answer_id": 176490,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": true,
"text": "<p>Use <code>get_the_tags()</code> instead of <code>the_tags()</code>, <a href=\"http://codex.wordpress... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176503",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51823/"
] | I can't seem to figure out how to include tags in a wordpress search. For example, if I search for 'apple', I would like to get back posts with 'apple' in the title or the content (default wordpress functionality) **as well as** posts that contain the tag 'apple'; When I add the `'tag' => $keyword` line into WP\_query ... | Use `get_the_tags()` instead of `the_tags()`, [`get_the_tags()`](http://codex.wordpress.org/Function_Reference/get_the_tags) does the following for you:
>
> Returns an array of objects, one object for each tag assigned to the post.
>
>
>
with which you can work with to achieve what you want. See the [examples](ht... |
176,506 | <p>I have the following code from a template to view get the post information:</p>
<pre><code><?php
$args = array(
'post_type' => 'post',
'posts_per_page' => $count,
'paged' => $paged,
);
$wp_query = new WP_Query( $args );
?>
<?php if ( $wp_query->have_posts() ) : ?>... | [
{
"answer_id": 176511,
"author": "Jason Hoffmann",
"author_id": 30668,
"author_profile": "https://wordpress.stackexchange.com/users/30668",
"pm_score": 0,
"selected": false,
"text": "<p>Slight error in your code. Once you've begun your loop (which you do after setting <code>$wp_query->... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176506",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13472/"
] | I have the following code from a template to view get the post information:
```
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => $count,
'paged' => $paged,
);
$wp_query = new WP_Query( $args );
?>
<?php if ( $wp_query->have_posts() ) : ?>
<?php while ( $wp_query->have_pos... | First of all, don't use and abuse the `$wp_query` global variable. This global should be reserved to the main query only. Use any other variable that will not create conflict.
Secondly, don't use the raw [`WP_Post` properties](http://codex.wordpress.org/Class_Reference/WP_Post). These are raw and unfiltered. `WP_Query... |
176,514 | <p>I am using <strong>WordPress v.4.1</strong> and all the plugins and the theme are up to date.</p>
<p>I see in my log files too many of these...</p>
<pre><code>xxx.xxx.xxx.xxx - - [02/Jan/2015:13:30:27 +0200] "POST /wp-cron.php?doing_wp_cron=1420198227.5184459686279296875000 HTTP/1.0" 200 - "-" "WordPress/217; http... | [
{
"answer_id": 176523,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p>In <code>wp-includes/default-filters.php</code> we can find a callback registration:</p>\n\n<pre><code>// WP Cron\nif ... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176514",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45047/"
] | I am using **WordPress v.4.1** and all the plugins and the theme are up to date.
I see in my log files too many of these...
```
xxx.xxx.xxx.xxx - - [02/Jan/2015:13:30:27 +0200] "POST /wp-cron.php?doing_wp_cron=1420198227.5184459686279296875000 HTTP/1.0" 200 - "-" "WordPress/217; http://www.example.com"
```
where **... | In `wp-includes/default-filters.php` we can find a callback registration:
```
// WP Cron
if ( !defined( 'DOING_CRON' ) )
add_action( 'init', 'wp_cron' );
```
If we go the function `wp_cron()` now, we see this:
```
$schedules = wp_get_schedules();
foreach ( $crons as $timestamp => $cronhooks ) {
if ( $timest... |
176,525 | <p>I was wondering how I can style different post formats differently on the home page.</p>
<p>I set up all the formats and grabbed this code from a tutorial website, that displays all the different formats on the page:</p>
<p>index.php </p>
<pre><code><?php
get_header();
?>
<?php if ( have_posts() ) : ?>... | [
{
"answer_id": 183077,
"author": "lynxtdc",
"author_id": 70055,
"author_profile": "https://wordpress.stackexchange.com/users/70055",
"pm_score": 1,
"selected": false,
"text": "<p>I've had the same problem and found it was due to the upload file size set for the server (in my case 2mb). ... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176525",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66781/"
] | I was wondering how I can style different post formats differently on the home page.
I set up all the formats and grabbed this code from a tutorial website, that displays all the different formats on the page:
index.php
```
<?php
get_header();
?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts(... | I've had the same problem and found it was due to the upload file size set for the server (in my case 2mb). There is another setting which escapes me at this point, but is basically a limit on the amount of space that can be used to process uploaded images...which WordPress does when it re-sizes the images on upload. U... |
176,534 | <p>I'm using custom post types and listing them in single-[customposttype].php?type=example</p>
<pre><code><?php if (have_posts()) : while(have_posts()) : the_post();the_content(); endwhile; endif; ?>
</code></pre>
<p>Now I have 2 different custom post type "customtype1" and "customtype2". "customtype1" is top... | [
{
"answer_id": 183077,
"author": "lynxtdc",
"author_id": 70055,
"author_profile": "https://wordpress.stackexchange.com/users/70055",
"pm_score": 1,
"selected": false,
"text": "<p>I've had the same problem and found it was due to the upload file size set for the server (in my case 2mb). ... | 2015/01/29 | [
"https://wordpress.stackexchange.com/questions/176534",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66786/"
] | I'm using custom post types and listing them in single-[customposttype].php?type=example
```
<?php if (have_posts()) : while(have_posts()) : the_post();the_content(); endwhile; endif; ?>
```
Now I have 2 different custom post type "customtype1" and "customtype2". "customtype1" is top category for "customtype2". Whe... | I've had the same problem and found it was due to the upload file size set for the server (in my case 2mb). There is another setting which escapes me at this point, but is basically a limit on the amount of space that can be used to process uploaded images...which WordPress does when it re-sizes the images on upload. U... |
176,565 | <p>What I need basically is to display child pages on a parent. But I want to split the list of childs to, lets say, 'important' and 'non-important' to display it at the beginning and at the end of a parent page.</p>
<p>I turned on TAGs for pages in function.php like:</p>
<pre><code>function tags_support_all() {
... | [
{
"answer_id": 176570,
"author": "Pieter Goosen",
"author_id": 31545,
"author_profile": "https://wordpress.stackexchange.com/users/31545",
"pm_score": 0,
"selected": false,
"text": "<p>You'll have to drop all page related functions if you need this type of functionality. Pages was never ... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176565",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66808/"
] | What I need basically is to display child pages on a parent. But I want to split the list of childs to, lets say, 'important' and 'non-important' to display it at the beginning and at the end of a parent page.
I turned on TAGs for pages in function.php like:
```
function tags_support_all() {
register_taxonomy_for... | Thanks @PieterGoosen and @realloc.
I came up with this solution:
Added `meta_key=important&meta_value=1` in `wp_list_pages()`.
And gonna use custom field for pages `important: 1`.
This is for list of IMPORTANT child pages.
```
function important_list_child_pages() {
global $post;
if ( is_page() && $post->post_par... |
176,573 | <p>I am using wp_get_archive() in category.php.</p>
<p>If I am on page of category=2 it should show my archives of only that category. However it is for all the categories.
Following is the code for my category.php as well as archive.php</p>
<pre><code><?php get_header(); ?>
<?php
$args =array( ... | [
{
"answer_id": 176631,
"author": "Pieter Goosen",
"author_id": 31545,
"author_profile": "https://wordpress.stackexchange.com/users/31545",
"pm_score": 3,
"selected": true,
"text": "<p>Before I start again, I just want to reinforce the fact you should not run a custom query in place of th... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176573",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62640/"
] | I am using wp\_get\_archive() in category.php.
If I am on page of category=2 it should show my archives of only that category. However it is for all the categories.
Following is the code for my category.php as well as archive.php
```
<?php get_header(); ?>
<?php
$args =array(
'post... | Before I start again, I just want to reinforce the fact you should not run a custom query in place of the main query on your archive pages. Please see [this post](https://wordpress.stackexchange.com/a/155976/31545) to learn when you should use a custom query and where not. I you do not switch back to the default loop, ... |
176,585 | <p>I want to output the sub category details of a taxonomy</p>
<pre><code>$getTerms = get_terms($taxonomy, $args);
print_r($getTerms);
</code></pre>
<p>When i print the above out it returns the object. But theres no value difference between parent and sub categories. The first is a parent taxonomy and the second is a... | [
{
"answer_id": 176589,
"author": "Duane",
"author_id": 13077,
"author_profile": "https://wordpress.stackexchange.com/users/13077",
"pm_score": 3,
"selected": true,
"text": "<p>You can use the <code>parent</code> argument in <code>get_terms()</code> to get direct children of a term.\nYou ... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176585",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31315/"
] | I want to output the sub category details of a taxonomy
```
$getTerms = get_terms($taxonomy, $args);
print_r($getTerms);
```
When i print the above out it returns the object. But theres no value difference between parent and sub categories. The first is a parent taxonomy and the second is a sub-category.
```
[1] =>... | You can use the `parent` argument in `get_terms()` to get direct children of a term.
You can use the `child_of` argument to get all descendents of a term.
Something like this.
```
$parent_id = 32;
$args = array(
'parent' => $parent_id
);
$terms = get_terms( $taxonomy, $args );
print_r( $terms );
```
If you w... |
176,593 | <p>I am using owl carosel which takes a hash url to go to a specific slide (<a href="http://www.owlcarousel.owlgraphic.com/demos/urlhashnav.html#five" rel="nofollow">http://www.owlcarousel.owlgraphic.com/demos/urlhashnav.html#five</a>)</p>
<p>Lets say I want to visit a password protected page with the slider there (si... | [
{
"answer_id": 176589,
"author": "Duane",
"author_id": 13077,
"author_profile": "https://wordpress.stackexchange.com/users/13077",
"pm_score": 3,
"selected": true,
"text": "<p>You can use the <code>parent</code> argument in <code>get_terms()</code> to get direct children of a term.\nYou ... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176593",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16318/"
] | I am using owl carosel which takes a hash url to go to a specific slide (<http://www.owlcarousel.owlgraphic.com/demos/urlhashnav.html#five>)
Lets say I want to visit a password protected page with the slider there (site.com/page#slideone)
When I visit the page I am asked for a password, upon entering it, the hash at ... | You can use the `parent` argument in `get_terms()` to get direct children of a term.
You can use the `child_of` argument to get all descendents of a term.
Something like this.
```
$parent_id = 32;
$args = array(
'parent' => $parent_id
);
$terms = get_terms( $taxonomy, $args );
print_r( $terms );
```
If you w... |
176,595 | <p>My reason for doing this is for a music & entertainment site where users will have the ability to share music and videos on other websites via embed code. I'm using the audio.php and video.php attachment pages to load the default MediaElement.js HTML5 Player with all the attached media from it's parent post. I t... | [
{
"answer_id": 176600,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>Some ideas for your attachments file:</p>\n\n<h2>A simplification:</h2>\n\n<pre><code>$tmp = $post; ... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176595",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35798/"
] | My reason for doing this is for a music & entertainment site where users will have the ability to share music and videos on other websites via embed code. I'm using the audio.php and video.php attachment pages to load the default MediaElement.js HTML5 Player with all the attached media from it's parent post. I then lin... | Some ideas for your attachments file:
A simplification:
-----------------
```
$tmp = $post; // Store the current global post object
$post = get_post( $post->post_parent ); // Use the post parent post object
$media = get_attached_media( 'audio' );
if( $media )
{
$sc = "[audio]";
if(... |
176,598 | <p>I use a betnami hosted wordpress multisite, when a user sign up in the site he should receive an email with activation link, but it does not work! so how to make it work? and if it work how to customize the email that the user receive.</p>
<p>Best Regards</p>
| [
{
"answer_id": 176601,
"author": "user3630842",
"author_id": 52191,
"author_profile": "https://wordpress.stackexchange.com/users/52191",
"pm_score": 0,
"selected": false,
"text": "<p>If that is a share hosting account then you are most likely facing a wait time on PHP's mail() functional... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176598",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66819/"
] | I use a betnami hosted wordpress multisite, when a user sign up in the site he should receive an email with activation link, but it does not work! so how to make it work? and if it work how to customize the email that the user receive.
Best Regards | You have to check if PHP mail is working in your server or debug WP's mail, there are several ways to do this, I would first test if a basic PHP mail function works.
The is as simple as running this from a PHP file or the command line:
```
mail ('your@email.com', "Test", "Test mail from wordpress");
```
Find out w... |
176,623 | <p>I recently moved a parent category and its children from the default categories taxonomy to a new custom taxonomy. The data moved over just fine and posts are properly associated with the company name in the the new company taxonomy.</p>
<p><strong>Before</strong></p>
<ul>
<li>Taxonomy: Category</li>
<li>Term: Com... | [
{
"answer_id": 176624,
"author": "Stephen S.",
"author_id": 5019,
"author_profile": "https://wordpress.stackexchange.com/users/5019",
"pm_score": 1,
"selected": false,
"text": "<p><strong>First Assumption: That an extra slash was being added for some reason</strong></p>\n\n<p>To see what... | 2015/01/30 | [
"https://wordpress.stackexchange.com/questions/176623",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5019/"
] | I recently moved a parent category and its children from the default categories taxonomy to a new custom taxonomy. The data moved over just fine and posts are properly associated with the company name in the the new company taxonomy.
**Before**
* Taxonomy: Category
* Term: Company
* Child Term: Mozilla
**After**
* ... | **First Assumption: That an extra slash was being added for some reason**
To see what was going on, I wanted to see what was going on in the array. When I `print_r()` the array I get the following:
```
Array (
[10] => stdClass Object (
[term_id] => 10
[name] => Mozilla
[slu... |
176,644 | <p>My posts table is about 600K, and I don't consider this big at all. Anyway wp_insert_post is becoming very slow. I am trying to import a huge list of hotel information into Posts. The list is about 1500K big. Inserting posts starts nicely with 200-400 posts per second but it dramatically drops down to abt 20-10 post... | [
{
"answer_id": 206078,
"author": "BA_Webimax",
"author_id": 44566,
"author_profile": "https://wordpress.stackexchange.com/users/44566",
"pm_score": 2,
"selected": false,
"text": "<p>Try modifying the database to improve the lookup speed of the post_name field...</p>\n\n<pre><code>ALTER T... | 2015/01/31 | [
"https://wordpress.stackexchange.com/questions/176644",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64704/"
] | My posts table is about 600K, and I don't consider this big at all. Anyway wp\_insert\_post is becoming very slow. I am trying to import a huge list of hotel information into Posts. The list is about 1500K big. Inserting posts starts nicely with 200-400 posts per second but it dramatically drops down to abt 20-10 posts... | you should revers the code you should add this befor the import
```
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
```
don't set it false and after the import you set it true you must do the oppsite thing
i had the same issue to insert 50 posts it took about 7 mintues after i added this cod... |
176,647 | <p>I've been struggling with this question for a while and although there's some information regarding this subject I'm not sure how to implement it. My question regards sharing the current page.</p>
<p>I am using <code><script type="text/javascript" charset="utf-8" >var bShareOpt = {url: "<?php echo get_perm... | [
{
"answer_id": 176787,
"author": "Adal",
"author_id": 16644,
"author_profile": "https://wordpress.stackexchange.com/users/16644",
"pm_score": 1,
"selected": false,
"text": "<p>Since you are calling <a href=\"http://codex.wordpress.org/Function_Reference/get_permalink\" rel=\"nofollow nor... | 2015/01/31 | [
"https://wordpress.stackexchange.com/questions/176647",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66835/"
] | I've been struggling with this question for a while and although there's some information regarding this subject I'm not sure how to implement it. My question regards sharing the current page.
I am using `<script type="text/javascript" charset="utf-8" >var bShareOpt = {url: "<?php echo get_permalink(); ?>"};</script>`... | Since you are calling [get\_permalink()](http://codex.wordpress.org/Function_Reference/get_permalink) outside of the loop, you need to define the post $id parameter.
You can [access the post ID outside of the loop](https://wordpress.stackexchange.com/questions/161711/how-to-get-current-page-id-outside-the-loop) by inv... |
176,687 | <p>I have set up some shortcodes to make things simpler for the user. It wraps up some bootstrap markup and just lets you put the <code>h1</code>, some <code>img</code> urls, etc in it without getting too close to the markup.</p>
<p>What I originally wanted was to let the user upload the image through the media librar... | [
{
"answer_id": 176787,
"author": "Adal",
"author_id": 16644,
"author_profile": "https://wordpress.stackexchange.com/users/16644",
"pm_score": 1,
"selected": false,
"text": "<p>Since you are calling <a href=\"http://codex.wordpress.org/Function_Reference/get_permalink\" rel=\"nofollow nor... | 2015/01/31 | [
"https://wordpress.stackexchange.com/questions/176687",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/60500/"
] | I have set up some shortcodes to make things simpler for the user. It wraps up some bootstrap markup and just lets you put the `h1`, some `img` urls, etc in it without getting too close to the markup.
What I originally wanted was to let the user upload the image through the media library and then grab the image url fo... | Since you are calling [get\_permalink()](http://codex.wordpress.org/Function_Reference/get_permalink) outside of the loop, you need to define the post $id parameter.
You can [access the post ID outside of the loop](https://wordpress.stackexchange.com/questions/161711/how-to-get-current-page-id-outside-the-loop) by inv... |
176,693 | <p>I have a site with a page where there's one form in the sidebar, and one in the main body of the page. The sidebar comes first in the HTML.</p>
<p>Both forms have their own nonces (generated with <code>wp_nonce_field</code>) with different $action and $name parameters. The $referrer fields are on.</p>
<p>When I s... | [
{
"answer_id": 176787,
"author": "Adal",
"author_id": 16644,
"author_profile": "https://wordpress.stackexchange.com/users/16644",
"pm_score": 1,
"selected": false,
"text": "<p>Since you are calling <a href=\"http://codex.wordpress.org/Function_Reference/get_permalink\" rel=\"nofollow nor... | 2015/01/31 | [
"https://wordpress.stackexchange.com/questions/176693",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42868/"
] | I have a site with a page where there's one form in the sidebar, and one in the main body of the page. The sidebar comes first in the HTML.
Both forms have their own nonces (generated with `wp_nonce_field`) with different $action and $name parameters. The $referrer fields are on.
When I submit the second form, I get ... | Since you are calling [get\_permalink()](http://codex.wordpress.org/Function_Reference/get_permalink) outside of the loop, you need to define the post $id parameter.
You can [access the post ID outside of the loop](https://wordpress.stackexchange.com/questions/161711/how-to-get-current-page-id-outside-the-loop) by inv... |
176,725 | <p>Is there a better way to get the category ID that may or may not have any posts assigned to it?</p>
<p>Currently im using the following code that resorts to parsing the page url, and getting the category ID from its slug. Doesn't feel like the best way to do it.</p>
<pre><code>$current_url = rtrim($_SERVER["HTTP_H... | [
{
"answer_id": 176712,
"author": "Reigel Gallarde",
"author_id": 974,
"author_profile": "https://wordpress.stackexchange.com/users/974",
"pm_score": 1,
"selected": false,
"text": "<p>It is:</p>\n\n<pre><code>wp.template( templateName )\n</code></pre>\n\n<p>I can't find it in Codex and co... | 2015/02/01 | [
"https://wordpress.stackexchange.com/questions/176725",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62160/"
] | Is there a better way to get the category ID that may or may not have any posts assigned to it?
Currently im using the following code that resorts to parsing the page url, and getting the category ID from its slug. Doesn't feel like the best way to do it.
```
$current_url = rtrim($_SERVER["HTTP_HOST"] . $_SERVER["REQ... | I believe what you are looking or are short codes.
Check the codex for more details on them:
* [Shortcode API](http://codex.wordpress.org/Shortcode_API%20Shortcode%20API)
* [Builtin Short Codes and Overview](http://codex.wordpress.org/Shortcode)
Hopefully that gets you going. |
176,733 | <p>I'm trying to create two custom post status'. I used the Codex to generate the code and that didn't work. Then I went to <a href="http://generatewp.com/post-status" rel="noreferrer">http://generatewp.com/post-status</a> and it didn't work either. It isn't showing up in the dropdown next to "Status" in "Edit Post".</... | [
{
"answer_id": 176735,
"author": "Privateer",
"author_id": 66020,
"author_profile": "https://wordpress.stackexchange.com/users/66020",
"pm_score": 0,
"selected": false,
"text": "<p>I'd change the priority on add_action to 1 and see if that fixes things.</p>\n\n<p>To the best of my knowle... | 2015/02/01 | [
"https://wordpress.stackexchange.com/questions/176733",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66878/"
] | I'm trying to create two custom post status'. I used the Codex to generate the code and that didn't work. Then I went to <http://generatewp.com/post-status> and it didn't work either. It isn't showing up in the dropdown next to "Status" in "Edit Post".
Do you see anything wrong with my code?
```
// ***** http://gener... | The *post status* values seems to be hardcoded in the core. [Here's the status box code](https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/meta-boxes.php#L68) for the edit screen:
```
<span id="post-status-display">
<?php
switch ( $post->post_status ) {
case 'private':
_e('Pr... |
176,766 | <p>I'm trying to upload an attachment using the "Add Media" button placed right above the editor.</p>
<p>The request goes to the <a href="https://core.trac.wordpress.org/browser/tags/4.1/src/wp-admin/async-upload.php" rel="nofollow"><code>wp-admin/async-upload.php</code></a> file.
I can put a <code>var_dump($_REQUEST... | [
{
"answer_id": 176767,
"author": "ᴍᴇʜᴏᴠ",
"author_id": 63414,
"author_profile": "https://wordpress.stackexchange.com/users/63414",
"pm_score": 2,
"selected": false,
"text": "<p>Ok this seems to have fixed it:</p>\n\n<pre><code>function wp_plupload_include_attachment_id( $params ) { \n ... | 2015/02/01 | [
"https://wordpress.stackexchange.com/questions/176766",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/63414/"
] | I'm trying to upload an attachment using the "Add Media" button placed right above the editor.
The request goes to the [`wp-admin/async-upload.php`](https://core.trac.wordpress.org/browser/tags/4.1/src/wp-admin/async-upload.php) file.
I can put a `var_dump($_REQUEST);` call there.
Whenever I upload an attachment for... | Ok this seems to have fixed it:
```
function wp_plupload_include_attachment_id( $params ) {
global $post_ID;
if ( isset( $post_ID ) )
$params['post_id'] = (int) $post_ID;
return $params;
}
add_filter( 'plupload_default_params', 'wp_plupload_include_attachment_id' );
```
This preprocesses t... |
176,804 | <p>The <a href="http://codex.wordpress.org/Function_Reference/get_template_part#Passing_Variables_to_Template">WP Codex says</a> to do this: </p>
<pre><code>// You wish to make $my_var available to the template part at `content-part.php`
set_query_var( 'my_var', $my_var );
get_template_part( 'content', 'part' );
</cod... | [
{
"answer_id": 176807,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 7,
"selected": true,
"text": "<p>As posts get their data set up via <code>the_post()</code> (respectively via <code>setup_postdata()</code>) and are... | 2015/02/02 | [
"https://wordpress.stackexchange.com/questions/176804",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10595/"
] | The [WP Codex says](http://codex.wordpress.org/Function_Reference/get_template_part#Passing_Variables_to_Template) to do this:
```
// You wish to make $my_var available to the template part at `content-part.php`
set_query_var( 'my_var', $my_var );
get_template_part( 'content', 'part' );
```
But how do I `echo $my_v... | As posts get their data set up via `the_post()` (respectively via `setup_postdata()`) and are therefore accessible through the API (`get_the_ID()` for e.g.), let's assume that we are looping through a set of users (as [`setup_userdata()`](http://queryposts.com/function/setup_userdata/) fills the global variables of the... |
176,819 | <p>I need to edit the date of several posts, change it to a specific date, all posts should have the same date.</p>
<p>How can I achieve this? Is there any fuction to add to the functions.php to add this feature?
I cant find a solution. </p>
| [
{
"answer_id": 184927,
"author": "Bamz Springfield",
"author_id": 70486,
"author_profile": "https://wordpress.stackexchange.com/users/70486",
"pm_score": 3,
"selected": true,
"text": "<p>Original source : <a href=\"http://www.quora.com/WordPress-Plugins/How-can-I-bulk-change-post-date\" ... | 2015/02/02 | [
"https://wordpress.stackexchange.com/questions/176819",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/50943/"
] | I need to edit the date of several posts, change it to a specific date, all posts should have the same date.
How can I achieve this? Is there any fuction to add to the functions.php to add this feature?
I cant find a solution. | Original source : [post date](http://www.quora.com/WordPress-Plugins/How-can-I-bulk-change-post-date)
1. Create ***admin-script.js*** at your current theme ( *this use js folder* )
```
jQuery(document).ready(function($){
$('.inline-edit-col-right .inline-edit-col')
.append(
'<label style="mar... |
176,832 | <p>What's an effective way of removing all the meta boxes for a specific post type in Wordpress? </p>
<p>The only solution for removing metaboxes at all that I've found seems to be the <a href="http://codex.wordpress.org/Function_Reference/remove_meta_box" rel="nofollow"><code>remove_meta_box()</code></a> function, wh... | [
{
"answer_id": 176835,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>The source for <code>remove_meta_box()</code> should give you reasonable idea.</p>\n\n<p>The registered boxes are s... | 2015/02/02 | [
"https://wordpress.stackexchange.com/questions/176832",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18635/"
] | What's an effective way of removing all the meta boxes for a specific post type in Wordpress?
The only solution for removing metaboxes at all that I've found seems to be the [`remove_meta_box()`](http://codex.wordpress.org/Function_Reference/remove_meta_box) function, which requires an id of the metabox to be removed... | If you want to *hide* all the metaboxes for all users, you can do that through the `get_user_option_metaboxhidden_{cpt}`, `default_hidden_meta_boxes` or the `hidden_meta_boxes` filter, according to the `/wp-admin/includes/screen.php` file.
Here's an example for the `post` post type:
```
/**
* Hide all metaboxes in t... |
176,870 | <p>I want to find out the latest version of WordPress that is officially released. If possible, I'd like to get that version language specific for at least English and German.</p>
<p>I could try and parse the website <a href="https://wordpress.org/download/" rel="noreferrer">https://wordpress.org/download/</a> but it ... | [
{
"answer_id": 176888,
"author": "Andrew Bartel",
"author_id": 17879,
"author_profile": "https://wordpress.stackexchange.com/users/17879",
"pm_score": 4,
"selected": true,
"text": "<p>WordPress.org offers an <a href=\"http://codex.wordpress.org/WordPress.org_API\" rel=\"noreferrer\">api<... | 2015/02/02 | [
"https://wordpress.stackexchange.com/questions/176870",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66930/"
] | I want to find out the latest version of WordPress that is officially released. If possible, I'd like to get that version language specific for at least English and German.
I could try and parse the website <https://wordpress.org/download/> but it doesn't have the version number in a specific place. I also know I coul... | WordPress.org offers an [api](http://codex.wordpress.org/WordPress.org_API) that includes a [version checker](http://codex.wordpress.org/WordPress.org_API#Version_Check). That version checker can return a json response (or a serialized string if that's your thing).
**Example usage**
```
$url = 'https://api.wordpress.... |
176,882 | <p>After ending The Loop, I simply have:</p>
<pre><code>echo paginate_links(array(
'mid_size' => 3,
'prev_text' => __( 'Previous posts' ),
'next_text' => __( 'Next posts' )
));
</code></pre>
<p>However, pagination is displayed only when the number of pages is greater t... | [
{
"answer_id": 176877,
"author": "Wyck",
"author_id": 1509,
"author_profile": "https://wordpress.stackexchange.com/users/1509",
"pm_score": 1,
"selected": false,
"text": "<p>Typically your opcode cache will detect file changes and update the cache entry, so you need to be more specific w... | 2015/02/02 | [
"https://wordpress.stackexchange.com/questions/176882",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66939/"
] | After ending The Loop, I simply have:
```
echo paginate_links(array(
'mid_size' => 3,
'prev_text' => __( 'Previous posts' ),
'next_text' => __( 'Next posts' )
));
```
However, pagination is displayed only when the number of pages is greater than 1. In other words, if I have 1 ... | Couple different things going on here, but my two cents:
1) Philosophically: if a file may be modified somehow in any of its remote deployment contexts, don't keep it in the repo. Since W3TC keeps its settings in a flat file (and that flat file is updated every time you go into the W3TC settings screen in any context ... |
176,929 | <p>I'm currently working with WPAlchemy class to create a metabox in a custom post type (Events from EventEspresso plugin more precisely). </p>
<p>This metabox should be able to call the media uploader and insert images for some custom metas.</p>
<p>It works pretty well, i'm able to call the media uploader and persis... | [
{
"answer_id": 176983,
"author": "Renato Gomes",
"author_id": 66339,
"author_profile": "https://wordpress.stackexchange.com/users/66339",
"pm_score": 2,
"selected": true,
"text": "<p>I managed to solve it. The problem was in using a custom post-type with <em>Metabox.php / MediaAccess.php... | 2015/02/03 | [
"https://wordpress.stackexchange.com/questions/176929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66339/"
] | I'm currently working with WPAlchemy class to create a metabox in a custom post type (Events from EventEspresso plugin more precisely).
This metabox should be able to call the media uploader and insert images for some custom metas.
It works pretty well, i'm able to call the media uploader and persist data from textf... | I managed to solve it. The problem was in using a custom post-type with *Metabox.php / MediaAccess.php* (both from WPAlchemy class)
Supposedly you can use custom post-types with WPAlchemy since, when instantiating a WPAlchemy\_MetaBox object you can pass some optional parameters to enable that kind of costumization. L... |
176,940 | <p>'<a href="http://codex.wordpress.org/Title_Tag" rel="nofollow">Title-tag</a>' is a theme feature introduced in Version 4.1, and I want to use it as the default title of my theme. This feature should be added on the <code>after_setup_theme</code> or <code>init</code> action. It is recommended <a href="https://make.wo... | [
{
"answer_id": 176952,
"author": "Unix",
"author_id": 37313,
"author_profile": "https://wordpress.stackexchange.com/users/37313",
"pm_score": 2,
"selected": false,
"text": "<p>I've found a solution, so I'm sure it will be useful for others.</p>\n\n<hr>\n\n<h2>First: custom titles</h2>\n\... | 2015/02/03 | [
"https://wordpress.stackexchange.com/questions/176940",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37313/"
] | '[Title-tag](http://codex.wordpress.org/Title_Tag)' is a theme feature introduced in Version 4.1, and I want to use it as the default title of my theme. This feature should be added on the `after_setup_theme` or `init` action. It is recommended [here](https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/). The ... | Your problem is that you can not use `wp_title()` in the theme if the theme already supports `title-tag`. The `<head>` of your theme should look like this:
```
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?>
... |
176,941 | <p>I want to create new networks but am having issues because Wordpress is saying it is invalid. I have a base url of something like <a href="http://website.com" rel="nofollow">http://website.com</a> and then I'm trying to create a new network after that. I'd like my new networks to have a name like:</p>
<p><a href="h... | [
{
"answer_id": 176952,
"author": "Unix",
"author_id": 37313,
"author_profile": "https://wordpress.stackexchange.com/users/37313",
"pm_score": 2,
"selected": false,
"text": "<p>I've found a solution, so I'm sure it will be useful for others.</p>\n\n<hr>\n\n<h2>First: custom titles</h2>\n\... | 2015/02/03 | [
"https://wordpress.stackexchange.com/questions/176941",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13472/"
] | I want to create new networks but am having issues because Wordpress is saying it is invalid. I have a base url of something like <http://website.com> and then I'm trying to create a new network after that. I'd like my new networks to have a name like:
<http://website.com/network1/football/page1>
<http://website.co... | Your problem is that you can not use `wp_title()` in the theme if the theme already supports `title-tag`. The `<head>` of your theme should look like this:
```
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?>
... |
176,964 | <p>I am trying to add some logic to this function of when to alert the admin to a password change but no email is being sent at all. The codex says it needs to be declared in a plugin, so is this legal from a mu plugin or is there only specific locations this can be redeclared?</p>
<p>As it stands this is roughly my c... | [
{
"answer_id": 176971,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>It should work from a mu plugin as well. (The codex is not very accurate, it should also be possible to o... | 2015/02/03 | [
"https://wordpress.stackexchange.com/questions/176964",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35677/"
] | I am trying to add some logic to this function of when to alert the admin to a password change but no email is being sent at all. The codex says it needs to be declared in a plugin, so is this legal from a mu plugin or is there only specific locations this can be redeclared?
As it stands this is roughly my code but th... | Here are the contents of a working example, placed in a php file in `wp-includes/mu-plugins/`. The email is sent when a user completes the password reset action after clicking the reset link in the email they receive.
```
<?php
if( ! function_exists( 'wp_password_change_notification' ) ){
function wp_password_chan... |
176,989 | <p>I have a profile field with checkboxes where users can check their "interests". I'd like to customize the activity feed by scoping it down with a search string including the users interests. Following the search term method here (the example with "nap"):
<a href="http://premium.wpmudev.org/blog/how-to-customize-the-... | [
{
"answer_id": 176971,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>It should work from a mu plugin as well. (The codex is not very accurate, it should also be possible to o... | 2015/02/03 | [
"https://wordpress.stackexchange.com/questions/176989",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/60584/"
] | I have a profile field with checkboxes where users can check their "interests". I'd like to customize the activity feed by scoping it down with a search string including the users interests. Following the search term method here (the example with "nap"):
<http://premium.wpmudev.org/blog/how-to-customize-the-buddypress-... | Here are the contents of a working example, placed in a php file in `wp-includes/mu-plugins/`. The email is sent when a user completes the password reset action after clicking the reset link in the email they receive.
```
<?php
if( ! function_exists( 'wp_password_change_notification' ) ){
function wp_password_chan... |
176,993 | <p>Our old webmaster abandoned us and stopped hosting our website. All he gave us to work with was a zipped folder of the website. It contains the wp-admin, wp-content, and wp-includes folders, index.php, and 26 other php files in the root of the folder. We don't have any access to the server it was installed on, but w... | [
{
"answer_id": 176971,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>It should work from a mu plugin as well. (The codex is not very accurate, it should also be possible to o... | 2015/02/03 | [
"https://wordpress.stackexchange.com/questions/176993",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67007/"
] | Our old webmaster abandoned us and stopped hosting our website. All he gave us to work with was a zipped folder of the website. It contains the wp-admin, wp-content, and wp-includes folders, index.php, and 26 other php files in the root of the folder. We don't have any access to the server it was installed on, but we d... | Here are the contents of a working example, placed in a php file in `wp-includes/mu-plugins/`. The email is sent when a user completes the password reset action after clicking the reset link in the email they receive.
```
<?php
if( ! function_exists( 'wp_password_change_notification' ) ){
function wp_password_chan... |
177,001 | <p>I need to make Wordpress not include jQuery in the <code><head></code> section of every page.
The reason I need this - is because I am already including jQuery at the very bottom of the document.</p>
<p>I tried this: <code>wp_deregister_script('jquery')</code> but it <strong>doesn't work.</strong></p>
<p>Ho... | [
{
"answer_id": 177003,
"author": "czerspalace",
"author_id": 47406,
"author_profile": "https://wordpress.stackexchange.com/users/47406",
"pm_score": 2,
"selected": true,
"text": "<p>the following may work </p>\n\n<pre><code>function wpdocs_dequeue_script() {\n wp_dequeue_script( ... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177001",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62519/"
] | I need to make Wordpress not include jQuery in the `<head>` section of every page.
The reason I need this - is because I am already including jQuery at the very bottom of the document.
I tried this: `wp_deregister_script('jquery')` but it **doesn't work.**
How does one remove jQuery from the `<head>` section? | the following may work
```
function wpdocs_dequeue_script() {
wp_dequeue_script( 'jquery' );
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
``` |
177,007 | <p>I need to disable Wordpress new user registration email confirmation link and auto generated password for new users.</p>
<p>Users should be register with a password of their choice without email confirmation link</p>
| [
{
"answer_id": 177043,
"author": "luukvhoudt",
"author_id": 44637,
"author_profile": "https://wordpress.stackexchange.com/users/44637",
"pm_score": 0,
"selected": false,
"text": "<p>I recommend you to use a plugin for that. Have a look at:</p>\n\n<ul>\n<li><a href=\"https://wordpress.org... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177007",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67017/"
] | I need to disable Wordpress new user registration email confirmation link and auto generated password for new users.
Users should be register with a password of their choice without email confirmation link | I noticed the current answers are plugin based only.
You can use `wpmu_signup_user_notification` to achieve this without installing a plugin.
Add to your `functions.php` - this will disable user signup notifcations completely.
```
add_filter( 'wpmu_signup_user_notification', '__return_false' );
```
You can read m... |
177,013 | <p>I have just started working with custom post types and meta fields/data. I'm able to get the custom post and meta field to appear. It just won't save. I've been staring at the code and reading up endlessly but nothing has jogged for me what is wrong. I would love some fresh eyes on it to see what y'all think. Once I... | [
{
"answer_id": 177022,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 1,
"selected": false,
"text": "<p>Have you noted that you are verifing that the post type is a page and that user can edit pages and posts?</p>... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177013",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67018/"
] | I have just started working with custom post types and meta fields/data. I'm able to get the custom post and meta field to appear. It just won't save. I've been staring at the code and reading up endlessly but nothing has jogged for me what is wrong. I would love some fresh eyes on it to see what y'all think. Once I ha... | Have you noted that you are verifing that the post type is a page and that user can edit pages and posts?
```
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_page', $post_id ) )
return;
} else {
if ( !current_user_can( 'edit_post', $post_id ) )
return;
}
```
It should be:... |
177,056 | <p>I am trying to display shortcode using the following pattern:</p>
<pre><code> class callShortCode {
function __construct() {
global $post;
$this->dos($post);
}
private function dos($post){
global $post;
$pid = get_the_ID();
$archive_id = get_queried_object_id();
if($ar... | [
{
"answer_id": 177053,
"author": "Masiorama",
"author_id": 66842,
"author_profile": "https://wordpress.stackexchange.com/users/66842",
"pm_score": 1,
"selected": false,
"text": "<p>You can replace the broken functions.php file, recovering it from the original theme package.</p>\n\n<p>Fro... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177056",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32989/"
] | I am trying to display shortcode using the following pattern:
```
class callShortCode {
function __construct() {
global $post;
$this->dos($post);
}
private function dos($post){
global $post;
$pid = get_the_ID();
$archive_id = get_queried_object_id();
if($archive_id == $pid) {... | You can replace the broken functions.php file, recovering it from the original theme package.
From the namespace of your error message I can guess that the theme you are using could be this:
<https://wordpress.org/themes/catch-box>
Right?
I hope it helps. |
177,068 | <p>I create ad custom post type <code>register_post_type( 'videos', $args);</code>
and custom taxonomy for that <code>register_taxonomy( 'video_category_categorie', 'videos', $args );</code>
<strong>Maximum number of post displayed is 2 per page. Via word press backend</strong>
in archive-videos. php i write the for... | [
{
"answer_id": 177077,
"author": "luukvhoudt",
"author_id": 44637,
"author_profile": "https://wordpress.stackexchange.com/users/44637",
"pm_score": 1,
"selected": false,
"text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/get_the_date\" rel=\"nofollow\"><code>get_the_... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177068",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/47440/"
] | I create ad custom post type `register_post_type( 'videos', $args);`
and custom taxonomy for that `register_taxonomy( 'video_category_categorie', 'videos', $args );`
**Maximum number of post displayed is 2 per page. Via word press backend**
in archive-videos. php i write the for displaying the post from a specific taxo... | The `post_date` and `post_date_gmt` serves as the date that the post was created. For scheduled posts this will be the date on which the post is scheduled to be published.
There is no reliable native method to determine the date when a scheduled post was added. For scheduled posts, you can try the `post_modified` or `... |
177,070 | <p>I have a custom post type <code>jobs</code> and custom field with key <code>expiry-date</code> which the user enters the date after which the post will no longer be displayed.</p>
<p>Here's my code so far...</p>
<pre><code>$loop = new WP_Query( array(
'post_type' => 'jobs',
'posts_per_pa... | [
{
"answer_id": 177077,
"author": "luukvhoudt",
"author_id": 44637,
"author_profile": "https://wordpress.stackexchange.com/users/44637",
"pm_score": 1,
"selected": false,
"text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/get_the_date\" rel=\"nofollow\"><code>get_the_... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177070",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64117/"
] | I have a custom post type `jobs` and custom field with key `expiry-date` which the user enters the date after which the post will no longer be displayed.
Here's my code so far...
```
$loop = new WP_Query( array(
'post_type' => 'jobs',
'posts_per_page' => -1,
'order' => 'ASC',
... | The `post_date` and `post_date_gmt` serves as the date that the post was created. For scheduled posts this will be the date on which the post is scheduled to be published.
There is no reliable native method to determine the date when a scheduled post was added. For scheduled posts, you can try the `post_modified` or `... |
177,076 | <p>I tried to use a form with the following markup using the action <code>admin-post.php</code></p>
<pre><code><form method='post' action='admin-post.php'>
</code></pre>
<p>I'm using the action hook <a href="http://codex.wordpress.org/Plugin_API/Action_Reference/admin_post_%28action%29" rel="noreferrer">suggest... | [
{
"answer_id": 201905,
"author": "bashleigh",
"author_id": 67929,
"author_profile": "https://wordpress.stackexchange.com/users/67929",
"pm_score": 6,
"selected": true,
"text": "<p>Maybe a little late but I stumbled on this when I was having issues figuring it out so thought I would suppl... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177076",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32147/"
] | I tried to use a form with the following markup using the action `admin-post.php`
```
<form method='post' action='admin-post.php'>
```
I'm using the action hook [suggested by Wordpress](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_post_%28action%29) to proceed the $\_POST parameters and it works fine... | Maybe a little late but I stumbled on this when I was having issues figuring it out so thought I would supply what I found out for future people.
I've found the basic principles are to have a hidden input named `action` and it's value being a custom set identifier. For example
```
<input name='action' type="hidden" ... |
177,081 | <p>This code adds the image before all titles on the page.</p>
<p>How do i add one single image before the posts entry title?</p>
<pre><code>function adt_abovetitle($title){
//Return new title if called inside loop
if ( in_the_loop() ) {
$x = do_shortcode('[shortcode id="'. $id . '"]');
return ... | [
{
"answer_id": 201905,
"author": "bashleigh",
"author_id": 67929,
"author_profile": "https://wordpress.stackexchange.com/users/67929",
"pm_score": 6,
"selected": true,
"text": "<p>Maybe a little late but I stumbled on this when I was having issues figuring it out so thought I would suppl... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177081",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32989/"
] | This code adds the image before all titles on the page.
How do i add one single image before the posts entry title?
```
function adt_abovetitle($title){
//Return new title if called inside loop
if ( in_the_loop() ) {
$x = do_shortcode('[shortcode id="'. $id . '"]');
return $x . $title;
... | Maybe a little late but I stumbled on this when I was having issues figuring it out so thought I would supply what I found out for future people.
I've found the basic principles are to have a hidden input named `action` and it's value being a custom set identifier. For example
```
<input name='action' type="hidden" ... |
177,102 | <p>I'm using <a href="https://wordpress.org/plugins/types/" rel="nofollow noreferrer">Wordpress Types</a> for create and manage Custom Post Types (CPT) at my blog and it works perfectly. I have created a CPT called <em>Espacio Publicitario</em> and I added also some custom fields (see image below). I need to hide <stro... | [
{
"answer_id": 177107,
"author": "61Pixels",
"author_id": 67052,
"author_profile": "https://wordpress.stackexchange.com/users/67052",
"pm_score": 3,
"selected": true,
"text": "<p>There is a built in WordPress function for this, <strong>remove_post_type_support</strong> <a href=\"http://c... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177102",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16412/"
] | I'm using [Wordpress Types](https://wordpress.org/plugins/types/) for create and manage Custom Post Types (CPT) at my blog and it works perfectly. I have created a CPT called *Espacio Publicitario* and I added also some custom fields (see image below). I need to hide **body copy box** since on this CPT is useless, can ... | There is a built in WordPress function for this, **remove\_post\_type\_support** <http://codex.wordpress.org/Function_Reference/remove_post_type_support> .
In your case you could use something like
```
add_action( 'init', 'my_custom_init' );
function my_custom_init() {
remove_post_type_support( 'custom_post_type... |
177,105 | <p>I've a custom widget for ads, it helps me to show ads on sidebar but I'm trying to display it under every single post or on front page near to slider.</p>
<pre><code><?php the_widget( 'AdWidget_300' ); ?>
</code></pre>
<p>How could I call custom widget anywhere I want?</p>
| [
{
"answer_id": 177109,
"author": "luukvhoudt",
"author_id": 44637,
"author_profile": "https://wordpress.stackexchange.com/users/44637",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://codex.wordpress.org/Widgetizing_Themes\" rel=\"nofollow\">Add a widget area</a> to your <... | 2015/02/04 | [
"https://wordpress.stackexchange.com/questions/177105",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/59698/"
] | I've a custom widget for ads, it helps me to show ads on sidebar but I'm trying to display it under every single post or on front page near to slider.
```
<?php the_widget( 'AdWidget_300' ); ?>
```
How could I call custom widget anywhere I want? | [Add a widget area](http://codex.wordpress.org/Widgetizing_Themes) to your `single.php`, `front-page.php`, `home.php` or whatever you want.. template's theme file. Than at the back-end go to Appearance > Widgets and move the widget to the widget area you just created. |
177,157 | <p>I tried to enqueue a custom .js file in my child theme directory.</p>
<p>In the functions.php of my child theme I find the following code</p>
<pre><code>/* After this. you can override Accessible Zen's pluggable functions or add your own.
* Remember, do your best to stay accessible! :)
*
*/
add_action( 'wp_enq... | [
{
"answer_id": 177160,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 6,
"selected": true,
"text": "<p>Here's a working example:</p>\n\n<pre><code>add_action( 'wp_enqueue_scripts', 'menu_scripts' );\nfunction me... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177157",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67074/"
] | I tried to enqueue a custom .js file in my child theme directory.
In the functions.php of my child theme I find the following code
```
/* After this. you can override Accessible Zen's pluggable functions or add your own.
* Remember, do your best to stay accessible! :)
*
*/
add_action( 'wp_enqueue_scripts', 'theme... | Here's a working example:
```
add_action( 'wp_enqueue_scripts', 'menu_scripts' );
function menu_scripts() {
wp_enqueue_script( 'responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script(
'custom-script',
get_stylesheet_directory_uri() .... |
177,162 | <p>I am trying to get post from a category ordered random, but making sure that the author does not repeat itself.</p>
<p>So I have this query which works as intended, but there is the chance that the author will repeat in those 4 posts. So any ideas how I could make sure it doesn't? </p>
<p>I was thinking of using $... | [
{
"answer_id": 177177,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>Out of curiosity, I played around with static SQL queries and this one seemed to work:</p>\n\n<pre><code>SELE... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177162",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/65942/"
] | I am trying to get post from a category ordered random, but making sure that the author does not repeat itself.
So I have this query which works as intended, but there is the chance that the author will repeat in those 4 posts. So any ideas how I could make sure it doesn't?
I was thinking of using $wpdb but I was ho... | With what you are asking, it is really difficult to come up with some performant easy way that is also reliable. As @birgire already stated, his solution is not reliable, but from tests, it seem to be the fastest clocking in at 2 db queries in about 0.015s average.
From a quick discussion between @birgire and me in co... |
177,182 | <p>Trying to learn WP plugin development.</p>
<p>Followed all the instructions.</p>
<p><code>plugins/e4-test-1</code> directory.</p>
<p>Main php file (<code>e4-test-1.php</code>):</p>
<pre><code><?php
/**
* Plugin Name: Test 1
* Plugin URI: http://xxxxx.xxx
* Description: xxxxxxxxxxxxxxxxxx
* Version: 1.0.0
... | [
{
"answer_id": 177188,
"author": "Interactive",
"author_id": 52240,
"author_profile": "https://wordpress.stackexchange.com/users/52240",
"pm_score": 0,
"selected": false,
"text": "<p>Try to activate the debug mode in config.php:\nSet this to true:<code>define('WP_DEBUG', false);</code></... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177182",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66972/"
] | Trying to learn WP plugin development.
Followed all the instructions.
`plugins/e4-test-1` directory.
Main php file (`e4-test-1.php`):
```
<?php
/**
* Plugin Name: Test 1
* Plugin URI: http://xxxxx.xxx
* Description: xxxxxxxxxxxxxxxxxx
* Version: 1.0.0
* Author: xxxxxxx
* Author URI: http://xxxxxx.xxx
* Licen... | You need to call your custom file into your main plugin file. Without doing that, your custom file will not get called. Think of your main plugin file as your themes `functions.php` file and your custom file like a custom file that also holds functions
By default, Wordpress will only read your functions.php, and not y... |
177,183 | <p>I'm using WP Query and the results coming back when using the search term aren't working as I wish. For example searching for 'art' returns also results for words containing 'art' such as 'part'.
How can I avoid this? and just return results for 'art' containing the exact word 'art'.</p>
| [
{
"answer_id": 177186,
"author": "Renato Gomes",
"author_id": 66339,
"author_profile": "https://wordpress.stackexchange.com/users/66339",
"pm_score": 4,
"selected": false,
"text": "<p>I think someone else has answered this before: <a href=\"https://wordpress.stackexchange.com/questions/8... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177183",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17862/"
] | I'm using WP Query and the results coming back when using the search term aren't working as I wish. For example searching for 'art' returns also results for words containing 'art' such as 'part'.
How can I avoid this? and just return results for 'art' containing the exact word 'art'. | This is actually a tricky question, as by stating **exact** there are two ways in which one can interprit your question -
1. Only find posts where the whole title or the whole content match exactly. For example, if you search **My post is super** you would not have returned a post with the title **My post is super awe... |
177,189 | <p>When I try and insert a form into a thickbox for use in the admin area, it seems to be removed completely. What do I need to change?</p>
<pre><code><?php
// Enqueue thickbox js and css
add_thickbox();
?>
<div style="text-align:center;padding:20px 0;">
<input alt="#TB_inline?width=500&he... | [
{
"answer_id": 177453,
"author": "mor7ifer",
"author_id": 11740,
"author_profile": "https://wordpress.stackexchange.com/users/11740",
"pm_score": 2,
"selected": true,
"text": "<p>The issue you are running into is partially an HTML issue. Forms cannot be nested. You are likely putting t... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177189",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51823/"
] | When I try and insert a form into a thickbox for use in the admin area, it seems to be removed completely. What do I need to change?
```
<?php
// Enqueue thickbox js and css
add_thickbox();
?>
<div style="text-align:center;padding:20px 0;">
<input alt="#TB_inline?width=500&height=600&inlineId=examplePopup1" ... | The issue you are running into is partially an HTML issue. Forms cannot be nested. You are likely putting this inside of another form (as a great bulk of the backend is already forms).
WordPress provides good handling for receiving submitted data to extend core functionality. I suggest that you look into this and figu... |
177,198 | <p>I have a page called 'blog' and I want to have the blog pages content at the top of the page as an intro and then underneath a list of all the posts. I've run into quite a few issues I'm not sure how to get around. Here they are...</p>
<ul>
<li>I have three posts at the moment, only post 1 and 3 are shown (post two... | [
{
"answer_id": 177199,
"author": "David Gard",
"author_id": 10097,
"author_profile": "https://wordpress.stackexchange.com/users/10097",
"pm_score": 2,
"selected": true,
"text": "<h1>Edited answer</h1>\n<p>Thank you for you clarification above, and please give this a try -</p>\n<p><strong... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177198",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67087/"
] | I have a page called 'blog' and I want to have the blog pages content at the top of the page as an intro and then underneath a list of all the posts. I've run into quite a few issues I'm not sure how to get around. Here they are...
* I have three posts at the moment, only post 1 and 3 are shown (post two isn't)
* I'm ... | Edited answer
=============
Thank you for you clarification above, and please give this a try -
**Note** - This code assumes that you are using **page.php**, a variation of the page templage or some other custom template - it will not work on your index page (**index.php**).
```
<div id="page-<?php the_ID(); ?>">
<?... |
177,205 | <p>I am having one page for example sample page. I am displaying 3 posts in that page. All 3 posts having 2 tags so total 6 tags.</p>
<p>Now I want to display all those 6 tags in sample page , I have tried below code :</p>
<pre><code> <?php echo wp_get_post_tags(1 , $args ) ?>
</code></pre>
<p>But above code p... | [
{
"answer_id": 177199,
"author": "David Gard",
"author_id": 10097,
"author_profile": "https://wordpress.stackexchange.com/users/10097",
"pm_score": 2,
"selected": true,
"text": "<h1>Edited answer</h1>\n<p>Thank you for you clarification above, and please give this a try -</p>\n<p><strong... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177205",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/63934/"
] | I am having one page for example sample page. I am displaying 3 posts in that page. All 3 posts having 2 tags so total 6 tags.
Now I want to display all those 6 tags in sample page , I have tried below code :
```
<?php echo wp_get_post_tags(1 , $args ) ?>
```
But above code printing **Array** instead of post tag a... | Edited answer
=============
Thank you for you clarification above, and please give this a try -
**Note** - This code assumes that you are using **page.php**, a variation of the page templage or some other custom template - it will not work on your index page (**index.php**).
```
<div id="page-<?php the_ID(); ?>">
<?... |
177,212 | <p>I'm using S2Member + Buddypress on a compatible template. I have 8 menu items and am using the "Menu Items Visibility Control" to limit the 7th for view only to
<code>current_user_is(s2member_level1) | in_array('administrator', $GLOBALS['current_user']->roles)</code> This visibility is working correctly.</p>
<p>... | [
{
"answer_id": 177231,
"author": "adriandegar",
"author_id": 67093,
"author_profile": "https://wordpress.stackexchange.com/users/67093",
"pm_score": 0,
"selected": false,
"text": "<p>I figured it out with a filter function. This finds the nav menu obj matching the given slug and then mod... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177212",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67093/"
] | I'm using S2Member + Buddypress on a compatible template. I have 8 menu items and am using the "Menu Items Visibility Control" to limit the 7th for view only to
`current_user_is(s2member_level1) | in_array('administrator', $GLOBALS['current_user']->roles)` This visibility is working correctly.
I'm in need of a way to ... | Congrats on figuring it out.
Perhaps this would also work:
```
function change_menu($items){
foreach($items as $item){
if ($item-> post_name == 'the-slug')/*replace "the-slug" with menu item post_name */
$item->url = bp_loggedin_user_domain() . '/events/my-events/?action=edit';
}
return $items;
}... |
177,213 | <p>This doesn't work for me in <code>functions.php</code>:</p>
<pre><code> if( is_page_template( 'template-flat.php' ) ) {
function flatsome_scripts() {
wp_enqueue_style( 'flatsome-style', get_template_directory_uri() .'/flatash/css/foundation.css', array(), '2.1', 'all');
}
add_action( 'wp_enqueue_scripts', 'fl... | [
{
"answer_id": 177214,
"author": "gdaniel",
"author_id": 30984,
"author_profile": "https://wordpress.stackexchange.com/users/30984",
"pm_score": 0,
"selected": false,
"text": "<p>You do it, the same way you do it to register other scripts, put it in a function and then add then use add_a... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177213",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40727/"
] | This doesn't work for me in `functions.php`:
```
if( is_page_template( 'template-flat.php' ) ) {
function flatsome_scripts() {
wp_enqueue_style( 'flatsome-style', get_template_directory_uri() .'/flatash/css/foundation.css', array(), '2.1', 'all');
}
add_action( 'wp_enqueue_scripts', 'flatsome_scripts' );
}... | Your problem is that you have wrapped your complete function and your action inside your conditional check. Your conditional check for your page template should be in your function.
Page templates gets set quite late, too late for your action.
Your function should look like this
```
function flatsome_scripts()
{
... |
177,222 | <p>I've created a custom taxonomy and added it to the admin menu. It works fine but I'd like to tweak it a little so that the input autofocus goes to the "name" field as soon as I select to add a new term. I've looked at edit-tags.php and can't find where I can insert this.</p>
<p>Thanks in advance!</p>
<p>EDIT: </p>... | [
{
"answer_id": 177214,
"author": "gdaniel",
"author_id": 30984,
"author_profile": "https://wordpress.stackexchange.com/users/30984",
"pm_score": 0,
"selected": false,
"text": "<p>You do it, the same way you do it to register other scripts, put it in a function and then add then use add_a... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177222",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64646/"
] | I've created a custom taxonomy and added it to the admin menu. It works fine but I'd like to tweak it a little so that the input autofocus goes to the "name" field as soon as I select to add a new term. I've looked at edit-tags.php and can't find where I can insert this.
Thanks in advance!
EDIT:
Howdy\_Mcgee's code... | Your problem is that you have wrapped your complete function and your action inside your conditional check. Your conditional check for your page template should be in your function.
Page templates gets set quite late, too late for your action.
Your function should look like this
```
function flatsome_scripts()
{
... |
177,227 | <p>I am using this code in <code>functions.php</code> to conditionally load some shortcodes but it doesn't work. The shortcodes are still loaded on <code>template-flat.php</code>. Any ideas what's wrong here?</p>
<pre><code>if( is_page_template( 'template-flat.php' ) ) {
// other code
}else{
require_once(functions ... | [
{
"answer_id": 177229,
"author": "hereswhatidid",
"author_id": 3032,
"author_profile": "https://wordpress.stackexchange.com/users/3032",
"pm_score": 3,
"selected": true,
"text": "<p>You need to run this code in an action hook rather than directly in the functions.php file. Take a look a... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177227",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40727/"
] | I am using this code in `functions.php` to conditionally load some shortcodes but it doesn't work. The shortcodes are still loaded on `template-flat.php`. Any ideas what's wrong here?
```
if( is_page_template( 'template-flat.php' ) ) {
// other code
}else{
require_once(functions . '/shortcodes.php');
}
```
I thi... | You need to run this code in an action hook rather than directly in the functions.php file. Take a look at the [Action Reference page](http://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request) in the Codex and determine at which point you want this script to run. Whatever action you c... |
177,230 | <p>I wrote a short code to work with an event plugin (the plugin creates the custom post type of event). I want to pull all future events from the database that use a specific category and list them on the page in order of the event date. The events are showing up but the category selection is not working and it is als... | [
{
"answer_id": 177229,
"author": "hereswhatidid",
"author_id": 3032,
"author_profile": "https://wordpress.stackexchange.com/users/3032",
"pm_score": 3,
"selected": true,
"text": "<p>You need to run this code in an action hook rather than directly in the functions.php file. Take a look a... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177230",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67103/"
] | I wrote a short code to work with an event plugin (the plugin creates the custom post type of event). I want to pull all future events from the database that use a specific category and list them on the page in order of the event date. The events are showing up but the category selection is not working and it is also s... | You need to run this code in an action hook rather than directly in the functions.php file. Take a look at the [Action Reference page](http://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request) in the Codex and determine at which point you want this script to run. Whatever action you c... |
177,232 | <p>I have a simple blog page that just lists blog posts on a page called 'news'</p>
<p><a href="http://my-site.co.uk/news" rel="nofollow">http://my-site.co.uk/news</a></p>
<p>I have a single.php page to display the actual post when it is clicked on 'news'</p>
<p>The single.php displays the post but the url is <a hre... | [
{
"answer_id": 177244,
"author": "Sean Grant",
"author_id": 67105,
"author_profile": "https://wordpress.stackexchange.com/users/67105",
"pm_score": 1,
"selected": false,
"text": "<p>This is normal.</p>\n\n<p>You probably have your Permalinks set to \"Post Name\".</p>\n\n<p>You can change... | 2015/02/05 | [
"https://wordpress.stackexchange.com/questions/177232",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17373/"
] | I have a simple blog page that just lists blog posts on a page called 'news'
<http://my-site.co.uk/news>
I have a single.php page to display the actual post when it is clicked on 'news'
The single.php displays the post but the url is <http://my-site.co.uk/the-post-title>.
Is this normal or should it be <http://my-s... | This is normal.
You probably have your Permalinks set to "Post Name".
You can change your Permalinks to "Custom Structure" and put '/news' in there before the post title, so the "Custom Structure" field would look like this:
```
/news/%postname%/
```
That should do it. |
177,270 | <p>I'm new at wordpress theme development. We inspected too many themes but didn't see any common culture at post format status. I wanted to ask how you're using this format, both front side and admin side ? Twitter embed code or just textarea or something, and if posible can you give some examples ?</p>
<p>Sorry abou... | [
{
"answer_id": 177244,
"author": "Sean Grant",
"author_id": 67105,
"author_profile": "https://wordpress.stackexchange.com/users/67105",
"pm_score": 1,
"selected": false,
"text": "<p>This is normal.</p>\n\n<p>You probably have your Permalinks set to \"Post Name\".</p>\n\n<p>You can change... | 2015/02/06 | [
"https://wordpress.stackexchange.com/questions/177270",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58801/"
] | I'm new at wordpress theme development. We inspected too many themes but didn't see any common culture at post format status. I wanted to ask how you're using this format, both front side and admin side ? Twitter embed code or just textarea or something, and if posible can you give some examples ?
Sorry about my bad E... | This is normal.
You probably have your Permalinks set to "Post Name".
You can change your Permalinks to "Custom Structure" and put '/news' in there before the post title, so the "Custom Structure" field would look like this:
```
/news/%postname%/
```
That should do it. |
177,272 | <p>I wrote a plugin that has various options and in case the user saves this options a CSS file will be generated. My intention is that the CSS is only created when the options are saved and not when somebody visits the page and the CSS will be created every single time.</p>
<p>So I need a hook that fires when somebod... | [
{
"answer_id": 177280,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 5,
"selected": true,
"text": "<p>Although I don't agree with your purpose, here the action hooks you may use (you have not shown us what you ar... | 2015/02/06 | [
"https://wordpress.stackexchange.com/questions/177272",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62987/"
] | I wrote a plugin that has various options and in case the user saves this options a CSS file will be generated. My intention is that the CSS is only created when the options are saved and not when somebody visits the page and the CSS will be created every single time.
So I need a hook that fires when somebody saves th... | Although I don't agree with your purpose, here the action hooks you may use (you have not shown us what you are using to save the options, so I can not say which one is better).
If you use `add_option` to save options:
========================================
**add\_option\_{option\_name}**: Runs **after** a the opti... |
177,320 | <p>When I add a new customer the email goes to new user in this format:</p>
<pre><code>From: WordPress [wordpress@siteurl.com]
Subject: [site name] Your user name and password
Message:
username: user
Password: password
siteurl.com/wp-login.php
</code></pre>
<p>Now I want to change this form... | [
{
"answer_id": 177329,
"author": "David Gard",
"author_id": 10097,
"author_profile": "https://wordpress.stackexchange.com/users/10097",
"pm_score": 3,
"selected": false,
"text": "<p>The new user notification email is created and sent by the function <code>wp_new_user_notification()</code... | 2015/02/06 | [
"https://wordpress.stackexchange.com/questions/177320",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64316/"
] | When I add a new customer the email goes to new user in this format:
```
From: WordPress [wordpress@siteurl.com]
Subject: [site name] Your user name and password
Message:
username: user
Password: password
siteurl.com/wp-login.php
```
Now I want to change this format Like this:
```
From: M... | **For 2018 and onwards users:**
David Gard's answer still works but is old and there's a new better/cleaner way to do this (no need for a plugin anymore).
Since WordPress 4.9.0 there are new filters you can use to customise registration emails:
* [wp\_new\_user\_notification\_email](https://developer.wordpress.org/r... |
177,354 | <p>Is there a way to disable <em>Blogroll</em> or <em>WordPress Dashboard News</em> section in WordPress v.4.1?</p>
<p><strong>EDIT:</strong><br>
Actually by saying disable, i mean completely remove and not just hide.<br>
I apologize for my the late response.</p>
| [
{
"answer_id": 177359,
"author": "gdaniel",
"author_id": 30984,
"author_profile": "https://wordpress.stackexchange.com/users/30984",
"pm_score": 4,
"selected": true,
"text": "<p>If you want to remove metaboxes from the dashboard page you can add this to functions.php</p>\n\n<pre><code>fu... | 2015/02/06 | [
"https://wordpress.stackexchange.com/questions/177354",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45047/"
] | Is there a way to disable *Blogroll* or *WordPress Dashboard News* section in WordPress v.4.1?
**EDIT:**
Actually by saying disable, i mean completely remove and not just hide.
I apologize for my the late response. | If you want to remove metaboxes from the dashboard page you can add this to functions.php
```
function remove_dashboard_widgets () {
remove_meta_box('dashboard_quick_press','dashboard','side'); //Quick Press widget
remove_meta_box('dashboard_recent_drafts','dashboard','side'); //Recent Drafts
remove_meta_box('d... |
177,373 | <p>I am using <code>filemtime()</code> to add a version number for different <strong>.css</strong> and <strong>.js</strong> files in a custom WordPress theme.</p>
<p>I used the <a href="https://wordpress.stackexchange.com/questions/40667/how-do-you-avoid-caching-during-development">accepted answer described here</a> a... | [
{
"answer_id": 177376,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 2,
"selected": false,
"text": "<p>Based on the article you have pointed to, it seems like there are two simple options</p>\n\n<ol>\n<li>pre... | 2015/02/07 | [
"https://wordpress.stackexchange.com/questions/177373",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34253/"
] | I am using `filemtime()` to add a version number for different **.css** and **.js** files in a custom WordPress theme.
I used the [accepted answer described here](https://wordpress.stackexchange.com/questions/40667/how-do-you-avoid-caching-during-development) as a guideline; however, I use the `wp_retister_style()` an... | You are loading the **rtl.css** using the WordPress automatic way, that is, having a **rtl.css** in the theme folder will be loaded by WordPress automatically if it presents and direction of current language ir rtl (you should add this information to the question, it has been difficult to figure it out how you are load... |
177,382 | <p>I have a custom post type (from a theme installed by previous developer), and here is the code of loop which retrieve the post and display them. </p>
<pre><code><?php
// Counter
$post_count = 1;
// Query
$gp_query_args = array(
'post_type' => 'event',
//EXCLUDE Events try by me
'post__no... | [
{
"answer_id": 177383,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 1,
"selected": true,
"text": "<p>Something like this should work from your functions file as long as you use the correct conditional tag for ... | 2015/02/07 | [
"https://wordpress.stackexchange.com/questions/177382",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/54871/"
] | I have a custom post type (from a theme installed by previous developer), and here is the code of loop which retrieve the post and display them.
```
<?php
// Counter
$post_count = 1;
// Query
$gp_query_args = array(
'post_type' => 'event',
//EXCLUDE Events try by me
'post__not_in' => array('1646... | Something like this should work from your functions file as long as you use the correct conditional tag for your CPT archive:
```
function exclude_single_post_cpt($query) {
if (is_post_type_archive('event') && $query->is_main_query() && !is_admin() ) {
$query->set('post__not_in', array(1646));
}
}
add_action(... |
177,395 | <p>I'm not sure whether my question sounds promising or not but what I'm going to ask is very much relevant. So please read the full question before down voting or flag.</p>
<p>I'm trying to implement DNS Pre-fetching on my wordpress mu, as site by site approach. On my primary site I use a child theme, so I planned to... | [
{
"answer_id": 177396,
"author": "TheDeadMedic",
"author_id": 1685,
"author_profile": "https://wordpress.stackexchange.com/users/1685",
"pm_score": 4,
"selected": true,
"text": "<p><strong>As of WordPress 4.6.0 there is a resource hints API that automatically adds all unique enqueued dom... | 2015/02/07 | [
"https://wordpress.stackexchange.com/questions/177395",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/50584/"
] | I'm not sure whether my question sounds promising or not but what I'm going to ask is very much relevant. So please read the full question before down voting or flag.
I'm trying to implement DNS Pre-fetching on my wordpress mu, as site by site approach. On my primary site I use a child theme, so I planned to put the f... | **As of WordPress 4.6.0 there is a resource hints API that automatically adds all unique enqueued domains, which you can override with [`wp_resource_hints`](https://make.wordpress.org/core/2016/07/06/resource-hints-in-4-6/) - you should only use the following answer if you're stuck with < 4.6.0**
---
All you can do i... |
177,415 | <p>When i create a page, and click "Add media" button above the TinyMCE editor, the Media Modal shows up.</p>
<p>Question: How do i edit the size of the images showing in the modal?</p>
<p>The current images are full size, causing the browser to load very slow and in some cases the browser crashes (most browsers exce... | [
{
"answer_id": 177396,
"author": "TheDeadMedic",
"author_id": 1685,
"author_profile": "https://wordpress.stackexchange.com/users/1685",
"pm_score": 4,
"selected": true,
"text": "<p><strong>As of WordPress 4.6.0 there is a resource hints API that automatically adds all unique enqueued dom... | 2015/02/08 | [
"https://wordpress.stackexchange.com/questions/177415",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45986/"
] | When i create a page, and click "Add media" button above the TinyMCE editor, the Media Modal shows up.
Question: How do i edit the size of the images showing in the modal?
The current images are full size, causing the browser to load very slow and in some cases the browser crashes (most browsers except Safari on Mac)... | **As of WordPress 4.6.0 there is a resource hints API that automatically adds all unique enqueued domains, which you can override with [`wp_resource_hints`](https://make.wordpress.org/core/2016/07/06/resource-hints-in-4-6/) - you should only use the following answer if you're stuck with < 4.6.0**
---
All you can do i... |
177,458 | <p>I have tried doing some research on this but haven't found anything solid yet. I have a plugin I am working on and between the last version and the new version we made some updates to the widget that changes some of the settings names (on the backend) and I am having trouble creating an upgrade routine to do this. <... | [
{
"answer_id": 177753,
"author": "Chief Alchemist",
"author_id": 18343,
"author_profile": "https://wordpress.stackexchange.com/users/18343",
"pm_score": 0,
"selected": false,
"text": "<p>Off the top of my head, each instance of a widget is given some sort of unique ID. I want to say that... | 2015/02/08 | [
"https://wordpress.stackexchange.com/questions/177458",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/48502/"
] | I have tried doing some research on this but haven't found anything solid yet. I have a plugin I am working on and between the last version and the new version we made some updates to the widget that changes some of the settings names (on the backend) and I am having trouble creating an upgrade routine to do this.
Wh... | I've did a quick test on just changing the option and it seems to work.
What I did is:
1. Wrote a widget that has just 2 fields: "Title" and "Name". Add several instances of this widget to my sidebars. Been sure that they are shown correctly in frontend.
2. Edited the class to use 3 fields: "Title" and "First Name" (... |
177,465 | <p>For some reason the first code works. But the second does not.
And I can't figure out what is wrong with my syntax.</p>
<pre><code>background-image: url("/wp-content/themes/flawless-v1-17-child-01/images/Logo-B-Classic.jpg") !important;
background-image:url('.get_stylesheet_directory_uri().'/images/Log... | [
{
"answer_id": 177470,
"author": "Leo Caseiro",
"author_id": 52791,
"author_profile": "https://wordpress.stackexchange.com/users/52791",
"pm_score": 3,
"selected": true,
"text": "<p><strong><em>get_stylesheet_directory_uri()</em></strong> is a PHP function, you must use it in a PHP file ... | 2015/02/08 | [
"https://wordpress.stackexchange.com/questions/177465",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67215/"
] | For some reason the first code works. But the second does not.
And I can't figure out what is wrong with my syntax.
```
background-image: url("/wp-content/themes/flawless-v1-17-child-01/images/Logo-B-Classic.jpg") !important;
background-image:url('.get_stylesheet_directory_uri().'/images/Logo-B-Classic.jp... | ***get\_stylesheet\_directory\_uri()*** is a PHP function, you must use it in a PHP file instead of your CSS file.
In your functions.php you can paste this code and change depends on your needs:
```
function my_login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
background-im... |
177,489 | <p>I uploaded one image with size of 1920*1200 and I checked the backend Media options as followed</p>
<p>Thumbnail size 150 150
Medium size 300 300
Large size 1024 1024</p>
<p>The upload directory was supposedly has four images there,the original image,thumbnail image,Medium image,Large image,four in total,however,5... | [
{
"answer_id": 177490,
"author": "user7031",
"author_id": 67234,
"author_profile": "https://wordpress.stackexchange.com/users/67234",
"pm_score": 1,
"selected": false,
"text": "<p>I figured it out this was a theme option located in the functions.php file</p>\n\n<pre><code>set_post_thumbn... | 2015/02/09 | [
"https://wordpress.stackexchange.com/questions/177489",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67234/"
] | I uploaded one image with size of 1920\*1200 and I checked the backend Media options as followed
Thumbnail size 150 150
Medium size 300 300
Large size 1024 1024
The upload directory was supposedly has four images there,the original image,thumbnail image,Medium image,Large image,four in total,however,5 images found th... | I figured it out this was a theme option located in the functions.php file
```
set_post_thumbnail_size( 825, 510, true );
```
This is how this customized size came out in the first place! |
177,498 | <p>I seek a solution for my navigation in a new WordPress template that I'm developing. </p>
<p>How can I output the unique post ID for every nav item? </p>
<p>I want to create a one-pager (microsite) for a client. </p>
<p>Before I tried something with walker-nav and other things that didn't work.</p>
| [
{
"answer_id": 177500,
"author": "shyammakwana.me",
"author_id": 49267,
"author_profile": "https://wordpress.stackexchange.com/users/49267",
"pm_score": 1,
"selected": true,
"text": "<p>html mark up for navigation will look like this </p>\n\n<pre><code><ul id=\"menu-res\" class=\"main... | 2015/02/09 | [
"https://wordpress.stackexchange.com/questions/177498",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67241/"
] | I seek a solution for my navigation in a new WordPress template that I'm developing.
How can I output the unique post ID for every nav item?
I want to create a one-pager (microsite) for a client.
Before I tried something with walker-nav and other things that didn't work. | html mark up for navigation will look like this
```
<ul id="menu-res" class="main-menu"><li id="menu-item-72" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-72"><a href="#home">Home</a></li>
<li id="menu-item-238" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-23... |
177,520 | <p>I have made a very simple JavaScript script. There is 1 <code>.js</code> file with a lot of code, and in the HTML file there is only 2 lines. The script works fine when I test it on a plain HTML page, but when I try it with WordPress, it doesn't work.</p>
<p>I guess it has something to do with the path to the exter... | [
{
"answer_id": 177500,
"author": "shyammakwana.me",
"author_id": 49267,
"author_profile": "https://wordpress.stackexchange.com/users/49267",
"pm_score": 1,
"selected": true,
"text": "<p>html mark up for navigation will look like this </p>\n\n<pre><code><ul id=\"menu-res\" class=\"main... | 2015/02/09 | [
"https://wordpress.stackexchange.com/questions/177520",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66256/"
] | I have made a very simple JavaScript script. There is 1 `.js` file with a lot of code, and in the HTML file there is only 2 lines. The script works fine when I test it on a plain HTML page, but when I try it with WordPress, it doesn't work.
I guess it has something to do with the path to the external `.js` file (`src=... | html mark up for navigation will look like this
```
<ul id="menu-res" class="main-menu"><li id="menu-item-72" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-72"><a href="#home">Home</a></li>
<li id="menu-item-238" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-23... |
177,554 | <p>I'm using AngularJS's <code>$http</code> function to send my payload to WordPress's <code>admin-ajax.php</code> subsystem, but it seems the latter only accepts <code>x-www-form-urlencoded</code> data, instead of the <code>application/json</code> supplied by Angular. </p>
<p>I know <a href="https://stackoverflow.com... | [
{
"answer_id": 177583,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p><code>admin-ajax.php</code> was designed to work against jQuery, most likely if you do not make the conve... | 2015/02/09 | [
"https://wordpress.stackexchange.com/questions/177554",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1682/"
] | I'm using AngularJS's `$http` function to send my payload to WordPress's `admin-ajax.php` subsystem, but it seems the latter only accepts `x-www-form-urlencoded` data, instead of the `application/json` supplied by Angular.
I know [there are ways](https://stackoverflow.com/a/19270196/467760) of making $http function m... | >
> it seems the latter only accepts x-www-form-urlencoded
>
>
>
That's not completely true.
WordPress `admin-ajax.php` takes the action from `$_REQUEST['action']` and `$_REQUEST` is equal to:
```
array_merge($_POST, $_GET);
```
But what many people don't realize is that `$_GET` in PHP is **not** the data was... |
177,589 | <p>I've been struggling with some code for a custom theme.</p>
<p><strong>The result:</strong>
Create an image with text.</p>
<p><strong>The problem:</strong>
Fails at header: <code>code</code> on production.</p>
<p>The funny thing is that the function works perfectly fine locally, but when I upload everything to pr... | [
{
"answer_id": 177590,
"author": "jdm2112",
"author_id": 45202,
"author_profile": "https://wordpress.stackexchange.com/users/45202",
"pm_score": 0,
"selected": false,
"text": "<p>Using the step-by-step installation directions on the WordPress Codex is a good way to get up and running wit... | 2015/02/09 | [
"https://wordpress.stackexchange.com/questions/177589",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66847/"
] | I've been struggling with some code for a custom theme.
**The result:**
Create an image with text.
**The problem:**
Fails at header: `code` on production.
The funny thing is that the function works perfectly fine locally, but when I upload everything to production it fails.
The code:
```
$euro = get_option('euro')... | I would like to agree with JDM2112. Start of with installing WP. Then write down everything your site needs to do and find the right plugins and themes to accomplish these goals.
Here's some helpfull info aswell to get you to grips with WordPress installs and its backend install.[Beginners guide to using WordPress](ht... |
177,620 | <p>I'm working on a multisite WP installation and I need to import content from other Wordpress sites (<code>.wxr</code> files). When I use the <em>Import WordPress</em> plugin I got the following:</p>
<p><img src="https://i.stack.imgur.com/txCH7.png" alt="enter image description here"></p>
<p>The maximum allowed upl... | [
{
"answer_id": 177636,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 2,
"selected": false,
"text": "<p>There's a filter named <code>'upload_size_limit'</code> where you <em>should</em> be able to change the value. Jus... | 2015/02/10 | [
"https://wordpress.stackexchange.com/questions/177620",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16412/"
] | I'm working on a multisite WP installation and I need to import content from other Wordpress sites (`.wxr` files). When I use the *Import WordPress* plugin I got the following:

The maximum allowed upload size is only `1MB`, while I set `100MB` in my... | Thanks **@kaiser** but not need to go through your solution I found a easy one and I'll share here for newbie likes me.
If you're working on a WP Network site then the steps are:
1. At the top, hover over My Sites and then click Network Admin.
2. At the left, hover over Settings and then click Network Settings.
3. Sc... |
177,637 | <p>My error when writing a plugin for uploads</p>
<p>and yes, I can debug. But it just jumps directly from this line to <code>destruct</code></p>
<p><img src="https://i.stack.imgur.com/VzaDE.png" alt="enter image description here"></p>
<p>the end of my <code>wp-config.php</code> <strong>EDIT:</strong></p>
<pre><cod... | [
{
"answer_id": 189560,
"author": "AddWeb Solution Pvt Ltd",
"author_id": 73643,
"author_profile": "https://wordpress.stackexchange.com/users/73643",
"pm_score": 0,
"selected": false,
"text": "<p>Toskan,</p>\n\n<p>It seems like your wordpress file is not uploaded, so there may be a possib... | 2015/02/10 | [
"https://wordpress.stackexchange.com/questions/177637",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/48130/"
] | My error when writing a plugin for uploads
and yes, I can debug. But it just jumps directly from this line to `destruct`

the end of my `wp-config.php` **EDIT:**
```
// Enable WP_DEBUG mode
define('WP_DEBUG', true);
// Enable Debug logging to the ... | Insert this into your wp-config.php
```
// Enable WP_DEBUG mode
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
```
Before
`/* That's all, sto... |
177,644 | <p>I want to add a custom field in the menu, therefore I am trying to use <code>wp_nav_menu_item_custom_fields</code>. I am using following code but it does not even call the function. I am adding it in a plugin, why is wrong in it?</p>
<pre><code>add_action( 'wp_nav_menu_item_custom_fields', 'my_custom_fields', 10, 4... | [
{
"answer_id": 177661,
"author": "user657489",
"author_id": 67320,
"author_profile": "https://wordpress.stackexchange.com/users/67320",
"pm_score": -1,
"selected": false,
"text": "<p>Add this after your function;</p>\n\n<pre><code>do_action('my_custom_fields');\n</code></pre>\n\n<p>This ... | 2015/02/10 | [
"https://wordpress.stackexchange.com/questions/177644",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67310/"
] | I want to add a custom field in the menu, therefore I am trying to use `wp_nav_menu_item_custom_fields`. I am using following code but it does not even call the function. I am adding it in a plugin, why is wrong in it?
```
add_action( 'wp_nav_menu_item_custom_fields', 'my_custom_fields', 10, 4);
function my_custom_fi... | Currently it doesn't seem to exist a filter to manage fields in the menu creation. On the other hand, what you can do is to create a new "menu walker", to provide Wordpress input fields as well as adding your own. That involves the extension of Wordpress class `Walker_Nav_Menu_Edit` with your own code.
Since the expl... |