WordPress ReAuth =1 Loop with wpCAS

The **wpCAS plugin** appears to be working: I have a **subdomain** on a website which contains the **WordPress** installation (i.e. `test.mywebsite.com`), and I'm running through a **WordPress GitHub Repo** along with **Capistrano** for actual deployment. This is important because, due to this setup, the content is within a subdirectory, i.e. `test.mywebsite.com/wp`. The result is that, in order to access the site's admin section, I have to input `test.mywebsite.com/wp/wp-admin` in my browser. Accessing the frontend website, however, only requires that I input `test.website.com`. Confusing enough? I'm testing all of this with a **localhost MAMP server**. It should also be worth nothing that I have also redirected the IP of `test.mywebsite.com` to my local box via my Mac's `hosts` file, so everything is correctly taking place on the local box. Now, here's the catch: I'm using the wpCAS plugin with a **RubyCAS server**. Everything works up until the actual login process. wpCAS is designed to simply **re-direct the login page to my CAS login** , and then **match the credentials** typed into the CAS interface with those in WordPress's database. If there's a match, it (theoretically) would bring me to the admin page with my credentials logged in and working correctly. As a result of this setup, my typing in `localhost/wp/wp-admin` takes me to `auth.mywebsite.com`, the CAS interface where I can input my credentials. However, once I put my credentials into the CAS interface I'm instead hit with a **redirect loop** that looks like: `wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fwp%2Fwp-admin%2F&reauth=1` and `wp-admin/` so around and around we go! Any idea why this would happen and how to solve the problem?


SSL Certificate and WordPress

One of my clients has decided to install an SSL certificate for his website/domain. I have developed a WP website for them it's ready to be deployed. We are currently accessing it via the IP address and it works fine. Normally I just change the URL settings via admin (2 options) and run a search and replace throughout the database, and that's all that's needed. Should I be doing anything else for SSL? I assume the URL should also start with https:// in the admin settings right?


Translate wordpress date from Italian to English

I'm developing a wordpress based site in English but I've installed the Italian version of it...   In my blog page, I get dates, exactly months, in Italian instead of English... How can I translate this? Are there other things I must manually translate?   For example, where should I translate errors? Thanks!


Paginate tags page

If I click a random tag I want the tag page to list only 20 posts that is related to that tag and paginate it.               <?php     /**      * The template for displaying Tag Archive pages.      */          get_header(); ?>

<?php                         printf( __( 'Tag Archives: %s', 'twentyten' ), '' . single_tag_title( '', false ) . '' );                     ?>
          <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array( 'orderby' => 'title', 'order' => 'ASC', 'post_type' => 'post', 'posts_per_page' => 20, 'paged' => $paged );     $wp_query = new WP_Query($args);     while ( have_posts() ) : the_post(); ?>                  <div <?php post_class() ?>>
<li id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                     <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_post_thumbnail(thumbnail); ?>

                  <?php endwhile; ?>           <?php if (function_exists("pagination")) {         pagination($additional_loop->max_num_pages);     } ?>
          <?php get_sidebar(); ?>
     <?php get_footer(); ?>      The problem with this code is it's listing all the posts and not posts that are related to that tag. Can anyone help me fix?


wp e-commerce group product by category

