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 |
|---|---|---|---|---|---|---|
126,373 | <p>I'm using some transitional css to "slide" up a div (".mask") which contains a short excerpt of the post when you hover over the post thumbnail.</p>
<p>This works very well, but I'd also like to add a text or icon link to each "mask" div which will link directly to the full size version of the image (and hopefully ... | [
{
"answer_id": 126377,
"author": "Will",
"author_id": 17940,
"author_profile": "https://wordpress.stackexchange.com/users/17940",
"pm_score": 0,
"selected": false,
"text": "<p>The way I read your question I believe you're after wp_get_attachment_link. <a href=\"http://codex.wordpress.or... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126373",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22537/"
] | I'm using some transitional css to "slide" up a div (".mask") which contains a short excerpt of the post when you hover over the post thumbnail.
This works very well, but I'd also like to add a text or icon link to each "mask" div which will link directly to the full size version of the image (and hopefully open autom... | I don't know if TimThumb is really necessary. You could easily do that with internal WordPress functions.
Add this code to your functions.php:
```
<?php
add_theme_support( 'post-thumbnails' ); // this enable thumbnails
add_image_size( 'preview-thumb', 300, 185, true ); //this sets your default size
?>
```
Use the... |
126,374 | <h1>General Info</h1>
<p>I used the plugin WP Types (wp-types.com) to create a custom post type called "<strong>artist</strong>".<br>
In WP Types you can also set another post type as parent post type. This is not possible by default; they implemented this feature by a meta query with the key:<br>
"_wpcf_belongs_%POS... | [
{
"answer_id": 127064,
"author": "Matthew Boynes",
"author_id": 12324,
"author_profile": "https://wordpress.stackexchange.com/users/12324",
"pm_score": 2,
"selected": false,
"text": "<p>You got it pretty close. Here's a working example of what you're trying to do:</p>\n\n<pre><code>class... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126374",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34790/"
] | General Info
============
I used the plugin WP Types (wp-types.com) to create a custom post type called "**artist**".
In WP Types you can also set another post type as parent post type. This is not possible by default; they implemented this feature by a meta query with the key:
"\_wpcf\_belongs\_%POSTTYPE%\_id"... | You got it pretty close. Here's a working example of what you're trying to do:
```
class Wpse_126374 {
public function __construct() {
add_action( 'init', array( $this, 'rewrites' ) );
add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
}
public function rewrites() {
a... |
126,389 | <p>I have searched high and low for a solution and couldn't find anything; hopefully someone here more skilled than myself can lend a hand.</p>
<p>I have two testimonial videos (from a video custom post type) displayed randomly every time the page loads. There are different clients that have testimonials and in some ca... | [
{
"answer_id": 127064,
"author": "Matthew Boynes",
"author_id": 12324,
"author_profile": "https://wordpress.stackexchange.com/users/12324",
"pm_score": 2,
"selected": false,
"text": "<p>You got it pretty close. Here's a working example of what you're trying to do:</p>\n\n<pre><code>class... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126389",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43873/"
] | I have searched high and low for a solution and couldn't find anything; hopefully someone here more skilled than myself can lend a hand.
I have two testimonial videos (from a video custom post type) displayed randomly every time the page loads. There are different clients that have testimonials and in some cases, ther... | You got it pretty close. Here's a working example of what you're trying to do:
```
class Wpse_126374 {
public function __construct() {
add_action( 'init', array( $this, 'rewrites' ) );
add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
}
public function rewrites() {
a... |
126,410 | <p>WordPress 3.8 introduced in core the plugin MP6 that among other things use an iconic font called Dashicons to display fonts in the dashboard.</p>
<p>Now, is well know that <a href="http://codex.wordpress.org/Function_Reference/register_post_type">register_post_type</a> has an argument <code>'menu_icon'</code> that... | [
{
"answer_id": 126411,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 2,
"selected": false,
"text": "<p>I'm answering myself because today I asked myself the 2 questions I posted, and spent some time to find an an... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126410",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35541/"
] | WordPress 3.8 introduced in core the plugin MP6 that among other things use an iconic font called Dashicons to display fonts in the dashboard.
Now, is well know that [register\_post\_type](http://codex.wordpress.org/Function_Reference/register_post_type) has an argument `'menu_icon'` that allow to specify a custom ico... | After going through the rabbit hole and back, the answer is - **yes**, core does allow to easily use dashicons when registering post types and adding menu pages.
To use dashicon you need to pass its CSS class `dashicons-[name]` to `menu_icon` or `icon_url` in relevant places.
Classes available can be looked up in [`d... |
126,413 | <p>I found this little trick <a href="http://css-tricks.com/snippets/htaccess/301-redirects/" rel="nofollow">http://css-tricks.com/snippets/htaccess/301-redirects/</a> to redirect my old Wordpress domain to my new domain with the path included. I run a test on my local copy and everything works fine. When I log in to... | [
{
"answer_id": 126416,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>Move your redirect up above the WordPress section. </p>\n\n<p>As it looks to me, what should be happening i... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126413",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43885/"
] | I found this little trick <http://css-tricks.com/snippets/htaccess/301-redirects/> to redirect my old Wordpress domain to my new domain with the path included. I run a test on my local copy and everything works fine. When I log in to the cpanel of the old domain and try it though it gives me some bad results.
Here is ... | Replace `Redirect 301 / http://newsite.com/` by `RewriteRule ^(.*)$ http://newsite.com/ [L,R=301]` |
126,417 | <p>I'm writing a plugin for Wordpress that required the Facebook PHP SDK. I've run into what I think is a common problem judging from the number of results I've found dating back to over a year ago. Unfortunately, I have been unable to find a solution.</p>
<p>I'm using Wordpress 3.8 and Facebook PHP SDK Master taken ... | [
{
"answer_id": 126955,
"author": "Azhar Munshi",
"author_id": 44078,
"author_profile": "https://wordpress.stackexchange.com/users/44078",
"pm_score": 2,
"selected": true,
"text": "<p>First of all download the zip of facebook php sdk from <code><a href=\"https://github.com/facebook/facebo... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126417",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18119/"
] | I'm writing a plugin for Wordpress that required the Facebook PHP SDK. I've run into what I think is a common problem judging from the number of results I've found dating back to over a year ago. Unfortunately, I have been unable to find a solution.
I'm using Wordpress 3.8 and Facebook PHP SDK Master taken from github... | First of all download the zip of facebook php sdk from `[Facebook PHP SDK from Github.com](https://github.com/facebook/facebook-php-sdk/archive/master.zip)`
Extract the zip folder, you need only the 'src' folder for integrate your facebook application in your plugin.
copy the 'src' folder and paste it in your plugin ... |
126,418 | <p>I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try.</p>
<p>Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send them offsite, thus have them uploaded to a different server through (ftp connection).</p>
<p>Below is the code... | [
{
"answer_id": 126955,
"author": "Azhar Munshi",
"author_id": 44078,
"author_profile": "https://wordpress.stackexchange.com/users/44078",
"pm_score": 2,
"selected": true,
"text": "<p>First of all download the zip of facebook php sdk from <code><a href=\"https://github.com/facebook/facebo... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126418",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43886/"
] | I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try.
Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send them offsite, thus have them uploaded to a different server through (ftp connection).
Below is the code i started after ... | First of all download the zip of facebook php sdk from `[Facebook PHP SDK from Github.com](https://github.com/facebook/facebook-php-sdk/archive/master.zip)`
Extract the zip folder, you need only the 'src' folder for integrate your facebook application in your plugin.
copy the 'src' folder and paste it in your plugin ... |
126,423 | <p>I have a site that suddenly stopped working earlier due to what I can only assume was the server going down. Now I can connect using ftp but in the browser I get the following. Any advice on how to get the site back again gratefully received.</p>
<blockquote>
<p>Internal Server Error</p>
<p>The server encoun... | [
{
"answer_id": 126955,
"author": "Azhar Munshi",
"author_id": 44078,
"author_profile": "https://wordpress.stackexchange.com/users/44078",
"pm_score": 2,
"selected": true,
"text": "<p>First of all download the zip of facebook php sdk from <code><a href=\"https://github.com/facebook/facebo... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126423",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38223/"
] | I have a site that suddenly stopped working earlier due to what I can only assume was the server going down. Now I can connect using ftp but in the browser I get the following. Any advice on how to get the site back again gratefully received.
>
> Internal Server Error
>
>
> The server encountered an internal error ... | First of all download the zip of facebook php sdk from `[Facebook PHP SDK from Github.com](https://github.com/facebook/facebook-php-sdk/archive/master.zip)`
Extract the zip folder, you need only the 'src' folder for integrate your facebook application in your plugin.
copy the 'src' folder and paste it in your plugin ... |
126,424 | <p>I try to fix my plugin with the answers i got here: <a href="https://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins">Using wp_filesystem in Plugins</a>
Background i wrote a theme (<a href="https://github.com/bassjobsen/jamedo-bootstrap-start-theme" rel="nofollow noreferrer">https://githu... | [
{
"answer_id": 126955,
"author": "Azhar Munshi",
"author_id": 44078,
"author_profile": "https://wordpress.stackexchange.com/users/44078",
"pm_score": 2,
"selected": true,
"text": "<p>First of all download the zip of facebook php sdk from <code><a href=\"https://github.com/facebook/facebo... | 2013/12/13 | [
"https://wordpress.stackexchange.com/questions/126424",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31759/"
] | I try to fix my plugin with the answers i got here: [Using wp\_filesystem in Plugins](https://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins)
Background i wrote a theme (<https://github.com/bassjobsen/jamedo-bootstrap-start-theme>) and a plugin (<https://github.com/bassjobsen/wp-less-to-css... | First of all download the zip of facebook php sdk from `[Facebook PHP SDK from Github.com](https://github.com/facebook/facebook-php-sdk/archive/master.zip)`
Extract the zip folder, you need only the 'src' folder for integrate your facebook application in your plugin.
copy the 'src' folder and paste it in your plugin ... |
126,438 | <p>I allow users to post from frontend. There are three kinds of users. Myself as admin, a junior ( given a role of an author) and anyone from public as non-logged-in user. Currently if any non-logged-in user posts from frontend, I am assigned as an author with this code. Currently my <code>wp_insert_post</code> array ... | [
{
"answer_id": 126443,
"author": "Will",
"author_id": 17940,
"author_profile": "https://wordpress.stackexchange.com/users/17940",
"pm_score": 1,
"selected": false,
"text": "<p>The wp_insert_post_data filter is the right approach. I would do something like this:</p>\n\n<pre><code>add_fil... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126438",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25508/"
] | I allow users to post from frontend. There are three kinds of users. Myself as admin, a junior ( given a role of an author) and anyone from public as non-logged-in user. Currently if any non-logged-in user posts from frontend, I am assigned as an author with this code. Currently my `wp_insert_post` array looks somethin... | This piece of code needs to go after `wp_insert_post`. It basically just updates the post\_author depending on the condition provided. Please note, that if the author is not logged in the post\_author will default to admin again.
```
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
if ( 19 ... |
126,442 | <p>so, i wanted to thumbnails in my query and i came across <code>add_theme_support</code>, it says you have to have that to enable actions such as <code>thumbnail</code>, so i put the following in my functions </p>
<pre><code>function pippin_add_thumbnail_support() {
if(!current_theme_supports('post-thumbnails'))... | [
{
"answer_id": 126443,
"author": "Will",
"author_id": 17940,
"author_profile": "https://wordpress.stackexchange.com/users/17940",
"pm_score": 1,
"selected": false,
"text": "<p>The wp_insert_post_data filter is the right approach. I would do something like this:</p>\n\n<pre><code>add_fil... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126442",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33028/"
] | so, i wanted to thumbnails in my query and i came across `add_theme_support`, it says you have to have that to enable actions such as `thumbnail`, so i put the following in my functions
```
function pippin_add_thumbnail_support() {
if(!current_theme_supports('post-thumbnails')) {
add_theme_support('post-t... | This piece of code needs to go after `wp_insert_post`. It basically just updates the post\_author depending on the condition provided. Please note, that if the author is not logged in the post\_author will default to admin again.
```
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
if ( 19 ... |
126,447 | <p>I have parent category, Game (cat ID 42), and some child categories in it: Acrade, Causaul. After I using the loop to get the title of the post, I want to have a child category name. But my code is not working:</p>
<pre><code><?php
$args = array(
'cat' => 42,
'posts_per_page' => 12,
... | [
{
"answer_id": 126449,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 2,
"selected": true,
"text": "<p>When you call </p>\n\n<pre><code>$categories = get_the_category($post->ID);\n</code></pre>\n\n<p>the <code>... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126447",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43862/"
] | I have parent category, Game (cat ID 42), and some child categories in it: Acrade, Causaul. After I using the loop to get the title of the post, I want to have a child category name. But my code is not working:
```
<?php
$args = array(
'cat' => 42,
'posts_per_page' => 12,
'post__in' => ge... | When you call
```
$categories = get_the_category($post->ID);
```
the `$post` variable is not defined yet (or is not the one that you expect), because you have to use it **inside** the loop.
Where you have
```
<span class="cate"><?php echo $categories ?></span>
```
replace with (this will output something like "... |
126,462 | <p>I have something like 10000 comments. They are probably all spam except for one or two. </p>
<p>And they are all waiting for me to approve them. Is there a free solution to this issue?</p>
<p>Thank you!</p>
| [
{
"answer_id": 126464,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p>Delete them all. I don’t think a few comments are worth so much of your time.</p>\n\n<p>To clean up the entire table, ... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34846/"
] | I have something like 10000 comments. They are probably all spam except for one or two.
And they are all waiting for me to approve them. Is there a free solution to this issue?
Thank you! | Delete them all. I don’t think a few comments are worth so much of your time.
To clean up the entire table, open a SQL console (the plugin [Adminer](http://wordpress.org/plugins/adminer/) has an UI for that) and type:
```
TRUNCATE table wp_comments
```
You might have to change the name if you are using an other pre... |
126,466 | <p>I'm new to wordpress. I want to create some main categories and 5 sub categories for each main category. Sub categories will be same for both main categories. E.g main categories will be "USA","Canada" etc. sub categories will be "places","photos" etc. Is it possible to make this with single wordpress or do i need t... | [
{
"answer_id": 126464,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p>Delete them all. I don’t think a few comments are worth so much of your time.</p>\n\n<p>To clean up the entire table, ... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126466",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43901/"
] | I'm new to wordpress. I want to create some main categories and 5 sub categories for each main category. Sub categories will be same for both main categories. E.g main categories will be "USA","Canada" etc. sub categories will be "places","photos" etc. Is it possible to make this with single wordpress or do i need to i... | Delete them all. I don’t think a few comments are worth so much of your time.
To clean up the entire table, open a SQL console (the plugin [Adminer](http://wordpress.org/plugins/adminer/) has an UI for that) and type:
```
TRUNCATE table wp_comments
```
You might have to change the name if you are using an other pre... |
126,469 | <p>I need to change default color scheme for all users.
The admin bar on my site is vidibile for all users including guests.
The default black color scheme isn't beauty with my design and I would like to change it with cofee scheme. Is there any way to do this?</p>
<p>I already found</p>
<pre><code>add_filter('get_... | [
{
"answer_id": 126476,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 1,
"selected": false,
"text": "<p>You can setup a theme on profile update, and if it present return that from the function hooking <code>get_us... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126469",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28575/"
] | I need to change default color scheme for all users.
The admin bar on my site is vidibile for all users including guests.
The default black color scheme isn't beauty with my design and I would like to change it with cofee scheme. Is there any way to do this?
I already found
```
add_filter('get_user_option_admin_col... | At the moment (3.8) color schemes **do not apply to admin bar at front end** at all, even if user is logged in and has non-default scheme selected.
The shortest way would probably be to force enqueue color scheme at front end:
```
add_action(
'wp_enqueue_scripts',
function () {
wp_enqueue_style(
... |
126,479 | <p>I'm making some changes in my theme. I want that when they visit a Post the header should contain the post author and his URL.
right now I'm using this:</p>
<pre><code>echo '<a href="'.get_author_posts_url().'">'.get_userdata($posts[0]->post_author)->data->display_name.'</a>;
</code></pre>
<p>... | [
{
"answer_id": 126476,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 1,
"selected": false,
"text": "<p>You can setup a theme on profile update, and if it present return that from the function hooking <code>get_us... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126479",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43423/"
] | I'm making some changes in my theme. I want that when they visit a Post the header should contain the post author and his URL.
right now I'm using this:
```
echo '<a href="'.get_author_posts_url().'">'.get_userdata($posts[0]->post_author)->data->display_name.'</a>;
```
the auhtor's display name is working correctly,... | At the moment (3.8) color schemes **do not apply to admin bar at front end** at all, even if user is logged in and has non-default scheme selected.
The shortest way would probably be to force enqueue color scheme at front end:
```
add_action(
'wp_enqueue_scripts',
function () {
wp_enqueue_style(
... |
126,483 | <p>I want to list in a drop-down box all users who have role "author"</p>
<p>How can i do it?</p>
<p>Thank you</p>
| [
{
"answer_id": 126485,
"author": "Ravinder Kumar",
"author_id": 29439,
"author_profile": "https://wordpress.stackexchange.com/users/29439",
"pm_score": 3,
"selected": true,
"text": "<p>you can create a function which gives you all users which have role author in a drop down list.</p>\n\... | 2013/12/14 | [
"https://wordpress.stackexchange.com/questions/126483",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16266/"
] | I want to list in a drop-down box all users who have role "author"
How can i do it?
Thank you | you can create a function which gives you all users which have role author in a drop down list.
**Note**: It is a dummy example modify it as you want( put this function in `functions.php` or custom `plugin` ).
**Use**: Call this function any where in theme like `<?php ravs_author_dropdown_list(); ?>`
```
function ra... |
126,530 | <p>I've created a vertical page template which displays stacked sections (which are simply the content from other wordpress pages). I am having problems displaying the contents of pages which are themselves using templates.</p>
<p>This is the main query I am using to fetch the contents of other pages:</p>
<pre><code>... | [
{
"answer_id": 126562,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 1,
"selected": false,
"text": "<p>The function <a href=\"http://codex.wordpress.org/Function_Reference/get_page\" rel=\"nofollow\"><c... | 2013/12/15 | [
"https://wordpress.stackexchange.com/questions/126530",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22537/"
] | I've created a vertical page template which displays stacked sections (which are simply the content from other wordpress pages). I am having problems displaying the contents of pages which are themselves using templates.
This is the main query I am using to fetch the contents of other pages:
```
<?php
//change to the... | The function [`get_page()`](http://codex.wordpress.org/Function_Reference/get_page) has been **deprecated**, don't use it anymore, use [`get_post()`](http://codex.wordpress.org/Function_Reference/get_post) instead. [`get_page_by_title()`](http://codex.wordpress.org/Function_Reference/get_page_by_title) returns an objec... |
126,547 | <p>Hi i am using the normal loop to get the post content. Objective is to show images or videos in the blog.</p>
<p>I tried <code>the_content()</code> for the loop but am getting the thumbnail image i belive, What i want is the original image should be there.</p>
<p>Here is the code </p>
<pre><code><?php if ( hav... | [
{
"answer_id": 126549,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>Since you say that your image is \"uploaded through add media\", you need to select the full sized image when... | 2013/12/15 | [
"https://wordpress.stackexchange.com/questions/126547",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37102/"
] | Hi i am using the normal loop to get the post content. Objective is to show images or videos in the blog.
I tried `the_content()` for the loop but am getting the thumbnail image i belive, What i want is the original image should be there.
Here is the code
```
<?php if ( have_posts() ) :
while ( have_p... | Since you say that your image is "uploaded through add media", you need to select the full sized image when you attach it to the post, not when you try to display it. You should even see in the markup that a smaller size has been chosen (by you).
Look over on the right side in the sidebar toward the bottom. You should... |
126,609 | <p>How to Add Font Awesome Icons to WordPress Menus</p>
| [
{
"answer_id": 126610,
"author": "RiotAct",
"author_id": 40891,
"author_profile": "https://wordpress.stackexchange.com/users/40891",
"pm_score": 4,
"selected": true,
"text": "<p>I assume you are wanting to add custom icons to the dashboard? Well with the latest update in wordpress to 3.... | 2013/12/16 | [
"https://wordpress.stackexchange.com/questions/126609",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43952/"
] | How to Add Font Awesome Icons to WordPress Menus | I assume you are wanting to add custom icons to the dashboard? Well with the latest update in wordpress to 3.8, dashboard icons have changed. They are now actually a font. This is actually quite cool as fonts can easily change colors with css and are responsive in size as well.
First I will tell you how to add a cust... |
126,626 | <p>The following code adds a text input for a subtitle to the space directly below the title input, via the <code>edit_form_after_title</code> hook. However, when editing the title, pressing tab moves the cursor to the main post editor and I can't figure out what tabindex I should use (or some other method if available... | [
{
"answer_id": 127042,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>You can also try playing with the <code>focusout</code> Javascript <em>event</em> and the <code>focus()</code... | 2013/12/16 | [
"https://wordpress.stackexchange.com/questions/126626",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6477/"
] | The following code adds a text input for a subtitle to the space directly below the title input, via the `edit_form_after_title` hook. However, when editing the title, pressing tab moves the cursor to the main post editor and I can't figure out what tabindex I should use (or some other method if available) in order to ... | I found last part of @birgire answer the most useful way, however it breaks the possibility to *tab* to content. In fact I think is normal focus the content by click tab while in the subtitle field.
To do that, you have also to take care if the content is shown in the "Text" tab or in the "Visual" tab (TynyMCE).
I pu... |
126,669 | <p>I am customizing the twenty thirteen theme and want to add a logo image in the navigation bar before menu items like <a href="http://orangeleafyogurt.com/" rel="nofollow">this link.</a> </p>
<p>I have tried different approaches but didn't work.</p>
<p>Would appreciate any suggestions in this regard.</p>
| [
{
"answer_id": 128145,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 3,
"selected": true,
"text": "<p>Tested on a Twenty Thirteen & Twenty Twelve child theme.</p>\n\n<p><img src=\"https://i.stack.imgur.com/... | 2013/12/16 | [
"https://wordpress.stackexchange.com/questions/126669",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35899/"
] | I am customizing the twenty thirteen theme and want to add a logo image in the navigation bar before menu items like [this link.](http://orangeleafyogurt.com/)
I have tried different approaches but didn't work.
Would appreciate any suggestions in this regard. | Tested on a Twenty Thirteen & Twenty Twelve child theme.

Try this from your child themes functions.php file.
You can add the image using various methods.
```
add_filter( 'wp_nav_menu_items', 'wpsites_add_logo_nav_menu', 10, 2 );
function wpsites... |
126,690 | <p>I'm having an issue with a <code>.mo</code> file.</p>
<p>I have a fully functioning localized custom theme that's running in four languages for the moment: Dutch, English, French and Spanish. There is one problem: the English localization doesn't work. The other languages work just fine.</p>
<p>The translation plu... | [
{
"answer_id": 128145,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 3,
"selected": true,
"text": "<p>Tested on a Twenty Thirteen & Twenty Twelve child theme.</p>\n\n<p><img src=\"https://i.stack.imgur.com/... | 2013/12/16 | [
"https://wordpress.stackexchange.com/questions/126690",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43981/"
] | I'm having an issue with a `.mo` file.
I have a fully functioning localized custom theme that's running in four languages for the moment: Dutch, English, French and Spanish. There is one problem: the English localization doesn't work. The other languages work just fine.
The translation plugin is polylang.
The plugin ... | Tested on a Twenty Thirteen & Twenty Twelve child theme.

Try this from your child themes functions.php file.
You can add the image using various methods.
```
add_filter( 'wp_nav_menu_items', 'wpsites_add_logo_nav_menu', 10, 2 );
function wpsites... |
126,697 | <p>I am surprised with the new colour scheme for 3.8 and although the classic 3.7 theme has gone, I would like to set the new "Light" colour scheme as the default for all users, but at the same time, still allow them to change the theme if they wish, in their user profile.</p>
<p>Has anyone managed to come up with a f... | [
{
"answer_id": 126700,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 5,
"selected": true,
"text": "<p>You can set (in terms of force) a default color within <code>functions.php</code> like this:</p>\n\n<pre><code>ad... | 2013/12/16 | [
"https://wordpress.stackexchange.com/questions/126697",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12651/"
] | I am surprised with the new colour scheme for 3.8 and although the classic 3.7 theme has gone, I would like to set the new "Light" colour scheme as the default for all users, but at the same time, still allow them to change the theme if they wish, in their user profile.
Has anyone managed to come up with a function to... | You can set (in terms of force) a default color within `functions.php` like this:
```
add_filter( 'get_user_option_admin_color', 'update_user_option_admin_color', 5 );
function update_user_option_admin_color( $color_scheme ) {
$color_scheme = 'light';
return $color_scheme;
}
```
Update: The following color... |
126,718 | <p>Whenever I upload a large image, it gets resized to the width of the post. This will be a negative feature for comic reading sites. I need to display the full width images, which I can resize when I need during upload.</p>
<p>If anything that can fix this issue?</p>
| [
{
"answer_id": 126724,
"author": "Mayeenul Islam",
"author_id": 22728,
"author_profile": "https://wordpress.stackexchange.com/users/22728",
"pm_score": 3,
"selected": false,
"text": "<p>WordPress resizes its images into 3 default sizes:</p>\n<ul>\n<li>Large (Default: 1024 × 1024)</li>\n<... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126718",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43911/"
] | Whenever I upload a large image, it gets resized to the width of the post. This will be a negative feature for comic reading sites. I need to display the full width images, which I can resize when I need during upload.
If anything that can fix this issue? | WordPress resizes its images into 3 default sizes:
* Large (Default: 1024 × 1024)
* Medium (Default: 300 × 300)
* Thumbnail (Default: 150 × 150)
And in all the three cases WordPress simply crop them from middle by default, and make their different versions for different use cases. It's done to ensure speed.
When we ... |
126,719 | <p>I want to add the WordPress default colorpicker in widget settings form. Here's what I'm trying:</p>
<p>In my functions.php, I have this:</p>
<pre><code>function widgets_scripts( $hook ) {
if ( 'widgets.php' != $hook ) {
return;
}
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_sc... | [
{
"answer_id": 126734,
"author": "chifliiiii",
"author_id": 4130,
"author_profile": "https://wordpress.stackexchange.com/users/4130",
"pm_score": 2,
"selected": false,
"text": "<p>The following worked for me. I using class attribute instead of ID to match multiple color pickers.</p>\n\n<... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126719",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38318/"
] | I want to add the WordPress default colorpicker in widget settings form. Here's what I'm trying:
In my functions.php, I have this:
```
function widgets_scripts( $hook ) {
if ( 'widgets.php' != $hook ) {
return;
}
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picke... | The following worked for me. I using class attribute instead of ID to match multiple color pickers.
```
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('.color-picker').on('focus', function(){
var parent = jQuery(this).parent();
jQuery(this).... |
126,727 | <p>When the password reset goes out, the name is 'WordPress' and the from address is wordpress@domain.com. I need to change these to the company name.</p>
<p>I'm running WordPress 3.8 multisite and have done the following:</p>
<ul>
<li>Updated general settings name and email address for the subsite</li>
<li>Installe... | [
{
"answer_id": 126731,
"author": "Maruti Mohanty",
"author_id": 37890,
"author_profile": "https://wordpress.stackexchange.com/users/37890",
"pm_score": 4,
"selected": true,
"text": "<p>You can use the following two hooks to change name and email address</p>\n\n<p>Use the following in you... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126727",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25430/"
] | When the password reset goes out, the name is 'WordPress' and the from address is wordpress@domain.com. I need to change these to the company name.
I'm running WordPress 3.8 multisite and have done the following:
* Updated general settings name and email address for the subsite
* Installed 'WP Change Email' plugin an... | You can use the following two hooks to change name and email address
Use the following in your active theme's **`functions.php`** file.
```
add_filter( 'wp_mail_from', 'wpse_new_mail_from' );
function wpse_new_mail_from( $old ) {
return 'your email address'; // Edit it with your email address
}
add_filter('... |
126,739 | <p>I am on a VPS running Nginx as a backend server.</p>
<p>I want to set up a sub-directory multisite WordPress installation, however I want all sub-sites to be under one sub-domain also. For example:</p>
<p>My main site: </p>
<pre><code>domain.com
</code></pre>
<p>Subsites:</p>
<pre><code>clients.domain.com/site1... | [
{
"answer_id": 127066,
"author": "David",
"author_id": 31323,
"author_profile": "https://wordpress.stackexchange.com/users/31323",
"pm_score": 0,
"selected": false,
"text": "<p>You can use a drop-in called <code>sunrise.php</code> to change the way, WordPress maps the request on a blog i... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126739",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15163/"
] | I am on a VPS running Nginx as a backend server.
I want to set up a sub-directory multisite WordPress installation, however I want all sub-sites to be under one sub-domain also. For example:
My main site:
```
domain.com
```
Subsites:
```
clients.domain.com/site1
clients.domain.com/site2
clients.domain.com/site3
... | This has been solved, please note I am using Wordpress 3.8 at the time of writing this, if you are from the future these plugins may not work with your current version, please check compatibility first.
The plugin [WP Multi Network](http://wordpress.org/plugins/wp-multi-network/installation/) provides this functionali... |
126,742 | <p>How do I change the search url?
I already have something like: /search/keyword
But I want to change /search to something else.</p>
<p>How can I do it?</p>
<p>Thank you!</p>
| [
{
"answer_id": 126744,
"author": "luke",
"author_id": 34790,
"author_profile": "https://wordpress.stackexchange.com/users/34790",
"pm_score": 0,
"selected": false,
"text": "<p>Add this to your functions.php in your theme folder:</p>\n\n<pre><code>function change_search_url_rewrite() {\n ... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126742",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9585/"
] | How do I change the search url?
I already have something like: /search/keyword
But I want to change /search to something else.
How can I do it?
Thank you! | Ok, the solution I'm now using is to create a rewrite rule in .htaccess (on the root of wp project) like this:
```
RewriteCond %{QUERY_STRING} ^s=([^\&]*)$
RewriteRule ^(.*)$ /pesquisar/%1 [NE,L,R=301]
```
I don't know if it's the best solution but seems to be working ok! |
126,750 | <p>I have set up an archive page for my custom post type <code>reference</code>, where I use a query to get all posts of type <code>reference</code>. This works, but when I try to paginate the result, it doesn't work. Right now, it doesn't even print out the pagination links.</p>
<p>EDIT: This was earlier used on a re... | [
{
"answer_id": 126744,
"author": "luke",
"author_id": 34790,
"author_profile": "https://wordpress.stackexchange.com/users/34790",
"pm_score": 0,
"selected": false,
"text": "<p>Add this to your functions.php in your theme folder:</p>\n\n<pre><code>function change_search_url_rewrite() {\n ... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126750",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43933/"
] | I have set up an archive page for my custom post type `reference`, where I use a query to get all posts of type `reference`. This works, but when I try to paginate the result, it doesn't work. Right now, it doesn't even print out the pagination links.
EDIT: This was earlier used on a regular page, but I changed it to ... | Ok, the solution I'm now using is to create a rewrite rule in .htaccess (on the root of wp project) like this:
```
RewriteCond %{QUERY_STRING} ^s=([^\&]*)$
RewriteRule ^(.*)$ /pesquisar/%1 [NE,L,R=301]
```
I don't know if it's the best solution but seems to be working ok! |
126,761 | <p>I'm aware this is a topic discussed to death, but I have read through many solutions and can't understand why my pagination simply isn't working.</p>
<p>I have a very simple custom wp_query:</p>
<pre><code>$current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$project_query = new WP_query(array(
... | [
{
"answer_id": 126770,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 1,
"selected": false,
"text": "<p>Your main problems are:</p>\n\n<ul>\n<li>You got no Error reporting/debug turned on: <code>WP_Query</code> vs. <co... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126761",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8967/"
] | I'm aware this is a topic discussed to death, but I have read through many solutions and can't understand why my pagination simply isn't working.
I have a very simple custom wp\_query:
```
$current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$project_query = new WP_query(array(
'post_type' => 'pr... | I think most pagination issues stem from a misunderstanding of the query and template loading process that happens before you are executing code within a template file.
When someone requests a page:
1. WordPress parses the request and decides what it's for based on the incoming URL. For example, is it the main root p... |
126,764 | <p>I am trying to get a custom field value (Field "bildname") as my post title, and another (Field "bildbeschreibung") as my content in my Custom Post Type.
It is not really working though. First it kept outputting "Auto Draft" for my Title.
SO I started researching here, then I managed to make it visible as Title in t... | [
{
"answer_id": 126767,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": true,
"text": "<p>The solution you are working on will always represent multiple database inserts as the post will be saved and... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126764",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42572/"
] | I am trying to get a custom field value (Field "bildname") as my post title, and another (Field "bildbeschreibung") as my content in my Custom Post Type.
It is not really working though. First it kept outputting "Auto Draft" for my Title.
SO I started researching here, then I managed to make it visible as Title in the ... | The solution you are working on will always represent multiple database inserts as the post will be saved and then the the title re-saved in a second database write. That is the nature of the `save_post` hook, since it runs after the primary post save.
Additionally, the code you found is wildly overcomplicated.
Inte... |
126,765 | <p>I have tried a code posted here>><a href="https://wordpress.stackexchange.com/questions/12143/custom-post-type-get-most-recent-permalink">Custom Post Type: Get most recent permalink</a></p>
<p>But the thing is-it is showing only one post from the recent and without get_the_title,,, can anyone help me to achieve, up... | [
{
"answer_id": 126768,
"author": "Sachit",
"author_id": 41471,
"author_profile": "https://wordpress.stackexchange.com/users/41471",
"pm_score": 1,
"selected": false,
"text": "<p>Assuming you know how to use WP_Query, you can use following code to get recent 10 posts for any custom post t... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126765",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37778/"
] | I have tried a code posted here>>[Custom Post Type: Get most recent permalink](https://wordpress.stackexchange.com/questions/12143/custom-post-type-get-most-recent-permalink)
But the thing is-it is showing only one post from the recent and without get\_the\_title,,, can anyone help me to achieve, upto 10 posts' Title ... | [The answer is essentially in Codex!](https://developer.wordpress.org/reference/functions/wp_get_recent_posts/)
```
<h2>Recent Posts</h2>
<ul>
<?php
$recent_posts = wp_get_recent_posts(array('post_type'=>'book'));
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID"]) ... |
126,772 | <p>I'm working on a custom taxonomy term page template where we want the items that are connected to the term sorted by a publication date (custom date field) - and if there are multiple items on the same day (formatted like YYYY-MM-DD) to then sort those by title, and finally sort by title if the custom field has not ... | [
{
"answer_id": 126773,
"author": "GhostToast",
"author_id": 13676,
"author_profile": "https://wordpress.stackexchange.com/users/13676",
"pm_score": 2,
"selected": false,
"text": "<p>I think you'd need to do 2 separate loops. You can capture all the posts found in the first loop and exclu... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126772",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44010/"
] | I'm working on a custom taxonomy term page template where we want the items that are connected to the term sorted by a publication date (custom date field) - and if there are multiple items on the same day (formatted like YYYY-MM-DD) to then sort those by title, and finally sort by title if the custom field has not bee... | Thank you everyone for your help!
In the end the query below got me the results I desired - which was to show and sort the posts by a custom field of "publication\_date" first - sorting by the date, and if there were multiple of the same date (say, 4 marked June 2013), it would sort those by title. Then, after it runs... |
126,796 | <p>It began with version <code>3.7.1</code>:</p>
<blockquote>
<p>You are using WordPress 3.7.1. Update to 3.7.1</p>
</blockquote>
<p>I've installed and usually update WP with git from <code>https://github.com/wordpress/wordpress</code>:</p>
<pre><code>cd wordpress
git fetch --tags
git checkout 3.8
</code></pre>
<... | [
{
"answer_id": 126822,
"author": "Ipstenu",
"author_id": 7886,
"author_profile": "https://wordpress.stackexchange.com/users/7886",
"pm_score": 1,
"selected": false,
"text": "<p>Don't use the update now button, use a full on download of the core WP - <a href=\"http://wordpress.org/downloa... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12021/"
] | It began with version `3.7.1`:
>
> You are using WordPress 3.7.1. Update to 3.7.1
>
>
>
I've installed and usually update WP with git from `https://github.com/wordpress/wordpress`:
```
cd wordpress
git fetch --tags
git checkout 3.8
```
Then I usually download localized version (`ru_RU`) and copy over updated l... | Don't use the update now button, use a full on download of the core WP - <http://wordpress.org/download/> - and then make sure you flush any cache you've got running. Do you have memcached or APC or xcache? Purge that. Plugins ditto.
I saw that on one of my sites where my server's object cache hung on to things. I wen... |
126,814 | <p>Im Using a post query in wordpress BUT the Pagination is not working, i don't know whats the problem BUT here is my code and i guess it's correct and no problem with it</p>
<p>it shows that there is pages BUT when i Click on Next Page it refresh the page and don't show any new results just the same page.</p>
<p>Im... | [
{
"answer_id": 136497,
"author": "ewroman",
"author_id": 44722,
"author_profile": "https://wordpress.stackexchange.com/users/44722",
"pm_score": 1,
"selected": false,
"text": "<p>This solution needs to be revised for that pagination functions are in functions.php.</p>\n\n<p>I am using Re... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126814",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44031/"
] | Im Using a post query in wordpress BUT the Pagination is not working, i don't know whats the problem BUT here is my code and i guess it's correct and no problem with it
it shows that there is pages BUT when i Click on Next Page it refresh the page and don't show any new results just the same page.
Im Using it on Stat... | This solution needs to be revised for that pagination functions are in functions.php.
I am using Reverie master theme (which uses foundation framework), that theme uses pagination function which is in functions.php
```
if( ! function_exists( 'reverie_pagination' ) ) {
function reverie_pagination() {
global $wp_qu... |
126,816 | <p>I'm running WP multi-site and I've created a plugin that adds meta boxes to my page and post.</p>
<pre><code>add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'post', 'normal', 'high' );
add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'page', 'normal', 'high' );
</code></pre>
<p>The p... | [
{
"answer_id": 126817,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 3,
"selected": true,
"text": "<p>I'm not sure what you mean by \"unknown custom posts\", but here is how you'd add a meta box to a number of p... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126816",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1447/"
] | I'm running WP multi-site and I've created a plugin that adds meta boxes to my page and post.
```
add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'post', 'normal', 'high' );
add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'page', 'normal', 'high' );
```
The problem is that this isn't ... | I'm not sure what you mean by "unknown custom posts", but here is how you'd add a meta box to a number of post types:
```
$post_types = array(
'post',
'page',
'my_custom_post_type',
);
foreach ($post_types as $post_type)
add_meta_box('Intro', __('Intro'), 'my_meta_box', $post_type, 'normal', 'high');
... |
126,820 | <p>By default, my theme is showing an author box below my posts. I am using a custom post type, and would like to remove this author box only on this post type. Here is how the theme is calling the author box:</p>
<pre><code>add_action( 'wp_head', 'woo_author', 10 );
if ( ! function_exists( 'woo_author' ) ) {
functio... | [
{
"answer_id": 126831,
"author": "Shazzad",
"author_id": 42967,
"author_profile": "https://wordpress.stackexchange.com/users/42967",
"pm_score": 3,
"selected": true,
"text": "<p>Query variable only can be accessed after <code>wp_query</code> has been called. In you call, the <code>get_po... | 2013/12/17 | [
"https://wordpress.stackexchange.com/questions/126820",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35695/"
] | By default, my theme is showing an author box below my posts. I am using a custom post type, and would like to remove this author box only on this post type. Here is how the theme is calling the author box:
```
add_action( 'wp_head', 'woo_author', 10 );
if ( ! function_exists( 'woo_author' ) ) {
function woo_author (... | Query variable only can be accessed after `wp_query` has been called. In you call, the `get_post_type()` function is actually returning an empty value. It should be working, if you change the hook to something which fires after wp\_query is called.
So, You should use -
```
add_action('wp', 'kiwi_remove_post_author_... |
126,834 | <p>When to use template tags and when to use <code>get_template_part()</code> and when to use <code>function.php</code>? I am confused at them.</p>
<p>For example, if I want to show related portfolios under single portfolio, I can create a template tag named <code>show_related_portfolios()</code>. </p>
<p>In contrast... | [
{
"answer_id": 126842,
"author": "Shazzad",
"author_id": 42967,
"author_profile": "https://wordpress.stackexchange.com/users/42967",
"pm_score": 2,
"selected": false,
"text": "<p><code>get_template_part()</code> should be a correct choice. Because, </p>\n\n<ul>\n<li>If the template file ... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126834",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40607/"
] | When to use template tags and when to use `get_template_part()` and when to use `function.php`? I am confused at them.
For example, if I want to show related portfolios under single portfolio, I can create a template tag named `show_related_portfolios()`.
In contrast, I can create a file named `content-related-portf... | A template tag is just a function, so I can't understand the difference from a function in `functions.php` and a template tag.
So the choiches are 2: function VS file.
The right choice depend case by case, and all things **@shazzad** pointed found me agree.
I prefer use file and `get_template_part` when the code nee... |
126,835 | <p>I have a front end form that let users submit a post.</p>
<p>This is how i store the data when a post is submitted :</p>
<pre><code>if ( isset( $_POST['submitted'] )) {
$post_information = array(
'post_title' => wp_strip_all_tags( $_POST['postTitle'] ),
'post_content' => $_POST['postC... | [
{
"answer_id": 126839,
"author": "jogesh_pi",
"author_id": 13331,
"author_profile": "https://wordpress.stackexchange.com/users/13331",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure but i think that is because of you didn't added the author into the <code>$post_information</... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126835",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38722/"
] | I have a front end form that let users submit a post.
This is how i store the data when a post is submitted :
```
if ( isset( $_POST['submitted'] )) {
$post_information = array(
'post_title' => wp_strip_all_tags( $_POST['postTitle'] ),
'post_content' => $_POST['postContent'],
'post_typ... | The post gets added and published but since you have the meta query and the meta key is not added when you submit the post from frontend, it does not show up. Use the following code which adds the meta data as needed.
```
if ( isset( $_POST['submitted'] ) ) {
$post_information = array(
... |
126,841 | <p>trying to create one plugin, getting some issue to submit the array data in wordpress database.</p>
<p>$formDATA gets the array value now issue is when</p>
<pre><code> $sql = "INSERT INTO `".$table_name ."` (`paid_arr`) VALUES '".$formDATA."'";
$result = $wpdb->insert($table_name,$formDATA);
</code></pr... | [
{
"answer_id": 126839,
"author": "jogesh_pi",
"author_id": 13331,
"author_profile": "https://wordpress.stackexchange.com/users/13331",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure but i think that is because of you didn't added the author into the <code>$post_information</... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126841",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44040/"
] | trying to create one plugin, getting some issue to submit the array data in wordpress database.
$formDATA gets the array value now issue is when
```
$sql = "INSERT INTO `".$table_name ."` (`paid_arr`) VALUES '".$formDATA."'";
$result = $wpdb->insert($table_name,$formDATA);
```
getting strange warnings and ... | The post gets added and published but since you have the meta query and the meta key is not added when you submit the post from frontend, it does not show up. Use the following code which adds the meta data as needed.
```
if ( isset( $_POST['submitted'] ) ) {
$post_information = array(
... |
126,852 | <p>Since I have a website for <strong>Comic reading</strong>, if I use reduced image sizes, it will also reduce the text which will be difficult to read. I want to retain the image size. No problem even if it creates a scrolling window. The post width should adjust to the image.</p>
<p>Anything that will work? I have ... | [
{
"answer_id": 126839,
"author": "jogesh_pi",
"author_id": 13331,
"author_profile": "https://wordpress.stackexchange.com/users/13331",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure but i think that is because of you didn't added the author into the <code>$post_information</... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126852",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43911/"
] | Since I have a website for **Comic reading**, if I use reduced image sizes, it will also reduce the text which will be difficult to read. I want to retain the image size. No problem even if it creates a scrolling window. The post width should adjust to the image.
Anything that will work? I have tried setting 0,0 value... | The post gets added and published but since you have the meta query and the meta key is not added when you submit the post from frontend, it does not show up. Use the following code which adds the meta data as needed.
```
if ( isset( $_POST['submitted'] ) ) {
$post_information = array(
... |
126,869 | <p>i want to custome post by ASC. i have some add some post in bachend one of the field date picker. i want to post by date which i set in date picker field </p>
<pre><code><?php
$args = array(
'post_type'=>'upcoming_events',
'order' => 'ASC',
);
global $mor... | [
{
"answer_id": 126839,
"author": "jogesh_pi",
"author_id": 13331,
"author_profile": "https://wordpress.stackexchange.com/users/13331",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure but i think that is because of you didn't added the author into the <code>$post_information</... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126869",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44054/"
] | i want to custome post by ASC. i have some add some post in bachend one of the field date picker. i want to post by date which i set in date picker field
```
<?php
$args = array(
'post_type'=>'upcoming_events',
'order' => 'ASC',
);
global $more;
query_posts( ... | The post gets added and published but since you have the meta query and the meta key is not added when you submit the post from frontend, it does not show up. Use the following code which adds the meta data as needed.
```
if ( isset( $_POST['submitted'] ) ) {
$post_information = array(
... |
126,887 | <p>So I have a <code>wp_query</code> which is getting the 5 most recent posts from my Wordpress site. What I want to do is from within this query, grab the most recent post and show this as a sort of 'hero' post, and then take the other 4 posts (could be more than 4 if I change the query at a later date) and show in a ... | [
{
"answer_id": 126888,
"author": "sri",
"author_id": 34200,
"author_profile": "https://wordpress.stackexchange.com/users/34200",
"pm_score": 1,
"selected": false,
"text": "<p>Changing your query args to something like below will order your posts by modified date.</p>\n\n<pre><code>$quer... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126887",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27548/"
] | So I have a `wp_query` which is getting the 5 most recent posts from my Wordpress site. What I want to do is from within this query, grab the most recent post and show this as a sort of 'hero' post, and then take the other 4 posts (could be more than 4 if I change the query at a later date) and show in a list or grid b... | You can use [`$current_post` property of `WP_Query`](http://codex.wordpress.org/Class_Reference/WP_Query#Properties)
```
$query_args = array(
"posts_per_page" => "5"
);
$listedPosts = new WP_Query($query_args);
// the loop
if ( $listedPosts->have_posts() ) {
while ( $listedPosts->have_posts() ) {
$l... |
126,922 | <p>I have removed the post menu from the admin side bar like so:</p>
<pre><code>add_action('admin_menu','remove_default_post_type');
function remove_default_post_type() {
remove_menu_page('edit.php');
}
</code></pre>
<p>How can I now remove it from the top bar 'new' menu as well?</p>
| [
{
"answer_id": 126924,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 0,
"selected": false,
"text": "<p>To remove submenus you can inspect the menu you will see every <code>li</code> will have an ID similar to <... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126922",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44049/"
] | I have removed the post menu from the admin side bar like so:
```
add_action('admin_menu','remove_default_post_type');
function remove_default_post_type() {
remove_menu_page('edit.php');
}
```
How can I now remove it from the top bar 'new' menu as well? | The users can still create new posts if the URL is known, like;
`domain.com/wp-admin/post-new.php`
Here is the code you can use for that ... added it to the file `functions.php`
```
function hide_add_new() {
global $submenu;
// For Removing New Posts from Admin Menu
unset($submenu['post-new.php?post_type=p... |
126,930 | <p>I know this may not be possible.But just trying to know wordpress deeply.
Is it possible to replace default admin login page with custom one?</p>
| [
{
"answer_id": 126933,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 2,
"selected": false,
"text": "<p>I personally like to use something like this. This will look for a <code>logo</code> image in your template... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126930",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/30937/"
] | I know this may not be possible.But just trying to know wordpress deeply.
Is it possible to replace default admin login page with custom one? | I personally like to use something like this. This will look for a `logo` image in your templates `/images/` folder or directory, then display it in place of the default Wordpress Logo.
```
function my_login_logo() {
if(file_exists(TEMPLATEPATH.'/images/logo.png'))
$logo = '/images/logo.png';
else if(... |
126,943 | <p>This thing has really confused me, when writting a custom query with <code>wp_query</code> we have pass multiple arguments. But i am using woocommerce, and i found this part of query on some form, which is</p>
<pre><code>$args = array(
'post_type' => 'product',
'meta_key' => '_featured',
'meta_value' =&... | [
{
"answer_id": 126945,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": true,
"text": "<p>On the post edit screen you can have the »Custom Fields« meta box, looking somewhat like shown <a hr... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126943",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33028/"
] | This thing has really confused me, when writting a custom query with `wp_query` we have pass multiple arguments. But i am using woocommerce, and i found this part of query on some form, which is
```
$args = array(
'post_type' => 'product',
'meta_key' => '_featured',
'meta_value' => 'yes',
'posts_per_page' => 1... | On the post edit screen you can have the »Custom Fields« meta box, looking somewhat like shown [here](http://codex.wordpress.org/Custom_Fields#Usage). You might have to enable it via the [screen options](http://codex.wordpress.org/Dashboard_Screen#Screen_Options). This way you can see the meta data for the edited post,... |
126,960 | <p>I am unable to install plugins on my Centos 6 VPS. When I attempt the install I get this:</p>
<blockquote>
<p>Installing Plugin: BotDetect WordPress CAPTCHA 3.0.Beta1.7</p>
<p>Downloading install package from <br>
[web path to:]botdetect-wp-captcha.zip…<br>
Unpacking the package…<br>
Could not create d... | [
{
"answer_id": 126967,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>This problem doesn't seem to be regarding CentOS but the permissions of your folders. Try creating the plugins fo... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126960",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44025/"
] | I am unable to install plugins on my Centos 6 VPS. When I attempt the install I get this:
>
> Installing Plugin: BotDetect WordPress CAPTCHA 3.0.Beta1.7
>
>
> Downloading install package from
>
> [web path to:]botdetect-wp-captcha.zip…
>
> Unpacking the package…
>
> Could not create directory.
>
> ... | Okay, I figured this out based upon suggestions from [StackOverflow](https://stackoverflow.com/questions/20673184/wordpress-fails-to-install-plugins-unable-to-locate-wordpress-plugin-directory). This is how I resolved this issue:
```
I created a group called ftpusers.
groupadd ftpusers
I added my wordpress user to t... |
126,974 | <p>I'm creating a wordpress theme in which I'm using the <a href="http://wordpress.org/plugins/redux-framework/installation/" rel="nofollow">Redux Framework</a> for creating the theme's options page. Now I believe everything is well set up but I'm having trouble in getting the values changed by Redux in my front end. <... | [
{
"answer_id": 127307,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>I have no idea how the framework actually stores its options, but I guess it uses the name <code>redux_demo</code>, no... | 2013/12/18 | [
"https://wordpress.stackexchange.com/questions/126974",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43834/"
] | I'm creating a wordpress theme in which I'm using the [Redux Framework](http://wordpress.org/plugins/redux-framework/installation/) for creating the theme's options page. Now I believe everything is well set up but I'm having trouble in getting the values changed by Redux in my front end.
For example I checked one of... | I have no idea how the framework actually stores its options, but I guess it uses the name `redux_demo`, not `redux_demo[10]`. If the option is an array, you can access the element `10` like this:
```
$redux_demo = get_option( 'redux_demo' );
if ( ! empty ( $redux_demo[ 10 ] ) and 1 === $redux_demo[ 10 ] )
{
prin... |
126,979 | <p>I want to do something like this but can't manage to figure it out.
[Click][1]</p>
<p>I am using this custom WP_Query to display upcoming events on my homepage.</p>
<pre><code> $events_args = array(
'post_type' => VA_EVENT_PTYPE,
'posts_per_page' => $number,
'no_found_rows' =&g... | [
{
"answer_id": 127307,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>I have no idea how the framework actually stores its options, but I guess it uses the name <code>redux_demo</code>, no... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/126979",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44088/"
] | I want to do something like this but can't manage to figure it out.
[Click][1]
I am using this custom WP\_Query to display upcoming events on my homepage.
```
$events_args = array(
'post_type' => VA_EVENT_PTYPE,
'posts_per_page' => $number,
'no_found_rows' => true,
'post_status... | I have no idea how the framework actually stores its options, but I guess it uses the name `redux_demo`, not `redux_demo[10]`. If the option is an array, you can access the element `10` like this:
```
$redux_demo = get_option( 'redux_demo' );
if ( ! empty ( $redux_demo[ 10 ] ) and 1 === $redux_demo[ 10 ] )
{
prin... |
126,991 | <p>I'm writing a plugin that automatically creates a bunch of stuff ie categories and child categories. But when I use the following code to create the categories: (from <a href="http://codex.wordpress.org/Function_Reference/wp_insert_category" rel="nofollow">wp codex</a>)</p>
<pre><code>//Create Post Categories
$my_c... | [
{
"answer_id": 127002,
"author": "Sabita Sahoo",
"author_id": 43570,
"author_profile": "https://wordpress.stackexchange.com/users/43570",
"pm_score": 0,
"selected": false,
"text": "<p>Try to use wp_insert_term() in place of wp_insert_category(). You can use the following code:</p>\n\n<pr... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/126991",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44088/"
] | I'm writing a plugin that automatically creates a bunch of stuff ie categories and child categories. But when I use the following code to create the categories: (from [wp codex](http://codex.wordpress.org/Function_Reference/wp_insert_category))
```
//Create Post Categories
$my_cat = array(
'cat_ID' => 1146,
'c... | Ok here is the solution I found:
You are not meant to set IDs when creating new objects like categories. Instead I created the parent categories first using something like
```
$my_cat = array(
'cat_name' => 'Community News & Views',
'category_nicename' => 'news',
'taxonomy' => 'category'
);
$my_cat_id = ... |
126,997 | <p>I am trying to get ID of post on HOME page .So far my coding is </p>
<pre><code>wp_enqueue_script( 'my-ajax-request', get_stylesheet_directory_uri() . '/js/ajax.js', array( 'jquery' ) );
wp_localize_script( 'my-ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
add_action('wp_ajax_no... | [
{
"answer_id": 127002,
"author": "Sabita Sahoo",
"author_id": 43570,
"author_profile": "https://wordpress.stackexchange.com/users/43570",
"pm_score": 0,
"selected": false,
"text": "<p>Try to use wp_insert_term() in place of wp_insert_category(). You can use the following code:</p>\n\n<pr... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/126997",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/30937/"
] | I am trying to get ID of post on HOME page .So far my coding is
```
wp_enqueue_script( 'my-ajax-request', get_stylesheet_directory_uri() . '/js/ajax.js', array( 'jquery' ) );
wp_localize_script( 'my-ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
add_action('wp_ajax_nopriv_ajax_request... | Ok here is the solution I found:
You are not meant to set IDs when creating new objects like categories. Instead I created the parent categories first using something like
```
$my_cat = array(
'cat_name' => 'Community News & Views',
'category_nicename' => 'news',
'taxonomy' => 'category'
);
$my_cat_id = ... |
127,003 | <p>I recently forgot login to my wordpress, I changed password in mysql to md5 and can now login... But when i do i get:</p>
<p>"Please enter your username or email address. You will receive a link to create a new password via email. Your password must be reset. Please submit this form to reset it."</p>
<p>and the Pr... | [
{
"answer_id": 127002,
"author": "Sabita Sahoo",
"author_id": 43570,
"author_profile": "https://wordpress.stackexchange.com/users/43570",
"pm_score": 0,
"selected": false,
"text": "<p>Try to use wp_insert_term() in place of wp_insert_category(). You can use the following code:</p>\n\n<pr... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127003",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/39044/"
] | I recently forgot login to my wordpress, I changed password in mysql to md5 and can now login... But when i do i get:
"Please enter your username or email address. You will receive a link to create a new password via email. Your password must be reset. Please submit this form to reset it."
and the Problem is my serve... | Ok here is the solution I found:
You are not meant to set IDs when creating new objects like categories. Instead I created the parent categories first using something like
```
$my_cat = array(
'cat_name' => 'Community News & Views',
'category_nicename' => 'news',
'taxonomy' => 'category'
);
$my_cat_id = ... |
127,022 | <p>Is there a way to prevent "subscribers" from editing specific fields in their profile, like email?</p>
<p>I thought it would be simple enough, but I've read though quite a few posts about it around the web (including this one <a href="https://wordpress.stackexchange.com/questions/11717/prevent-users-from-changing-t... | [
{
"answer_id": 127002,
"author": "Sabita Sahoo",
"author_id": 43570,
"author_profile": "https://wordpress.stackexchange.com/users/43570",
"pm_score": 0,
"selected": false,
"text": "<p>Try to use wp_insert_term() in place of wp_insert_category(). You can use the following code:</p>\n\n<pr... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127022",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37651/"
] | Is there a way to prevent "subscribers" from editing specific fields in their profile, like email?
I thought it would be simple enough, but I've read though quite a few posts about it around the web (including this one [prevent users from changing their email address](https://wordpress.stackexchange.com/questions/1171... | Ok here is the solution I found:
You are not meant to set IDs when creating new objects like categories. Instead I created the parent categories first using something like
```
$my_cat = array(
'cat_name' => 'Community News & Views',
'category_nicename' => 'news',
'taxonomy' => 'category'
);
$my_cat_id = ... |
127,031 | <p>I use a dropdownbox to show all custom types ('abschreibungstabelle'). It works fine. But now, I want to show the value of the custom field 'nutzungsdauer' in my input-field. Any ideas?</p>
<pre><code> <input type="text" class="text-input" placeholder="Nutzungsdauer" value="" name="nutzungsdauer" id="nd">
</... | [
{
"answer_id": 127002,
"author": "Sabita Sahoo",
"author_id": 43570,
"author_profile": "https://wordpress.stackexchange.com/users/43570",
"pm_score": 0,
"selected": false,
"text": "<p>Try to use wp_insert_term() in place of wp_insert_category(). You can use the following code:</p>\n\n<pr... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127031",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37959/"
] | I use a dropdownbox to show all custom types ('abschreibungstabelle'). It works fine. But now, I want to show the value of the custom field 'nutzungsdauer' in my input-field. Any ideas?
```
<input type="text" class="text-input" placeholder="Nutzungsdauer" value="" name="nutzungsdauer" id="nd">
```
function.php
``... | Ok here is the solution I found:
You are not meant to set IDs when creating new objects like categories. Instead I created the parent categories first using something like
```
$my_cat = array(
'cat_name' => 'Community News & Views',
'category_nicename' => 'news',
'taxonomy' => 'category'
);
$my_cat_id = ... |
127,034 | <p>I have a problem to get category id of current post. We are using <code><?php get_the_category( $id ) ?></code> for finding out category of current post.
If a post like 'demo' has 2 category like cat1 and cat2. When i open a cat1 page and then go to demo page, i want different layout.. and when i open a cat2 p... | [
{
"answer_id": 127035,
"author": "Gaffen",
"author_id": 44004,
"author_profile": "https://wordpress.stackexchange.com/users/44004",
"pm_score": 0,
"selected": false,
"text": "<pre><code><?php $categories = get_the_category( $post->ID ); ?>\n</code></pre>\n\n<p>This will return a... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127034",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41003/"
] | I have a problem to get category id of current post. We are using `<?php get_the_category( $id ) ?>` for finding out category of current post.
If a post like 'demo' has 2 category like cat1 and cat2. When i open a cat1 page and then go to demo page, i want different layout.. and when i open a cat2 page and then go to d... | WordPress has a function [`wp_get_referer`](https://codex.wordpress.org/Function_Reference/wp_get_referer), which gets the referring url from the http-header. So, if you go from a category archive to a single post, the name of the category will normally be included in that url. This means you can start your `single.php... |
127,039 | <p>Could anyone help me with this please?
I am trying to install my wp theme Recital (it came out quite recently), but when I upload the zip and press install, it says Could not create directory...</p>
<p>What am I supposed to do?</p>
| [
{
"answer_id": 208696,
"author": "lintuxvi",
"author_id": 47539,
"author_profile": "https://wordpress.stackexchange.com/users/47539",
"pm_score": 2,
"selected": false,
"text": "<p>If you can log into your host with SSH or FTP, it's an easy fix. Like the comments said before, check your p... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127039",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44118/"
] | Could anyone help me with this please?
I am trying to install my wp theme Recital (it came out quite recently), but when I upload the zip and press install, it says Could not create directory...
What am I supposed to do? | If you can log into your host with SSH or FTP, it's an easy fix. Like the comments said before, check your permissions for the Wordpress directory. For example, if you check the hosting directory with `ls -al` (typically `/var/www`, as on DigitalOcean), they should look something like this:
```
drwxrwxr-x 6 www-data ... |
127,048 | <p>I have a child theme from Genesis framework. How can I create a child theme of it.
Actually I need to do some changes, so if I'm changing in my child theme, then if any future updates comes I can not update. Is there any way? </p>
| [
{
"answer_id": 208696,
"author": "lintuxvi",
"author_id": 47539,
"author_profile": "https://wordpress.stackexchange.com/users/47539",
"pm_score": 2,
"selected": false,
"text": "<p>If you can log into your host with SSH or FTP, it's an easy fix. Like the comments said before, check your p... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127048",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38156/"
] | I have a child theme from Genesis framework. How can I create a child theme of it.
Actually I need to do some changes, so if I'm changing in my child theme, then if any future updates comes I can not update. Is there any way? | If you can log into your host with SSH or FTP, it's an easy fix. Like the comments said before, check your permissions for the Wordpress directory. For example, if you check the hosting directory with `ls -al` (typically `/var/www`, as on DigitalOcean), they should look something like this:
```
drwxrwxr-x 6 www-data ... |
127,075 | <p>I have registered a custom post type and I want to create a page where I will list some posts, it will be like an index page.</p>
<p>I have created an archive page called <strong>mycpt-archive.php</strong> and a page called <strong>myCPT.php</strong>. </p>
<p>I've added a custom URL in the menu called "myCPT" lik... | [
{
"answer_id": 127079,
"author": "eduardogoncalves",
"author_id": 44085,
"author_profile": "https://wordpress.stackexchange.com/users/44085",
"pm_score": 3,
"selected": true,
"text": "<p>If you have: <br /><br />\n<code>\nregister_post_type( 'my_custom_post_type', $args );\n</code>\n<br ... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127075",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12572/"
] | I have registered a custom post type and I want to create a page where I will list some posts, it will be like an index page.
I have created an archive page called **mycpt-archive.php** and a page called **myCPT.php**.
I've added a custom URL in the menu called "myCPT" like this : **www.mywebsite.com/mycpt**
Now, w... | If you have:
`register_post_type( 'my_custom_post_type', $args );`
And you need a custom page to displays all entries from this custom post type, you have to create: `archive-my_custom_post_type.php`.
But if you don't need a custom page, wordpress will use archive.php to display you custom post type archive.
If y... |
127,081 | <p>How to query for a list of users along with the blogs in which they are member of in a multi site wordpress installation.</p>
<p>For example, I need the results as below</p>
<pre><code>user domain
abc xyz.com
abc example.com
ggh example.com
</code></pre>
<p>I tried the below query, but its not listing all the ... | [
{
"answer_id": 127086,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 3,
"selected": true,
"text": "<p>You can use <a href=\"http://codex.wordpress.org/Function_Reference/get_blogs_of_user\" rel=\"nofollow\"><code>g... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127081",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44139/"
] | How to query for a list of users along with the blogs in which they are member of in a multi site wordpress installation.
For example, I need the results as below
```
user domain
abc xyz.com
abc example.com
ggh example.com
```
I tried the below query, but its not listing all the domains..
```
SELECT DISTINCT a... | You can use [`get_blogs_of_user()`](http://codex.wordpress.org/Function_Reference/get_blogs_of_user) to get all the blogs of a given user.
So to get a list sorted by the users:
```
global $wpdb;
$blogs = array();
$user_ids = $wpdb->get_col( 'SELECT ID FROM $wpdb->users' );
foreach( $user_ids as $user_id ) {
$blog... |
127,083 | <p>I'm trying to setup a shortcode to show a single random user each time the page is refreshed. I've been successful in displaying <strong>all</strong> users or a select user by the user ID.</p>
<p>Here is my shortcode as it is now:</p>
<pre><code>//* Shortcode for getting users
function list_of_users( $atts ) {
... | [
{
"answer_id": 127086,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 3,
"selected": true,
"text": "<p>You can use <a href=\"http://codex.wordpress.org/Function_Reference/get_blogs_of_user\" rel=\"nofollow\"><code>g... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127083",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5295/"
] | I'm trying to setup a shortcode to show a single random user each time the page is refreshed. I've been successful in displaying **all** users or a select user by the user ID.
Here is my shortcode as it is now:
```
//* Shortcode for getting users
function list_of_users( $atts ) {
extract( shortcode_atts(
... | You can use [`get_blogs_of_user()`](http://codex.wordpress.org/Function_Reference/get_blogs_of_user) to get all the blogs of a given user.
So to get a list sorted by the users:
```
global $wpdb;
$blogs = array();
$user_ids = $wpdb->get_col( 'SELECT ID FROM $wpdb->users' );
foreach( $user_ids as $user_id ) {
$blog... |
127,088 | <p>I'm coding a widget and I'd like the user to be able to pick a link like you can when editing a regular posts or page (when you click on the little link icon and you get the AJAX search functionality in the pop up). Does anyone know how I get this working? I've got a HTML button which I would like to attach and clic... | [
{
"answer_id": 129726,
"author": "MikeNGarrett",
"author_id": 1670,
"author_profile": "https://wordpress.stackexchange.com/users/1670",
"pm_score": 0,
"selected": false,
"text": "<blockquote>\n <p>RE: \"How would you do it? (roughly?)\"</p>\n</blockquote>\n\n<p>First, I would build it s... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127088",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5827/"
] | I'm coding a widget and I'd like the user to be able to pick a link like you can when editing a regular posts or page (when you click on the little link icon and you get the AJAX search functionality in the pop up). Does anyone know how I get this working? I've got a HTML button which I would like to attach and click e... | I invoke the link dialogue within the metabox class I use for development. Its a tad hacky but can be done, until something more [robust](https://core.trac.wordpress.org/ticket/25471#comment:1) is developed.
You can invoke the link box by first enqueing the required js, and then interacting with the wp-link js files m... |
127,091 | <p>I'm using the Jetpack for Wordpress to produce a JSON API for my <strong>Events</strong> custom post type, which works fine:</p>
<p><code>https://public-api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100</code></p>
<p>However, this CPT also includes quite a few Post Meta Fields generated by <... | [
{
"answer_id": 128439,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 3,
"selected": true,
"text": "<h2>From the documentation:</h2>\n\n<p>According to the <a href=\"http://developer.wordpress.com/2013/04/26/custo... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127091",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33576/"
] | I'm using the Jetpack for Wordpress to produce a JSON API for my **Events** custom post type, which works fine:
`https://public-api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100`
However, this CPT also includes quite a few Post Meta Fields generated by [Custom Meta Boxes and Fields for Wordpress](h... | From the documentation:
-----------------------
According to the [JetPack JSON API docs](http://developer.wordpress.com/2013/04/26/custom-post-type-and-metadata-support-in-the-rest-api/):
>
> By default, all metadata keys are allowed in the API, as long as they
> are not protected keys. Any metadata key that starts... |
127,111 | <p>I am running multisite for 5 sites. I have a theme where it doesn't have a text area at the top of the page but i want to put some introduction text on the homepage. I currently have all 5 sites using the same child theme to maintain the same look and layout.</p>
<p>What is the best way to add the custom text to th... | [
{
"answer_id": 128439,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 3,
"selected": true,
"text": "<h2>From the documentation:</h2>\n\n<p>According to the <a href=\"http://developer.wordpress.com/2013/04/26/custo... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127111",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35677/"
] | I am running multisite for 5 sites. I have a theme where it doesn't have a text area at the top of the page but i want to put some introduction text on the homepage. I currently have all 5 sites using the same child theme to maintain the same look and layout.
What is the best way to add the custom text to the homepage... | From the documentation:
-----------------------
According to the [JetPack JSON API docs](http://developer.wordpress.com/2013/04/26/custom-post-type-and-metadata-support-in-the-rest-api/):
>
> By default, all metadata keys are allowed in the API, as long as they
> are not protected keys. Any metadata key that starts... |
127,117 | <p>Here is what I have tried:</p>
<p>1) Added <code>add_theme_support('post-thumbnails');</code> in functions.php.</p>
<p>2) Added <code><?php the_post_thumbnail(); ?></code> inside single.php which looks like this:</p>
<pre><code><?php
/**
* The Template for displaying all single posts.
*
* @package Wor... | [
{
"answer_id": 127121,
"author": "Wrought_steel",
"author_id": 38098,
"author_profile": "https://wordpress.stackexchange.com/users/38098",
"pm_score": 0,
"selected": false,
"text": "<p>As Rahil has said in the comments, you will need to add the <code>the_post_thumbnail();</code> block to... | 2013/12/19 | [
"https://wordpress.stackexchange.com/questions/127117",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44148/"
] | Here is what I have tried:
1) Added `add_theme_support('post-thumbnails');` in functions.php.
2) Added `<?php the_post_thumbnail(); ?>` inside single.php which looks like this:
```
<?php
/**
* The Template for displaying all single posts.
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven... | As mentioned by Rahil Wazir, take that code snippet `<?php the_post_thumbnail(); ?>` away from single.php.
Put following in your functions.php (at the bottom)
```
add_filter('the_content', 'put_thumbnail_in_posting');
function put_thumbnail_in_posting($content) {
global $post;
if ( has_post_thumbnail() && ( $post->pos... |
127,137 | <p>The WordPress theme is for a comic reading site. Since image cannot be re sized because the text will be distorted, I need to extend the site width according to the image size in the post.</p>
<p>Here is the URL: <a href="http://myreadingmanga.info/wordpress/?p=1578" rel="nofollow">http://myreadingmanga.info/wordpr... | [
{
"answer_id": 127121,
"author": "Wrought_steel",
"author_id": 38098,
"author_profile": "https://wordpress.stackexchange.com/users/38098",
"pm_score": 0,
"selected": false,
"text": "<p>As Rahil has said in the comments, you will need to add the <code>the_post_thumbnail();</code> block to... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127137",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43911/"
] | The WordPress theme is for a comic reading site. Since image cannot be re sized because the text will be distorted, I need to extend the site width according to the image size in the post.
Here is the URL: <http://myreadingmanga.info/wordpress/?p=1578>
**Image re size should not be done, but site expansion should be.... | As mentioned by Rahil Wazir, take that code snippet `<?php the_post_thumbnail(); ?>` away from single.php.
Put following in your functions.php (at the bottom)
```
add_filter('the_content', 'put_thumbnail_in_posting');
function put_thumbnail_in_posting($content) {
global $post;
if ( has_post_thumbnail() && ( $post->pos... |
127,138 | <p>I'm using wordpress 3.8 and a custom class derived from <code>WP_List_Table</code>. Why is there no search form?</p>
<p><img src="https://i.stack.imgur.com/C3y1L.png" alt="My Plugin admin page (using WP_List_Table)"></p>
<p>My code in plugin class:</p>
<pre><code>function __construct()
{
... | [
{
"answer_id": 133740,
"author": "fumigato",
"author_id": 47267,
"author_profile": "https://wordpress.stackexchange.com/users/47267",
"pm_score": 0,
"selected": false,
"text": "<p>Take a look at the 'wp_list_table' search_box:</p>\n\n<pre><code>function search_box( $text, $input_id ) {\n... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127138",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43951/"
] | I'm using wordpress 3.8 and a custom class derived from `WP_List_Table`. Why is there no search form?

My code in plugin class:
```
function __construct()
{
register_activation_hook( __FILE__, array( $this, ... | You must use
`$list_obj->prepare_items()` before `$list_obj->search_box('Search', 'search')` function!
Example:
```
<form method="post">
<input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
<?php $this->sales_obj->... |
127,141 | <p>With <code>add_query_arg()</code> it is nice to add additional parameters to an URL and it is also easy to create a rewrite rule. So far so good. But the problem is the URL replacement done by wordpress.</p>
<p>When I have an URL, like:</p>
<pre><code>www.mysite.com/?page_id=1&myvar=test
</code></pre>
<p>and ... | [
{
"answer_id": 154194,
"author": "swissspidy",
"author_id": 12404,
"author_profile": "https://wordpress.stackexchange.com/users/12404",
"pm_score": 3,
"selected": false,
"text": "<p>Just faced the same situation and stumbled upon this question while googling.</p>\n\n<p>It seems like this... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127141",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44064/"
] | With `add_query_arg()` it is nice to add additional parameters to an URL and it is also easy to create a rewrite rule. So far so good. But the problem is the URL replacement done by wordpress.
When I have an URL, like:
```
www.mysite.com/?page_id=1&myvar=test
```
and I type this URL into the address line of the bro... | Just faced the same situation and stumbled upon this question while googling.
It seems like this isn't possible. Core itself just appends strings to the URL if pretty permalinks are enabled, see <https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/link-template.php#L571>
For anyone interested in this: ... |
127,159 | <p>I have some code that uses preg_match to grab the first paragraph, and then spit it out in the loop:</p>
<pre><code>function first_paragraph() {
global $post, $posts;
$first_para = '';
ob_start();
ob_end_clean();
$output = preg_match_all('%(<p[^>]*>.*?</p>)%i', $post->post_content, $matc... | [
{
"answer_id": 127160,
"author": "Nathan Fitzgerald - Fitzgenius",
"author_id": 7025,
"author_profile": "https://wordpress.stackexchange.com/users/7025",
"pm_score": 1,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>function first_paragraph() {\n global $post, $posts;\n ... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127159",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33541/"
] | I have some code that uses preg\_match to grab the first paragraph, and then spit it out in the loop:
```
function first_paragraph() {
global $post, $posts;
$first_para = '';
ob_start();
ob_end_clean();
$output = preg_match_all('%(<p[^>]*>.*?</p>)%i', $post->post_content, $matches);
$first_para = $matches ... | You can use this function:
```
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
$str = substr( $str, 0, strpos( $str, '</p>' ) + 4 );
$str = strip_tags($str, '<a><strong><em>');
return '<p>' . $str . '</p>';
}
```
and then call it in your loop with:
```
<?php ec... |
127,179 | <p>In my Wordpress dashboard "Screen Option" and "Help" button are not pulldown.</p>
<p><img src="https://i.stack.imgur.com/QcO5W.png" alt="Screen Option not working"></p>
<p>Could anybody help me to solve the problem.
Thanks.</p>
| [
{
"answer_id": 146084,
"author": "Jerome",
"author_id": 52424,
"author_profile": "https://wordpress.stackexchange.com/users/52424",
"pm_score": -1,
"selected": false,
"text": "<p>It's a jQuery problem. I solved it by adding: <code>define('CONCATENATE_SCRIPTS', false);</code> to the <code... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127179",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44182/"
] | In my Wordpress dashboard "Screen Option" and "Help" button are not pulldown.

Could anybody help me to solve the problem.
Thanks. | Check if you or a plugin include bootstrap and the bootstrap CSS / Theme files.
Bootstraps `.hidden` class looks like:
```
.hidden {
display: none !important;
}
```
But overrides wordpress' definition of `.hidden`:
```
.hidden {
display: none;
}
```
The Top 'Help' & 'Screen Options' bars are displayed via in... |
127,189 | <p>I've created a page template and the goal is to create a loop that gets all posts by category name. The category name is passed from the slug of the page name. I haven't been able to get this to work entirely. </p>
<p><strong>EDIT</strong> Here's my function for this loop (updated from answers):</p>
<pre><code>glo... | [
{
"answer_id": 127191,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 3,
"selected": true,
"text": "<ol>\n<li>You are missing an <code>endwhile;</code>.</li>\n<li>Since you are trying to concatenate, you need to ... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127189",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5295/"
] | I've created a page template and the goal is to create a loop that gets all posts by category name. The category name is passed from the slug of the page name. I haven't been able to get this to work entirely.
**EDIT** Here's my function for this loop (updated from answers):
```
global $post;
$page_slug = $post->pos... | 1. You are missing an `endwhile;`.
2. Since you are trying to concatenate, you need to use `get_*` for title, permalink and content.
3. You are using `$page_slug` here and `$post_slug` there. Just use one and the same variable. ;)
4. Put the condition of the `while` loop inside brackets.
See updated code:
```
global ... |
127,195 | <p>Function below returns in alphabetical order and not, as wished, in arbitrarily order.<br />
Is it possible to -not- return in alphabetical but in exact order as given in the array?</p>
<pre><code>add_filter('the_content', 'my_function');
function my_function($content) {
if ( is_single() && in_category( '5'... | [
{
"answer_id": 127224,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>If you take a look at source for <a href=\"http://queryposts.com/function/wp_get_object_terms/\" rel=\"nofollow\"><... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127195",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15605/"
] | Function below returns in alphabetical order and not, as wished, in arbitrarily order.
Is it possible to -not- return in alphabetical but in exact order as given in the array?
```
add_filter('the_content', 'my_function');
function my_function($content) {
if ( is_single() && in_category( '5' ) ) {
the_post_thumbnail... | ```
add_filter('the_content','my_function');
function my_function($content){
the_post_thumbnail('thumbnail', array('class' => 'top-post-img' ));
if (is_single() && in_category('5')){
global $post;
$term_list = wp_get_post_terms ($post->ID,'school',array('fields'=>'names'));
?>
<div id="some_class... |
127,211 | <p>I am creating AJAX loading and need to use WP_LOCALIZE_SCRIPT but cannot make it work.</p>
<p>Here is my code. I place it in functions.php</p>
<pre><code>wp_enqueue_script( 'page_data');
$gallery_js_data_array = array(
'maxPages' => '$gallery_max_load = $gallery->max_num_pages;',
'cur... | [
{
"answer_id": 127212,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 2,
"selected": false,
"text": "<p>You have to use the correct handle:</p>\n\n<pre><code>wp_localize_script('page_data', 'glr_dt', $gallery_js_... | 2013/12/20 | [
"https://wordpress.stackexchange.com/questions/127211",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43506/"
] | I am creating AJAX loading and need to use WP\_LOCALIZE\_SCRIPT but cannot make it work.
Here is my code. I place it in functions.php
```
wp_enqueue_script( 'page_data');
$gallery_js_data_array = array(
'maxPages' => '$gallery_max_load = $gallery->max_num_pages;',
'curPage' => '1'
);
wp_locali... | You have to use the correct handle:
```
wp_localize_script('page_data', 'glr_dt', $gallery_js_data_array);
```
**// Edit**
Your code is also wrong. What do you want to do in this line:
```
'maxPages' => '$gallery_max_load = $gallery->max_num_pages;'
```
You are assigning a string to `maxPages`.
I guess you wa... |
127,232 | <p>I have a 'relationship' custom field that allows you to select multiple values and display them via</p>
<pre><code><?php $post_objects = get_field('field');
if($post_objects!=''){ ?>
<?php foreach( $post_objects as $post): ?>
<?php setup_postdata($post); ?>
<a href="<?php the... | [
{
"answer_id": 127212,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 2,
"selected": false,
"text": "<p>You have to use the correct handle:</p>\n\n<pre><code>wp_localize_script('page_data', 'glr_dt', $gallery_js_... | 2013/12/21 | [
"https://wordpress.stackexchange.com/questions/127232",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40906/"
] | I have a 'relationship' custom field that allows you to select multiple values and display them via
```
<?php $post_objects = get_field('field');
if($post_objects!=''){ ?>
<?php foreach( $post_objects as $post): ?>
<?php setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>">
<?php th... | You have to use the correct handle:
```
wp_localize_script('page_data', 'glr_dt', $gallery_js_data_array);
```
**// Edit**
Your code is also wrong. What do you want to do in this line:
```
'maxPages' => '$gallery_max_load = $gallery->max_num_pages;'
```
You are assigning a string to `maxPages`.
I guess you wa... |
127,235 | <p>I am trying to compare dates from a custom field. I have them stored as something like "20121125". If the date has expired, a placeholder image will be used, if not, the default thumbnail will be used. Any advice is appreciated.</p>
<pre><code><?php
$html = "";
$key = get_post_meta($post->ID, 'Due', true);
$d... | [
{
"answer_id": 127236,
"author": "André Maldonado",
"author_id": 41329,
"author_profile": "https://wordpress.stackexchange.com/users/41329",
"pm_score": 0,
"selected": false,
"text": "<p>You can try this:</p>\n\n<pre><code><?php\n$html = \"\";\n$key = get_post_meta($post->ID, 'Due'... | 2013/12/21 | [
"https://wordpress.stackexchange.com/questions/127235",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/19061/"
] | I am trying to compare dates from a custom field. I have them stored as something like "20121125". If the date has expired, a placeholder image will be used, if not, the default thumbnail will be used. Any advice is appreciated.
```
<?php
$html = "";
$key = get_post_meta($post->ID, 'Due', true);
$date = date('ymd');
i... | Well, the exact server time/timestamp can be retrieve with current\_time function. And comparing your date format, it would need to be Ymd. So combining these two thing, the proper comparison for you should be -
```
$key = get_post_meta( $post->ID, 'Due', true );
$date = date('Ymd', current_time('timestamp') );
if( ... |
127,248 | <p>Basically I want to use wordpress functions for example <code>wp_create_user()</code> or <code>wp_update_user()</code> outside of wordpress (outside of wordpress directory).</p>
<p>I tried with all the below code snippets to load the wordpress environment, I am able to use the functions correctly in both the cases ... | [
{
"answer_id": 127254,
"author": "user42826",
"author_id": 42826,
"author_profile": "https://wordpress.stackexchange.com/users/42826",
"pm_score": 2,
"selected": false,
"text": "<p>If you place the file in the WP root directory, e.g. <a href=\"http://mysite.com/myscript.php\" rel=\"nofol... | 2013/12/21 | [
"https://wordpress.stackexchange.com/questions/127248",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44208/"
] | Basically I want to use wordpress functions for example `wp_create_user()` or `wp_update_user()` outside of wordpress (outside of wordpress directory).
I tried with all the below code snippets to load the wordpress environment, I am able to use the functions correctly in both the cases but the problem is that this als... | Well I don't know the reason how this worked but it did.
At first, I was loading the wp environment in the beginning of my file and it was loading the wp template(wp theme) which I didn't want.
But now I loaded the wp environment at the end of the file and it worked. |
127,269 | <p>I'm creating a WordPress theme and I've noticed that a lot of premium themes allow the users to go to Appearance->Sidebars and create a new Sidebar by simply giving it a name.
The user can then Go to widgets and assign different widgets to this sidebar and also add custom menus. This I believe is a great feature as ... | [
{
"answer_id": 127274,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 4,
"selected": true,
"text": "<p>Create a function that register sidebars, using <a href=\"http://codex.wordpress.org/Function_Reference/regist... | 2013/12/21 | [
"https://wordpress.stackexchange.com/questions/127269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43834/"
] | I'm creating a WordPress theme and I've noticed that a lot of premium themes allow the users to go to Appearance->Sidebars and create a new Sidebar by simply giving it a name.
The user can then Go to widgets and assign different widgets to this sidebar and also add custom menus. This I believe is a great feature as it ... | Create a function that register sidebars, using [`register_sidebar`](http://codex.wordpress.org/Function_Reference/register_sidebar), starting from an option:
```
add_action('widgets_init', 'my_custom_sidebars');
function my_custom_sidebars() {
$sidebars = get_option('my_theme_sidebars'); // get all the sidebars na... |
127,295 | <p>I have installed WordPress 3.8 and now I am trying to install <code>WooCommerce - excelling eCommerce 2.0.20</code> plugin but every time I am getting this error:</p>
<p><strong>Note: I am trying to install plugin in local machine.</strong></p>
<pre><code>Fatal error: Maximum execution time of 60 seconds exceeded ... | [
{
"answer_id": 127297,
"author": "Rahil Wazir",
"author_id": 36349,
"author_profile": "https://wordpress.stackexchange.com/users/36349",
"pm_score": 0,
"selected": false,
"text": "<p>Edit <code>php.ini</code></p>\n\n<p>Should be located at <code>xampp/php/php.ini</code></p>\n\n<p>Find th... | 2013/12/21 | [
"https://wordpress.stackexchange.com/questions/127295",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26204/"
] | I have installed WordPress 3.8 and now I am trying to install `WooCommerce - excelling eCommerce 2.0.20` plugin but every time I am getting this error:
**Note: I am trying to install plugin in local machine.**
```
Fatal error: Maximum execution time of 60 seconds exceeded in M:\XAMPP\htdocs\woocommerce\wp-includes\cl... | I had the same problem but it occured while importing the theme-unit-test-data.xml along with its attachments. I am using WP 3.8.1. It's a WordPress issue so editing the php.ini has no effect. WP uses a hardcoded value (60 secs) for http\_request\_timeout of WP\_Http in `class-http.php`.
To solve it, place this code i... |
127,299 | <p>I found this post//</p>
<p><a href="https://wordpress.stackexchange.com/questions/98426/use-media-upload-in-custom-widget-on-wordpress-3-5">Use Media upload in custom widget on wordpress 3.5</a></p>
<p>I'm not experienced in any of this so I pretty much just copied the code he provided into my own functions.php fi... | [
{
"answer_id": 127310,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 4,
"selected": true,
"text": "<p>Let's face it in detail: The registered sidebar (with the ID <code>left-sidebar</code>) has two arguments to wrap... | 2013/12/21 | [
"https://wordpress.stackexchange.com/questions/127299",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34888/"
] | I found this post//
[Use Media upload in custom widget on wordpress 3.5](https://wordpress.stackexchange.com/questions/98426/use-media-upload-in-custom-widget-on-wordpress-3-5)
I'm not experienced in any of this so I pretty much just copied the code he provided into my own functions.php file. I uploaded the JS and ev... | Let's face it in detail: The registered sidebar (with the ID `left-sidebar`) has two arguments to wrap the whole widget (`before_widget` and `after_widget`) which you can output via `echo $before_widget` and `echo $after_widget` in your widget (see my version below):
```
<?php
// Register sidebar
if (function_exists(... |
127,328 | <p>I want to include some kinds of posts in the default query. When the loop begins:</p>
<pre><code> if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
</code></pre>
<p>the default type post is <code>'post'</code>, so other kind of posts won't enter the loop (... | [
{
"answer_id": 127331,
"author": "JMau",
"author_id": 31376,
"author_profile": "https://wordpress.stackexchange.com/users/31376",
"pm_score": 0,
"selected": false,
"text": "<p>You could use this : </p>\n\n<pre><code>$query = new WP_Query( 'post_type=any' );\n</code></pre>\n\n<blockquote>... | 2013/12/22 | [
"https://wordpress.stackexchange.com/questions/127328",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36778/"
] | I want to include some kinds of posts in the default query. When the loop begins:
```
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
```
the default type post is `'post'`, so other kind of posts won't enter the loop (e.g. I have a custom post type called... | You should use [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) hook, which allows you to target one (or multiple) query precisely and change it so that everything works correctly (which is rarely result of manipulating main query in template, especially with pagination). |
127,355 | <p>How and were do I change the size on the sticky post images and the other images in the theme twentyfourteen?</p>
<p>I would like 8 sticky post images on the "front page" instead of 6 and I want them in a more portrait format so that I can use all my old images on my current blog (600x850px). I like the theme but a... | [
{
"answer_id": 127363,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 0,
"selected": false,
"text": "<p>The two image sizes are defined in the theme's <code>functions.php</code> file:</p>\n\n<pre><code>set_post_thumbna... | 2013/12/22 | [
"https://wordpress.stackexchange.com/questions/127355",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44239/"
] | How and were do I change the size on the sticky post images and the other images in the theme twentyfourteen?
I would like 8 sticky post images on the "front page" instead of 6 and I want them in a more portrait format so that I can use all my old images on my current blog (600x850px). I like the theme but all my old ... | Well, that was... interesting. In a nutshell there seem to be two things in play here:
* `max_posts` set to `6` in `add_theme_support( 'featured-content'`
* `quantity` set to default `6` in `Featured_Content` class
`quantity` defines how many posts there are, but can be no larger than `max_posts`. However while resul... |
127,356 | <p>I'm trying to work this query - the first if clause works, and the else works, but the middle clause, elseif, doesn't work.</p>
<pre><code><?php if(get_post_meta($post->ID, 'TourURL', true)) {
<div class="tourenquiryonline">
<h2>Book or Inquire</h2>
This t... | [
{
"answer_id": 127358,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 1,
"selected": false,
"text": "<p>This <strong>cannot</strong> work.\nIt has to look like the following (or similar):</p>\n\n<pre><code><?p... | 2013/12/22 | [
"https://wordpress.stackexchange.com/questions/127356",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16726/"
] | I'm trying to work this query - the first if clause works, and the else works, but the middle clause, elseif, doesn't work.
```
<?php if(get_post_meta($post->ID, 'TourURL', true)) {
<div class="tourenquiryonline">
<h2>Book or Inquire</h2>
This tour can be booked online.
... | This **cannot** work.
It has to look like the following (or similar):
```
<?php
if (get_post_meta($post->ID, 'TourURL', true)) {
?>
<div class="tourenquiryonline">
<h2>Book or Inquire</h2>
This tour can be booked online.
</div>
<?php
} elseif (get_post_meta($post->ID, 'bhid', true)) {
... |
127,383 | <p>I've had a WordPress blog I've hosted on Dream Host for several years now. Recently (the past year) my site is going down often. Via Dream Host I found that I'm using up my CPU limit and they are killing my process. This used to happen twice a day, but I was able to get it down to maybe once a week. I did that by sw... | [
{
"answer_id": 127358,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 1,
"selected": false,
"text": "<p>This <strong>cannot</strong> work.\nIt has to look like the following (or similar):</p>\n\n<pre><code><?p... | 2013/12/22 | [
"https://wordpress.stackexchange.com/questions/127383",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4268/"
] | I've had a WordPress blog I've hosted on Dream Host for several years now. Recently (the past year) my site is going down often. Via Dream Host I found that I'm using up my CPU limit and they are killing my process. This used to happen twice a day, but I was able to get it down to maybe once a week. I did that by swapp... | This **cannot** work.
It has to look like the following (or similar):
```
<?php
if (get_post_meta($post->ID, 'TourURL', true)) {
?>
<div class="tourenquiryonline">
<h2>Book or Inquire</h2>
This tour can be booked online.
</div>
<?php
} elseif (get_post_meta($post->ID, 'bhid', true)) {
... |
127,401 | <p>Is there a way to return the current active color scheme?</p>
<p>This is how to register a new admin color scheme</p>
<pre><code><?php register_admin_color_schemes(); ?>
</code></pre>
<p>is there something like <code>get_admin_color_scheme();</code> that will return which is active?</p>
| [
{
"answer_id": 127402,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p>The current admin color scheme is a user setting, you can get its value with:</p>\n\n<pre><code>$current_color = get_u... | 2013/12/23 | [
"https://wordpress.stackexchange.com/questions/127401",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43000/"
] | Is there a way to return the current active color scheme?
This is how to register a new admin color scheme
```
<?php register_admin_color_schemes(); ?>
```
is there something like `get_admin_color_scheme();` that will return which is active? | The current admin color scheme is a user setting, you can get its value with:
```
$current_color = get_user_option( 'admin_color' );
```
See the function `admin_color_scheme_picker()` in `wp-admin/includes/misc.php` for an usage example. |
127,448 | <p>I want to customize the footer text in a Custom Post Type admin page.
I have a plugin that creates this custom post type and want to add in it a function to customize admin_footer_text.</p>
<p>As you can see in code below I can change the footer text, but only globaly.</p>
<pre><code>function my_custom_footer_admi... | [
{
"answer_id": 127451,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>There is <a href=\"http://codex.wordpress.org/Conditional_Tags#A_Post_Type\" rel=\"nofollow\">number of functions r... | 2013/12/23 | [
"https://wordpress.stackexchange.com/questions/127448",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44085/"
] | I want to customize the footer text in a Custom Post Type admin page.
I have a plugin that creates this custom post type and want to add in it a function to customize admin\_footer\_text.
As you can see in code below I can change the footer text, but only globaly.
```
function my_custom_footer_admin_text () {
ech... | This should do. Put the following in your `functions.php`
```
if (in_array($GLOBALS['pagenow'], array('edit.php', 'post.php', 'post-new.php')))
add_filter('admin_footer_text', 'my_custom_footer_admin_text');
function my_custom_footer_admin_text($text) {
$post_type = filter_input(INPUT_GET, 'post_type');
i... |
127,463 | <p>I was wondering if I can use white label plugin, like White Label CMS, on Wordpress without violating their terms and agreements.</p>
<p>This plugin (or plugins like it) will remove every instance of the word "Wordpress" wherever it appears (including text, images, etc.)</p>
| [
{
"answer_id": 127451,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>There is <a href=\"http://codex.wordpress.org/Conditional_Tags#A_Post_Type\" rel=\"nofollow\">number of functions r... | 2013/12/23 | [
"https://wordpress.stackexchange.com/questions/127463",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42899/"
] | I was wondering if I can use white label plugin, like White Label CMS, on Wordpress without violating their terms and agreements.
This plugin (or plugins like it) will remove every instance of the word "Wordpress" wherever it appears (including text, images, etc.) | This should do. Put the following in your `functions.php`
```
if (in_array($GLOBALS['pagenow'], array('edit.php', 'post.php', 'post-new.php')))
add_filter('admin_footer_text', 'my_custom_footer_admin_text');
function my_custom_footer_admin_text($text) {
$post_type = filter_input(INPUT_GET, 'post_type');
i... |
127,467 | <p>I posed a similar question a few days back, but perhaps I put the question a bit incorrectly.</p>
<p>I would like my footer.php and sidebar.php to change depending on the URL. If URL contains /ru then show show ru-footer.php else show default footer (footer.php). The same should happen with the sidebar.</p>
<p>If ... | [
{
"answer_id": 127469,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 0,
"selected": false,
"text": "<p>If you will really use the URL as switcher then use the predefined variable of PHP <code>$_SERVER</code>. If you ... | 2013/12/23 | [
"https://wordpress.stackexchange.com/questions/127467",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44226/"
] | I posed a similar question a few days back, but perhaps I put the question a bit incorrectly.
I would like my footer.php and sidebar.php to change depending on the URL. If URL contains /ru then show show ru-footer.php else show default footer (footer.php). The same should happen with the sidebar.
If it is possible, c... | So, this is how I did it and it works.
```
<?php $url = $_SERVER["REQUEST_URI"];
if (strpos($url, "/ru/")) {
$div_id = "logo_top_ru" .$contnet;
}else {
$div_id = "logo_top_en" .$contnet;
}
?>
<div id="<?php echo $div_id ?>"></div>
```
Enjoy |
127,493 | <p>I've been following the WordPress Settings API tutorial series of this guy:</p>
<p><a href="http://wp.tutsplus.com/tutorials/theme-development/the-complete-guide-to-the-wordpress-settings-api-part-1/" rel="noreferrer">http://wp.tutsplus.com/tutorials/theme-development/the-complete-guide-to-the-wordpress-settings-ap... | [
{
"answer_id": 127499,
"author": "MrJustin",
"author_id": 43934,
"author_profile": "https://wordpress.stackexchange.com/users/43934",
"pm_score": 5,
"selected": true,
"text": "<p>Here is how I do it, beware, post is extensive.</p>\n<pre><code>/* Add Menus\n-------------------------------... | 2013/12/23 | [
"https://wordpress.stackexchange.com/questions/127493",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36718/"
] | I've been following the WordPress Settings API tutorial series of this guy:
<http://wp.tutsplus.com/tutorials/theme-development/the-complete-guide-to-the-wordpress-settings-api-part-1/>
So far, I've been successful at doing the basic thing. Now, when implementing tab, I'm facing problem.
Problem 1: The Tabs are not ... | Here is how I do it, beware, post is extensive.
```
/* Add Menus
-----------------------------------------------------------------*/
add_action('admin_menu', 'ch_essentials_admin');
function ch_essentials_admin() {
/* Base Menu */
add_menu_page(
'Essentials Theme',
'Essentials Theme',
'manage_optio... |
127,513 | <p>I have decided that for all pages where multiple posts are shown (e.g. front, category, tag pages), that post images should not be shown. Instead, featured images, if specified, should be shown next to each post.</p>
<p>Right now, featured images are working fine for posts. However, when multiple posts are displaye... | [
{
"answer_id": 127531,
"author": "thienhaxanh2405",
"author_id": 31678,
"author_profile": "https://wordpress.stackexchange.com/users/31678",
"pm_score": -1,
"selected": false,
"text": "<p>Simple way I do. I set feature images for each post.</p>\n\n<pre><code>global $post;\n// number post... | 2013/12/24 | [
"https://wordpress.stackexchange.com/questions/127513",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44304/"
] | I have decided that for all pages where multiple posts are shown (e.g. front, category, tag pages), that post images should not be shown. Instead, featured images, if specified, should be shown next to each post.
Right now, featured images are working fine for posts. However, when multiple posts are displayed (e.g. on... | Try this
```
<?php
add_filter('the_content','wpi_image_content_filter',11);
function wpi_image_content_filter($content){
if (is_home() || is_front_page()){
$content = preg_replace("/<img[^>]+\>/i", "", $content);
}
return $content;
}
?>
```
Place in your functions.php file, call up... |
127,530 | <p>I am using wp_mail to send an email to multiple recipients.</p>
<p>my mail function looks like this:</p>
<pre><code>wp_mail($group_emails, 'my subject', 'my message', $headers);
</code></pre>
<p><code>$group_emails</code> is an array of email address's and gets outputed like this:</p>
<pre><code>$group_emails = ... | [
{
"answer_id": 127534,
"author": "Rohit Pande",
"author_id": 21274,
"author_profile": "https://wordpress.stackexchange.com/users/21274",
"pm_score": 4,
"selected": true,
"text": "<p>There are multiple ways of doing this.</p>\n\n<p>You can consider any of the following.</p>\n\n<p>1.My <st... | 2013/12/24 | [
"https://wordpress.stackexchange.com/questions/127530",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13213/"
] | I am using wp\_mail to send an email to multiple recipients.
my mail function looks like this:
```
wp_mail($group_emails, 'my subject', 'my message', $headers);
```
`$group_emails` is an array of email address's and gets outputed like this:
```
$group_emails = Array ( [0] => ceri@test.com [1] => craigj@test.com [2... | There are multiple ways of doing this.
You can consider any of the following.
1.My **preferred**:
```
foreach($group_emails as $email_address)
{
wp_mail($email_address, 'my subject', 'my message', $headers);
}
```
2.Another way
Define the array as follows.
```
$group_emails = array('ceri@test.com', 'craigj@te... |
127,536 | <p>How can I make sure that <code>my_function</code> action hook on 'wp_head' is executing last? One hack, that I'm using, is to give <code>999999</code> (a big number) as the third argument. But maybe some other hook on 'wp_head' is giving even bigger number than this one.</p>
<pre><code>function my_function() {
... | [
{
"answer_id": 127542,
"author": "JMau",
"author_id": 31376,
"author_profile": "https://wordpress.stackexchange.com/users/31376",
"pm_score": 3,
"selected": true,
"text": "<p>You define priority. It's not a hack.\nMaybe it's that you're looking for is <code>PHP_INT_MAX</code> which is a ... | 2013/12/24 | [
"https://wordpress.stackexchange.com/questions/127536",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36718/"
] | How can I make sure that `my_function` action hook on 'wp\_head' is executing last? One hack, that I'm using, is to give `999999` (a big number) as the third argument. But maybe some other hook on 'wp\_head' is giving even bigger number than this one.
```
function my_function() {
?>
<style>
.custom-cla... | You define priority. It's not a hack.
Maybe it's that you're looking for is `PHP_INT_MAX` which is a PHP constant. So you can put it as priority number. |
127,574 | <p>The WordPress theme I am using didn't come with a proper Error 404 handler and I'd like to add one to the code. I am having a hard time how WordPress determines if a URL does exist as a post, is a search query, or doesn't exist. I'd like to know where the code WordPress uses is located, or how WordPress determines t... | [
{
"answer_id": 127582,
"author": "thienhaxanh2405",
"author_id": 31678,
"author_profile": "https://wordpress.stackexchange.com/users/31678",
"pm_score": 0,
"selected": false,
"text": "<p>Why do you want to customize the 404's core.</p>\n\n<p>One theme always has a file 404.php. You can d... | 2013/12/25 | [
"https://wordpress.stackexchange.com/questions/127574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | The WordPress theme I am using didn't come with a proper Error 404 handler and I'd like to add one to the code. I am having a hard time how WordPress determines if a URL does exist as a post, is a search query, or doesn't exist. I'd like to know where the code WordPress uses is located, or how WordPress determines this... | You don't need to add anything special to the top of 404.php. WordPress will know to use 404.php automatically when it tries to get a post or page and fails.
To create a custom 404 page for a theme, the simplest way is to:
1. Copy the index.php file from the current theme to a file called 404.php.
2. Edit your new 40... |
127,579 | <p>I'm using MongoDB to store separate data for a WordPress website and need to be able to create pages with the data from MongoDB rather than from manually created pages in the dashboard. I've searched all over for this and can't seem to find anything for creating pages in the backend.</p>
<p>Is this even possible an... | [
{
"answer_id": 127580,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>Why would the type of DB you use have any relevance to the front end of the site? In theory, if you make ... | 2013/12/25 | [
"https://wordpress.stackexchange.com/questions/127579",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44334/"
] | I'm using MongoDB to store separate data for a WordPress website and need to be able to create pages with the data from MongoDB rather than from manually created pages in the dashboard. I've searched all over for this and can't seem to find anything for creating pages in the backend.
Is this even possible and if so, d... | You can programmatically create posts and pages using `wp_insert_post` or insert content using WXR files via WordPress's import feature.
To use `wp_insert_post` see the documentation here: <http://codex.wordpress.org/Function_Reference/wp_insert_post>
A simple example:
```
$my_post = array(
'post_title' ... |
127,586 | <p><a href="https://wordpress.stackexchange.com/a/52281/22728">Got the way</a> to change the labels everywhere for the post_type "Post". For a customer site, I need to use the WordPress comments. Just need to change the label from "Comments/Comment" to "Review" everywhere. But where for post_type "Post" we can use <cod... | [
{
"answer_id": 127589,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>The only way to change all the places with the word \"comment/s\" to \"review/s\" is by creating a new tr... | 2013/12/25 | [
"https://wordpress.stackexchange.com/questions/127586",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22728/"
] | [Got the way](https://wordpress.stackexchange.com/a/52281/22728) to change the labels everywhere for the post\_type "Post". For a customer site, I need to use the WordPress comments. Just need to change the label from "Comments/Comment" to "Review" everywhere. But where for post\_type "Post" we can use `$wp_post_types;... | You can try the [`gettext`](http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext) filter.
According to the [Codex](http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext):
>
> This filter hook is applied to the translated text by the
> internationalization functions (\_\_(), \_e(), \_x(), etc.). T... |
127,598 | <p>We are building a landing page site (only 2 pages total) for a client where they are physically mailing out access codes to specific customers. Therefore, I am trying to create a login system where ideally, a user logs in with a pre-determined access code. I have been trying different hacks of a login type of but ... | [
{
"answer_id": 127589,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 0,
"selected": false,
"text": "<p>The only way to change all the places with the word \"comment/s\" to \"review/s\" is by creating a new tr... | 2013/12/25 | [
"https://wordpress.stackexchange.com/questions/127598",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38241/"
] | We are building a landing page site (only 2 pages total) for a client where they are physically mailing out access codes to specific customers. Therefore, I am trying to create a login system where ideally, a user logs in with a pre-determined access code. I have been trying different hacks of a login type of but nothi... | You can try the [`gettext`](http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext) filter.
According to the [Codex](http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext):
>
> This filter hook is applied to the translated text by the
> internationalization functions (\_\_(), \_e(), \_x(), etc.). T... |
127,616 | <p>I try to add some content on the post excerpt in wordpress. For a category page excerpt condition working perfect. but i am not sure how to check in home page i tried is_home and is_front_page like that </p>
<pre><code> function addtoexcerpt($excerpt) {
ob_start();
$values = ob_get_clean();
return $... | [
{
"answer_id": 127629,
"author": "Neutrino",
"author_id": 44357,
"author_profile": "https://wordpress.stackexchange.com/users/44357",
"pm_score": 0,
"selected": false,
"text": "<p>It depends on how you set your home page in Settings > Reading. Try <code>is_home()</code>.</p>\n\n<p>When y... | 2013/12/25 | [
"https://wordpress.stackexchange.com/questions/127616",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24481/"
] | I try to add some content on the post excerpt in wordpress. For a category page excerpt condition working perfect. but i am not sure how to check in home page i tried is\_home and is\_front\_page like that
```
function addtoexcerpt($excerpt) {
ob_start();
$values = ob_get_clean();
return $values.$exc... | In the case of expound theme index page is used as homepage, and there is no static front-page in the theme.
Try to add is\_home() to the condition.
```
function addtoexcerpt($excerpt) {
ob_start();
$values = ob_get_clean();
return $values.$excerpt;
}
if( is_single()||is_category()||is_home() ) {
add_... |
127,632 | <p>Is there a way to update all post at once?</p>
<p>The issue is, when i migrated content from another CMS, some of the permalinks are working fine and some of them are not, when i updated the posts all links are working fine.</p>
<p>I have tried some methods to perform this requirement, but it doesn't helped.</p>
| [
{
"answer_id": 127629,
"author": "Neutrino",
"author_id": 44357,
"author_profile": "https://wordpress.stackexchange.com/users/44357",
"pm_score": 0,
"selected": false,
"text": "<p>It depends on how you set your home page in Settings > Reading. Try <code>is_home()</code>.</p>\n\n<p>When y... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127632",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26760/"
] | Is there a way to update all post at once?
The issue is, when i migrated content from another CMS, some of the permalinks are working fine and some of them are not, when i updated the posts all links are working fine.
I have tried some methods to perform this requirement, but it doesn't helped. | In the case of expound theme index page is used as homepage, and there is no static front-page in the theme.
Try to add is\_home() to the condition.
```
function addtoexcerpt($excerpt) {
ob_start();
$values = ob_get_clean();
return $values.$excerpt;
}
if( is_single()||is_category()||is_home() ) {
add_... |
127,633 | <p>While assigning multiple categories to a post, I need to restrict the category choices on a post depending on what other categories have already been assigned to the particular post.</p>
<p>For example, lets say we have categories A, B and C.<br>
For any post, we want to restrict having both categories B and C. So ... | [
{
"answer_id": 128051,
"author": "Bendoh",
"author_id": 8907,
"author_profile": "https://wordpress.stackexchange.com/users/8907",
"pm_score": 2,
"selected": false,
"text": "<p>There doesn't appear to be any hook that you can leverage to alter the categories going in when <code>wp_create_... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44311/"
] | While assigning multiple categories to a post, I need to restrict the category choices on a post depending on what other categories have already been assigned to the particular post.
For example, lets say we have categories A, B and C.
For any post, we want to restrict having both categories B and C. So posts may h... | Okay, I've had a couple minutes free time, so I wrote up a small plugin. ;)
---
The following goes into a new plugin file `tf-restrict-categories/tf-restrict-categories.php`:
### The introduction
```
<?php
/**
* Plugin Name: Restrict Categories
* Description: Individually restrict category combinations.
* Licens... |
127,636 | <p>I am just trying to change the url of "register" on wp default login page(domain.com/wp-login.php)</p>
<ol>
<li><p>I want to change the url on register link.</p></li>
<li><p>when you are on domain.com/wp-login.php?action=register, I want to redirect to domain.com/register</p></li>
</ol>
<p>I have added redirect li... | [
{
"answer_id": 127651,
"author": "Sisir",
"author_id": 3094,
"author_profile": "https://wordpress.stackexchange.com/users/3094",
"pm_score": 3,
"selected": true,
"text": "<p>Code from @bainternet's <a href=\"http://en.bainternet.info/2012/wordpress-easy-login-url-with-no-htaccess\" rel=\... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127636",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34463/"
] | I am just trying to change the url of "register" on wp default login page(domain.com/wp-login.php)
1. I want to change the url on register link.
2. when you are on domain.com/wp-login.php?action=register, I want to redirect to domain.com/register
I have added redirect link. but it's not working.
```
RedirectMatch 3... | Code from @bainternet's [website](http://en.bainternet.info/2012/wordpress-easy-login-url-with-no-htaccess).
```
function wpse127636_register_url($link){
/*
Change wp registration url
*/
return str_replace(site_url('wp-login.php?action=register', 'login'),site_url('register', 'login'),$link);
}
ad... |
127,650 | <p>I want users to give their Reviews about the products. Currently have woocommerce installed in my wordpress site . I want to add the comments at the bottom of the Woocommerce shop page (not single product page), below last product in the shop page.</p>
<p>I have tried using wp_list_comments( ); But all it is not sh... | [
{
"answer_id": 127651,
"author": "Sisir",
"author_id": 3094,
"author_profile": "https://wordpress.stackexchange.com/users/3094",
"pm_score": 3,
"selected": true,
"text": "<p>Code from @bainternet's <a href=\"http://en.bainternet.info/2012/wordpress-easy-login-url-with-no-htaccess\" rel=\... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127650",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38168/"
] | I want users to give their Reviews about the products. Currently have woocommerce installed in my wordpress site . I want to add the comments at the bottom of the Woocommerce shop page (not single product page), below last product in the shop page.
I have tried using wp\_list\_comments( ); But all it is not showing co... | Code from @bainternet's [website](http://en.bainternet.info/2012/wordpress-easy-login-url-with-no-htaccess).
```
function wpse127636_register_url($link){
/*
Change wp registration url
*/
return str_replace(site_url('wp-login.php?action=register', 'login'),site_url('register', 'login'),$link);
}
ad... |