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 |
|---|---|---|---|---|---|---|
127,653 | <p>Is it possible to set session in wordpress. If yes can you please tell how to do it? My sample code is.</p>
<pre><code><?php
session_start();
if(!isset($_SESSION['impression'])) {
$_SESSION['impression'] = 100;
}else {
if($_SESSION['impression']<=0)
$_SESSION['impression'] = 100;
}
echo $_... | [
{
"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/127653",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43612/"
] | Is it possible to set session in wordpress. If yes can you please tell how to do it? My sample code is.
```
<?php
session_start();
if(!isset($_SESSION['impression'])) {
$_SESSION['impression'] = 100;
}else {
if($_SESSION['impression']<=0)
$_SESSION['impression'] = 100;
}
echo $_SESSION['impression'... | 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,669 | <p>I just want to set featured image of my post but don't want to show it in my post.
How can I do that?</p>
<p>Detailed :
I want to post to show its thumbnail in main page but not to show it when we expend the post ie: Not to show that featured image in post when somebody open that post by clicking Read-More </p>
<p... | [
{
"answer_id": 127676,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>It sounds like you want the thumbnail on archives but not on single post displays, so if you are willing to ... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127669",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44374/"
] | I just want to set featured image of my post but don't want to show it in my post.
How can I do that?
Detailed :
I want to post to show its thumbnail in main page but not to show it when we expend the post ie: Not to show that featured image in post when somebody open that post by clicking Read-More
Plugin will be g... | It sounds like you want the thumbnail on archives but not on single post displays, so if you are willing to edit the theme you can just wrap the thumbnail code in `if(!is_single())`. For example:
```
if(!is_single()) {
the_post_thumbnail();
}
```
You could also filter `post_thumbnail_html` but that is pretty waste... |
127,671 | <p>This is the first paragraph of the <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" rel="nofollow">documentation of the function <code>wp nav menu</code></a>:</p>
<blockquote>
<p>Given a <code>theme_location parameter</code>, the function displays the menu
assigned to that location, or nothin... | [
{
"answer_id": 127675,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>The documentation is wrong. <a href=\"http://core.trac.wordpress.org/browser/tags/3.8/src/wp-includes/nav-men... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127671",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44375/"
] | This is the first paragraph of the [documentation of the function `wp nav menu`](http://codex.wordpress.org/Function_Reference/wp_nav_menu):
>
> Given a `theme_location parameter`, the function displays the menu
> assigned to that location, or nothing if no such location exists or no
> menu is assigned to it.
>
> ... | The documentation is wrong. [Check the source](http://core.trac.wordpress.org/browser/tags/3.8/src/wp-includes/nav-menu-template.php#L241). There are two telling comments. First there is:
>
>
> ```
> // Get the nav menu based on the theme_location
>
> ```
>
>
And after which there is another comment that reads:
... |
127,689 | <p>I have simple fuction that adds additional comment form field called "Subject":</p>
<pre><code>add_action( 'comment_form_logged_in_before', 'additional_fields' );
add_action( 'comment_form_before_fields', 'additional_fields' );
function additional_fields () {
echo '<p class="comment-form-subject">'.
... | [
{
"answer_id": 127924,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 1,
"selected": false,
"text": "<p>How about using a conditional to check if there are comments? If not, display a different comment form.</p>\n\n<p... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127689",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44383/"
] | I have simple fuction that adds additional comment form field called "Subject":
```
add_action( 'comment_form_logged_in_before', 'additional_fields' );
add_action( 'comment_form_before_fields', 'additional_fields' );
function additional_fields () {
echo '<p class="comment-form-subject">'.
'<label for="subjec... | The Reply links
---------------
I assume your *Reply* links look like this:
```
<a class="comment-reply-link" href="/2013/12/29/hello-world/?replytocom=32#respond"
onclick="return addComment.moveForm('comment-32', '32', 'respond', '1')">Reply</a>
```
and the *Cancel Reply* link:
```
<a rel="nofollow" id="cancel-... |
127,690 | <p>I am trying to run a function on Keyup of the TinyMCE Editor on new post and edit post screens.</p>
<p>I'm having a hard time catching the keyboard action when a user types something.</p>
<pre><code>jQuery(document).ready(function() {
setTimeout(function(){
var content = "tinymc... | [
{
"answer_id": 127924,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 1,
"selected": false,
"text": "<p>How about using a conditional to check if there are comments? If not, display a different comment form.</p>\n\n<p... | 2013/12/26 | [
"https://wordpress.stackexchange.com/questions/127690",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43000/"
] | I am trying to run a function on Keyup of the TinyMCE Editor on new post and edit post screens.
I'm having a hard time catching the keyboard action when a user types something.
```
jQuery(document).ready(function() {
setTimeout(function(){
var content = "tinymce";
... | The Reply links
---------------
I assume your *Reply* links look like this:
```
<a class="comment-reply-link" href="/2013/12/29/hello-world/?replytocom=32#respond"
onclick="return addComment.moveForm('comment-32', '32', 'respond', '1')">Reply</a>
```
and the *Cancel Reply* link:
```
<a rel="nofollow" id="cancel-... |
127,728 | <p>I have activated SSL to my site </p>
<p>On my wordpress multisite, I am getting 404 errors when I am entering a correct url for example <code>http://site.org/wp-admin</code> it automatically redirecting and giving <code>https://site.org/wp-adminwp-admin</code> </p>
<p>Is there any code that i need to add or remo... | [
{
"answer_id": 127924,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 1,
"selected": false,
"text": "<p>How about using a conditional to check if there are comments? If not, display a different comment form.</p>\n\n<p... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127728",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44307/"
] | I have activated SSL to my site
On my wordpress multisite, I am getting 404 errors when I am entering a correct url for example `http://site.org/wp-admin` it automatically redirecting and giving `https://site.org/wp-adminwp-admin`
Is there any code that i need to add or remove in the .htaccess code to get this fixe... | The Reply links
---------------
I assume your *Reply* links look like this:
```
<a class="comment-reply-link" href="/2013/12/29/hello-world/?replytocom=32#respond"
onclick="return addComment.moveForm('comment-32', '32', 'respond', '1')">Reply</a>
```
and the *Cancel Reply* link:
```
<a rel="nofollow" id="cancel-... |
127,744 | <p>Is there anyway I could convert all the posts e have right now on our WordPress install into products using some MySQL query or something like that?</p>
| [
{
"answer_id": 127745,
"author": "Ashok G",
"author_id": 44400,
"author_profile": "https://wordpress.stackexchange.com/users/44400",
"pm_score": 2,
"selected": false,
"text": "<p>You can update the <code>post_type</code> in <code>mysql</code> table <code>wp_posts</code> update the <code>... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127744",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26407/"
] | Is there anyway I could convert all the posts e have right now on our WordPress install into products using some MySQL query or something like that? | You could install the [Post Type Switcher plugin](http://wordpress.org/plugins/post-type-switcher/faq/)
Or Run SQL query on your database to change the post to product post type
```
UPDATE `wp_posts` SET `post_type` = 'product' WHERE `post_type` = 'post';
```
**Backup your DB 1st.**
```
UPDATE `wp_posts` SET ... |
127,750 | <p>I noticed recently my custom counts for custom post types are not showing on the dashboard. Im using this function:</p>
<p><a href="http://codex.wordpress.org/Plugin_API/Action_Reference/right_now_content_table_end" rel="nofollow">right_now_content_table_end</a></p>
<p>It worked well before, Im not sure when it st... | [
{
"answer_id": 127752,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>The new thing is essentially different widget and that hook was removed from core. The closest replacement is new <... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127750",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41331/"
] | I noticed recently my custom counts for custom post types are not showing on the dashboard. Im using this function:
[right\_now\_content\_table\_end](http://codex.wordpress.org/Plugin_API/Action_Reference/right_now_content_table_end)
It worked well before, Im not sure when it stopped working but I think after updatin... | The new action is `dashboard_glance_items`. It is a filter providing an array to which you can add items.
Example from my plugin [T5 Taxonomy Location](https://github.com/toscho/t5-taxonomy-location)
```
add_filter(
'dashboard_glance_items',
array ( $this, 'add_to_glance' )
);
/**
* Add locations to the new... |
127,758 | <p>I want to create a popup shortcode in admin panel.
I already create the shortcode button and a popup on button click.</p>
<p>I want to display in the popup (not in the shortcode button), all my custom shortcodes that I have created in a dropdown list.</p>
<p>I really don't know how to get my shortcodes name with ... | [
{
"answer_id": 127759,
"author": "Will",
"author_id": 17940,
"author_profile": "https://wordpress.stackexchange.com/users/17940",
"pm_score": 0,
"selected": false,
"text": "<p>shortcodes get added to the global $shortcode_tags array as they are registred/added. Therefore you can access t... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127758",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35097/"
] | I want to create a popup shortcode in admin panel.
I already create the shortcode button and a popup on button click.
I want to display in the popup (not in the shortcode button), all my custom shortcodes that I have created in a dropdown list.
I really don't know how to get my shortcodes name with a loop like this ... | You get all shortcodes, there are registered in WordPress with the default function in the global `$shortcode_tags`. You can loop about this shortcodes and filter via tag or functiion.
```
foreach( $shortcode_tags as $tag => $function ) {
}
```
If the `$function` is a array, then can also read the parameters. See t... |
127,765 | <p>What i mean is i am trying to add breadcrumbs to my blog and i thought of adding it before content or after title but there's an issue with that - on archive pages or category pages the breadcrumbs appear for every posts.</p>
<p>so i figured i have to attach the breadcrumbs to something above the post - like the he... | [
{
"answer_id": 127767,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>So far as I am aware, there is no hook in the location you need, if I understand you. The closest I can think... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127765",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41032/"
] | What i mean is i am trying to add breadcrumbs to my blog and i thought of adding it before content or after title but there's an issue with that - on archive pages or category pages the breadcrumbs appear for every posts.
so i figured i have to attach the breadcrumbs to something above the post - like the head.
how c... | So far as I am aware, there is no hook in the location you need, if I understand you. The closest I can think of is [`loop_start`](http://core.trac.wordpress.org/browser/tags/3.8/src/wp-includes/query.php#L3122), which as you might expect runs when the loop begins. The problem with that hook is that you don't know what... |
127,779 | <p>I've implemented a custom Isotope template for the NextGen Gallery plugin, and I've made changes and bug fixes to the template, but when I refresh the page the template changes have not taken effect.</p>
<p>I tested the cache of my browser by making changes to other theme template files, such as <em>header.php</em>... | [
{
"answer_id": 127803,
"author": "webaware",
"author_id": 24260,
"author_profile": "https://wordpress.stackexchange.com/users/24260",
"pm_score": 3,
"selected": false,
"text": "<p>NextGEN Gallery 2.0 caches galleries and albums in transients (plus their own custom transient expiration ti... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127779",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10110/"
] | I've implemented a custom Isotope template for the NextGen Gallery plugin, and I've made changes and bug fixes to the template, but when I refresh the page the template changes have not taken effect.
I tested the cache of my browser by making changes to other theme template files, such as *header.php*, etc. The browse... | NextGEN Gallery 2.0 caches galleries and albums in transients (plus their own custom transient expiration time record). You can clear the cache by deleting all transients.
Easiest way is to install a plugin like [Delete Expired Transients](http://wordpress.org/plugins/delete-expired-transients/) and delete all transie... |
127,793 | <p>I want to display the pages 'famous' and 'mschief'.</p>
<p>Using this code, WP_query() doesn't return any result:</p>
<pre><code>$args = array(
'post_type' => 'page',
'pagename' => 'famous,mschief',
'posts_per_page' => 3
);
</code></pre>
<p>This code returns one of the 2 pages:</p>
<pre><code>$args = ar... | [
{
"answer_id": 127795,
"author": "hornj",
"author_id": 25598,
"author_profile": "https://wordpress.stackexchange.com/users/25598",
"pm_score": 0,
"selected": false,
"text": "<p>For the first one, you have mismatched quotes on the third line. What it seems you were trying to do was:</p>\n... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127793",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11634/"
] | I want to display the pages 'famous' and 'mschief'.
Using this code, WP\_query() doesn't return any result:
```
$args = array(
'post_type' => 'page',
'pagename' => 'famous,mschief',
'posts_per_page' => 3
);
```
This code returns one of the 2 pages:
```
$args = array(
'post_type' => 'page',
'pagename=famous,mschief... | If you look at the query object after those queries are run, you'll see that none of those examples are doing what you think they're doing. The first issue is that you can't mix query string and array parameters, and the second issue is that `pagename` can only be used to load a single page.
In this one, you're missin... |
127,797 | <p>I have this code on a page called <strong>Categories</strong>.</p>
<pre><code><?php
/*
Template Name: Categories
*/
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<header class="page-header">
... | [
{
"answer_id": 127798,
"author": "hornj",
"author_id": 25598,
"author_profile": "https://wordpress.stackexchange.com/users/25598",
"pm_score": 0,
"selected": false,
"text": "<p>This line:</p>\n\n<pre><code> 'paged' => get_query_var('paged')\n</code></pre>\n\n<p>Should be se... | 2013/12/27 | [
"https://wordpress.stackexchange.com/questions/127797",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17368/"
] | I have this code on a page called **Categories**.
```
<?php
/*
Template Name: Categories
*/
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<header class="page-header">
<h1 class="page-title">
Catego... | The problem was in the same name for category slug "categories" and the same for the custom page that was holding all categories with the same name "categories".
I have solved that by changing categories slug (in permalinks settings) to singular "category" and I have left custom page as plural "categories".
If somebo... |
127,818 | <p>I'm building a plugin that adds extra functionality to a main plugin. Ideally in the plugins administration screen, the "activate" link should be disabled and an inline note should be added that tells the user to install and activate the main plugin first before he/she can use the current plugin.</p>
| [
{
"answer_id": 127819,
"author": "MrJustin",
"author_id": 43934,
"author_profile": "https://wordpress.stackexchange.com/users/43934",
"pm_score": 2,
"selected": false,
"text": "<p>Try this out, it's commented, so that should help you understand it.</p>\n\n<pre><code><?php\nregister_ac... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127818",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44420/"
] | I'm building a plugin that adds extra functionality to a main plugin. Ideally in the plugins administration screen, the "activate" link should be disabled and an inline note should be added that tells the user to install and activate the main plugin first before he/she can use the current plugin. | Thanks for the answers guys. Though both answers set me on the right path, none worked out of the box. So I'm sharing my solutions below.
Method 1 - Using register\_activation\_hook:
--------------------------------------------
Create the Parent Plugin in plugins/parent-plugin/parent-plugin.php:
```
<?php
/*
Plugin ... |
127,833 | <p>On a page-template, I need to display recent 10 posts. So I tried to use, <code>wp_get_recent_posts</code>, <a href="http://codex.wordpress.org/Function_Reference/wp_get_recent_posts" rel="nofollow">found here</a> in the codex, which I think is an appropriate hook for the purpose.The rest of the code is from my arch... | [
{
"answer_id": 127841,
"author": "Subharanjan",
"author_id": 13615,
"author_profile": "https://wordpress.stackexchange.com/users/13615",
"pm_score": 1,
"selected": false,
"text": "<p>Add the meta_key parameter to fetch the latest posts which have featured image set. <code>$args = array( ... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127833",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25508/"
] | On a page-template, I need to display recent 10 posts. So I tried to use, `wp_get_recent_posts`, [found here](http://codex.wordpress.org/Function_Reference/wp_get_recent_posts) in the codex, which I think is an appropriate hook for the purpose.The rest of the code is from my archive.php which displays the post-thumbnai... | Add the meta\_key parameter to fetch the latest posts which have featured image set. `$args = array( 'numberposts' => '10', 'meta_key' => '_thumbnail_id' );`
```
<?php
/*
Template Name: Recent Profiles
*/
get_header();
?>
<h1 class="page-title"><?php the_title(); ?></h1>
<div id="content">
<div id="maso... |
127,834 | <p>I have added the code to get the author, but it displays the author's ID number. How can I get the author's name to show and their gravatar.</p>
<p><strong>CODE</strong></p>
<pre><code><?php
$product_pages_args = array(
'meta_key' => '_wp_page_template',
'meta_value' => 'page_library_html_content.... | [
{
"answer_id": 127841,
"author": "Subharanjan",
"author_id": 13615,
"author_profile": "https://wordpress.stackexchange.com/users/13615",
"pm_score": 1,
"selected": false,
"text": "<p>Add the meta_key parameter to fetch the latest posts which have featured image set. <code>$args = array( ... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127834",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42718/"
] | I have added the code to get the author, but it displays the author's ID number. How can I get the author's name to show and their gravatar.
**CODE**
```
<?php
$product_pages_args = array(
'meta_key' => '_wp_page_template',
'meta_value' => 'page_library_html_content.php',
'hierarchical' => '0'
);
$product... | Add the meta\_key parameter to fetch the latest posts which have featured image set. `$args = array( 'numberposts' => '10', 'meta_key' => '_thumbnail_id' );`
```
<?php
/*
Template Name: Recent Profiles
*/
get_header();
?>
<h1 class="page-title"><?php the_title(); ?></h1>
<div id="content">
<div id="maso... |
127,857 | <p>I have my site: <a href="http://theapkstore.com" rel="nofollow">http://theapkstore.com</a> . On the homepage I've added a slider. And reduced the top margin of widget which says "Welcome to my site". The homepage looks fine but then when I open any one the link from the navbar then on that page I see that the top ma... | [
{
"answer_id": 127859,
"author": "Will",
"author_id": 17940,
"author_profile": "https://wordpress.stackexchange.com/users/17940",
"pm_score": 0,
"selected": false,
"text": "<p>use a conditional template tag when you enqueue the css.</p>\n\n<pre><code>add_action( 'wp_enqueue_scripts', 'ww... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127857",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44429/"
] | I have my site: <http://theapkstore.com> . On the homepage I've added a slider. And reduced the top margin of widget which says "Welcome to my site". The homepage looks fine but then when I open any one the link from the navbar then on that page I see that the top margin is acting on all the pages which causes the widg... | You are using `body_class()` in your template already, so your home page has a class `home` on the `body` element.
Restrict the margin rule in your stylesheet by using that class:
```
.home #secondary {
margin-top: 20px;
}
``` |
127,860 | <p>I am trying to use SMOF Options Framework in a plugin and i have this problem.
SMOOF use this constants to get theme directory url:</p>
<pre><code>if( !defined('ADMIN_PATH') )
define( 'ADMIN_PATH', get_template_directory() . '/admin/' );
if( !defined('ADMIN_DIR') )
define( 'ADMIN_DIR', get_template_director... | [
{
"answer_id": 127864,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>Use <code>plugin_dir_url( __FILE__ );</code> for the URL and <code>plugin_dir_path( __FILE__ );</code> for the path.</... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127860",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44196/"
] | I am trying to use SMOF Options Framework in a plugin and i have this problem.
SMOOF use this constants to get theme directory url:
```
if( !defined('ADMIN_PATH') )
define( 'ADMIN_PATH', get_template_directory() . '/admin/' );
if( !defined('ADMIN_DIR') )
define( 'ADMIN_DIR', get_template_directory_uri() . '/ad... | Use `plugin_dir_url( __FILE__ );` for the URL and `plugin_dir_path( __FILE__ );` for the path.
Pass the plugin’s main file to both functions to get similar results.
Besides that, `ADMIN_PATH` and `ADMIN_DIR` are really poor names for custom code. They might result in collisions with other code in the future. Try to u... |
127,863 | <p>I want to include the facebook JSSDK only on pages where I want to use it. On the facebook dev site it sais that ideally its included right after the opening body tag, which sits in header.php</p>
<p>My thought was to add in header.php</p>
<pre><code><?php do_action( 'topofthetop'); ?>
</code></pre>
<p>righ... | [
{
"answer_id": 127864,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>Use <code>plugin_dir_url( __FILE__ );</code> for the URL and <code>plugin_dir_path( __FILE__ );</code> for the path.</... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127863",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43825/"
] | I want to include the facebook JSSDK only on pages where I want to use it. On the facebook dev site it sais that ideally its included right after the opening body tag, which sits in header.php
My thought was to add in header.php
```
<?php do_action( 'topofthetop'); ?>
```
right after the opening body tag.
And the... | Use `plugin_dir_url( __FILE__ );` for the URL and `plugin_dir_path( __FILE__ );` for the path.
Pass the plugin’s main file to both functions to get similar results.
Besides that, `ADMIN_PATH` and `ADMIN_DIR` are really poor names for custom code. They might result in collisions with other code in the future. Try to u... |
127,872 | <p>Very simple Question: Here is my <code>get_categories()</code> code:</p>
<pre><code><?php $args = array(
'show_option_all' => '',
'show_option_none' => '',
'orderby' => 'ID',
'order' => 'ASC',
'show_count' => 0,
'hide_empty' => 0,
... | [
{
"answer_id": 127875,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 5,
"selected": true,
"text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/get_terms\"><code>get_terms</code></a> with a <co... | 2013/12/28 | [
"https://wordpress.stackexchange.com/questions/127872",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22728/"
] | Very simple Question: Here is my `get_categories()` code:
```
<?php $args = array(
'show_option_all' => '',
'show_option_none' => '',
'orderby' => 'ID',
'order' => 'ASC',
'show_count' => 0,
'hide_empty' => 0,
'exclude' => '1',
'hierarchic... | Use [`get_terms`](http://codex.wordpress.org/Function_Reference/get_terms) with a `parent` argument. From the Codex page for that function, emphasis mine:
>
> parent
> (integer) Get direct children of this term (only terms whose explicit parent is this value). **If 0 is passed, only top-level terms are returned.** ... |
127,901 | <p>Can someone tell me what's wrong here? I'm trying to create a category and a sub-category via PHP.</p>
<p>My code is</p>
<pre><code>wp_set_object_terms($postID, array($subCategory, $catgeory), 'category');
</code></pre>
<p>But that creates two categories on the same hirearchy level; my goal is a category with a s... | [
{
"answer_id": 127902,
"author": "shea",
"author_id": 19726,
"author_profile": "https://wordpress.stackexchange.com/users/19726",
"pm_score": 2,
"selected": false,
"text": "<p>You can use the <a href=\"http://codex.wordpress.org/Function_Reference/wp_insert_term\" rel=\"nofollow\"><code>... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127901",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44440/"
] | Can someone tell me what's wrong here? I'm trying to create a category and a sub-category via PHP.
My code is
```
wp_set_object_terms($postID, array($subCategory, $catgeory), 'category');
```
But that creates two categories on the same hirearchy level; my goal is a category with a sub-category. | You can use the [`wp_insert_term()`](http://codex.wordpress.org/Function_Reference/wp_insert_term) function to achive this. First create the parent category, then create a child category.
```
$parent = wp_insert_term(
'Parent Category', // category name
'category', // taxonomy
array(
'description' ... |
127,904 | <p>heelo,
I want to use this great hook <strong>edit_form_after_title</strong> </p>
<p>it was announced on December 1, 2012:<br>
<a href="http://make.wordpress.org/core/2012/12/01/more-hooks-on-the-edit-screen/" rel="nofollow">http://make.wordpress.org/core/2012/12/01/more-hooks-on-the-edit-screen/</a></p>
<p><stron... | [
{
"answer_id": 127907,
"author": "Shazzad",
"author_id": 42967,
"author_profile": "https://wordpress.stackexchange.com/users/42967",
"pm_score": 1,
"selected": false,
"text": "<p>Check post type using <code>$typenow</code> and <code>$pagenow</code> global variables.</p>\n\n<pre><code>add... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127904",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41168/"
] | heelo,
I want to use this great hook **edit\_form\_after\_title**
it was announced on December 1, 2012:
<http://make.wordpress.org/core/2012/12/01/more-hooks-on-the-edit-screen/>
**it curreclty hook for :
post-new, post, page-new, page.**
how do I make it to work only in edit page/post (**only post, page**)
th... | Personally I'd use a different approach, because **@Shazzad**'s solution seems too much global dependent, and **@s\_ha\_dum**'s needs 2 hooks instead of one.
I'd use [`get_current_screen`](http://codex.wordpress.org/Function_Reference/get_current_screen) function to get a [`WP_Screen`](http://codex.wordpress.org/Class... |
127,914 | <p>I tried to show tabbed settings in admin settings page by a tutorial but for me am getting settings saved notification for two times.</p>
<p>I think it is due to different settings field but based on selection of tab am showing only one form using the php condition. So there might be only one form with one <code>se... | [
{
"answer_id": 127916,
"author": "MrJustin",
"author_id": 43934,
"author_profile": "https://wordpress.stackexchange.com/users/43934",
"pm_score": 0,
"selected": false,
"text": "<p>Your going about setting up your options page in the non-traditional manner. View <a href=\"https://wordpre... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127914",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37102/"
] | I tried to show tabbed settings in admin settings page by a tutorial but for me am getting settings saved notification for two times.
I think it is due to different settings field but based on selection of tab am showing only one form using the php condition. So there might be only one form with one `settings_fields()... | The culprit is:
```
<?php settings_errors(); ?>
```
It isn't needed and will produce a second "Settings saved." notification if there are no errors.
**Edited for formatting.** |
127,917 | <p>Maybe I'm missing something here but I really can't find any answer to my question around the web.</p>
<p>I am creating a new wordpress theme from scratch (literally from scratch) and would like to create languages folder with PO and MO file in it.</p>
<p><strong>I would like to generate this translation MO file f... | [
{
"answer_id": 127918,
"author": "Subharanjan",
"author_id": 13615,
"author_profile": "https://wordpress.stackexchange.com/users/13615",
"pm_score": 4,
"selected": true,
"text": "<p>You can use the tool <code>POEdit</code> to translate your theme from scratch or update/add new strings in... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127917",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7730/"
] | Maybe I'm missing something here but I really can't find any answer to my question around the web.
I am creating a new wordpress theme from scratch (literally from scratch) and would like to create languages folder with PO and MO file in it.
**I would like to generate this translation MO file from scratch**
I was lo... | You can use the tool `POEdit` to translate your theme from scratch or update/add new strings into the .po/.mo files. Here is the tool usage tutorial: [Translating\_With\_Poedit](http://codex.wordpress.org/Translating_WordPress#Translating_With_Poedit)
There is a plugin that can do the job for you: [codestyling-localiz... |
127,920 | <p>My sidebar is getting dragged down on uid=1: <a href="http://www.mrgeek.me/contributors/?uid=1" rel="nofollow">http://www.mrgeek.me/contributors/?uid=1</a></p>
<p>Now, the other contributor pages have the same underlying markup, yet they work fine.</p>
<p>For example, uid=3, <a href="http://www.mrgeek.me/contribut... | [
{
"answer_id": 127922,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 3,
"selected": true,
"text": "<p>Look for unclosed elements like a div tag or unordered list tag which looks something like this:</p>\n\n<pre... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127920",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44451/"
] | My sidebar is getting dragged down on uid=1: <http://www.mrgeek.me/contributors/?uid=1>
Now, the other contributor pages have the same underlying markup, yet they work fine.
For example, uid=3, <http://www.mrgeek.me/contributors/?uid=3>.
I need to know what is happening and what should I do? | Look for unclosed elements like a div tag or unordered list tag which looks something like this:
```
/div>
/ul>
```
You've got 30 errors on the page and about 4 unclosed elements.
You can test any url using <http://validator.w3.org/>
Here's some of the results:
Error Line 1277, Column 7: End tag for body seen, bu... |
127,921 | <p>I'm using <a href="https://codex.wordpress.org/Function_Reference/get_taxonomy_template" rel="nofollow">taxonomy_template</a> filter in my <strong>plugin</strong> to load a template file for <strong>custom user taxonomies</strong>. This is the code I'm using</p>
<pre><code> add_filter( 'taxonomy_template', 'get_cus... | [
{
"answer_id": 127923,
"author": "Jørgen",
"author_id": 23502,
"author_profile": "https://wordpress.stackexchange.com/users/23502",
"pm_score": 0,
"selected": false,
"text": "<p>The get_query_var function requires the wp_query object, and it is not within your functions scope - so you ne... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127921",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32466/"
] | I'm using [taxonomy\_template](https://codex.wordpress.org/Function_Reference/get_taxonomy_template) filter in my **plugin** to load a template file for **custom user taxonomies**. This is the code I'm using
```
add_filter( 'taxonomy_template', 'get_custom_taxonomy_template' );
function get_custom_taxonomy_template(... | Issue was with `UT_TEMPLATES_URL`used for including the template.
I was using `file URL` and not `file PATH` which was creating the issue.
Modifying the `UT_TEMPLATES_URL`, to `FILE PATH` fixes the issue. |
127,940 | <p>I can't find a solutions in internet or advance custom field website docs about this. I hope wordpress genius can help me.</p>
<p>I use <a href="http://wordpress.org/extend/plugins/advanced-custom-fields/" rel="nofollow">http://wordpress.org/extend/plugins/advanced-custom-fields/</a> for themes options/function.
I ... | [
{
"answer_id": 127923,
"author": "Jørgen",
"author_id": 23502,
"author_profile": "https://wordpress.stackexchange.com/users/23502",
"pm_score": 0,
"selected": false,
"text": "<p>The get_query_var function requires the wp_query object, and it is not within your functions scope - so you ne... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127940",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44455/"
] | I can't find a solutions in internet or advance custom field website docs about this. I hope wordpress genius can help me.
I use <http://wordpress.org/extend/plugins/advanced-custom-fields/> for themes options/function.
I want to show category post in homepage using category name. here is my code:
```
<!-- Start Cate... | Issue was with `UT_TEMPLATES_URL`used for including the template.
I was using `file URL` and not `file PATH` which was creating the issue.
Modifying the `UT_TEMPLATES_URL`, to `FILE PATH` fixes the issue. |
127,947 | <p>I would like to sort my article from a category by a number added in a meta field.</p>
<p>Here is the first step, I get the articles to display on the page.</p>
<pre><code><?php
$cat = get_post_meta( get_the_ID(), 'cat_page', true );
?>
</code></pre>
<p>I begin the loop. This is on this loop I get my cu... | [
{
"answer_id": 127966,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 0,
"selected": false,
"text": "<pre><code><?php\n$cat = get_post_meta( get_the_ID(), 'cat_page', true );\n\n$args = array(\n 'category_name' ... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127947",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42755/"
] | I would like to sort my article from a category by a number added in a meta field.
Here is the first step, I get the articles to display on the page.
```
<?php
$cat = get_post_meta( get_the_ID(), 'cat_page', true );
?>
```
I begin the loop. This is on this loop I get my custom meta field.
```
<?php if ( $cat )... | ```
<?php
$cat = get_post_meta( get_the_ID(), 'cat_page', true );
$args = array(
'category_name' => $cat,
'meta_key' => 'niveau_chiffre',
'orderby' => 'meta_value_num', //Since we're dealing with numbers
'order' => 'ASC',
//'meta_query' => array(
// array(
//'key' => 'niveau-chiff... |
127,951 | <p><br/>
I'm building a website in which there is a page where I collect a list of works/projects; I created a file called <code>work.php</code> where I made the template of this page, but when I try to view a single custom post (when I press on a single item), it says that the page doesn't exist.</p>
<p>Then, my ques... | [
{
"answer_id": 127953,
"author": "Przemysław Suszek",
"author_id": 43829,
"author_profile": "https://wordpress.stackexchange.com/users/43829",
"pm_score": 0,
"selected": false,
"text": "<p>You have to create a custom single page file. Or search about template post in wordpress.</p>\n"
... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127951",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26716/"
] | I'm building a website in which there is a page where I collect a list of works/projects; I created a file called `work.php` where I made the template of this page, but when I try to view a single custom post (when I press on a single item), it says that the page doesn't exist.
Then, my question is: do I have to creat... | If you CPT is called "**work**", i.e. you have registered it using
```
register_post_type('work', $args);
```
you have to create a file called **`'single-work.php'`** and that will be used to show the singular work post.
If you don't create that file the file `'single.php'`,if present, will be used by WordPress. If... |
127,962 | <p>How do you add CSS code to a certain blog post in WordPress? Would I have to create a new file and keep the CSS code I need for this blog post in that file?</p>
| [
{
"answer_id": 127963,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 0,
"selected": false,
"text": "<p>The easiest way is probably to add it in the post itself (inline CSS) if you are only editing ONE post (you will ... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127962",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44349/"
] | How do you add CSS code to a certain blog post in WordPress? Would I have to create a new file and keep the CSS code I need for this blog post in that file? | You can use PHP code in your child themes functions.php file to add a custom body class to any page/post etc.
```
add_filter( 'body_class', 'my_custom_body_class' );
function my_custom_body_class( $classes ) {
if ( is_single( '007' ))
$classes[] = 'custom-class';
return $classes;
}
```
This sample code will ... |
127,971 | <p>I'm using the following JavaScript to load more pages in #work_items (see live at <a href="http://mtthwbsh.com" rel="nofollow">http://mtthwbsh.com</a>):</p>
<pre><code>jQuery(document).ready(function($){
$('.older a').live('click', function(e) {
e.preventDefault();
$('.navigation').prepend("<div class=\"loader\... | [
{
"answer_id": 127963,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 0,
"selected": false,
"text": "<p>The easiest way is probably to add it in the post itself (inline CSS) if you are only editing ONE post (you will ... | 2013/12/29 | [
"https://wordpress.stackexchange.com/questions/127971",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27728/"
] | I'm using the following JavaScript to load more pages in #work\_items (see live at <http://mtthwbsh.com>):
```
jQuery(document).ready(function($){
$('.older a').live('click', function(e) {
e.preventDefault();
$('.navigation').prepend("<div class=\"loader\"> </div>");
var link = jQuery(this).attr('href');
var $... | You can use PHP code in your child themes functions.php file to add a custom body class to any page/post etc.
```
add_filter( 'body_class', 'my_custom_body_class' );
function my_custom_body_class( $classes ) {
if ( is_single( '007' ))
$classes[] = 'custom-class';
return $classes;
}
```
This sample code will ... |
127,979 | <p>I would like to let category editor appear to any user and user can edit their preferred category(ies).</p>
<p><strong>For example:</strong>
the category is about kind of job or profession and there are 10 categories(professions).
When user login, they can edit profile and they can choose their profession as well.
... | [
{
"answer_id": 127980,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 1,
"selected": false,
"text": "<p>There are a number of ways you could do this. Essentially, I'd split the process into 3 parts.</p>\n\n<ol>\n ... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/127979",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35701/"
] | I would like to let category editor appear to any user and user can edit their preferred category(ies).
**For example:**
the category is about kind of job or profession and there are 10 categories(professions).
When user login, they can edit profile and they can choose their profession as well.
I can imagine that crea... | `User taxonomies` can help you achieve this, I'm working on something similar.
You can install the plugin <http://wordpress.org/plugins/user-taxonomies/>, and register a custom taxonomy , although in my case the plugin has some limitations, may be it helps you.
```
register_taxonomy('profession', 'user', array(
'publi... |
127,991 | <p>I did a wordpress project localhost using MAMP in Mac os,when I'm import the data to window 7.
I have 6 Menu items </p>
<p><img src="https://i.stack.imgur.com/y0bNJ.png" alt="enter image description here"></p>
<p>there are some images and they are not displaying(I'm using revolutio slider)
Menu items are also not... | [
{
"answer_id": 127980,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 1,
"selected": false,
"text": "<p>There are a number of ways you could do this. Essentially, I'd split the process into 3 parts.</p>\n\n<ol>\n ... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/127991",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44418/"
] | I did a wordpress project localhost using MAMP in Mac os,when I'm import the data to window 7.
I have 6 Menu items

there are some images and they are not displaying(I'm using revolutio slider)
Menu items are also not working properly when i click ... | `User taxonomies` can help you achieve this, I'm working on something similar.
You can install the plugin <http://wordpress.org/plugins/user-taxonomies/>, and register a custom taxonomy , although in my case the plugin has some limitations, may be it helps you.
```
register_taxonomy('profession', 'user', array(
'publi... |
128,004 | <p>I know how to write WordPress plugins but I have no idea how we could create an option page for our plugin. I have read lot of tutorials but I still have no idea about creating option pages.</p>
<p>So just for learning, I want to create an Option Page with one input field "Favicon URL" which will update <strong>FAV... | [
{
"answer_id": 127980,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 1,
"selected": false,
"text": "<p>There are a number of ways you could do this. Essentially, I'd split the process into 3 parts.</p>\n\n<ol>\n ... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128004",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33233/"
] | I know how to write WordPress plugins but I have no idea how we could create an option page for our plugin. I have read lot of tutorials but I still have no idea about creating option pages.
So just for learning, I want to create an Option Page with one input field "Favicon URL" which will update **FAVICON IMAGE URL**... | `User taxonomies` can help you achieve this, I'm working on something similar.
You can install the plugin <http://wordpress.org/plugins/user-taxonomies/>, and register a custom taxonomy , although in my case the plugin has some limitations, may be it helps you.
```
register_taxonomy('profession', 'user', array(
'publi... |
128,026 | <p>Currently I have two WooCommerce setups both running on the same server for demonstration and testing purposes. Each is installed on a different subdomain. One sends out registration and forgot password emails ("working" version) but the other does not ("fail" version). Both use WP latest (3.8).</p>
<p>The "working... | [
{
"answer_id": 128028,
"author": "Subharanjan",
"author_id": 13615,
"author_profile": "https://wordpress.stackexchange.com/users/13615",
"pm_score": 1,
"selected": false,
"text": "<p>-- Check your log files for any errors if you have one.</p>\n\n<p>else </p>\n\n<p>-- Create a file say 'w... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128026",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28957/"
] | Currently I have two WooCommerce setups both running on the same server for demonstration and testing purposes. Each is installed on a different subdomain. One sends out registration and forgot password emails ("working" version) but the other does not ("fail" version). Both use WP latest (3.8).
The "working" version ... | I just completed troubleshooting with my hosting support and there was an error (not sure where yet, CSR should be sending it shortly) but it was not viewable by me anywhere in my cPanel.
The error message led me to suspect that my 77 character long site name was a problem. I went into `WooCommerce->Settings->Emails` ... |
128,062 | <p>I'm trying to create a class that allows me to generate a navigation menu. Here's a simplified version of what I'm using:</p>
<pre><code>class PJ_Menu {
function make_menu() {
$args = array(
'theme_location' => 'location',
'fallback_cb' => array( $this, 'pj_page_menu' ),
... | [
{
"answer_id": 128066,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": true,
"text": "<p>The <code>fallback_cb</code> argument is used when the menu doesn't exist-- that is, when there is no menu of... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128062",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16121/"
] | I'm trying to create a class that allows me to generate a navigation menu. Here's a simplified version of what I'm using:
```
class PJ_Menu {
function make_menu() {
$args = array(
'theme_location' => 'location',
'fallback_cb' => array( $this, 'pj_page_menu' ),
);
wp_... | The `fallback_cb` argument is used when the menu doesn't exist-- that is, when there is no menu of the right name. I won't be used otherwise. [Check the Codex](http://codex.wordpress.org/Function_Reference/wp_nav_menu). By default the fallback is `wp_page_menu`.
Your code looks right to me for using a class method as... |
128,063 | <p>I am using bootstrap to create panels for the sidebar widgets, and I can set the container markup for the widget, as well as the markup for the panel header, but I cannot provide the markup for the panel content. I have this so far:</p>
<pre><code>register_sidebar(array(
'name' => __('Right Sidebar'),
'i... | [
{
"answer_id": 128066,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": true,
"text": "<p>The <code>fallback_cb</code> argument is used when the menu doesn't exist-- that is, when there is no menu of... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128063",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35090/"
] | I am using bootstrap to create panels for the sidebar widgets, and I can set the container markup for the widget, as well as the markup for the panel header, but I cannot provide the markup for the panel content. I have this so far:
```
register_sidebar(array(
'name' => __('Right Sidebar'),
'id' => 'home_right... | The `fallback_cb` argument is used when the menu doesn't exist-- that is, when there is no menu of the right name. I won't be used otherwise. [Check the Codex](http://codex.wordpress.org/Function_Reference/wp_nav_menu). By default the fallback is `wp_page_menu`.
Your code looks right to me for using a class method as... |
128,072 | <p>I am simply trying to reorder my dropdown options in my header menu.
It pulls from categories and is currently listed them, with the exception of the first, in alphabetical order. I want to list in order of slug. I have tried to change the 'orderby' but seemingly unsuccessfully.</p>
<p>Attached are screen shots of ... | [
{
"answer_id": 128077,
"author": "abhishekfdd",
"author_id": 44079,
"author_profile": "https://wordpress.stackexchange.com/users/44079",
"pm_score": 1,
"selected": false,
"text": "<p>In $args you are using</p>\n\n<pre><code>'child_of'=>5,\n</code></pre>\n\n<p>why are you using this an... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128072",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44499/"
] | I am simply trying to reorder my dropdown options in my header menu.
It pulls from categories and is currently listed them, with the exception of the first, in alphabetical order. I want to list in order of slug. I have tried to change the 'orderby' but seemingly unsuccessfully.
Attached are screen shots of
a) the dr... | In $args you are using
```
'child_of'=>5,
```
why are you using this and if you are using this parameter you should set
```
hide_empty => 0
``` |
128,081 | <p>Could anyone be kind enough to descrive how to I can detect (in my functions file) when admin an user is on the 'All Posts' page?</p>
<p>I have tried get_post_type() but it returns nothing.</p>
<p>Thanks.</p>
| [
{
"answer_id": 128083,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 0,
"selected": false,
"text": "<p>If I understood you correctly, this is what you are looking for:</p>\n\n<pre><code>if (\n 'edit.php' === ... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128081",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44498/"
] | Could anyone be kind enough to descrive how to I can detect (in my functions file) when admin an user is on the 'All Posts' page?
I have tried get\_post\_type() but it returns nothing.
Thanks. | If you need exactly on `All Posts` page, Not on `All Pages`, nor `All Products` or etc -
```
if
(
'edit.php' === $GLOBALS['pagenow']
&& (
isset( $GLOBALS['typenow'] )
&& '' == $GLOBALS['typenow']
|| 'post' == $GLOBALS['typenow']
)
)
{
// Do what you like...
}
``` |
128,084 | <p>Happy New year!</p>
<p>So I am having a big of a problem, currently one of our php files that we bought points to the default uploads directory for wordpress and we would like to change this to our own uploads directory.</p>
<p>We are still using the default uploads directory for wordpress but we want to change th... | [
{
"answer_id": 128832,
"author": "sakibmoon",
"author_id": 23214,
"author_profile": "https://wordpress.stackexchange.com/users/23214",
"pm_score": 0,
"selected": false,
"text": "<p>You need to define <code>UPLOADS</code> constant.</p>\n\n<p>Add the following line in your <code>wp-config.... | 2013/12/30 | [
"https://wordpress.stackexchange.com/questions/128084",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31899/"
] | Happy New year!
So I am having a big of a problem, currently one of our php files that we bought points to the default uploads directory for wordpress and we would like to change this to our own uploads directory.
We are still using the default uploads directory for wordpress but we want to change the directory where... | try this way:
```
function wp128084_upload_dir( $pathdata ) {
// change path here
return $pathdata;
}
add_filter('upload_dir', 'wp128084_upload_dir');
```
add this where you want to change upload directory then again remove filter
to change to default wordpress directory
```
remove_filter('upload_dir', '... |
128,118 | <p>I've got this in my main php file, but the scripts aren't loading</p>
<pre><code>function class_table_scripts() {
wp_register_script( 'JavaScript1', plugins_url('js/wcs.js'), array() );
wp_register_script( 'JavaScript1', plugins_url('js/jquery.qtip-1.0.0-rc3.min.js'), array('jquery') );
}
add_action( 'wp_en... | [
{
"answer_id": 128119,
"author": "shahpranaf",
"author_id": 42962,
"author_profile": "https://wordpress.stackexchange.com/users/42962",
"pm_score": 2,
"selected": false,
"text": "<p>Hey use admin_enqueue_scripts.<br>\nif you want to load a set of CSS and/or Javascript documents to all ad... | 2013/12/31 | [
"https://wordpress.stackexchange.com/questions/128118",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43473/"
] | I've got this in my main php file, but the scripts aren't loading
```
function class_table_scripts() {
wp_register_script( 'JavaScript1', plugins_url('js/wcs.js'), array() );
wp_register_script( 'JavaScript1', plugins_url('js/jquery.qtip-1.0.0-rc3.min.js'), array('jquery') );
}
add_action( 'wp_enqueue_scripts'... | Here's how I finally got it:
```
function class_table_scripts() {
wp_register_script( 'JavaScript1', plugins_url('js/wcs.js',__FILE__));
wp_register_script( 'JQuery1', plugins_url('js/jquery.qtip-1.0.0-rc3.min.js',__FILE__) );
}
add_action( 'admin_init', 'class_table_scripts' );
``` |
128,140 | <p>I am trying to create a post to show top 10 movies of 2013.</p>
<p>I have created a post with the same heading. However how can I show the post with next buttons. That is position 10 movie should be first, with corresponding image and some text. </p>
<p>Then on clicking next button go to 9th movie. like that the ... | [
{
"answer_id": 128119,
"author": "shahpranaf",
"author_id": 42962,
"author_profile": "https://wordpress.stackexchange.com/users/42962",
"pm_score": 2,
"selected": false,
"text": "<p>Hey use admin_enqueue_scripts.<br>\nif you want to load a set of CSS and/or Javascript documents to all ad... | 2013/12/31 | [
"https://wordpress.stackexchange.com/questions/128140",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44534/"
] | I am trying to create a post to show top 10 movies of 2013.
I have created a post with the same heading. However how can I show the post with next buttons. That is position 10 movie should be first, with corresponding image and some text.
Then on clicking next button go to 9th movie. like that the last screen should... | Here's how I finally got it:
```
function class_table_scripts() {
wp_register_script( 'JavaScript1', plugins_url('js/wcs.js',__FILE__));
wp_register_script( 'JQuery1', plugins_url('js/jquery.qtip-1.0.0-rc3.min.js',__FILE__) );
}
add_action( 'admin_init', 'class_table_scripts' );
``` |
128,157 | <p>I have the terms of a custom taxonomy presented in a list like this:</p>
<pre><code> <?php $taxonomy = 'categories'; $tax_terms = get_terms($taxonomy); ?>
<ul>
<?php foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_ter... | [
{
"answer_id": 128159,
"author": "tfrommen",
"author_id": 27722,
"author_profile": "https://wordpress.stackexchange.com/users/27722",
"pm_score": 0,
"selected": false,
"text": "<p>Try it like this:</p>\n\n<pre><code><?php\n$taxonomy = 'categories';\n$tax_terms = get_terms($taxonomy);\... | 2013/12/31 | [
"https://wordpress.stackexchange.com/questions/128157",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44367/"
] | I have the terms of a custom taxonomy presented in a list like this:
```
<?php $taxonomy = 'categories'; $tax_terms = get_terms($taxonomy); ?>
<ul>
<?php foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf... | `get_terms()` got an upgrade in WordPress v4.6 so you can use the news `WP_Term_Query` class instead. You can use this to simply exclude the ID of the term `archive` so that it never becomes part of your results to begin with. So say the ID of `archive` is 5:
```
$args = array(
'taxonomy' => 'category',
'exclude... |
128,164 | <p>For months I've been trying to plan out a good project structure for using git version control for WordPress website development that doesn't sacrifice the ability to update core and plugins through the WP dashboard, doesn't require an unconventional directory structure (wp-content outside of the WP parent folder) a... | [
{
"answer_id": 128165,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": false,
"text": "<p>From my perspective there are two issues with your plan - Git and \"conventional\" structure. So basically everythi... | 2013/12/31 | [
"https://wordpress.stackexchange.com/questions/128164",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/21290/"
] | For months I've been trying to plan out a good project structure for using git version control for WordPress website development that doesn't sacrifice the ability to update core and plugins through the WP dashboard, doesn't require an unconventional directory structure (wp-content outside of the WP parent folder) and ... | From my perspective there are two issues with your plan - Git and "conventional" structure. So basically everything. :)
1. Git (and version control in general) is a poor tool for whole site stacks. Been there, done that, it hurt a lot.
2. What you call an "unconventional" structure with content separated from core has... |
128,178 | <p>Right now I am adding a sidebar above my woocommerce products. How can I hook the sidebar to my theme. </p>
<p>Have registered sidebar and it works.</p>
<pre><code>register_sidebar(
array(
'name' => __( 'Filters', 'woothemes' ),
'id' => 'filters',
'descript... | [
{
"answer_id": 128165,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": false,
"text": "<p>From my perspective there are two issues with your plan - Git and \"conventional\" structure. So basically everythi... | 2014/01/01 | [
"https://wordpress.stackexchange.com/questions/128178",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44553/"
] | Right now I am adding a sidebar above my woocommerce products. How can I hook the sidebar to my theme.
Have registered sidebar and it works.
```
register_sidebar(
array(
'name' => __( 'Filters', 'woothemes' ),
'id' => 'filters',
'description' => __( 'Optional wid... | From my perspective there are two issues with your plan - Git and "conventional" structure. So basically everything. :)
1. Git (and version control in general) is a poor tool for whole site stacks. Been there, done that, it hurt a lot.
2. What you call an "unconventional" structure with content separated from core has... |
128,189 | <p>Where is defined a custom register_taxonomy for my website url?</p>
<p>Now is showing:</p>
<pre><code>http://localhost:1337/wordpress/portfolio-list/yapbond/
</code></pre>
<p>But I want</p>
<pre><code>http://localhost:1337/wordpress/product-list/yapbond/
</code></pre>
<p>In which file I change this?</p>
| [
{
"answer_id": 128165,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": false,
"text": "<p>From my perspective there are two issues with your plan - Git and \"conventional\" structure. So basically everythi... | 2014/01/01 | [
"https://wordpress.stackexchange.com/questions/128189",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44173/"
] | Where is defined a custom register\_taxonomy for my website url?
Now is showing:
```
http://localhost:1337/wordpress/portfolio-list/yapbond/
```
But I want
```
http://localhost:1337/wordpress/product-list/yapbond/
```
In which file I change this? | From my perspective there are two issues with your plan - Git and "conventional" structure. So basically everything. :)
1. Git (and version control in general) is a poor tool for whole site stacks. Been there, done that, it hurt a lot.
2. What you call an "unconventional" structure with content separated from core has... |
128,213 | <p>I am converting html5 to wordpress Theme. I want to use custom scroll for wordpress. The code </p>
<p>DEPENDENCIES It's a plugin for the jquery framework, you need to include jquery in your scripts.</p>
<p>I will use</p>
<p><code><?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?></code></... | [
{
"answer_id": 128207,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 1,
"selected": false,
"text": "<p>You can add the help text above the meta boxes in the Edit Screens easily when using a plugin like ACF or T... | 2014/01/01 | [
"https://wordpress.stackexchange.com/questions/128213",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44529/"
] | I am converting html5 to wordpress Theme. I want to use custom scroll for wordpress. The code
DEPENDENCIES It's a plugin for the jquery framework, you need to include jquery in your scripts.
I will use
`<?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>`
Will it work just by that What about belo... | You can also add meta boxes with the content, which help the users. This is more useful. The writers can hide this box and set their personal options to hide the hints from you, if is not necessary for the writers. To add the boxes to the different post type use the specific hooks: `add_meta_boxes_xxx`, `xxx` is for th... |
128,215 | <p>My blog <a href="http://MyTechFlow.Com" rel="nofollow">http://MyTechFlow.Com</a> having a link below ie: after footer its due to a link in child thems function.php</p>
<p>I want to remove it but dont know what to remove & what to keep.</p>
<p>Below is the text part of function.php plz suggest me to which line ... | [
{
"answer_id": 128218,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": false,
"text": "<p>The part you need to remove is this: <code>add_action( 'wp_footer', 'addcopy' );</code>. Or remove it with ... | 2014/01/01 | [
"https://wordpress.stackexchange.com/questions/128215",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44374/"
] | My blog <http://MyTechFlow.Com> having a link below ie: after footer its due to a link in child thems function.php
I want to remove it but dont know what to remove & what to keep.
Below is the text part of function.php plz suggest me to which line and symbol to remove so that it will remove that link from my footers ... | The part you need to remove is this: `add_action( 'wp_footer', 'addcopy' );`. Or remove it with `remove_action`, like so:
```
remove_action('wp_footer','addcopy');
```
However, if your theme has included this link in such a way that you cannot easily remove it-- that is, cannot remove it with a theme option without ... |
128,237 | <p>I am trying to convert html to wordpress.
The code in the html was:</p>
<pre><code><script src="js/jquery.nicescroll.min.js"></script>
<script src="js/jquery.js"></script> ( jQuery v1.7.2 )
</code></pre>
<p>and The inline script </p>
<pre><code>$(document).ready(
function() {
$("h... | [
{
"answer_id": 128248,
"author": "Wyck",
"author_id": 1509,
"author_profile": "https://wordpress.stackexchange.com/users/1509",
"pm_score": 2,
"selected": false,
"text": "<p>Several pointers.</p>\n\n<ul>\n<li>The latest WordPress version uses jQuery v1.10.2 , always use the\nbundled vers... | 2014/01/01 | [
"https://wordpress.stackexchange.com/questions/128237",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44529/"
] | I am trying to convert html to wordpress.
The code in the html was:
```
<script src="js/jquery.nicescroll.min.js"></script>
<script src="js/jquery.js"></script> ( jQuery v1.7.2 )
```
and The inline script
```
$(document).ready(
function() {
$("html").niceScroll();
}
); and much more.
```
In wordpres... | Several pointers.
* The latest WordPress version uses jQuery v1.10.2 , always use the
bundled version for admin areas , for the front end you can use the
bundled version or a CDN.
If you use a CDN make sure to still use `jquery` as a `$handle` so it is not loaded multiple times from other plugins/themes that also enq... |
128,247 | <p>I use the Categories widget on my sidebar(s) and I would like to display a <a href="http://fontawesome.io/" rel="nofollow">Font Awesome icon</a> next to each category listed in the widget. The icon would be the same for all categories, for now, but I would like to give each category it's own unique icon in the futu... | [
{
"answer_id": 128547,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"https://stackoverflow.com/questions/16994606/modify-default-wordpress-category-widget\">This answer</a>... | 2014/01/01 | [
"https://wordpress.stackexchange.com/questions/128247",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43934/"
] | I use the Categories widget on my sidebar(s) and I would like to display a [Font Awesome icon](http://fontawesome.io/) next to each category listed in the widget. The icon would be the same for all categories, for now, but I would like to give each category it's own unique icon in the future.
I would like to modify th... | Assumptions:
------------
You don't explain how you want to install the Font Awesome package, so I just assume for the moment that you use the plugin [Font Awesome Icons](http://wordpress.org/plugins/font-awesome/).
You wrote:
>
> Before anyone says use a background image, I do not want to do that. I
> would like... |
128,294 | <p>I do not want a user to be able to publish a post if no category is selected. I don't mind throwing a JS alert or handling this on the server side as well. </p>
<p>Anyway, how can I ensure this? </p>
<p>Note: "uncategorized" should not be chosen as well.</p>
| [
{
"answer_id": 128301,
"author": "shahpranaf",
"author_id": 42962,
"author_profile": "https://wordpress.stackexchange.com/users/42962",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this easily with jQuery:</p>\n\n<pre><code>/* Checks if cat is selected when publish button is c... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128294",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24656/"
] | I do not want a user to be able to publish a post if no category is selected. I don't mind throwing a JS alert or handling this on the server side as well.
Anyway, how can I ensure this?
Note: "uncategorized" should not be chosen as well. | You can do this easily with jQuery:
```
/* Checks if cat is selected when publish button is clicked */
jQuery( '#submitdiv' ).on( 'click', '#publish', function( e ) {
var $checked = jQuery( '#category-all li input:checked' );
//Checks if cat is selected
if( $checked.length <= 0 ) {
alert( "Please ... |
128,302 | <p>i want to get image full path so that i can apply it in the src attribute of image element.</p>
<p>what i am getting right now is the image, generated from function:
the_post_thumbnail();
which i can't apply to image element</p>
<p>what i did so far is:</p>
<pre><code> <?php
$d=get_c... | [
{
"answer_id": 128301,
"author": "shahpranaf",
"author_id": 42962,
"author_profile": "https://wordpress.stackexchange.com/users/42962",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this easily with jQuery:</p>\n\n<pre><code>/* Checks if cat is selected when publish button is c... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128302",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44589/"
] | i want to get image full path so that i can apply it in the src attribute of image element.
what i am getting right now is the image, generated from function:
the\_post\_thumbnail();
which i can't apply to image element
what i did so far is:
```
<?php
$d=get_cat_ID( 'news' );
... | You can do this easily with jQuery:
```
/* Checks if cat is selected when publish button is clicked */
jQuery( '#submitdiv' ).on( 'click', '#publish', function( e ) {
var $checked = jQuery( '#category-all li input:checked' );
//Checks if cat is selected
if( $checked.length <= 0 ) {
alert( "Please ... |
128,306 | <p>I have a couple of custom fields setup and working fine, is there any way to show the date when the custom field was created within the post template? I tried searching around, but no luck.</p>
<p>For example:</p>
<pre><code>name: test1 - value: result1 -------- created 10/02/09
name: test2 - value: result2 ... | [
{
"answer_id": 128328,
"author": "Geoffrey Hale",
"author_id": 44572,
"author_profile": "https://wordpress.stackexchange.com/users/44572",
"pm_score": -1,
"selected": false,
"text": "<p>For a rough estimate, you could check the database for first entries to the field.</p>\n"
},
{
... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128306",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27376/"
] | I have a couple of custom fields setup and working fine, is there any way to show the date when the custom field was created within the post template? I tried searching around, but no luck.
For example:
```
name: test1 - value: result1 -------- created 10/02/09
name: test2 - value: result2 -------- created 15... | By default, there are no creation dates associated with custom meta fields. If you [check the description](https://codex.wordpress.org/Database_Description#Table%3a_wp_postmeta), you can see that it is a very simple table of key/value pairs associated with a post ID, plus an auto-increment field. There is no time compo... |
128,316 | <p>I have embedded a map on the third tab on a page. </p>
<p><a href="http://caminoways.lucidity.us/ways/french-way-camino-frances/french-way-section-8" rel="nofollow">Page here</a> > 'Itinerary' tab</p>
<p>If you go straight to the tab while the page is still loading - it loads the map perfectly. However, if you wai... | [
{
"answer_id": 128321,
"author": "shahpranaf",
"author_id": 42962,
"author_profile": "https://wordpress.stackexchange.com/users/42962",
"pm_score": 3,
"selected": true,
"text": "<p>You are using iframe in tab structure.So,<br>\n1) When page loads fully, the iframe in itenary tab has disp... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128316",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43113/"
] | I have embedded a map on the third tab on a page.
[Page here](http://caminoways.lucidity.us/ways/french-way-camino-frances/french-way-section-8) > 'Itinerary' tab
If you go straight to the tab while the page is still loading - it loads the map perfectly. However, if you wait until the page has fully loaded and then ... | You are using iframe in tab structure.So,
1) When page loads fully, the iframe in itenary tab has display none. so it is not loading the zoomed map properly.
2) When you switch to itenary tab before loading completes, iframe is display block i.e visible so it loads the url/map properly.
So for this what you can... |
128,325 | <p>I have a virtual server at Strato with Plesk 11 installed. There I got offered to install WordPress and created a blog. All fine. It has created a "/wordpress" folder on my server's <code>httpdocs</code> directory.
Say, I wanted to have a second installation of WordPress on the same server, running a different blog.... | [
{
"answer_id": 128321,
"author": "shahpranaf",
"author_id": 42962,
"author_profile": "https://wordpress.stackexchange.com/users/42962",
"pm_score": 3,
"selected": true,
"text": "<p>You are using iframe in tab structure.So,<br>\n1) When page loads fully, the iframe in itenary tab has disp... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128325",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44603/"
] | I have a virtual server at Strato with Plesk 11 installed. There I got offered to install WordPress and created a blog. All fine. It has created a "/wordpress" folder on my server's `httpdocs` directory.
Say, I wanted to have a second installation of WordPress on the same server, running a different blog. Can I just go... | You are using iframe in tab structure.So,
1) When page loads fully, the iframe in itenary tab has display none. so it is not loading the zoomed map properly.
2) When you switch to itenary tab before loading completes, iframe is display block i.e visible so it loads the url/map properly.
So for this what you can... |
128,336 | <p>I'm using the following page template to display the posts in a single category and plan to format the first post differently than the others. This works as desired but I have the category_name hard coded in the template. I want to use this template for several different categories and would like to learn how to p... | [
{
"answer_id": 128337,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress will use the first Template file it finds in your current Theme's directory from the following li... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128336",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44606/"
] | I'm using the following page template to display the posts in a single category and plan to format the first post differently than the others. This works as desired but I have the category\_name hard coded in the template. I want to use this template for several different categories and would like to learn how to pass ... | Rather than creating pages and assigning a template, I would use the `category_template` filter to load a specific template for all those particular categories. In this example I use a hardcoded array, but this could be adapted to load an option which stores the category slugs you want the template applied to.
```
fun... |
128,365 | <p>I have a PHP filter for wordpress/gravityforms, that just recently stopped working and I can't figure out why. Can anyone help me?</p>
<p>Here's the code:</p>
<pre><code>add_filter('gform_pre_submission_2', 'create_company_full_name', 10, 2, 'input_7', 'input_6', 'input_1');
add_filter('gform_pre_submission_1', '... | [
{
"answer_id": 128366,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>If you look at the codex entry for <a href=\"http://codex.wordpress.org/Function_Reference/add_filter\" rel=\"nofo... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128365",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36515/"
] | I have a PHP filter for wordpress/gravityforms, that just recently stopped working and I can't figure out why. Can anyone help me?
Here's the code:
```
add_filter('gform_pre_submission_2', 'create_company_full_name', 10, 2, 'input_7', 'input_6', 'input_1');
add_filter('gform_pre_submission_1', 'create_company_full_n... | If you look at the codex entry for [`add_filter`](http://codex.wordpress.org/Function_Reference/add_filter), you'll see there are 4 arguments for the function, the last being `$accepted_args`, which should be an *integer*. Your `add_filter` calls are not correct, so I'm not sure how they worked in the first place.
The... |
128,372 | <p>I'm still trying to wrap my head around PHP (no pun intended) and am trying to get something to work using the <a href="http://www.advancedcustomfields.com/" rel="nofollow">Advanced Custom Field</a>s plugin in WordPress.</p>
<p>So, I've got a repeater field that's made up of two Number Fields and a True/False field... | [
{
"answer_id": 128384,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.advancedcustomfields.com/resources/functions/the_sub_field/\" rel=\"nofollow\"><code>the_sub_... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128372",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14355/"
] | I'm still trying to wrap my head around PHP (no pun intended) and am trying to get something to work using the [Advanced Custom Field](http://www.advancedcustomfields.com/)s plugin in WordPress.
So, I've got a repeater field that's made up of two Number Fields and a True/False field. I'm basically trying to write a st... | ```
<?php
if( get_field('parent_repeater') ) : while( has_sub_field('parent_repeater') ) :
$some_bool = get_sub_field('true');
$sf1 = get_sub_field('sub_field_1');
$sf2 = get_sub_field('sub_field_2');
if( $some_bool == true ){
echo $sf1 . $sf2;
} else {
echo $sf1;
}
endwhile; ... |
128,374 | <p>What do i Change this to So its shows the default page icon?<code>', plugins_url( 'myplugin/images/icon.png' )</code></p>
<pre><code> add_menu_page( 'Info', 'Info', 'manage_options', 'LINK', '', plugins_url( 'myplugin/images/icon.png' ), 10 );
</code></pre>
<p>I find out how to do this. </p>
<p>Step 1. Screenshot... | [
{
"answer_id": 128379,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 3,
"selected": false,
"text": "<p>Assuming you're running WP 3.8, you can choose from a collection of icons (<a href=\"https://developer.wordpress.... | 2014/01/02 | [
"https://wordpress.stackexchange.com/questions/128374",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27789/"
] | What do i Change this to So its shows the default page icon?`', plugins_url( 'myplugin/images/icon.png' )`
```
add_menu_page( 'Info', 'Info', 'manage_options', 'LINK', '', plugins_url( 'myplugin/images/icon.png' ), 10 );
```
I find out how to do this.
Step 1. Screenshot or find the image you like.
Step 2. Name i... | Assuming you're running WP 3.8, you can choose from a collection of icons ([listed here](https://developer.wordpress.org/resource/dashicons/)). In your case, replace your icon URL with `dashicons-admin-page`, like so:
```
add_menu_page( 'Info', 'Info', 'manage_options', 'LINK', '', 'dashicons-admin-page', 10 );
```
... |
128,396 | <p>Now there may seem to be duplicates for this question but nothing concise so I'm going to try:</p>
<p>I have a wordpress install setup at mydomain.com/subdir - hosted on fatcow.</p>
<p>I went ahead and bought a domain from godaddy.com(cos it was dirt cheap)</p>
<p>-pointed the name servers where needed.(fatcow's ... | [
{
"answer_id": 128397,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 1,
"selected": false,
"text": "<p>All links in the content was saved in the databases, pure strings. If you have change change the settings of the ... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128396",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42695/"
] | Now there may seem to be duplicates for this question but nothing concise so I'm going to try:
I have a wordpress install setup at mydomain.com/subdir - hosted on fatcow.
I went ahead and bought a domain from godaddy.com(cos it was dirt cheap)
-pointed the name servers where needed.(fatcow's servers)
Opened fatcow ... | All links in the content was saved in the databases, pure strings. If you have change change the settings of the wordpress install to an new domain, then it is important that you change also the links inside the content. This is possible with a sql statement or also with plugins and helper.
1. [WP Plugin](http://wordp... |
128,399 | <p>I like to create a landing page for my custom taxonomies. Right now ive created three custom taxonomies </p>
<pre><code>/country/[terms]
/person/[terms]
/interrests/[terms]
</code></pre>
<p>i like to create a listing page for each of the taxonomy, this listing page should list all the [terms] they contain. And lin... | [
{
"answer_id": 128401,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 1,
"selected": false,
"text": "<p>In your case you need to create three custom files: <code>taxonomy-country.php</code>, <code>taxonomy-p... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128399",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10378/"
] | I like to create a landing page for my custom taxonomies. Right now ive created three custom taxonomies
```
/country/[terms]
/person/[terms]
/interrests/[terms]
```
i like to create a listing page for each of the taxonomy, this listing page should list all the [terms] they contain. And link to the normal (`taxonomy... | I can see at least 3 ways to do that.
1. Adding a rewrite rule. See <http://codex.wordpress.org/Rewrite_API> for details:
```
add_rewrite_rule('^(country|person|interest)/?','index.php?tax=$matches[1]','top');
```
then use the `template_redirect` filter to load your template when the `tax`variable is there:
```
i... |
128,400 | <p>My site has "log in" and "register" links on the top right corner of homepage and every page. Where do I find these in the source code?</p>
| [
{
"answer_id": 128401,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 1,
"selected": false,
"text": "<p>In your case you need to create three custom files: <code>taxonomy-country.php</code>, <code>taxonomy-p... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128400",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16266/"
] | My site has "log in" and "register" links on the top right corner of homepage and every page. Where do I find these in the source code? | I can see at least 3 ways to do that.
1. Adding a rewrite rule. See <http://codex.wordpress.org/Rewrite_API> for details:
```
add_rewrite_rule('^(country|person|interest)/?','index.php?tax=$matches[1]','top');
```
then use the `template_redirect` filter to load your template when the `tax`variable is there:
```
i... |
128,423 | <p>This is both a WordPress and a PHP question, since a PHP programmer may know a technique that the WP group doesn't.</p>
<p>I have been attempting to write a shortcode that fires the Foundation Reveal code for use inline with the WP Editor. I envision having it work like this:</p>
<pre><code>[reveal size="medium" b... | [
{
"answer_id": 128432,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 3,
"selected": true,
"text": "<p>There are different ways to get the result. You can use a class, store the div content in a class or instance ... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128423",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28719/"
] | This is both a WordPress and a PHP question, since a PHP programmer may know a technique that the WP group doesn't.
I have been attempting to write a shortcode that fires the Foundation Reveal code for use inline with the WP Editor. I envision having it work like this:
```
[reveal size="medium" bg="true" slug="page-s... | There are different ways to get the result. You can use a class, store the div content in a class or instance variable and output it when needed.
As alternative you can use a function with a static variable, to hold the content.
I'll use this second alternative, converting it in a class is an exercise for you ;)
In ... |
128,448 | <p>I need to change navigation menu in my plugin for each user for example:</p>
<pre><code>if(is_user_logged_in())
wp_nav_menu(...);
else
wp_nav_menu(...);
</code></pre>
<p>But when I apply the above code in my plugin it shows me some errors. What should I do? </p>
| [
{
"answer_id": 128432,
"author": "gmazzap",
"author_id": 35541,
"author_profile": "https://wordpress.stackexchange.com/users/35541",
"pm_score": 3,
"selected": true,
"text": "<p>There are different ways to get the result. You can use a class, store the div content in a class or instance ... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128448",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43030/"
] | I need to change navigation menu in my plugin for each user for example:
```
if(is_user_logged_in())
wp_nav_menu(...);
else
wp_nav_menu(...);
```
But when I apply the above code in my plugin it shows me some errors. What should I do? | There are different ways to get the result. You can use a class, store the div content in a class or instance variable and output it when needed.
As alternative you can use a function with a static variable, to hold the content.
I'll use this second alternative, converting it in a class is an exercise for you ;)
In ... |
128,450 | <p>I'm trying to reposition the messages in my Woocommerce theme. For example the successfully added to cart message. They appear to automatically be placed at the very top of where the woocommerce wrapper start begins.</p>
<p>I've already found <a href="https://gist.github.com/ChromeOrange/3423933" rel="nofollow">thi... | [
{
"answer_id": 128451,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 3,
"selected": true,
"text": "<p>WooCommerce renders messages by using <code>woocommerce_show_messages()</code> function. This function i... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128450",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29158/"
] | I'm trying to reposition the messages in my Woocommerce theme. For example the successfully added to cart message. They appear to automatically be placed at the very top of where the woocommerce wrapper start begins.
I've already found [this link](https://gist.github.com/ChromeOrange/3423933) which allows me to change... | WooCommerce renders messages by using `woocommerce_show_messages()` function. This function is hooked to `woocommerce_before_single_product` action. So if you don't want to render messages before single product, you need to remove that hook for the action.
```
remove_action( 'woocommerce_before_single_product', 'wooco... |
128,469 | <p>I'm using woocommerce plugin in my wordpress web site. In Admin panel for products I've added few custom fields as shown bellow:</p>
<p><img src="https://i.stack.imgur.com/PJ8j6.jpg" alt="enter image description here"></p>
<p>On my shop page, I want to print the custom field values, and I use the following code (
... | [
{
"answer_id": 128471,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 1,
"selected": false,
"text": "<p>Firstly, i would use a custom function in your child themes functions file rather than add the code directl... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128469",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44180/"
] | I'm using woocommerce plugin in my wordpress web site. In Admin panel for products I've added few custom fields as shown bellow:

On my shop page, I want to print the custom field values, and I use the following code (
my code is inside the `while lo... | Firstly, i would use a custom function in your child themes functions file rather than add the code directly to the template file.
You can use the [WooCommerce conditional tags and hooks](https://wordpress.stackexchange.com/questions/128116/what-is-the-action-hook-code-to-supporting-product-category-condition-in-singl... |
128,476 | <p>I have a hierarchy that I need to get data from. It's the child (by slug name) that I need to get while already having knowledge of the parents.</p>
<pre><code>Highest Known Parent Page (slug : 'parent')
|_ Child 1 (slug : 'child-1')
|_ Page 1 (slug : 'page-1')
|_ Page 2 (slug : 'page-2')
|_ Child 2 (slug : '... | [
{
"answer_id": 128477,
"author": "Snail",
"author_id": 35083,
"author_profile": "https://wordpress.stackexchange.com/users/35083",
"pm_score": -1,
"selected": false,
"text": "<p>i hope this help you, you need to get ID of your parent's page and start the loop like this</p>\n\n<pre><code>... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128476",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5449/"
] | I have a hierarchy that I need to get data from. It's the child (by slug name) that I need to get while already having knowledge of the parents.
```
Highest Known Parent Page (slug : 'parent')
|_ Child 1 (slug : 'child-1')
|_ Page 1 (slug : 'page-1')
|_ Page 2 (slug : 'page-2')
|_ Child 2 (slug : 'child-2')
|... | You should use the `pagename` parameter for WP\_Query along with `post_parent`. Limit your query to one post using `posts_per_page`.
```
$parent_id = get_the_ID();
$args = array(
'post_type' => 'page'
'pagename' => 'page-2',
'post_parent' => $parent_id,
'posts_per_page' => 1
);
$posts = ... |
128,483 | <p>Is it possible to set the capabilities of a role to allow editing of a custom content type but not editing of the regular post types? If so, how would I go about doing that? Thanks!</p>
| [
{
"answer_id": 128477,
"author": "Snail",
"author_id": 35083,
"author_profile": "https://wordpress.stackexchange.com/users/35083",
"pm_score": -1,
"selected": false,
"text": "<p>i hope this help you, you need to get ID of your parent's page and start the loop like this</p>\n\n<pre><code>... | 2014/01/03 | [
"https://wordpress.stackexchange.com/questions/128483",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44663/"
] | Is it possible to set the capabilities of a role to allow editing of a custom content type but not editing of the regular post types? If so, how would I go about doing that? Thanks! | You should use the `pagename` parameter for WP\_Query along with `post_parent`. Limit your query to one post using `posts_per_page`.
```
$parent_id = get_the_ID();
$args = array(
'post_type' => 'page'
'pagename' => 'page-2',
'post_parent' => $parent_id,
'posts_per_page' => 1
);
$posts = ... |
128,514 | <p>I'm creating a theme and don't want to display the sidebar on single-product's page. </p>
<p>Following the recommendations of WooCommerce, I made a copy of "<strong>templates</strong>" folder (under woocommerce plugin) and installed on <strong>mytheme/templates</strong>, changing the folder's name to "<strong>wooco... | [
{
"answer_id": 128515,
"author": "Abhik",
"author_id": 26991,
"author_profile": "https://wordpress.stackexchange.com/users/26991",
"pm_score": 0,
"selected": false,
"text": "<p>Here it goes.. </p>\n\n<pre><code>function remove_sidebar_shop() {\n if ( is_singular('product') ) {\n ... | 2014/01/04 | [
"https://wordpress.stackexchange.com/questions/128514",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43151/"
] | I'm creating a theme and don't want to display the sidebar on single-product's page.
Following the recommendations of WooCommerce, I made a copy of "**templates**" folder (under woocommerce plugin) and installed on **mytheme/templates**, changing the folder's name to "**woocommerce**". On my theme's root, I created a... | The conditional tag for single products is is\_product()
```
add_action('template_redirect', 'remove_sidebar_shop');
function remove_sidebar_shop() {
if ( is_product('add-page-i.d-here') ) {
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar');
}
}
```
You may also want to change the layout on tha... |
128,532 | <p>I have a WordPress website on a VPS running nginx. I have installed the WP Security plugin to improve the security of my site. After changing all the settings to my liking, a pop-up notifies me that I need rewrite the rules to save my changes. Part of it said "See the Better WP Security Dashboard for a list of the r... | [
{
"answer_id": 128515,
"author": "Abhik",
"author_id": 26991,
"author_profile": "https://wordpress.stackexchange.com/users/26991",
"pm_score": 0,
"selected": false,
"text": "<p>Here it goes.. </p>\n\n<pre><code>function remove_sidebar_shop() {\n if ( is_singular('product') ) {\n ... | 2014/01/04 | [
"https://wordpress.stackexchange.com/questions/128532",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44693/"
] | I have a WordPress website on a VPS running nginx. I have installed the WP Security plugin to improve the security of my site. After changing all the settings to my liking, a pop-up notifies me that I need rewrite the rules to save my changes. Part of it said "See the Better WP Security Dashboard for a list of the rewr... | The conditional tag for single products is is\_product()
```
add_action('template_redirect', 'remove_sidebar_shop');
function remove_sidebar_shop() {
if ( is_product('add-page-i.d-here') ) {
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar');
}
}
```
You may also want to change the layout on tha... |
128,568 | <p>I am using the code below to give users download the thumbnail image, as i have a wallpapers site:</p>
<pre><code><a class="downloadbutton" href="<?php echo $src[0]; ?>" download="imageName">Download this Wallpaper</a>
</code></pre>
<p>But the above code is giving download of a htm file not the ... | [
{
"answer_id": 128515,
"author": "Abhik",
"author_id": 26991,
"author_profile": "https://wordpress.stackexchange.com/users/26991",
"pm_score": 0,
"selected": false,
"text": "<p>Here it goes.. </p>\n\n<pre><code>function remove_sidebar_shop() {\n if ( is_singular('product') ) {\n ... | 2014/01/04 | [
"https://wordpress.stackexchange.com/questions/128568",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44708/"
] | I am using the code below to give users download the thumbnail image, as i have a wallpapers site:
```
<a class="downloadbutton" href="<?php echo $src[0]; ?>" download="imageName">Download this Wallpaper</a>
```
But the above code is giving download of a htm file not the image download, can anyone please help me sol... | The conditional tag for single products is is\_product()
```
add_action('template_redirect', 'remove_sidebar_shop');
function remove_sidebar_shop() {
if ( is_product('add-page-i.d-here') ) {
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar');
}
}
```
You may also want to change the layout on tha... |
128,570 | <p>I want to use Pagination throughout a new theme but am having trouble getting it to work correctly.</p>
<p>I am using some code within my functions.php file and then calling that function. It works on the 'blog' page but not on paginated posts or pages.</p>
<p>Here is my code:</p>
<pre><code>// Pagination for pag... | [
{
"answer_id": 128572,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Post Navigation</strong></p>\n\n<p>Here's the way its done in the Twenty Twelve themes single.php f... | 2014/01/04 | [
"https://wordpress.stackexchange.com/questions/128570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/20853/"
] | I want to use Pagination throughout a new theme but am having trouble getting it to work correctly.
I am using some code within my functions.php file and then calling that function. It works on the 'blog' page but not on paginated posts or pages.
Here is my code:
```
// Pagination for paged posts, Page 1, Page 2, Pa... | **Post Navigation**
Here's the way its done in the Twenty Twelve themes single.php file however it looks like Twenty Fourteen has a better solution which works for pages as well.
```
<nav class="nav-single">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
... |
128,574 | <p>I have a few pages that contains technical tips. </p>
<p>I would like to group these pages under the title "tips" in the menu bar, but I don't want to make the item "tips" clickable because it does not contain any data.</p>
<p>How do I create a menu item which is not a page, whose sole purpose is to server as a me... | [
{
"answer_id": 128572,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Post Navigation</strong></p>\n\n<p>Here's the way its done in the Twenty Twelve themes single.php f... | 2014/01/04 | [
"https://wordpress.stackexchange.com/questions/128574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6117/"
] | I have a few pages that contains technical tips.
I would like to group these pages under the title "tips" in the menu bar, but I don't want to make the item "tips" clickable because it does not contain any data.
How do I create a menu item which is not a page, whose sole purpose is to server as a menu parent? | **Post Navigation**
Here's the way its done in the Twenty Twelve themes single.php file however it looks like Twenty Fourteen has a better solution which works for pages as well.
```
<nav class="nav-single">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
... |
128,579 | <p>Trying to debug, getting headache so I want to ensure that I have placed the query args in the correct place. I want to sort/order all my posts based on "myvalue".</p>
<pre><code>if ( have_posts() ) :
/* Start the Loop */
$args = array(
'meta_key' => 'myvalue',
'orderby' => 'meta_value... | [
{
"answer_id": 128580,
"author": "passatgt",
"author_id": 8038,
"author_profile": "https://wordpress.stackexchange.com/users/8038",
"pm_score": 1,
"selected": false,
"text": "<pre><code>$args = array(\n 'posts_per_page' => 10,\n 'order' => 'DESC',\n 'meta_key' => 'myval... | 2014/01/04 | [
"https://wordpress.stackexchange.com/questions/128579",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44504/"
] | Trying to debug, getting headache so I want to ensure that I have placed the query args in the correct place. I want to sort/order all my posts based on "myvalue".
```
if ( have_posts() ) :
/* Start the Loop */
$args = array(
'meta_key' => 'myvalue',
'orderby' => 'meta_value_num',
'orde... | I am guessing but based on your choice of placeholder names in the code above...
```
$args = array(
'meta_key' => 'myvalue',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
```
... your `meta_key` argument is wrong. That is the meta *key* not the meta value as your naming convention suggests.
>
> meta\... |
128,603 | <p>I am importing affiliate products via XML into Woocommerce. Due to products having variations if I use the External/Affiliate product type I get repetition of product on my front end (eg. same product with different location/colour). To avoid this I am attempting to import these products as variable products, this s... | [
{
"answer_id": 128606,
"author": "Mayeenul Islam",
"author_id": 22728,
"author_profile": "https://wordpress.stackexchange.com/users/22728",
"pm_score": 0,
"selected": false,
"text": "<p>You got the exact code to display WordPress custom field. I'm not accustomed to WooCommerce, but I can... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128603",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44727/"
] | I am importing affiliate products via XML into Woocommerce. Due to products having variations if I use the External/Affiliate product type I get repetition of product on my front end (eg. same product with different location/colour). To avoid this I am attempting to import these products as variable products, this solv... | I was able to find a solution for adding a custom field to EACH variation, in case someone is looking for this solution, there is a tutorial here (thanks Derek!):
<http://designloud.com/how-to-add-affiliate-links-to-woocommerce-variations/>
I spent weeks trying to find a solution for this - Hope this saves someone so... |
128,622 | <p>I want to build a TV series database using WordPress. I have followed some tutorials and I have two custom post types: one for <code>movies</code>, one for and <code>series</code>. I followed <a href="https://wordpress.stackexchange.com/questions/20125/tv-show-database-best-way-for-structuring-it">this post for the ... | [
{
"answer_id": 128626,
"author": "JMB",
"author_id": 43615,
"author_profile": "https://wordpress.stackexchange.com/users/43615",
"pm_score": 3,
"selected": false,
"text": "<p>I recommend the <a href=\"http://wordpress.org/plugins/posts-to-posts/\">Posts 2 Posts</a> plugin, which I've jus... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128622",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43776/"
] | I want to build a TV series database using WordPress. I have followed some tutorials and I have two custom post types: one for `movies`, one for and `series`. I followed [this post for the structure](https://wordpress.stackexchange.com/questions/20125/tv-show-database-best-way-for-structuring-it).
My question is: how ... | Using a Plugin
--------------
Some very good plugins for relationships:
* [ACF Relationship Field](http://www.advancedcustomfields.com/resources/field-types/relationship/)
* [Posts-2-Posts](http://wordpress.org/plugins/posts-to-posts/)
Using a Metabox
---------------
You can build a simple relationship using metabo... |
128,625 | <p>I'm using the following code to set my post featured image as a <code>background-image</code>…</p>
<pre><code><?php if (has_post_thumbnail( $post->ID ) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
endif; ?>
</code></pre>
<p>How can I add an... | [
{
"answer_id": 128628,
"author": "Shazzad",
"author_id": 42967,
"author_profile": "https://wordpress.stackexchange.com/users/42967",
"pm_score": 1,
"selected": false,
"text": "<p>You can just use else below your code.</p>\n\n<pre><code><?php \nif (has_post_thumbnail( $post->ID ) ):... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128625",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43439/"
] | I'm using the following code to set my post featured image as a `background-image`…
```
<?php if (has_post_thumbnail( $post->ID ) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
endif; ?>
```
How can I add an else statement so if the post doesn't have a fea... | You can just use else below your code.
```
<?php
if (has_post_thumbnail( $post->ID ) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
else:
$image = array( '/images/featured.jpg' );
endif;
$image_url = $image[0];
?>
``` |
128,636 | <p>Given this custom post type:</p>
<pre><code>register_post_type(
'sample_post_type',
[
'labels' => [
'name' => _x('Sample Posts', 'post type general name'),
'singular_name' => _x('Sample Post', 'post type singular name'),
],
'public' => true,
... | [
{
"answer_id": 128637,
"author": "Kumar",
"author_id": 32466,
"author_profile": "https://wordpress.stackexchange.com/users/32466",
"pm_score": 7,
"selected": true,
"text": "<p>To be able to disable the single view for a CPT you can either redirect users to a specific URL, or disable it w... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128636",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8038/"
] | Given this custom post type:
```
register_post_type(
'sample_post_type',
[
'labels' => [
'name' => _x('Sample Posts', 'post type general name'),
'singular_name' => _x('Sample Post', 'post type singular name'),
],
'public' => true,
'show_in_nav_menus' => f... | To be able to disable the single view for a CPT you can either redirect users to a specific URL, or disable it while registering CPT itself.
**METHOD 1:**
**Redirect CPT single to a custom URL, archive page is publicly available**.
You can use `template_redirect` hook to redirect a user, you can use any URL you want... |
128,639 | <p>I have a problem. I am trying get the theme customizer load a different CSS file based on what radio input in clicked, <strong>live!</strong></p>
<p>It works so far right now that option is saved when I click "Save & Publish" it only loads up when manually reload the entire customizer page. The preview panel is... | [
{
"answer_id": 128637,
"author": "Kumar",
"author_id": 32466,
"author_profile": "https://wordpress.stackexchange.com/users/32466",
"pm_score": 7,
"selected": true,
"text": "<p>To be able to disable the single view for a CPT you can either redirect users to a specific URL, or disable it w... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128639",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38602/"
] | I have a problem. I am trying get the theme customizer load a different CSS file based on what radio input in clicked, **live!**
It works so far right now that option is saved when I click "Save & Publish" it only loads up when manually reload the entire customizer page. The preview panel is refreshed on select but no... | To be able to disable the single view for a CPT you can either redirect users to a specific URL, or disable it while registering CPT itself.
**METHOD 1:**
**Redirect CPT single to a custom URL, archive page is publicly available**.
You can use `template_redirect` hook to redirect a user, you can use any URL you want... |
128,647 | <p>I would like to retrieve each widget existing in a sidebar in order e.g. to mix them with posts inside the main loop.</p>
<p>I know I can use different widget areas (sidebars) but this approach clutters the widget admin page with some tens of sidebars. To mitigate this, I thought to just add them to a single sideba... | [
{
"answer_id": 128653,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>I am taking the core of the question to be: \"... I'm not able to retrieve the widget class name\"</p>\n\n<p>... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128647",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26688/"
] | I would like to retrieve each widget existing in a sidebar in order e.g. to mix them with posts inside the main loop.
I know I can use different widget areas (sidebars) but this approach clutters the widget admin page with some tens of sidebars. To mitigate this, I thought to just add them to a single sidebar and retr... | I am taking the core of the question to be: "... I'm not able to retrieve the widget class name"
You will need to check the `global` variable `$wp_registered_widgets` to fill in the missing information. This proof-of-concept code should give you the idea. The code assumes a sidebar named `sidebar-1`. You will have to ... |
128,656 | <p>A friend of mine who has got a live Wordpress website has bought a new theme. Before he's going to install and use it, he would like to adapt the theme's styles to his current web design. I uploaded the theme files on a different server because I hoped that I can preview the pages while I work on the CSS, but that d... | [
{
"answer_id": 128653,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>I am taking the core of the question to be: \"... I'm not able to retrieve the widget class name\"</p>\n\n<p>... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128656",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44737/"
] | A friend of mine who has got a live Wordpress website has bought a new theme. Before he's going to install and use it, he would like to adapt the theme's styles to his current web design. I uploaded the theme files on a different server because I hoped that I can preview the pages while I work on the CSS, but that does... | I am taking the core of the question to be: "... I'm not able to retrieve the widget class name"
You will need to check the `global` variable `$wp_registered_widgets` to fill in the missing information. This proof-of-concept code should give you the idea. The code assumes a sidebar named `sidebar-1`. You will have to ... |
128,658 | <p>I'd like to create new thumbnail options in Bones and have followed the instructions in the Bones theme Functions.php file. I am expecting therefore that one should be able to choose from the Size Dropdown menu the new thumbnail I have set like this. (note, the default wp sizes is showing)</p>
<p><img src="https://... | [
{
"answer_id": 128653,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>I am taking the core of the question to be: \"... I'm not able to retrieve the widget class name\"</p>\n\n<p>... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128658",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12589/"
] | I'd like to create new thumbnail options in Bones and have followed the instructions in the Bones theme Functions.php file. I am expecting therefore that one should be able to choose from the Size Dropdown menu the new thumbnail I have set like this. (note, the default wp sizes is showing)
![enter image description he... | I am taking the core of the question to be: "... I'm not able to retrieve the widget class name"
You will need to check the `global` variable `$wp_registered_widgets` to fill in the missing information. This proof-of-concept code should give you the idea. The code assumes a sidebar named `sidebar-1`. You will have to ... |
128,661 | <p>I am trying to create my first wp theme. So far it has been quite nice experience, but now i have a problem that i don't quite understand.</p>
<p>The Admin bar is showing only on some of my pages, on the others it shows only white (actually transparent).
Ex: on the Home page it is transparent (like if there is the ... | [
{
"answer_id": 128662,
"author": "Robin Westerlundh",
"author_id": 44439,
"author_profile": "https://wordpress.stackexchange.com/users/44439",
"pm_score": 0,
"selected": false,
"text": "<p>This Sounds like a HTML problem. If you did not close all the tags in the theme or have open html t... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128661",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44739/"
] | I am trying to create my first wp theme. So far it has been quite nice experience, but now i have a problem that i don't quite understand.
The Admin bar is showing only on some of my pages, on the others it shows only white (actually transparent).
Ex: on the Home page it is transparent (like if there is the empty plac... | First of all i would like to thank you for trying to help me!!
i found out what was causing it: it was an error on the functions.php:
it was missing:
```
require get_template_directory() . '/inc/template-tags.php';
```
i have added it back to the functions.php and now everything seems to be working fine.
Thank yo... |
128,672 | <p>I need to insert a post via wp_insert_post and then add relevant post_meta - however, the WP admin has been customized with the excellent ACF.</p>
<p>I know I can <a href="http://codex.wordpress.org/Function_Reference/add_post_meta" rel="noreferrer">add_post_meta</a> in this way:</p>
<pre><code>add_post_meta( $pos... | [
{
"answer_id": 128722,
"author": "Q Studio",
"author_id": 7968,
"author_profile": "https://wordpress.stackexchange.com/users/7968",
"pm_score": 4,
"selected": true,
"text": "<p>I do need to add both post_meta:</p>\n\n<pre><code>add_post_meta( $insert_q_key_id, 'q_key_type', (int)$q_key_t... | 2014/01/05 | [
"https://wordpress.stackexchange.com/questions/128672",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7968/"
] | I need to insert a post via wp\_insert\_post and then add relevant post\_meta - however, the WP admin has been customized with the excellent ACF.
I know I can [add\_post\_meta](http://codex.wordpress.org/Function_Reference/add_post_meta) in this way:
```
add_post_meta( $post_id, 'q_key_type', $q_key_type );
```
How... | I do need to add both post\_meta:
```
add_post_meta( $insert_q_key_id, 'q_key_type', (int)$q_key_type ); // Q Key Type
```
And for ACF:
```
update_field( "field_52c737a413e07", (int)$q_key_type, $insert_q_key_id ); // Q Key Type
```
And the rest of the answer "should" be covered by wp\_set\_object\_terms:
```
wp... |
128,760 | <p>I'm trying to use is_search to output some stuff from functions.php. I'm using is_search on the actual search page itself and it works fine:</p>
<pre><code>if(is_search()) {
echo get_search_query( '<h1>', '</h1>' );
}
</code></pre>
<p>But from functions.php this doesn't work:</p>
<pre><code>functi... | [
{
"answer_id": 128762,
"author": "LindaJeanne",
"author_id": 44091,
"author_profile": "https://wordpress.stackexchange.com/users/44091",
"pm_score": 0,
"selected": false,
"text": "<p>Your code doesn't show where you call data_scroll_all() from, so this is just a blind guess -- apologies ... | 2014/01/06 | [
"https://wordpress.stackexchange.com/questions/128760",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35858/"
] | I'm trying to use is\_search to output some stuff from functions.php. I'm using is\_search on the actual search page itself and it works fine:
```
if(is_search()) {
echo get_search_query( '<h1>', '</h1>' );
}
```
But from functions.php this doesn't work:
```
function data_scroll_all(){
if(is_search()) {
... | >
> ... the call works fine as it actually echos "nope" where it's supposed
> to, are you saying that it may be a problem because I'm making an ajax
> call which is not search.php?
>
>
>
An Ajax call is a *new* request to the server. The page that loads is (should be) `wp-admin/admin-ajax.php` which is template ... |
128,767 | <p>Our code base has a ton of logic that executes as the post is inserted/created. However, some of that logic depends on custom post meta. The only way I know of to add post meta to a new post is like so:</p>
<pre><code>$post_id = wp_insert_post($post_obj);
add_post_meta($post_id, 'key', "value");
</code></pre>
<p>H... | [
{
"answer_id": 128786,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook your function to the <a href=\"http://codex.wordpress.org/Plugin_API/Action_Reference/wp_insert_pos... | 2014/01/06 | [
"https://wordpress.stackexchange.com/questions/128767",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41534/"
] | Our code base has a ton of logic that executes as the post is inserted/created. However, some of that logic depends on custom post meta. The only way I know of to add post meta to a new post is like so:
```
$post_id = wp_insert_post($post_obj);
add_post_meta($post_id, 'key', "value");
```
However, this means that th... | You can hook your function to the [`wp_insert_post`](http://codex.wordpress.org/Plugin_API/Action_Reference/wp_insert_post) action hook:
```
add_action( 'wp_insert_post', 'wpse128767_add_meta' );
function wpse128767_add_meta( $post_id ) {
add_post_meta( $post_id, 'key', 'value' );
}
```
To make sure your metadat... |
128,768 | <p>I have a question which is so easy but if it's wrong then I'll lose everything. I have a site which is working on WordPress 3.5.2 and now I got the 3.8 version. I want to update it, which is easy, but the problem is, I don't have backup functionality.</p>
<p>So is this safe to just click the update link or will I f... | [
{
"answer_id": 128786,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook your function to the <a href=\"http://codex.wordpress.org/Plugin_API/Action_Reference/wp_insert_pos... | 2014/01/06 | [
"https://wordpress.stackexchange.com/questions/128768",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have a question which is so easy but if it's wrong then I'll lose everything. I have a site which is working on WordPress 3.5.2 and now I got the 3.8 version. I want to update it, which is easy, but the problem is, I don't have backup functionality.
So is this safe to just click the update link or will I face any pr... | You can hook your function to the [`wp_insert_post`](http://codex.wordpress.org/Plugin_API/Action_Reference/wp_insert_post) action hook:
```
add_action( 'wp_insert_post', 'wpse128767_add_meta' );
function wpse128767_add_meta( $post_id ) {
add_post_meta( $post_id, 'key', 'value' );
}
```
To make sure your metadat... |
128,771 | <p>I need my authors to have the right to delete any of the attachments they uploaded in case they made some mistake. Currently if the author clicks on any thumbnail in media-library, he gets the <code>edit_image</code> link but not the <code>delete_permanently</code> link ( as it appears for higher roles ). So right n... | [
{
"answer_id": 128776,
"author": "sakibmoon",
"author_id": 23214,
"author_profile": "https://wordpress.stackexchange.com/users/23214",
"pm_score": 3,
"selected": true,
"text": "<p>It seems that you have to add the capability yourself. You can get the necessary code for that in <a href=\"... | 2014/01/06 | [
"https://wordpress.stackexchange.com/questions/128771",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25508/"
] | I need my authors to have the right to delete any of the attachments they uploaded in case they made some mistake. Currently if the author clicks on any thumbnail in media-library, he gets the `edit_image` link but not the `delete_permanently` link ( as it appears for higher roles ). So right now, the author gets to ed... | It seems that you have to add the capability yourself. You can get the necessary code for that in [How do I create a custom role capability?](https://wordpress.stackexchange.com/questions/35165/how-do-i-create-a-custom-role-capability).
You can also use [Members Plugin](http://wordpress.org/plugins/members/) which see... |
128,790 | <p>I have a page like <a href="http://example.com/mypage" rel="nofollow noreferrer">http://example.com/mypage</a></p>
<p>and I want to set some <code>$_GET</code> parameter like that:</p>
<pre><code>http://example.com/mypage/firstparameter/firstvalue
</code></pre>
<p>I need <code>firstparameter</code> value but I al... | [
{
"answer_id": 128776,
"author": "sakibmoon",
"author_id": 23214,
"author_profile": "https://wordpress.stackexchange.com/users/23214",
"pm_score": 3,
"selected": true,
"text": "<p>It seems that you have to add the capability yourself. You can get the necessary code for that in <a href=\"... | 2014/01/06 | [
"https://wordpress.stackexchange.com/questions/128790",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44789/"
] | I have a page like <http://example.com/mypage>
and I want to set some `$_GET` parameter like that:
```
http://example.com/mypage/firstparameter/firstvalue
```
I need `firstparameter` value but I always end in the **404 page**.
I've spent some hours with `get_query_var()`, `add_query_vars_filter()` and `add_rewrite... | It seems that you have to add the capability yourself. You can get the necessary code for that in [How do I create a custom role capability?](https://wordpress.stackexchange.com/questions/35165/how-do-i-create-a-custom-role-capability).
You can also use [Members Plugin](http://wordpress.org/plugins/members/) which see... |
128,814 | <p>I created a custom post type "podcast" and all podcasts are inside it. when I visit <code>http://example.com/?feed=podcast</code>, it only shows latest 10 podcasts. How do I change it to 99?</p>
<p>I googled and found the code below: </p>
<pre><code>function feedFilter($query) {
if (is_feed()) {
$query->set... | [
{
"answer_id": 128816,
"author": "Kumar",
"author_id": 32466,
"author_profile": "https://wordpress.stackexchange.com/users/32466",
"pm_score": 2,
"selected": false,
"text": "<p>You can use <code>post_limits</code> filter for feeds, or From backend you should be able to manage post count ... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128814",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44796/"
] | I created a custom post type "podcast" and all podcasts are inside it. when I visit `http://example.com/?feed=podcast`, it only shows latest 10 podcasts. How do I change it to 99?
I googled and found the code below:
```
function feedFilter($query) {
if (is_feed()) {
$query->set('posts_per_page','30');
}
return $... | The file where the `pre_get_posts` action runs is `wp-includes/query.php`, If we look in that file, we'll see that *after* the action is executed, the `posts_per_page` setting is overridden for feeds with this bit of code:
```
if ( $this->is_feed ) {
$q['posts_per_page'] = get_option('posts_per_rss');
$q['nopa... |
128,824 | <p>Is is possible to find how how many tags (and categories) a post has and to display it?</p>
<p>something like this:
when a post has three Tags and two categories, at the end of the post show that number inside brackets, like so:</p>
<p>TAGS (3) | CATEGORIES (2)</p>
<p>I would like to have it so, because ... | [
{
"answer_id": 128828,
"author": "Ravi Patel",
"author_id": 35477,
"author_profile": "https://wordpress.stackexchange.com/users/35477",
"pm_score": 0,
"selected": false,
"text": "<blockquote>\n <p>Use this code on your post loop: ya display on single.php</p>\n</blockquote>\n\n<pre><code... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128824",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44739/"
] | Is is possible to find how how many tags (and categories) a post has and to display it?
something like this:
when a post has three Tags and two categories, at the end of the post show that number inside brackets, like so:
TAGS (3) | CATEGORIES (2)
I would like to have it so, because i would like that the tag/categor... | for tags you can use
```
$tags = get_tags();
$categories = get_categories();
$no_of_tags = count($tags);
$no_of_categories = count($categories);
```
refer this if you need more details :
<http://codex.wordpress.org/Function_Reference/get_tags>
<http://codex.wordpress.org/Function_Reference/get_categories> |
128,825 | <p>I would like to know what hook should I used when the permalink/url of a post is modified.
My goal is to get the old permalink and new permalink so I can used it for my plugin.
Thanks.</p>
<p>[EDIT]
Just want to clarify the question. I would like to get the old and new url in a scenario for example, when a user sel... | [
{
"answer_id": 128826,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 0,
"selected": false,
"text": "<p>The action is <code>update_option_permalink_structure</code>.</p>\n\n<p>The follow example works with this hook.<... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128825",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43994/"
] | I would like to know what hook should I used when the permalink/url of a post is modified.
My goal is to get the old permalink and new permalink so I can used it for my plugin.
Thanks.
[EDIT]
Just want to clarify the question. I would like to get the old and new url in a scenario for example, when a user select one it... | You need to exactly use `wp_insert_post_data`. This contains array of post data what will be store into database after WordPress has done all of the validation/sanitization.
```
add_filter('wp_insert_post_data', 'wpse_wp_insert_post_data', 10, 2);
function wpse_wp_insert_post_data($data, $post_attr)
{
// you get t... |
128,838 | <p>I would like to redirect this page <code>wp-login.php</code> to <code>/login</code> page.
So when a user clicks on a link like this <code><a href="/wp-login.php">login</a></code>, wordpress will redirect him to <code>/register</code> .</p>
<p>I found this function and modified it : </p>
<pre><code>add_... | [
{
"answer_id": 128850,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": -1,
"selected": false,
"text": "<p>If you will create a custom login page on your address <code>/login</code>, then create a rewrite:</p>\n\n<pre><... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128838",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43134/"
] | I would like to redirect this page `wp-login.php` to `/login` page.
So when a user clicks on a link like this `<a href="/wp-login.php">login</a>`, wordpress will redirect him to `/register` .
I found this function and modified it :
```
add_action('init','custom_login');
function custom_login(){
global $pagenow;
i... | If you're only concerned about login links displayed on your pages, you should be able to modify the URL by hooking the [`login_url`](https://codex.wordpress.org/Plugin_API/Filter_Reference/login_url) filter. This won't redirect a user that types `http://MYSITE/wp-login.php` directly into their browser, but it should a... |
128,853 | <p>I put this code into my functions.php <a href="https://gist.github.com/corvannoorloos/4703066" rel="nofollow">https://gist.github.com/corvannoorloos/4703066</a> and it work nice. </p>
<p>Now I want to display value from <strong>Sample Select Options</strong> filed in some front-end templates.</p>
<p>How can I do t... | [
{
"answer_id": 256966,
"author": "Johannes Eret",
"author_id": 113645,
"author_profile": "https://wordpress.stackexchange.com/users/113645",
"pm_score": 1,
"selected": false,
"text": "<p>I think you need to display it like this:</p>\n\n<pre><code><?php $options = get_option( 'your_reg... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128853",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37464/"
] | I put this code into my functions.php <https://gist.github.com/corvannoorloos/4703066> and it work nice.
Now I want to display value from **Sample Select Options** filed in some front-end templates.
How can I do that?
I tried [get\_option](http://codex.wordpress.org/Function_Reference/get_option)
```
<?php echo get... | I think you need to display it like this:
```
<?php $options = get_option( 'your_registered_option' ); echo $options['sample_select_options']; ?>
```
Replace **your\_registered\_option** with the name you gave in functions php for **register\_setting();**
Hope this helps |
128,864 | <p>This started happening after I moved my wordpress installation from the shared hosting to a vps.</p>
<p>The full error is this:</p>
<blockquote>
<p>Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in /home/pcsteps/public_html/wp-includes/plugin.php o... | [
{
"answer_id": 128865,
"author": "MrJustin",
"author_id": 43934,
"author_profile": "https://wordpress.stackexchange.com/users/43934",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure of exactly what <code>$the_['function']</code> is, but you are getting an error for that.</p>\n... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128864",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44834/"
] | This started happening after I moved my wordpress installation from the shared hosting to a vps.
The full error is this:
>
> Warning: call\_user\_func\_array() expects parameter 1 to be a valid callback, array must have exactly two members in /home/pcsteps/public\_html/wp-includes/plugin.php on line 199
>
>
>
I ... | This is a tricky one. You don't really need to look at wp-includes/plugin.php, there is nothing wrong with that file, it's a core file so you should just leave it alone, like all the other core files.
The reason it's tricky is because actions and filters in core expect a working callback function, but when you `add_ac... |
128,931 | <p>I successfully added a TinyMCE stylesheet using add_editor_style() so that I can preview the styles in the body of the TinyMCE editor.</p>
<p>However, am I right in assuming that the add_editor_style() function can only access style for the body of the editor? </p>
<p>If so, is there another method or function tha... | [
{
"answer_id": 128950,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 7,
"selected": true,
"text": "<p>You can not enhance the drop-down list <code>formatselect</code>. But you can enhance with the hook <code>tiny_mce... | 2014/01/07 | [
"https://wordpress.stackexchange.com/questions/128931",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9517/"
] | I successfully added a TinyMCE stylesheet using add\_editor\_style() so that I can preview the styles in the body of the TinyMCE editor.
However, am I right in assuming that the add\_editor\_style() function can only access style for the body of the editor?
If so, is there another method or function that I can use t... | You can not enhance the drop-down list `formatselect`. But you can enhance with the hook `tiny_mce_before_init` the second drop down `styleselect`, there is to hide in a default WordPress install.
The [documentation](http://www.tinymce.com/wiki.php/Configuration:formats) list all defaults and possibilities.
* inline –... |
128,941 | <p>My permalinks is in the format <code>domain.com/post-id/post-slug</code></p>
<p>I notice this is a great choice for permalinks as I can share articles with a short URL like <code>domain.com/123</code></p>
<p>But when I go to this short url, should it not redirect to show the full URL, becuase in the adress bar its... | [
{
"answer_id": 129255,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 2,
"selected": false,
"text": "<p>The shortlink of a WordPress post is on default <code>domain.com/?p=30</code>, not the Id after the domain. If yo... | 2014/01/08 | [
"https://wordpress.stackexchange.com/questions/128941",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17306/"
] | My permalinks is in the format `domain.com/post-id/post-slug`
I notice this is a great choice for permalinks as I can share articles with a short URL like `domain.com/123`
But when I go to this short url, should it not redirect to show the full URL, becuase in the adress bar its only showing `domain.com/123`
Any se... | Why?
----
I think the reason why
```
a) domain.com/123
```
is not redirected back to
```
b) domain.com/123/post-slug
```
with the `/%post_id%/%postname%/` permalinks settings, is that the matched rule is:
```
[matched_rule] => ([0-9]+)(/[0-9]+)?/?$
```
You can get that information from the global `$wp` objec... |
128,973 | <p>I have tried everything I could come up with, including using the '!important' attribute, but have not been able to change the CSS for the Disqus comments on my site. Their CSS not only originates from a file on their website, but I think the comments are in an iframe or something, which would explain why the '!impo... | [
{
"answer_id": 129023,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 0,
"selected": false,
"text": "<p>You could try loading your themes style sheet after all plugins by giving it a high priority.</p>\n\n<p>Her... | 2014/01/08 | [
"https://wordpress.stackexchange.com/questions/128973",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44686/"
] | I have tried everything I could come up with, including using the '!important' attribute, but have not been able to change the CSS for the Disqus comments on my site. Their CSS not only originates from a file on their website, but I think the comments are in an iframe or something, which would explain why the '!importa... | Disqus comments are loaded in an iFrame, but you can do some modifications. Check out [Disqus Appearance Tweaks | DISQUS](http://help.disqus.com/customer/portal/articles/545277-disqus-appearance-tweaks)
You need to be able to use Dev Tools. Use [Firebug](http://getfirebug.com/) with Firefox, or use the developer tools... |
129,011 | <p>I have 3 custom post types - Events, Music and Video. I have custom article pages for these 3 post types as having them on a singular archive page would be bloated. So i have:</p>
<ol>
<li>archive-events.php</li>
<li>archive-music.php</li>
<li>archive-video.php</li>
</ol>
<p>When a taxonomy is clicked (Tag or Cate... | [
{
"answer_id": 129023,
"author": "Brad Dalton",
"author_id": 9884,
"author_profile": "https://wordpress.stackexchange.com/users/9884",
"pm_score": 0,
"selected": false,
"text": "<p>You could try loading your themes style sheet after all plugins by giving it a high priority.</p>\n\n<p>Her... | 2014/01/08 | [
"https://wordpress.stackexchange.com/questions/129011",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43041/"
] | I have 3 custom post types - Events, Music and Video. I have custom article pages for these 3 post types as having them on a singular archive page would be bloated. So i have:
1. archive-events.php
2. archive-music.php
3. archive-video.php
When a taxonomy is clicked (Tag or Category) it defaults to the standard archi... | Disqus comments are loaded in an iFrame, but you can do some modifications. Check out [Disqus Appearance Tweaks | DISQUS](http://help.disqus.com/customer/portal/articles/545277-disqus-appearance-tweaks)
You need to be able to use Dev Tools. Use [Firebug](http://getfirebug.com/) with Firefox, or use the developer tools... |
129,014 | <p>I have a childtheme of twentythirteen in which i want to use the same template for pages and the blogposts-overview. But in twentythirteen is a page.php and an index.php. So I need override both, meaning I have to do all edits twice.</p>
<p>Any elegant solution for that?</p>
| [
{
"answer_id": 129015,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>Create <code>index.php</code> and format it the way you want.</p>\n\n<p>Then create <code>page.php</code> and... | 2014/01/08 | [
"https://wordpress.stackexchange.com/questions/129014",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44890/"
] | I have a childtheme of twentythirteen in which i want to use the same template for pages and the blogposts-overview. But in twentythirteen is a page.php and an index.php. So I need override both, meaning I have to do all edits twice.
Any elegant solution for that? | Create `index.php` and format it the way you want.
Then create `page.php` and load the index file with something very simple like:
```
get_template_part('index'):
```
Note: This is untested and I am not able to test this right now. If there is a problem, leave a comment and I will run proper testing later and get b... |