Sorry for my bad english.   I have WP 3.3.1 & wp-e-commerce.3.8.7.6.2. On the products page (which use wpsc-products_page.php template) I have list of products. I want to group this products by category. For example: _*_ *Cat1   Product 1   Product 2   * _*_ Cat2   Product 1   Product 2   * _*_ Cat3   Product 1   Product 2   I try to use this method, but it`s does not work                 add_filter('posts_join', create_function('$a', 'global $wpdb; return $a . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";'));     add_filter('posts_where', create_function('$a', 'global $wpdb; return $a . " AND $wpdb->term_taxonomy.taxonomy = \'wpsc_product_category\'";'));     add_filter('posts_orderby', create_function('$a','global $wpdb; return "$wpdb->term_taxonomy.term_id DESC";'));     query_posts('');      Thank you all in advance for your reply!


Make datestamp for status updates show time

I have an installation of Wordpress 3.6 running on my server. Playing around with it, I found that 'status updates' don't show the time posted: ![enter image description here](http://i.stack.imgur.com/ZB5DD.png) Here's the thing: I want the time there too. Something like this would be best: ![enter image description here](http://i.stack.imgur.com/4txdH.png) Is there a way to change the format the time is shown in? Something in a child theme?


Prevent "main" WPMU site_url() being returned in functions

I've noticed that in a WordPress MU install with domain mapping enabled, some functions return URIs that don't use the current WPMU site's primary domain name which possibly means they are "WPMU Domain Mapped-ignorant functions" (a little harsh, I know). What can I do to ensure the primary domain of the current WPMU site is used in returned URIs when I call these kinds of functions, in an effort towards referencing assets (js, css, img, etc) in a canonical, siloed manner? A quick example being the following:               $ft_img = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');      So in this example `$ft_img[0]` would have the same URI for every subsite in a WPMU network, using the base site's `siteurl` when it should be subsite- specific.


Trouble with editing template for "List category posts" plugin

WP 3.0.4   local installation, multisite network enabled   theme: Twentyten   plugin: List Category Posts v .15, network activated I've created the folder `list-category-posts` inside my theme folder, and placed `default.php` inside it. Edited `default.php` and saved as `lcp_template_1.php` inside same folder. However, the changes are not appearing at all. I'm trying to change the style of the lcp output from the default `<ul>` to `<div>` classes defined in my theme (child)'s `style.css`. NOT WORKING. That is, the plugin is functioning, but the style changes are not working. Code for my template file is up at http://wordpress.pastebin.com/EGmrkerQ Please help. Sorry, no url for viewing the output, because this is a local installation. Oh, btw, I should mention that in the shortcode I have called for the new template, as follows: `[catlist id=1 template=lcp_template_1]`.


Upgrade not working & themes not supporting

I just transfered my website from shared hosting to VPS, I installed all the backup from previous website to the VPS, Everything was fine, My website was functioning all perfect, But I was not able to see wp-admin page, When I hit on url "mywebsite.com/wp-admin", I get a blank white page, I disabled all plugins and themes by renaming the folder names, Then I was able to login, no white screen was there, After digging my head into it for long time, I found that there is problem with the plugins folder, My theme is all up-to-date, and works fine without any errors If I de-activate all the plugins, then I don't get any blank white screen during login, **but if any one plugin** is activated the I get white blank screen on wp-admin page, This is not it, when trying to update any plugin or theme I am getting this message: > Unpacking the update… > > Notice: Undefined offset: 1 in /home/admin/onlinemba.co.in/wp- > admin/includes/class-ftp-sockets.php on line 93 > > Warning: Invalid argument supplied for foreach() in > /home/admin/onlinemba.co.in/wp-admin/includes/class-wp-filesystem- > ftpsockets.php on line 299 > > Notice: Undefined offset: 1 in /home/admin/onlinemba.co.in/wp- > admin/includes/class-ftp-sockets.php on line 93 > > Installing the latest version… > > Notice: Undefined offset: 1 in /home/admin/onlinemba.co.in/wp- > admin/includes/class-ftp-sockets.php on line 93 > > Warning: Invalid argument supplied for foreach() in > /home/admin/onlinemba.co.in/wp-admin/includes/class-wp-filesystem- > ftpsockets.php on line 299 > > Incompatible Archive. > > Plugin upgrade failed . (I have included `define("WP_DEBUG",true);` to wp-config file, after @Backie suggestions, so I am getting errors) I am not able to update my wordpress, but I did it manually, I am having the latest version of wordpress, I am not able to update my any plugins and themes.


Dynamic User State & City selection

I need to implement a state-city selection for my users to choose from. Where they first choose their state and then there is a city drop down field that shows only the cities in that state. Currently, users have to type in the state and city for their account. This concerns me because they may not enter the correct names. I would like this in order to keep these values consistent and to make the site more user friendly. I thought about creating all the states and cities as categories. I tried this which totaled to over 10,300 categories and sort of crashed my site. Certain pages that needed to access the categories would take update 10 minutes to load the page due to the large number of categories it had to process. I am looking a solution to this. I would like them to choose their state from a dropdown list and then based on the state chosen they can pick a city of that state from a dropdown list. I need some major help with this. Thanks a lot.


add metabox to specific custom plugin page

Hello I am new to WordPress and I am creating a custom plugin called ZeeFields. Now i wanna add a meta box to my custom plugin page. I tried but still i cant get it to work. btw I can add meta box to post or dashboard but not to my plugin. how can i do that ? here's my code               <?php     /*     Plugin Name: Post to exlcel     Plugin URI:     Description: Download posts to CSV...     Version: 0.1     Author: ZeeFields     Author URI: http://ZeeFields.com     License: GPL2     */          add_action( 'add_meta_boxes', 'cd_meta_box_add' );       function cd_meta_box_add(){             add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'metaBox_details',     'custompage', 'normal',  'high');           }     function metaBox_details()       {           echo 'What you put here, show\'s up in the meta box';          }            //============================================================================================================     add_action( 'admin_menu', 'register_my_custom_menu_page' );     function register_my_custom_menu_page(){         add_menu_page( 'ZeeFields', 'ZeeFields', 'manage_options', 'custompage',     'my_custom_menu_page',NULL,26 );           }     function my_custom_menu_page(){         echo 'I wanna Meta box showing here';     }     //============================================================================================================


Multiple Select Boxes Settings API

I know how to do select boxes, those are easy - but how would you do multiple select boxes? where you can select and save multiple things? Would you still use the `selected()` function? if so can some one provide a example? google is not being very nice about this.


Secure wordpress_logged_in cookie

I have to make sure, that the Wordpress cookie set after successful log in, "wordpress_logged_in_[salt-sth]" is set to be available for secure connections only. It looks like that it´s a filter used in pluggable.php, line 653 $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure); How can I set it to secure, WITHOUT modifiyng the wordpress core files? If I modify the core (set to true) - it´s not possible to logout anymore... Thank U!


Wordpress front end posting to multiple blog in multisite with advanced custom field

I am using advanced custom field frond end posting.               <?php           function my_pre_save_post( $post_id )     {         // check if this is to be a new post         if( $post_id != 'new' )         {             return $post_id;         }              // Create a new post         $post = array(             'post_status'  => 'draft' ,             'post_title'  => 'A title, maybe a $_POST variable' ,             'post_type'  => 'post' ,         );                // insert the post         $post_id = wp_insert_post( $post );               // update $_POST['return']         $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );                  // return the new ID         return $post_id;     }          add_filter('acf/pre_save_post' , 'my_pre_save_post' );          ?>      I want to use this method               <?php     $original_blog_id = get_current_blog_id(); // get current blog          $bids = array(1,2); // all the blog_id's to loop through     foreach($bids as $bid):            switch_to_blog($bid); //switched to blog with blog_id $bid            // ... your code for each blog ...     endforeach ;           switch_to_blog( $original_blog_id ); //switched back to current blog     ?>      How can I Post to multiple blog at same time. please help me.


WordPress add options to theme not displaying

Hi I am trying to learn to add theme options to WordPress themes by reading The Complete guide to WordPress Settings Api on wptuts I have gotten as far as the 4th part and have stoped to create an example for myself because I have gotten confused with how can I add the sections I create in a page.Here is my code:                function thanatos_theme_menu(){         add_theme_page(                        "Thanathos Theme Options",                         "Thanathos Theme",                         "administrator",                         "thanathos_theme_options",                        "thanathos_theme_display_callback"                       );     }     add_action('admin_menu' , 'thanatos_theme_menu');     function thanathos_theme_display_callback(){           echo "Johny la hanta este mui loca";      }          add_action('admin_init' , 'thanatos_initializa_theme_options');     function thanatos_initializa_theme_options(){         add_settings_section(                 'general_settings_section',                  'Thanatos Options',                  'thanatos_general_options_callback',                  'thanathos_theme_options' //I believe this where my mistakes is          );     }          function thanatos_general_options_callback(){         echo 'mergem la mare';     }      I have used the page id in order to set where to put this section and I belive the thanatos_general_options_callback() should display there but for some reasons it doesn't.What am I doing wrong here?


Change the name of an installed plugin

I have installed a third-party plugin for my wordpress site. What I want is to rename that plugin so that it matches my purpose for installing it. Is it possible? The plugin I'm trying to modify is CubePoints.. It's a pointing system for the users. But for the sake of better understanding, I'll be calling it MyPoints or something like that.a When I rename it in the plugin `PHP` file, it affects only the plugin listing. But it has a separate menu in the left panel. What I need is it to take effect there, so that the user can see the modified name in their user panel.


Is it possible to get the comment_reply_link within latest comments?

I have the following code to get the latest comments;               function get_recent_comments($no_comments = 5, $comment_len = 80, $avatar_size = 48)      {          $comments_query = new WP_Comment_Query();     $comments = $comments_query->query( array( 'number' => $no_comments ) );          $comm = '';     if ( $comments ) : foreach ( $comments as $comment ) :         $comm .= '
' . get_avatar( $comment->comment_author_email, $avatar_size );         $comm .= 'post_ID ) . '#comment-' . $comment->comment_ID . '">';         $comm .= get_comment_author( $comment->comment_ID ) . ': ';         $comm .= 'reply';         $comm .= '
' . strip_tags( substr( apply_filters( 'get_comment_text', $comment->comment_content ), 0, $comment_len ) ) . '

';          endforeach; else :         $comm .= 'No comments.';          endif;          echo $comm;       }      Is it possible to get the reply link to reply inline to these comments? So far, I have tried getting the               comment_reply_link();      But this doesn't seem to work either,,,,


Adding Custom Product Attribute and Variable in WooCommerce Programatically

Can you please let me know how I can add Custom Product Attribute and Variable in WooCommerce Programatically? I know this easy to be done in Woocommerce GUI but I need to do this through functions.php I have a Attribute Called "Class" and Some Variables as [A,B,C,D] now I would like to add them to the Cart and Shop page, I already tried this function but it didn't add any thing to the page:               function woocommerce_variable_add_to_cart() {        //Type attribute         $product_attributes['type'] = array(             //Make sure the 'name' is same as you have the attribute             'name' => htmlspecialchars(stripslashes('Class')),             'value' => $attributes,             'position' => 1,             'is_visible' => 1,             'is_variation' => 1,             'is_taxonomy' => 0         );          //Add as post meta     update_post_meta($post_id, '_product_attributes', $product_attributes);          }      Thanks


get_permalink() with wp_rewrite giving wrong permalink?

I have two custom post types: news and special, each would require ID within the url, like example.com/news/ID or example.com/special/ID. Since wordpress's custom post type always have post title in the it's url, I have to rewrite them in functions.php with the following code.               add_action('init', 'cdsb_rewrite');     function cdsb_rewrite() {         global $wp_rewrite;         $queryarg = 'post_type=news&p=';         $wp_rewrite->add_rewrite_tag('%cpt_id0%', '([^/]+)', $queryarg);         $wp_rewrite->add_permastruct('news', '/news/%cpt_id0%', false);         $queryarg1 = 'post_type=special&p=';         $wp_rewrite->add_rewrite_tag('%cpt_id1%', '([^/]+)', $queryarg1);         $wp_rewrite->add_permastruct('special', '/special/%cpt_id1%', false);     }          add_filter('post_type_link', 'cdsb_permalink', 1, 3);     function cdsb_permalink($post_link, $id = 0, $leavename) {         global $wp_rewrite;         $post = &get_post($id);         if ( is_wp_error( $post ) )         return $post;         if(get_post_type() == 'news'){             $newlink = $wp_rewrite->get_extra_permastruct('news');             $newlink = str_replace("%cpt_id0%", $post->ID, $newlink);             $newlink = home_url(user_trailingslashit($newlink));             return $newlink;}         elseif(get_post_type() == 'special'){             $newlink = $wp_rewrite->get_extra_permastruct('special');             $newlink = str_replace("%cpt_id1%", $post->ID, $newlink);             $newlink = home_url(user_trailingslashit($newlink));             return $newlink;}         else {             return $post_link;         }         }      the rewritten urls are working good, they can be visited using a browerser. But when i'm developing themes, weired things happen: I'm getting DYNAMIC urls! **get_permalink(NEWSID1);** within **single-special.php** , the function should return **example.com/news/NEWSID1** ，instead it's returning **example.com/special/NEWSID1** ,hence the link is not accessable. What's happening here? What can I do to get the right url? is it because all the custom post type urls are really flattened out in wordpress wp_posts table, so you can't really get STATIC url depending on custom post type? I know I can use **get_post_type();** to compile the right url , but can someone help me sort it out? sorry for my english by the way.


How can I get rid off url pagination?

I use to paginate my posts but a few day ago I decided to quit split posts in more that one page. But the old links to the secondary pages are still crowlable by the google because they still work. I mean, for example: initially I had one post split in two pages. Because of that there were two URLs for that post (`www.example.com/post` and `www.example.com/post/2`). After I remove the pagination code from that post I expect that only the `www.example.com/post _url` to be available. But the `www.example.com/post/2` is still available. Besides, I found that instead of the "2" from `www.example.com/post/2` I can put any number, and that URL is working (displaying the content of `www.example.com/post` ). Do you know how can I get rid of the `www.example.com/post/2`?


Using/compiling Foundation SASS on live WordPress server

so far I've used extensively LESS and BootStrap for many of my sites. However, I decided to start using Zurb Foundation as it seem more powerful, especially with the latest release (5). With LESS, what I have always done was installing `WP-Less`, a plugin that uses phpLess library to compile `.less` stylesheets by looking at whatever `.less` file was enqueued using `wp_enqueue_style()` function within my WordPress theme. So if I made any editing on my main `.less` file and its dependanciens/inclusions, etc. and updloaded it on my server, WP-Less would notice that and recompile for me a new `.css` stylesheet, which is served to the end users. Magic! I understood that Foundation is based on SASS and Compass. But these require ruby to run? Is there any equivalent of WP-Less for Foundation? Like, I enqueue `.sass` stylesheet and I have a library compiling for me the resulting `.css` if there's an update? So I can just do my edits locally, upload to the server and have my final stylesheet(s) recompiled automagically? Sorry if I made any stupid assumptions, but this is how I had been working with LESS and BootStrap and it was rather efficient to me. Thank you


Debian drops connection in wordpress admin section

I have installed wordpress 3.6(also tried 3.7). The problem is when I get to admin section, server after approximately 10 requests began to abort connection (on both get and post requests). I have checked ip tables. There is no restrictions at all in neither of the tables. I checked apache log which is empty when 'droppy' request comes in. I traced down packages, they come to the server, but server is not responding at all. Any good Ideas what to look for and where? I'm running: > Distributor ID: Debian, Description: Debian GNU/Linux 6.0.7 (squeeze), > Release: 6.0.7, Codename: squeeze, Apache 2, php 5.3


Adding CSS Classes to Sub items in Menus is not working

Ok, so this is the code I have to my Mega Menu that works with Bootstrap framework for Wordpress. For some reason, when I enter a class name in the backend of Wordpress > Menus > Sub item > CSS Classes, it's not showing up int he mark up. However if I put a Title, the title tag shows up. I've been going back and forth and I'm at loss what to do to fix it. Below is the navigation coding:               class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {          //
 elements     function start_lvl(&$output, $depth) {         // code indentation         $indent = ($depth > 0 ? str_repeat("\t", $depth) : '');         // build classes         $classes = array(         // only the top level will have dropdowns         $depth == 0 ? 'dropdown-menu' : '',         // assign a class to items nested deeper         $depth >= 1 ? 'sub-menu col-sm-4' : '');         $class_names = implode(' ', $classes);         // build html -
 becomes
 at top levels         if ($depth == 0)             $output .= "\n" . $indent . '
' . "\n" . $indent . '
' . "\n";         else             $output .= "\n" . $indent . '
' . "\n";     }          //
 elements and  links     function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {         // code indentation         $indent = ($depth) ? str_repeat("\t", $depth) : '';         // prepare         $li_attributes = '';         $class_names = $value = '';         $classes = empty($item -> classes) ? array() : (array)$item -> classes;         // build classes and attributes for
 elements that have nested
         if ($args -> has_children && $depth == 0) {             $classes[] = 'dropdown yamm-fw';             $li_attributes .= 'data-dropdown="dropdown"';         }         $classes[] = 'menu-item-' . $item -> ID;         // if we are on the current page, add the active class to that menu item         $classes[] = ($item -> current) ? 'active' : '';         // add all of the wordpress classes, including those set by user in Wordpress         $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));         $class_names = ' class="' . esc_attr($class_names) . '"';         // add id to
 elements         $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item -> ID, $item, $args);         $id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';         // build html - the
 elements at top level become
         if ($depth == 0)             $output .= $indent . '
' . "\n" . $indent . '
';         //         elseif ($depth == 1)             $output .= $indent . '
';         else             $output .= $indent . '
';         // build attributes and classes for  link elements         $attributes = !empty($item -> attr_title) ? ' title="' . esc_attr($item -> attr_title) . '"' : '';         $attributes .= !empty($item -> target) ? ' target="' . esc_attr($item -> target) . '"' : '';         $attributes .= !empty($item -> xfn) ? ' rel="' . esc_attr($item -> xfn) . '"' : '';         $attributes .= !empty($item -> url) ? ' href="' . esc_attr($item -> url) . '"' : '';         $attributes .= ($args -> has_children && $depth == 0) ? ' class="dropdown-toggle" data-toggle="dropdown"' : '';         // build  link html         $item_output = $args -> before;         $item_output .= '';         $item_output .= $args -> link_before . apply_filters('the_title', $item -> title, $item -> ID) . $args -> link_after;         // add a bootstrap "caret" to top level dropdowns toggles         $item_output .= ($args -> has_children && $depth == 0) ? '  ' : '';         $item_output .= '';         if ($depth == 0)             $item_output .= '
' . $item -> description . '
';         else             '';         $item_output .= $args -> after;         // final html output         $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);     }          function end_el(&$output, $item, $depth) {         // closes elements opened in start_el         if ($depth == 0)             $output .= '
' . "\n" . '
' . "\n";         elseif ($depth == 1)             $output .= '
' . "\n";         else             $output .= "
\n";     }          function end_lvl(&$output, $depth) {         // code indentation         $indent = ($depth > 0 ? str_repeat("\t", $depth) : '');         // closes elements opened in start_lvl         if ($depth == 0)             $output .= $indent . '
' . "\n" . $indent . '
' . "\n";         else             $output .= $indent . '
' . "\n";     }          // Overwrite display_element function to add has_children attribute @since WP 3.4     function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) {         if (!$element)             return;         $id_field = $this -> db_fields['id'];         //display this element         if (is_array($args[0]))             $args[0]['has_children'] = !empty($children_elements[$element -> $id_field]);         else if (is_object($args[0]))             $args[0] -> has_children = !empty($children_elements[$element -> $id_field]);         $cb_args = array_merge(array(&$output, $element, $depth), $args);         call_user_func_array(array(&$this, 'start_el'), $cb_args);         $id = $element -> $id_field;         // descend only when the depth is right and there are children for this element         if (($max_depth == 0 || $max_depth > $depth + 1) && isset($children_elements[$id])) {             foreach ($children_elements[ $id ] as $child) {                 if (!isset($newlevel)) {                     $newlevel = true;                     //start the child delimiter                     $cb_args = array_merge(array(&$output, $depth), $args);                     call_user_func_array(array(&$this, 'start_lvl'), $cb_args);                 }                 $this -> display_element($child, $children_elements, $max_depth, $depth + 1, $args, $output);             }             unset($children_elements[$id]);         }         if (isset($newlevel) && $newlevel) {             //end the child delimiter             $cb_args = array_merge(array(&$output, $depth), $args);             call_user_func_array(array(&$this, 'end_lvl'), $cb_args);         }         //end this element         $cb_args = array_merge(array(&$output, $element, $depth), $args);         call_user_func_array(array(&$this, 'end_el'), $cb_args);     }          }          function Bootstrap_nav_menu_css_class($classes, $item) {     // CHANGE .current-menu-item .current-menu-parent .current-menu-ancestor INTO .active     $classes = preg_replace('/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', 'active', $classes);          // Add the .dropdown class to the list items that have children     if ($item -> hasChildren) {         $classes[] = 'dropdown';     }          return $classes;     }      Below is the HTML mark up that it outputs, I put a comment on where the class attribute is not being added:
                     <button data-target=".navbar-ex1-collapse" data-toggle="collapse" class="navbar-toggle" type="button">                         Toggle navigation                                                                                </button>                     A leader in the field of assessment and career guidance

Products
Career and Psych Assessments

             Section Title

Test Link

Test Link

Test Link

Test Link


wp_get_attachment_image_src() and custom sizes

As said in this page, `wp_get_attachment_image_src()`only accepts built-in sizes such as thumbnail, medium, large or full. How do you get the same return value with custom sizes you add with `add_image_sizes()` ?


How can i fix a 404 error when targeting custom taxonomy slug ?

I have defined my new taxonomy like this               $args = array(      'labels'       => $labels,      'show_tagcloud'    => false,      'hierarchical'     => true,      'rewrite'          => array( 'slug' => 'activites', 'hierarchical' => true ),     );     register_taxonomy( 'business_category', 'business', $args );      I have no custom rewrite rules. this url works :               http://mydomain.com/activites/architecture-decoration/      calling my taxonomy-business_category.php template. so i want to reach this url now :               http://mydomain.com/activites/      but it throws a 404. the purpose (besides having a functional breadcrumb) on this page is to list all my custom category terms. how can i target a page that englobes all categories ? is it a rewrite conflict or a rewrite missing ? thank for your further explanation.


Child Theme: how to override variables?

I'm going to build my first Child Theme. I understood how to override functions (hope!), but how to override variables? For example, in a Premium Template I want to change the values of feed variables shown in functions.php:                 $app_rss_feed = 'http://xxx.rss';     $app_twitter_rss_feed = 'http://yyy.rss';     $app_forum_rss_feed = 'http://zzz.rss';      But if I create my functions.php file inside my child theme and assign a different RSS feed value to these variables... nothing happens. So, which is the right way to change variables?


Make buddypress posts likes count show to all users

Im using the buddypress likes plugin and I'm using a code to show the like count for posts on the index page of my site. The problem Im running into is the Like count only shows if you've liked the post and then it shows the total number. If you're logged out you won't see any like counts. How can I show the Like Counts to everyone? Here's how I call it inside the index page loop.               <?php if ( bp_like_is_liked( $id, 'blogpost' ) ) : ?>         <?php            $liked_count = count( get_post_meta( $id, 'liked_count', true ) );           if ( $liked_count ) echo 'Likes '. $liked_count . ''; ?>         <?php endif; ?>      I changed it so now all the liked show but for some reason all posts show atleast a like count of 1 even when they don't have any. Any idea why that is. Here's what I changed.               <?php            $liked_count = count( get_post_meta( $id, 'liked_count', true ) );           if ( !$liked_count==0 ) echo 'Likes '. $liked_count . ''; ?>


Listing Sub-Pages & Sub-Sub-Pages

So I don't really know why I am having so much trouble with this, it seems like functionality in wordpress that should be a bit easier to working with. Anyhow **I need to generate a menu system for a sidebar that looks like this (for a top level page):**

Sub-Page

Sub-Page

Sub-Sub-Page

Sub-Sub-Page

Sub-Page

Sub-Sub-Page

Sub-Sub-Page

Sub-Sub-Page

Sub-Page

      * * * On top if this, **I need to show the same menu, no matter how deep in the sub pages the user is at**. For example, if I was on a sub-sub-page, then I still wish to show the same menu. In other words, even if I was at a 3rd level page, it would still show 3rd and 2nd level pages - exactly the same as the above menu. * * * Thanks for the help in this one!


How to remove _wp_http_referer from URL when husing WP_List_table?

I have built a plugin that displays a table using the WP_List_Table class. The table displays entries on which it's possible to apply a filter and some bulk actions. The problem is that is that when I click on the "filter" button or "apply bulk action" button multiple times, the _wp_http_referer paramater is added to the URL and keeps being longer and longer each time I click on the button. Eventually the URL is so long that I get a blank page in the browser with the following error message:               Request-URI Too Large     The requested URL's length exceeds the capacity limit for this server.      I think I have set up the filter and bulk action select menus properly inside a simple form tag:               form action method="get"      The sale problem seems to have been described here: How to stop _wpnonce and _wp_http_referer from appearing in URL and as I am facing the same issue I am wondering if someone would have any idea how to remove the _wp_http_referer paramater from the URL after clicking on my form action buttons. Thanks


role manage_options always return true

i have a serious problem with wordpress roles, i have some custom roles                (      [data] => stdClass Object (          [ID] => 7         [user_login] => test         [user_pass] => $P$BSaGUc/dZwyl1PLaauaQdWBDIIkrWL.         [user_nicename] => test         [user_email] => [email protected]         [user_url] =>          [user_registered] => 0000-00-00 00:00:00         [user_activation_key] =>          [user_status] => 0         [display_name] => test     )     [ID] => 7     [caps] => Array (          [uploader_team_moderator] => 1     )     [cap_key] => acwp_capabilities     [roles] => Array (          [0] => uploader_team_moderator     )     [allcaps] => Array (          [read] => true         [sucuriscan_cap_lastlogins] => 1         [role_image] => /wp-content/images/89r6lbhsgnm37a0h2t4y.png         [role_title] => مدیر تیم آپلود         [role_color] => color: #2A537C; font-weight: bolder;         [publish_posts] => 1         [upload_edit] => 1         [upload_add] => 1         [upload_remove] => 1         [manage_options] =>          [uploader_team_moderator] => 1     )     [filter] => )      even i set manage_options false (remove_cap) but still return true when i try current_user_can                           if (current_user_can('manage_options')) {                 echo 'beep';             }      i even tried this:                               $cu = wp_get_current_user();                 $cu->remove_cap('manage_options');                 if ($cu->has_cap('manage_options')) {                    echo '123';                 }       but still see 123!!! i really don't know what the problem here. all i found when i disable buddypress plugins it work properly but when i enable it it stop working properly (this only happen by manage_options).


How to add plugin activity in the menus?

I have Installed CM answer plugin, but how can I add that as a menu at the top? Note: I can install plugin but the problem is that I don't know the way to add the plugin into the menu or a page.


How do I display a user specific content?

I have a site that displays the content only to registered users. Most of the content is available to all the users, but some of it is user specific (i.e. all users have that page, but each sees a it's own content which no one else can see). Any idea as to how I can restrict(and display) specific content per specific user ?


wordpress plugin license issue -New plugin development

Can i copy all the codes of a free plugin and paste it in my new plugin ?. Is there any license issue for using the others plugin code. My new plugin is working properly ,but for making this plugin i copy the resources of other free plugin .


rewrite rules and querystring

When I go to the url `mysite.com/photos/120` I'm _wanting_ to get the `120` out. In the PHP I want to be able to grab these "parameters" like the url was `mysite.com?page=photos&id=120` or even just `mysite.com/photos?id=120` Can I leverage **rewrite rules**? Or do I need to do **regex** in php to get what I want? Thanks **** EDIT 1 **** For the life of me I can't get this to work. Based on the answers given (thanks) here is what I have:               add_action( 'init', 'rewrite_photo_url' );     function rewrite_photo_url() {         add_rewrite_rule( '^photos/([^/]*)/?','index.php?page=photos&photo_id=$matches[1]', 'top' );     }          add_rewrite_tag('%id%','([0-9]+)');          print(get_query_var('photo_id'));      I suspect I'm missing a concept somewhere? **** EDIT 2 **** I'm starting to see that perhaps this needs to be in functions.php so I now have:               function rewrite_photo_url() {         add_rewrite_rule( '^photos/([^/]*)/?','index.php?page=photos&photo_id=$matches[1]', 'top' );     }     function register_custom_query_vars( $vars ) {         array_push( $vars, 'photo_id' );         return $vars;     }          add_action( 'init', 'rewrite_photo_url');     add_filter( 'query_vars', 'register_custom_query_vars', 1 );      Now I just need to know how to get my desired var in my page template. I've tried               print(get_query_var('photo_id'));      But that's not doing the trick atm.


How to test wp_cron?

This is kind of a stupid question... I scheduled a action to run every hour:               if(!wp_next_scheduled('my_hourly_events'))       wp_schedule_event(time(), 'hourly', 'my_hourly_events');          add_action('my_hourly_events', 'the_function_to_run');          function the_function_to_run(){        echo 'it works!';      }      How can I test if this works without waiting an hour? :) I tried adding `wp_clear_scheduled_hook('my_hourly_events');` before this code and adding `wp_cron()` after, but I don't see my function running... **edit:** ok, I added a `trigger_error()` inside my function, checked out the apache error log, and it's there :) So now I'm even more confused:   * How can the wp-cron run in the background? because apparently that's what happens if I see no output...   * this doesn't seem to work in a object context; why?


is_taxonomy is deprecated. What's the alternative?

Now that `is_taxonomy($taxonomy)` function deprecated how do I know if a taxonomy exist? What's the alternative? On a second note, the codex for `wp_insert_term()` says that if the taxonomy does not exist, an error is fired. Here, the "if taxonomy exists" part is ambiguous to me. Does that mean if the taxonomy has currently been registered with the registered_taxonomy or does that mean there is at least one term in the `wp_term_taxonomy()` table that's been associated with that taxonomy? And my 3rd question final question is how do I catch an error when an error is raised by the `wp_insert_term()` function? Would this work?               if (list($term_id,$taxonomy_id) = wp_insert_term(...)):     else:       //error here?     endif;


bbPress - Post count increases after every edit

I’ve installed bbPress 2.4 recently and I’ve noticed that each time I edit a post, my post count increases. Is there a way to stop that from happening? Thanks. > ![screenshot](http://i.stack.imgur.com/6F4AL.png) P.S. Is it normal for this to happen or is there something wrong on my end?


Scripts only working on home page

I am using the following example code to enqueue several scripts..                   add_action( 'wp_enqueue_scripts', 'my_scripts' );         function my_scripts() {               wp_enqueue_script( 'jQuery-Main', get_template_directory_uri().'/js/jquery.js',array(),'2.0.3', true);         }      If I set the `$in_footer` parameter to true, the scripts load in the footer and work correctly **only on the homepage**. If I leave the `$in_footer` parameter blank, the scripts work correctly on all pages **except the homepage.** This problem only started occurring recently and I cannot figure out why.


Return array of categories to php function

I am looking for a function that will retrieve the names and ids of all categories that will output a checkbox, or give me the data so I can perform a loop.               <input type="checkbox" name="category" value="category_id" /> Category 1     <input type="checkbox" name="category" value="category_id" /> Category 2     <input type="checkbox" name="category" value="category_id" /> Category 3     <input type="checkbox" name="category" value="category_id" /> Category 4     <input type="checkbox" name="category" value="category_id" /> Category 5


Empty space instead of admin bar

So I upgraded to 3.1 now I have a white band above the header of my website in the frontend when I'm logged in, I know this should be the control menu, but just a white band :-(


WordPress category

I want to get all categories in a new page which doesn't include any post. I tried wp_list_categories(); function. But it show only "No category" message. How do I do it?


WP admin broken. Not saving catgories or adding categories to menu

Wordpress Admin panel is not saving categories when creating new post or editing it. Also same problem with adding categories or pages to menu. It just doesn't save changes when I press update.


Exclude the category in Wordpress

## My question: This code retrieves the categories. I need to exclude the category number:81. Is there an easy way to exclude it in this code?               <?php                    $cat_lists = retrieve_cat_data_sp( get_option('bn_exclude_home_lists') );                      for ($i = 1; $i < count($cat_lists); $i++ ) {                      if( (get_category( $cat_lists[$i] )->count) > 0 ):             ?>


Tinymce list of shortcodes button

does someone know about tutorial or how to do button with list of shortcodes in tinymce? For example like in this video http://www.youtube.com/watch?v=DmzUuwW9AU4 (This function in the video is exatly what I want to). Same function have a lot of templates on themeforest. Thx for reading my question.


Get wordpress taxonomy slug name(s) to use as div class

I'm trying to mark up my posts using their custom taxonomy slug as the div class so that they can be filtered... So far what I have displays the taxonomy name but what I need is the slug so I have a nice-space-free-name, I have the below so far outputting the name:                <div class="box-item cocktails-box       <?php $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'cocktail_type', '', ' ', '' ) );      echo $terms_as_text; ?>">      Any help would be much appreciated - I'm getting a bald patch from scratching my head on this..


Wordpress home page showing 404 error

I've had a look for anyone experiencing the same issue but to no avail. I am currently working on a Wordpress site that previously did not have permalinks, so have added these (i.e. to change the URLS from ?p=123 to /about/the-company etc.) in the standard way but I've ended up with the homepage displaying a 404 error. All of the other pages work fine bar the home page. I have since tried deactivating it though now end up with the error still occurring. It seems to be a bit temperamental; in some browsers it works but others it doesn't. The issue can be seen at: http://www.walkerpoolenixon.com/wordpress/ Thanks in advance!


Display different number of posts from one category on the different pages

according with Pagination with custom loop. I use the custom loop for display flash game. For make a pagination on the page with posts from one category (mydomain/category/categoryName) I used:               add_action( 'pre_get_posts', 'wpse5477_pre_get_posts' );     function wpse5477_pre_get_posts( &$wp_query )     {         if ( $wp_query->is_category() ) {             $wp_query->set( 'post_type', 'game' );             $wp_query->set( 'posts_per_page', 9 );         }     }      I have the section on the main page of my site, where displayed three game from each category. But according with code above I can't display only 3 games, even if I determine in array('post_per_page', 3) or smth like this, because this number have been already determine in $wp-query. how could I kill two birds with one stone? Thanks.


Prev/Next child navigation for current page?

How can I get a Previous / Next navigation that only navigates the child pages of the current page? By that i mean url.com/page/ **child1** , url.com/page/ **child2** and so on.. I've been searching around alot but I'm still lost. It seems like you can't do that according to wordpress (they recommend plugins..)


add_image_size in a Plugin i created

I created a plugin and i need to use add_image_size in it. I know how it work in the function file and for a theme, but how can i implement this in a plugin? I want new images uploaded by wordpress users to be smaller for mobile with               add_image_size( 'wp_small', 60, 75, true ); //mobile      I read that you need to use init or admin_init but i don't know how to implement this.


query order by category

i have this line.. in sidebar..               <?php query_posts ( ( array('orderby' => 'rand', 'showposts' => 12)));?>      i want to order by category not random.. so if i am in a post from category animals.. i want to show 12 post just from this category. Not Random like now.. how can i do that?


How to put JQuery/Ajax inside shortcode?

The purpose of this plugin is to create a list that users can modify with up or down votes. The shortcode is supposed to display the list on a page and use JQuery to fadeIn and fadeOut while updating the database. A demo of the concept is available at http://bucketlingerwedding.com/80s-music-reception/ (note: the working code does not yet use AJAX). I would like to put this plugin in the Wordpress Repository, but the AJAX is killing me. The following is the latest code. It shows only a page with a blank content area. I need to get this code to update the database with AJAX, and to avoid re-loading the page, so that I can work in animations/transitions. The code is commented to reflect my understanding of what I'm trying to do. **Code:**               /*     *     *     SHORTCODE     *     *     */          add_shortcode('list-up-down', 'cb_lud_scfunc');          //This creates the shortcode.     function cb_lud_scfunc() {     //Define some basic variables.     global $wpdb;     $cb_lud_prefix = $wpdb->prefix;     $cb_lud_table = $cb_lud_prefix . 'cb_list_up_down';     $cb_lud_homeurl = home_url();     $cb_lud_upimg = plugins_url('list-up-down/images/up-arrow.png', _FILE_);     $cb_lud_downimg = plugins_url('list-up-down/images/down-arrow.png', _FILE_);     $cb_lud_sample_query = $wpdb->query('SELECT * FROM '.$cb_lud_table);     $cb_lud_field1_name = $wpdb->get_col_info('name',1);     $cb_lud_field2_name = $wpdb->get_col_info('name',2);          /*     CREATE THE JAVASCRIPT/JQUERY FUNCTION     */     //Create the Javascript and AJAX     //add_action('init', 'cb_lud_action_javascript');          function cb_lud_action_javascript() {     ?>                <?php     //End Javascript function.       }          //Call the javascript function.     //Rather than hook into an action, call whenever shortcode is in a page.     cb_lud_action_javascript();          /*     *     CREATE THE AJAX (HELP!)     *     */          /*     ARROW CALLBACK     */          //Use the Wordpress AJAX functions     //Apparently, there has to be an if->then statement depending on whether the user is an admin.     if( is_admin() )     {     add_action('wp_ajax_cb_lud_arrow_action', 'cb_lud_arrow_callback');     add_action('wp_ajax_nopriv_cb_lud_arrow_action', 'cb_lud_arrow_callback');     }     else     {     //Assume the 'else' is the normal execution of the shortcode.          //Want to get the POST values from the form, above.          //These don't seem to be working.              $cb_lud_entry_id = $_POST['entry'];         $cb_lud_arrow_direction = $_POST['arrowdirection'];               //If the post value is 'up', do this. If 'down', do this.               if ($cb_lud_arrow_direction == 'up') {             $wpdb->query('UPDATE '.$cb_lud_table.' SET up_votes=up_votes+1             WHERE entry_ID='.$cb_lud_entry_id.'');         }              else if ($cb_lud_arrow_direction == 'down') {             $wpdb->query('UPDATE '.$cb_lud_table.' SET down_votes=down_votes+1             WHERE entry_ID='.$cb_lud_entry_id.'');         }          die(); // this is required to return a proper result     }               //Create the function that executes the AJAX Callback     function cb_lud_arrow_callback(){         }          /*     CREATE THE FORM     */     //Create the form to allow users to add records         $cb_lud_sc_form = '             <form id="list-up-down-form" name="list-up-down-form" action="" method="post">

     //Using inputs rather than links because inputs can contain values.
'.$cb_lud_field1_name.':
<input id="field1_input" name="field1_input" type="text"></input>
'.$cb_lud_field2_name.':
<input id="field2_input" name="field2_input" type="text"></input>	                     <input name="add_record" type="submit" value="Add Record" />

             </form>             ';          /*     DEFINE HOW THE FORM HANDLES THE INPUT(S)     */     $field1_data = htmlspecialchars($_POST['field1_input'], ENT_QUOTES);     $field2_data = htmlspecialchars($_POST['field2_input'], ENT_QUOTES);     $up_votes = 0;     $down_votes = 0;     $new_data = array(         $cb_lud_field1_name => $field1_data,         $cb_lud_field2_name => $field2_data,         'up_votes' => $up_votes,         'down_votes' => $down_votes,         );     $format = array('%s', '%s', '%f', '%f');          if (isset($field1_data) && !empty($field1_data) && isset($field2_data) &&!empty($field2_data)) {         $wpdb->insert(             $cb_lud_table, $new_data, $format         );     }          /*     DISPLAY THE LIST     */               //Get the list from the database, and set the variables for display in the output.     $get_list = $wpdb->get_results('SELECT entry_ID, '.$cb_lud_field1_name.' AS "field1", '.$cb_lud_field2_name.' AS "field2", up_votes, down_votes, up_votes - down_votes AS "total_votes"         FROM '.$cb_lud_table.'         GROUP BY entry_ID         ORDER BY total_votes DESC         ',OBJECT);          //Check if list is null, and if so, set a variable to display a warning. Otherwise, display the list.     if (empty($get_list)) {         $cb_lud_sc_output .= "Warning: You don't seem to have any records for this list. Why don't you add some now?";         $cb_lud_sc_output .= $cb_lud_sc_form;         return $cb_lud_sc_output;     }     else {         $cb_lud_sc_output .= $cb_lud_sc_form;         $cb_lud_sc_output .= '
';         $cb_lud_sc_output .= '
';         $cb_lud_sc_output .= '
'.$cb_lud_field1_name.'	'.$cb_lud_field2_name.'	Score	Vote Up/Down
';             foreach ($get_list as $list_items) {                 $cb_lud_sc_output .= '
'.stripslashes($list_items->field1).'	'.stripslashes($list_items->field2).'	'.$list_items->total_votes.'	<form id="up-down-arrows-form" action="" method="post"><input class="up-arrow" name="arrow-up-ID-'.$list_items->entry_ID.'" type="image" src="'.$cb_lud_upimg.'" value="'.$list_items->entry_ID.'"/> <input class="down-arrow" name="arrow-down-ID-'.$list_items->entry_ID.'" type="image" src="'.$cb_lud_downimg.'" value="'.$list_items->entry_ID.'"/></form>
';                 }         $cb_lud_sc_output .= '
';         return $cb_lud_sc_output;     }     };     /*     END SHORTCODE     */


Is it possible to rewrite a page url Without setting the permalinks to Post Name?

Is it possible to rewrite the page url if your page link is for example `localhost/wordpress/?p=123` ? Instead of `post_name.php?...`. (So the first option of permalinks and not `post_name`.


Random sidebar/widget background

Does anyone have a clever idea to get a random/changing background for just the widget sidebar?


Pages included in another page and duplicate content issues for SEO

in a recent project I've decided to create a page template (PageX) which is a kind of "stack" of subpages. This template simply includes the content of three other separate pages (PageA, PageB, PageC). I'm just trying now to find the best way to avoid duplicate content for SEO, as Wordpress automatically create specific permalinks for these 3 subpages. Is there a way to tell Wordpress that these pages must not have permalinks?


Adding Pinterest Script Before Closing Body Tag

According to the Pinterest website in order to add the Pinterest button to any page I have to add the following just below the closing body tag:               <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>      What's the best way to do this? Should I follow the link, grab the script and use wp_enqueue_script? Or can I somehow include the script element another way? Thanks.


Upacking the package... stalls, but installs plugin

I have been searching high and low for the correct solution to my problem. I have found many searches relating to this, but can not find a solution... Here is the Updated Video to see what happens ? http://youtu.be/ILkaSyxFaDs When installing plugins or themes , it will get to the page:               "Unpacking the package..."      ![enter image description here](http://i.stack.imgur.com/RfUwx.png) and then just stalls. Nothing else happens. **The Plugin or Theme Installs just fine, but it doesn't output the correct info on this "update.php" page.** I have tried to edit my .htaccess page, increase memory_limit and a bunch of other tips that I found from searches. I even tried to install a fresh Wordpress and the problem still persists. Here is a snapshot of the source code of where the page stops loading from every time. Thanks in advance.. my head is spinning... **EDIT: Here is the debug info I am receiving:** > [24-Mar-2014 14:51:18] PHP Notice: ob_end_flush() [ref.outcontrol]: failed > to delete buffer zlib output compression. in /home/web/public_html/store/wp- > includes/functions.php on line 2773 ![enter image description here](http://i.stack.imgur.com/09iMb.png)


Is it a good idea to make whole theme widgetized?

I have mainly seen sites using widgets on sidebars or inside multi-column layout. However, I was wondering what if we could use widgets in every blocks like header, main content block, footer etc. Is that a good or a bad idea?


Getting the post_id in wp_ajax function

I wrote a custom AJAX function in which I have assigned a post type to be a child of another post type. In one function I am looping through those child posts, and I want to update the database to reflect the post_parent(the post which the child posts belong to). Problem is, I cannot grab that post's ID from anywhere to update the db. Any suggestions? Here is the jQuery function:                   $.ajax({                             url: ajaxurl,                             type: 'POST',                             async: true,                              cache: false,                             dataType: 'json',                             data:{                                     action: 'new_item_save',                                     item_order: $('#img-sortable').sortable('toArray').toString()                                  }         });      And here is the PHP callback:               function save_new_img_order($post) {     global $wpdb;     $pid = $post->ID;          $order = explode(',', $_POST['item_order']);     $counter = 0;     foreach ($order as $item_id) {         $wpdb->update($wpdb->posts, array( 'menu_order' => $counter, 'post_parent' => $pid ), array( 'ID' => $item_id ) );         $counter++;     }     die(1);     }     add_action('wp_ajax_new_item_save', 'save_new_img_order');      Thanks in advance for any pointers!


How to modify the query to exclude posts by slug?

How can I modify my query in order to exclude certain posts by slug? Is it possible?               query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1));      Ty


Using action hooks inside of a shortcode

I am trying to create a modular plugin that includes action hooks for developers to add content before and after the main shortcode content. I'm having some trouble because anything I do in the function called by the action hook is always echoed out at the top of the shortcode instead of inside the shortcode where it belongs. I've been searching and I did come across this response from Pippin Williams on a recent ThemeForest thread, where he recommends using output buffering. I haven't gotten this to work properly for me, and I've read elsewhere that output buffering should only be used as a last resort, so I'm still looking for a clean solution. The simplest shortcode ever:               add_shortcode('shortcode','example_shortcode');          function example_shortcode( $atts ) {            $shortcode_output = "
Some shortcode content.
";       $shortcode_output .= "
More shortcode content.
";            return $shortcode_output;          }      Now lets add an action:               add_shortcode('shortcode','example_shortcode');          function example_shortcode( $atts ) {            $shortcode_output = "
Some shortcode content.
";       $shortcode_output .= "
More shortcode content.
";            do_action('below_shortcode');            return $shortcode_output;     }          add_action('below_shortcode', 'example_action_output');          function example_action_output() {         echo "
This should be output at the end.
";     }      The contents of example_action_output() are returned above the shortcode content because of the echo statement. I tried output buffering as recommended by Pippin:               add_shortcode('shortcode','example_shortcode');          function example_shortcode( $atts ) {            $shortcode_output = "
Some shortcode content.
";       $shortcode_output .= "
More shortcode content.
";            ob_start();       do_action('below_shortcode');       return ob_get_clean();            return $shortcode_output;     }          add_action('below_shortcode', 'example_action_output');          function example_action_output() {         echo "
This should be output at the end.
";     }      This returned the contents of example_action_output(), but wiped out the rest of my shortcode. Any suggestions? Thanks, Dalton


Why is WordPress automatically modifying image URLs? (Tracking pixel from RSS)

Can you explain the hooks or filters WordPress applies when saving a post which remove an absolute URL and makes it a relative URL? _Background_ My site consumes an RSS feed, that I pay for, which includes a tracking pixel at the end of each post. The tracking pixel is in an IMG tag with a bunch of parameters after it - something like this: ` <img src='http://example.com/trackingPixel.gif?param1=123abc456' /> ` The tracking pixel changes for each item in the RSS feed (after 'param1' in the example), so I can't just add the pixel myself - I have to use the one that's in the feed's content. The problem is WordPress replaces the tracking pixel with a relative URL like this: ` /uploads/2012/02/trackingPixel.gif ` The modified URL makes the tracking pixel useless. I have been looking for a workaround for hours now - I checked default filters, removed default filters, modified $allowedtags global variable, commented out the wp_strip_all_tags function, went through the theme, RSS reader, etc, etc.


Wordpress.com Like Button

Is there a plugin out there similar to wordpress.com like button? http://en.support.wordpress.com/likes/


what is the topic-view page's name? in bbpress

I'd like to **seperate** the " **write a New Topic** " page by a button. but, I cannot find the " **view topic** "'s file. where is it? I found the write form.(form-topic.php)


Creating a user's own folder on user registration

I need a plugin or some guidence on creating a user's own folder on user registation. For example...A user clicks on Register and registers ... I need wordpress to create a directory which would be linked with this user. The reason I want to do this is because I am going to work on building a dashboard where a wordpress template will display the contents of this user's own directory. Let me explain further step by step: (Note: "Not Req" means I don't need help with this step)   1. User Registers and wordpress creates a directory called the same as the username.   2. User uploads images to that specific directory via ftp or upload - **"Not Req"**   3. I create a template that would display the content of the directory / sub (images) in some kind of tree format. Right now, what I need to do is step 1. Hope this helps.


I'm confused about url sanitization in meta boxes

I'm making meta box for a custom post. This meta box will contain a href value. I dont need any validation that is it valid href value but i would like to do this in a way that it is secure. I have buld my meta box with this tutorial. In the part where to sanitize the input i have used esc_url_raw. It seems to work just fine, but the Codex says on esc_url_raw: "This function is not safe to use for displaying the URL, use `esc_url()` instead". So should i use `esc_url()` or is there something else that i should be using? And if so, why should not use `esc_url_raw` in this case.               /* Get the posted data and sanitize it */     $new_meta_value = ( isset( $_POST['mod-modbox-link'] ) ? esc_url_raw( $_POST['mod-modbox-link'] ) : '' );      I get the url:s to pages like this:               $my_link = get_post_meta( $post->ID, 'mod_modbox_link', true );


get_post_templates lists one item with gibberish

This code at the bottom of this question draws a listing of page templates on the edit post screen. The problem is that on the listing of page templates on the page editor as well as at "Appearance > Editor", when it comes to the place where it should list the .php file that the code is contained in (functions_post_options.php), rather than just specifying its name, it lists it as:                (.*)$|mi',$template_data,$name)) Page Template      Here's the html it returns:                    (.*)$|mi',$template_data,$name)) Page Template
(functions_post_options.php)      Anyone know how to fix this? The script below is contained inside the page functions_post_options.php               add_action('add_meta_boxes','add_post_template_metabox');     function add_post_template_metabox() {             add_meta_box('postparentdiv', __('Custom Layout Template','cb'), 'post_template_meta_box', 'post', 'side', 'core');     }               function get_post_templates()     {         $themes = wp_get_themes();         $theme = wp_get_theme();         $templates = $themes['mytheme']['Template Files'];     //$templates = $themes[$theme['Name']]['Template Files'];         $post_templates = array();              if ( is_array( $templates ) ) {         $base = array( trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()) );             foreach ( $templates as $template ) {                 $basename = str_replace($base, '', $template);                 if ($basename != 'functions.php' && $basename != 'functions_post_options.php') {                          // don't allow template files in subdirectories                     if ( false !== strpos($basename, '/') )                         continue;                     $template_data = implode( '', file( $template ));                     $name = '';                     if(preg_match('|Template Name:(.*)$|mi',$template_data,$name))                         $name = _cleanup_header_comment($name[1]);                     if ( !empty( $name ) ) {                         $post_templates[trim( $name )] = $basename;                     }                 }             }         }         return $post_templates;     }          function post_template_dropdown( $default = '' ) {         $templates = get_post_templates();         ksort( $templates );         foreach (array_keys( $templates ) as $template )             : if ( $default == $templates[$template] )                 $selected = " selected='selected'";             else                 $selected = '';         echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";         endforeach;     }          add_action('save_post','save_post_template',10,2);     function save_post_template($post_id,$post) {         if ($post->post_type=='post' && !empty($_POST['post_template']))             update_post_meta($post->ID,'_post_template',$_POST['post_template']);     }


Wordpress Multisite add widget on new blog

I need to put widget in sidebar when new blog is creating. My code is:               function make_default_widgets($blog_id, $user_id, $domain, $path, $site_id, $meta) {     switch_to_blog($blog_id);          $sidebars_widgets = array();     $sidebars_widgets['sidebar-1'] = array();     $sidebars_widgets['sidebar-1'][] = 'calendar-1';     update_option('sidebars_widgets', $sidebars_widgets);          restore_current_blog();     }          add_action( 'wpmu_new_blog', 'make_default_widgets' );      It creates calendar widget in new blog. But when I want to enter the title it shows error: _**An error has occurred. Please reload the page and try again._** What I am missing here ? One thing when I want to register this widget Calendar-2 it doesnt register in new blog. When I register with Calendar-1 every new blog when I create it creates in sidebar. But as I said when I need to enter the title of calandar it shows the error. Sorry for bad english...


User meta and public function security

I am using stripe to setup a system of buying credits, which can be used on my wordpress site. I save credits using wordpress user meta, and I increment those credits after a successful transaction with stripe. I do this using the following function in my themes functions.php file               //increment a users pack credits     function increment_pack_credits( $user_id , $credit_amt ) {         if ( !current_user_can( 'edit_user', $user_id ) ){             return false;         }else{             //get the current credits amount             $pack_credits = get_user_meta($user_id, 'pack_credits', true);             //increment by the added credit amount             $pack_credits = ($pack_credits + $credit_amt);             update_usermeta( $user_id, 'pack_credits', $pack_credits );         }     }      Two questions: 1) Is user meta a secure method to store purchased credits? 2) Is my function, located in functions.php, a secure method to increment credits? How easy (or not) would it be to tamper with credit amount?


Calling a shortcode in the backend

I'm using TablePress to make some backend tables. What I want to do is show these tables in a different admin menu than the TablePress menu, because they'll be available to lower user groups. So I found out how to create a custom menu and in that menu I have custom pages. In these pages I would like to show the shortcode `[table id=1 /]` (a table that has already been created). I've tried               echo do_shortcode('[table id=1 /]');      but that just shows `[table id=1 /]`. The plugin uses               add_shortcode( 'table', array( $this, 'shortcode_table' ) );      so I **can't** use directly the shortcode callback because I've no access to `$this` variable outside the object (the object class is `TablePress_Frontend_Controller`). In addition, looking at plugin files, I've noticed one called `template-tag- functions.php` that contains a function `tablepress_print_table`. However this function, just like shortcode, works on frontend but not on backend (throwing an error). What is the best way to solve this?


How can I add a default description to uploaded files?

Is there a way to add a default description for media files as soon as they are uploaded to WordPress? Specifically, I want to modify the code here to extract the text from PDF files and include it in the description for the media item in WP. I've found that adding a filter using the "attachment_fields_to_save" hook will allow me to change the description (post_content) for media, but it only works after I click "update" on the Edit Media screen. When items are first uploaded, the description is empty by default. Thanks for any help!


custom sortable column

I am trying to create a extra column for year in my timeline custom post. I can create the extra column and I can actually get it sorting and it works correctly but then all my pages then dont seem to work. this is all of my code i am using to create the column and make it sortable:               // Register the column     add_filter( 'manage_edit-maryg_timeline_columns', 'set_custom_edit_date_columns' );     add_action( 'manage_maryg_timeline_posts_custom_column' , 'custom_date_column', 10, 2 );          function set_custom_edit_date_columns($columns) {         unset( $columns['date'] );         $columns['timeline_date'] = __( 'Year', 'your_text_domain' );              return $columns;     }          //output data for the column     function custom_date_column( $column, $post_id ) {         switch ( $column ) {             case 'timeline_date' :                 $year = get_post_meta( $post_id, 'timeline_date', true );                      if ( is_string( $year ) )                     echo $year;                 else                     echo 'Unable to retrieve year';                 break;         }     }          //make columns sortable     add_filter("manage_edit-maryg_timeline_sortable_columns", 'timeline_sort');     function timeline_sort($columns) {         // $custom = array(         //     'timeline_date'   => 'Year'         // );         // return wp_parse_args($custom, $columns);         //or this way         $columns['timeline_date'] = 'Year';         return $columns;     }          //make the date column sorted by year by default     add_filter( 'request', 'timeline_column_orderby' );     function timeline_column_orderby( $vars ) {         if ( !isset( $vars['orderby'] ) || ( isset( $vars['orderby'] ) && 'Year' == $vars['orderby'] ) ) {             $vars = array_merge( $vars, array(                 'meta_key' => 'timeline_date',                 'orderby' => 'meta_value'             ) );         }         return $vars;     }      the problem code i have narrowed it down to is:               add_filter( 'request', 'timeline_column_orderby' );     function timeline_column_orderby( $vars ) {         if ( !isset( $vars['orderby'] ) || ( isset( $vars['orderby'] ) && 'Year' == $vars['orderby'] ) ) {             $vars = array_merge( $vars, array(                 'meta_key' => 'timeline_date',                 'orderby' => 'meta_value'             ) );         }         return $vars;     }      The only thing is i dont understand why my pages not work any more Thanks in advance **EDIT** I've narrowed it down even further to it being this line of code:               !isset( $vars['orderby'] ) ||      but what im trying to do is sort by this column automatically and if i remove that it doesnt do that


Problem when importing the post from blogger to wordpress

I have a blogger and I had a adsense account. But the adsense account is now blocked. I was using blogger and I was happy. I really didnot make the website to earn money so I didnot care till now. But Now I want to open new website in wordpress. I am deleting my blogger website now but I want to transfer some of the post from blogger to wordpress. also I want to apply for adsense. So if I import my post from blogger to wordpress, Google is probably going to know where was the post exported to. Will it effect my new adsense account which I am using in wordpress.


Using Posts To Posts to update a taxonomy

I'm trying to do something on the admin side that's got me stumped. Here's what's happening: I have custom posts for a business and for its products. The products are categorized using a custom taxonomy. P2P (scribu's plugin Posts To Post) connects the products and business custom posts so that you can see connected products when editing the business info and vice versa. Recently, we've decided to add faceted search to the site, so I want to be able to search for business in a given state which makes products in a given category. State information is just a custom field associated with the business so that's easy. However, the category information isn't attached to the business, it's attached to the products that are connected to the business. I've associated the custom taxonomy with the business CPT now, but of course nothing's assigned to the business post. What I need to do is to grab the taxonomy information from the products that are connected to the business CPT and assign it to the business. I can get at this information on the front-end via code something like this http://pastebin.com/6JCuepbG but of course, that doesn't work on the backend. What I want to do is to bring up a business listing and, on Publish or Update, query for the products connected to it (in P2P), get their assigned categories within the custom taxonomy and then write those to the taxonomy for that business listing. If this was stored in custom fields, it would be easy, but it's not. Any ideas?


Page Not Found when file does exist

We are having an issue where although files are listed in File Manager they will not pull up when we link to them. We are on the current version of WordPress and all plug-ins. Here is a link to a particular page experiencing the issue: http://www.usarugbysouth.com/about-us/meetings/. If you click on the first set of minutes, December 15, 2012, you will see the issue. Our site is hosted at GoDaddy. It is the Deluxe Linux product. When we log in, access Control Panel, and then File Manager, we can see, access, and manage all of the files which result in the 404 when we try the links. We've tried resetting Permalinks with many times with no result. All of our Posts and Pages pull up and links to files and sites outside of our own are fine as well. Please advise with suggestions. We are happy to provide any files or documentation we can. We've created a page to share any documents, files, screen shots, etc. Please see: http://www.usarugbysouth.com/wordpress-support- sharing/. We're also available for desktop sharing sessions during the business day. Thank you in advance.


How can I stop TinyMCE from converting my HTML entities to characters?

Here's the problem: I paste the HTML entity code for, let's say, a service mark (`℠`) into the HTML view of the editor. As soon as I switch to the "visual" tab, my entity code is turned into an _actual service mark character_ (I guess the corresponding UTF-8 character or something? I don't know from character encodings...). I don't want this--I want it to stay as the entity reference. Is there some kind of configuration I can change to stop TinyMCE from doing this? My understanding from reading the internets is that this is not the default behavior--that TinyMCE should actually be doing the opposite, and converting characters to their entities. So is this something specific to WordPress' version of TinyMCE?


Disable pingbacks and trackbacks in blog posts

Just created a new self-hosted WordPress blog, and among the very first things, I "unchecked" the `Allow link notifications from other blogs (pingbacks and trackbacks)` option under **Settings** > **Discussion**. I was fixing a few things for the to-be-launched-soon blog, when I noticed a pingback on the default **"Hello world!"** post on my blog. But I've already disabled pingbacks/trackbacks, so why exactly is this happening? What could be wrong?


Wordpress Navigation

I have my html code for menu as follows:

Home

About Us

Services

Success Stories

Testimonials

Contact Us

      I have registered sidebar in `functions.php` as follows               <?php     $args = array(         'name'          => __( 'Main Navigation', 'theme_text_domain' ),         'id'            => 'sidebar-navigation',         'description'   => 'Main Navigation Container',             'class'         => '',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
' );         register_sidebar( $args );          ?>      After that i called the dynamic sidebar in `header.php` file as               <?php dynamic_sidebar('sidebar-navigation'); ?>      But i could not see the menus appearing.


Multisite / Network - Stable?

I have about 15 individual WordPress sites running on my server and am looking at re-creating those sites under the multisite area to avoid having to update each install. My question - I heard some remarks about a year ago that multisite wasn't quite "ready" or may still have some quirks. I really need these rock solid, should I be concerned?


How can I safely delete data related to wp_post table manually from the mysql database?

Recently I downloaded a plugin that had a bug that orphaned its custom post type items in the wp_post table rather than deleting them. Being new to wordpress, it wasn't apparent to me that the wp_postmeta table was related to that table. Now, I have entries in the latter with NULL values for the $post_id. (I simply deleted everything in wp_post with that content type.) I'm assuming that it would be easy enough to do a left join query to find all those wp_postmeta items and delete everything with $post_id NULL. But, I'm not exactly sure how the wordpress tables relate to each other. If I were to do this manually, are there any other default tables that need to be taken into consideration? Does anyone have a script in their library to handle something like this? If you can suggest a plugin, I'm open to that as well.


How to display thumbnail + tags + title of a child page?

What do I need to do to display thumbnail + tags + title of a child page? [ Thumbnail ] [ Title ] [ Tags ] Thanks! EDIT: Well this work, but only showing thumbs+title... it shouldnt be too difficult to add the tags:                   <?php         $child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent = ".$post->ID."    AND post_type = 'page' ORDER BY menu_order", 'OBJECT');    ?>         <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
          <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"> <?php echo get_the_post_thumbnail($pageChild->ID, 'thumbnail'); ?>
          <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?>

         <?php endforeach; endif;         ?>


PHP if statement works in template files, but not header

This is driving me nuts, and I'm sure that as soon as someone points out the answer, I'm going to feel dumb. I have a website where most pages require login to view. So I am using an if statement to view page content if a user is logged in, or view a login form if not. If I put this in a page template, everything works just fine:               <?php get_header(); ?>          <?php if(is_user_logged_in()): ?>

<?php the_field('headline'); ?>
             <?php the_field('text'); ?>
          <?php else:              $args = array( 'pagename' => 'request-access' );         $the_query = new WP_Query( $args );              if ( $the_query->have_posts() ) :             while ( $the_query->have_posts() ) : $the_query->the_post();                 the_content();             endwhile;         endif;              wp_reset_postdata();          endif; ?>          <?php get_footer(); ?>      That's great, but it makes more sense to put the if statement in the header so I don't have to copy it onto every single page template. But if I put the exact same if statement: `<?php if(is_user_logged_in()): ?>` at the end of the header.php, I get an error saying "Parse error: syntax error, unexpected $end" in the last line of header.php. So why does this work at the beginning of a template file but not at the end of the header file?


PHP and Jquery pass value from form. Update function on DataBase

i do loop foreach:               <?php  $myrows = $wpdb->get_results( "SELECT * FROM wp_myprojects" ); ?>     <form  id="aad-form2" action="" method="POST">     <?php foreach($myrows as $a): ?>          <input id="id" type="text" name="id" value="<?php echo $a->id; ?>">     <input id="name" type="text" name="name" value="<?php echo $a->name; ?>">     <input id="header" type="text" name="header" value="<?php echo $a->header; ?>">     <input id="body" type="text" name="body" value="<?php echo $a->body; ?>">     <input id="urls" type="text" name="urls" value="<?php echo $a->urls; ?>">     <input type="submit" name="aad-submit2" id="aad_submit2" class="button- primary"value="<?php _e('Update', 'aad'); ?>"/>     <img src="<?php echo admin_url('/images/wpspin_light.gif'); ?>" class="waiting" id="aad_loading2" style="display:none;"/>
          <?php endforeach ?>     </form>      And my jquery code:               jQuery(document).ready(function($) {     $('#aad-form2').submit(function(){     //alert('test');     $('#aad_loading2').show();     $('#aad_submit2').attr('disabled', true);     data2 = {     action: 'aad_get_results2',     form_data2: $('#aad-form2').serialize()     //aad_nonce: aad_vars.aad_nonce     };          $.post(ajaxurl, data2, function (response) {     $('#aad_results').html(response);     $('#aad_loading2').hide();     $('#aad_submit2').attr('disabled', false);     });      return false;     });     });      And when i do action only last form is update in data base. Example i have 5 records in database. Foreach print me 5 forms, but when i click submit button record 1 or record 2 nothing happen. Only last record from loop is update. Help Tell me why? Probaly i don't now jquery saw good :) Help me. My update function in plugin:               function aad_process2_ajax() {     global $wpdb;     parse_str($_POST['form_data2'], $form_data2);     echo $id = $form_data2['id'];     echo $name = $form_data2['name'];     echo $header = $form_data2['header'];     echo $body = $form_data2['body'];     echo $urls = $form_data2['urls'];     $wpdb->update('wp_myprojects', array('id'=>$id, 'name'=>$name, 'header'=>$header, 'body'=>$body, 'urls'=>$urls), array('id'=>$id));     $wpdb->show_errors();     /*EVRY PROCESS AJAX MUST DIE!!!!*/     die();     /*EVRY PROCESS AJAX MUST DIE!!!!*/     }     add_action('wp_ajax_aad_get_results2','aad_process2_ajax');


Change the footer text on the login page

I am customising the login page and would like to alter the footer text that takes the user back to the website. Ideally and as an example, changing it from the first image, to the second just below:   1. ![enter image description here](http://i.stack.imgur.com/wo1KR.jpg)   2. ![enter image description here](http://i.stack.imgur.com/Gp5LO.jpg) I've searched around a bit but can't seem to find the answer I'm looking for in modifying the text. The closest I have is changing the _Register_ or _Lost your password?_ text, but can't apply this script to the third user option. **functions.php:**               function back_to_site_text( $translated ) {          $translated = str_ireplace(  '← Back to My Site', 'Head back to My Site',  $translated );          return $translated;     }          add_filter('gettext', 'back_to_site_text');     add_filter('ngettext',  'back_to_site_text');      How do I change the footer text on the login page that takes the user back to the main website?


Shortcode in Text Widget not working

Not sure why this is not working. I get no errors, but just shows nothing at all in the text widget. The shortcode works on pages and posts. WordPress version 3.9.1               add_filter('widget_text', 'do_shortcode');          // Shortcode for Widget copyright Year [year]          function copyyear_shortcode() {       $year = date('Y');       return $year;     }     add_shortcode('year', 'copyyear_shortcode');      Any help would be greatly appreciated.


WordPress Multisite - Questions about select all posts from all network sites

Someone would tell me how i could do so that all posts published on the websites of my network were published on the main site of the network also? Or more directly, any way of doing a select on which he select all posts of all prefixes wp_2_posts, wp_3_posts infinitely...


$reverse_top_level works the opposite way according to Codex?

The Codex for wp_list_comments states `$reverse_top_level (boolean) (optional) Setting this to true will display the most recent comment first then going back in order.` For my it is actually the opposite way. `false` option will display the latest comment as the first one and `true` option or if the option is not used at all will the last one. The same applies if comment pagination is used or is not used. Similar behavior applies to `reverse_children` option. If `false` or not used at all the latest child is the first one. Code used along with WordPress 3.6.1 on TurnKey                   $comments =     get_comments(array(             'number' => $get_comments_number_approved,     //          'offset' => 10,             'post_id' => $post_id,             'status' => 'approve' ,             'orderby' => 'comment_date_gmt',             'order' => 'DESC'         ));                  wp_list_comments(array(                 'reverse_top_level' => false, //Show the latest comments at the top of the list                 'reverse_children' => false,                 'page' => $page_number,                 'per_page' => $comments_per_page,     //              'avatar_size'   => 16,             ), $comments);      Did I miss something or is it a bug or Codex needs to be updated?


Custom permalink variable on single post

I'm trying rewrite url for permalink on single post   my permalink: /%postname%/ My single form: http://example.com/abc- def/?chapter=1   adc-def mean: %postname%   i want permalink is: http://example.com/abc-def/chapter/1 But it is not possible. this is my code:               add_action( 'init', 'myblog_rewrites_init' );     function myblog_rewrites_init(){         add_rewrite_rule(             '([^/]+)/([0-9]+)/?$',             'index.php?name=$matches[1]&chapter=$matches[2]',             'top' );     }          add_filter( 'query_vars', 'myblog_rewrite' );     function myblog_rewrite( $query_vars ){         $query_vars[] = 'chapter';         return $query_vars;     }      Please help me! Thanks every body!


How to make all the posts commentable by default? Imputs in Settings/Discussions are not saved

I've modified my website quite a bit and now looks almost as I desire. I've set all the posts to be commentable in Settings/Discussions but it seems that this imput is not saved and new posts by authors are not commentable. Everytime, I need to "quick edit" the new post and mark the |_|Allow Comments field as selected |x|. This takes me a lot of time and I wonder if there's a way to have a function to make all the new posts as commentable as, just like I said, it seems not possible to choose it as option in Settings/Discussions. Thanks!


Install custom header file twenty thirteen theme

I'm trying to install a `*.png` file as a custom header using the Twenty Thirteen theme. The file contains a client's logo, site name, and tag line, and is 750 px wide x 175 px high. When I attempt to install the file in the header, the theme automatically tries to crop the file's height and width. [The default header height and width for this theme is 230 x 1040 px.] The cropped file fails to show all the formatting I generated with my graphics editor. Using the parent theme, when I crop the custom header to its maximum permitted size and save my changes, the theme expands the file width beyond the view of my computer monitor. The text and images in the custom header look pixelated and ragged, and both ends of the logo are cut off. This is not acceptable. The solution seem to lie in creating a child theme, with modifications to the parent `style.css` and `functions. php` files within the child theme folder. I modified the allowable height of a custom header to 400 px as described in the following thread. The child theme fully accepted the height of the logo (175 px H), while cropping less of the width than the parent theme. When I viewed the home page of the site, both ends of the logo were chopped off, and the logo continue to look ragged, although less so than just using the parent theme. Worse, the CSS of the navigation bar failed to install. I'm at a complete loss as to how to fix this issue. I suspect that the topic thread referenced above is not the complete solution. The parent theme `custom-header.php` file has default settings for header height and width. Should I modify those values in my child theme as well? * * * **Correction:** when the child theme is active, the CSS for the entire site fails to load, not just for the navigation bar. Just to clarify things here:   1. child theme `style.css`: I did call the parent theme 'twentythirteen' at Template: twentythirteen, and the import function with `@import url("../wp-content/themes/twentythirteen")`, and   2. `functions. php`: I did use an opening `<?php` and closing `?>` tag to contain the modified scripts.


why does add_rewrite_rule refresh and loose url variables

I am using:               add_action( 'init', 'add_author_rules' );       function add_author_rules() {            add_rewrite_rule(               "support/([^/]+)/?", "index.php?category=$matches[1]", "top");        }       in the `themes/function.php` when I enter the address:               http://localhost/support/funding      the url changes to:               http://localhost      and the variable is not set:               print_r($_GET);     $category = get_query_var('category');     echo '!'.$category.'!';      both give an empty result the `.htaccess` is unchanged and is:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      In case I wasnt clear I want: `/support/funding` to remain in the address bar and me to have access to the variable category which would be 'funding' in this case


List all subpages hierarchically based on the currently viewed page, top ancestor levels included

Based on the current page, I'm listing the links of all pages which belongs to the parent ancestor. However when I'm accessing a grandchild, the top parent page will gone from the links hierarchy. This is what I have tried:               <?php     // display the sub pages from the current page item     if($post->post_parent) {         $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");         $titlenamer = get_the_title($post->post_parent);         $permalink = get_permalink($post->post_parent);     } else {         $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");         $titlenamer = get_the_title($post->ID);         $permalink = get_permalink($post->ID);     }     if ($children) {         ?>
<a href="<?php echo $permalink; ?>"><?php echo $titlenamer; ?>

             <?php echo $children; ?>
     <?php } ?>      What I'd like is to have listed all the pages with subpages hierarchically based on the currently viewed page.


Unwanted content in website title

I use "anythingslider" jquery plugin to animate some html content in my wordpress theme. and i use this code in header.php to show title:               <title><?php bloginfo('name'); ?> <?php if ( is_single() ) ?><?php wp_title(); ?></title>      But the first page have unwanted content (#&panel1-2) in title like this: www.domain.com/#&panel1-2 I am sure this is because of anythingslider plugin but i don't have any idea how to fix this.


How to update scrollbar when using Jetpack's Inifnite Scroller?

for the last couple of days, I have been trying to have a custom scrollbar (jquery+css) while using Jetpack's infinite scroller. What I want is to get rid off the standard scrollbar and use a custom one for my content. I have tried a couple and most of them have an update function that I need to insert somewhere into Jetpack's Infinite scroller (js) so when it loads the content, the custom scrollbar gets updated and it resizes itself. The problem is that I have no idea where to insert this update function. Can someone please help me? I wont post any code because they are all pretty much the same. Anyways, if for some reason, you do need to see it, you can check out this one at: https://github.com/noraesae/perfect-scrollbar


How to use multiple check-box values to work in a function and insert values in database

I am working on a custom theme where there is option to upload images . I have certain check-boxes in the form which the users select as per where the image has to go. My form code is as follows :               <input type="checkbox" class="input" name="vtype[]" value="3"/>     <input type="checkbox" class="input" name="vtype[]" value="4" />     <input type="checkbox" class="input" name="vtype[]" value="5" />     <input type="checkbox" class="input" name="vtype[]" value="6" />      function for using the values is :               $image_category = implode(',', $_POST['vtype']);      if i echo this then the result is fine e.g. 3,4,5 . but if i try to use this value to insert values in database then the value is updated in only the 1st category and nothing happens for the remaining. main function is inserting values in database is :               $post = array(           'ID' => '',           'post_author' => $image_author,            'post_category' => array($image_category),           'post_content' => $image_to_attach,            'post_title' => $image_title,           'post_status' => 'publish'             );         }         // Insert the values in DB         $id = wp_insert_post($post);


Wordpress refuses to send mail, "...your host may have disabled the mail() function"

I recently implemented a comment area on my website and tried to get the email notification functionality to work. It doesn't seem to want to send email notifications when new comments are made. Just to see if PHP can send emails, i tried to reset the password (because you'll get a new password via mail), and i then got the message: > The e-mail could not be sent. Possible reason: your host may have disabled > the mail() function I've checked the checkboxes in Settings -> Discussion, and the email is valid, so it's not a setting issue. I tried to create a php file and send using `mail()`, and it sent successfully. So there must be something weird going on with Wordpress. Any ideas?


updated permalink structure on localhost does not work

I have a fresh localhost install and when i change the permalink structure from the default to any other structure the links break. I have created new post under the new structure and it doesnt work. When i change the structure i get the "Permalink Structure updated" alert but it does not work. When i switch back to default, everything works. I tried updating .htaccess to                BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      END WordPress      and nothing. This is probably an easy fix. Please help Jim


Moving to directory creates path problems.. how to solve?

I've moved my installation from `example.com/beta` to `example.com` and I've noticed that there are a few broken images. Looking at the source, it appears that they are still looking in looking in the `/beta` directory for the images.. How can I fix this? The pics which are broken seem to be the ones uploaded from within the page/post editor. (Note:I exported the database to a file and there were many instances of example.com/beta in it .. I wonder if I can find-replace to get rid of the beta and then import the db..?) EDIT In the end, I went into each post, and edited each broken image (Edit Image > Advanced Settings) to take out the `beta/` before wp-content. I was too scared to edit the exported sql and re-import it. If it happens in the future I would just re-create the `/beta/wp-contents/uploads` with the contents of `/wp- contents/uploads` until I found the patience to go thru and change each image paths.


How turn on error reporting without reset?

How would I turn on error reporting without resetting the theme? I ask hostgator to help, now my subsite urls are broken.