setup_postdata in "loop-handling" php file called via $.ajax

I'm calling a "loop handler" kind of php file that opens a loop with WP_Query. Inside the `foreach` loop I want to use the `show_postdata` function. I'm aware of the global $post aspect of this function. I tried placing the `global $post` everywhere in that php file without success though. I get an error 500 server error with noch detailed error message in the catch part. When I use the class to get data on the server inside a template it works. This is my AJAX call:                   $.ajax({         type       : "GET",         data       : {numPosts : numPosts, postTypes : postTypes, template : template, postID : null, filterArgs : filterArgs, fields: fields, inclMeta : inclMeta, imgFields : imgFields },         dataType   : "html",         url        : bfApp.setWPUrl + "/bfLoopHandler.php",         beforeSend : function(){         },         success    : function(data){                  if (typeof(callbackSuccess) == "function") {                 callbackSuccess(data);             }              },         error     : function(jqXHR, textStatus, errorThrown) {                  if (typeof(callbackError) == "function") {                 callbackError(jqXHR, textStatus, errorThrown);             }              }     });      This is an excerpt from the php file up to the point where show_postdata is called:               class bfLoop {     public function getData($postIDs, $postTypes, $numPosts, $filterArgs, $template, $fields, $inclMeta, $imgFields, $inclCats) {              global $post;              define('WP_USE_THEMES', false);         $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );         require_once( str_replace('index.php', '', $parse_uri[0]) . 'wp-load.php' );              // Argumente setzen         if ($postIDs == null || $postIDs == 0) {             $args = array( 'post_type' => $postTypes,                             'post_status' => array('publish'),                            'posts_per_page' => $numPosts,                             'meta_query' => $filterArgs,                            'fields' => $idsOnly );         } else {             if (is_array($postIDs)) {                 $args = array(                 'post__in' => $postIDs,                 'post_type' => 'any');                               } else {                 $args = array(                 'p' => $postIDs,                 'post_type' => 'any');                             }         }              $loop = new WP_Query( $args );                    $retArray = array();                  $posts = $loop->get_posts();                foreach ( $posts as $post ) {                      try {                    setup_postdata( $post );                  } catch(Exception $e) {                     //return "AFTER";                     return "W:" . $e->getMessage();                 } ......


wp_nav_menu() doesn't assign proper class to elements and it forces wrapping the ul element

I'm having trouble with `wp_nav_menu` function. I want the menu to have no `div` wrapper; have the class `sf-menu right` for `ul` element of the menu and `li` elements not have any classes. I've tried many combinations, but hasn't gave me the proper result. my current `wp_nav_menu` function:
             <?php wp_nav_menu(array(                 'theme_location' => 'primary-menu',                 'container'       => false,                 'menu_class'      => 'sf-menu right',                  )); ?>
      How can I achieve my goal result? **EDIT** my result after trying :
         <?php wp_nav_menu(array(                 'theme_location' => 'primary-menu',                 'container'       => '',                 'items_wrap' => '

%3$s
' )         ); ?>
      **RESULT :**

بهینه سازی وبسایت

تماس با ما

طراحی سایت

نمونه کارها

فروشگاه اینترنتی

مقالات


Delete child post and attachment links to parent post

I have a hierarchical posts, when ever I delete the child posts its attachments go and link to deleted post's parent How can I stop this?


Woocommerce - sort by discount in dropdown menu - woocommerce_get_catalog_ordering_args

I have searched and searched for a solution for adding a "Sort by Discount" to the dropdown on the shop page in woocommerce. I need to add a calculation such as this somewhere:               $percentage= round((( ( $regular_price - $sales_price ) / $regular_price ) * 100),0) ;      I have found some code which apparently would add the item to the dropdown menu, but I need to calculate the percentage and add it in somehow:               add_filter( 'woocommerce_get_catalog_ordering_args', mycode_woocommerce_add_salediscount_to_catalog_ordering_args' );     function mycode_woocommerce_add_salediscount_to_catalog_ordering_args( $args ) {     $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );     if ( 'discount' == $orderby_value ) {     $args['orderby'] = 'meta_value_num';     $args['order'] = 'DESC';     $args['meta_key'] = '_pa_discount';     }     return $args;     }     add_filter( 'woocommerce_default_catalog_orderby_options', 'mycode_woocommerce_add_salediscount_to_catalog_orderby' );     add_filter( 'woocommerce_catalog_orderby', 'mycode_woocommerce_add_salediscount_to_catalog_orderby' );     function mycode_woocommerce_add_salediscount_to_catalog_orderby( $sortby ) {     $sortby['discount'] = 'Sort by discount';     return $sortby;     }         This line               $args['meta_key'] = '_pa_discount';      is where I think I need to add the calc, or is there no way of calculating here? would I need to create a custom field that is (I have no idea how to do this), calculated automatically based on $regular_price and $sales_price?? Is there another way around this? I have looked for plugins too, but didn't find anything that did this. Any help would be greatly appreciated. As is probably obvious, I am not a coder, but just attempting to add some functionality to my site that I thought would be a simple task, so please answer with as much detail as possible. Thanks in advance.


Possible to stop Wordpress from adding p1, p2… classes to p tags in TinyMCE?

I've noticed the first time today that WP is adding numbered class names (p1,p2…) to my p tags. I have the following TinyMCE init related part in the functions.php.               function my_mce( $init ) {         $init['block_formats'] = "Paragraph=p; Heading 3=h3; Heading 4=h4";              $style_formats = array(             array(                 'title' => 'Link',                 'selector' => 'a',                 'classes' => 'link'             )         );         $init['style_formats'] = json_encode( $style_formats );         return $init;     }     add_filter('tiny_mce_before_init', 'my_mce');      In my php an example snippet (using ACF options field) looks like that:

Google Analytics
         <?php the_field('op-dataprivacy-analytics', 'option'); ?>
      The outputted p tag get the p1 class:

Google Analytics

Privacy statement

More infos.

      Is it possible to prevent that?


Unexpected output using theme customizer

I am setting up a textarea input for theme customizer. It seems to be working well apart from it outputting a line of text above the textarea label which I cannot find where it comes from and why. ![Theme customizer settings](http://i.stack.imgur.com/Y7bOe.png) In this screenshot, above the label _Säätiön toiminta_ , is the text `data- customize-setting-link='textarea_setting'` This is somehow being automatically generated. **Function**               function mytheme_customize_register( $wp_customize ) {         require_once(TEMPLATEPATH . '/inc/customizer_classes/wp_customizer_textarea.php');              $wp_customize->add_setting('textarea_setting', array(                                    'default' => 'default text',                                    'transport' => 'refresh'                                    ));              $wp_customize->add_section( 'Mytheme_content' , array(             'title'      => __( 'Site content', 'Mytheme' ),             'priority'   => 30,         ) );              $wp_customize->add_control(new Mytheme_Textarea_Control($wp_customize, 'textarea_setting', array(             'label' => 'Säätiön toiminta',             'section' => 'Mytheme_content',             'settings' => 'textarea_setting'         )));     }     add_action( 'customize_register', 'mytheme_customize_register' );      **wp_customizer_textarea.php**               class Mytheme_Textarea_Control extends WP_Customize_Control {         public $type = 'textarea';         public function render_content() {             echo '             ' . esc_html( $this->label ) . '             <textarea rows="5" style="width:100%;" ' . $this->link() . '>' . esc_textarea( $this->value() ) . '</textarea>         ';         }     }


Folder structure when using multiple domains with WordPress

I have 10 domain names and am thinking about using WordPress. Are the domains set up in separate folders with their subsequent pages? In other words, how are the domains and their subsequent pages kept separate within WordPress?


issues with templates

I'm working on a wordpress theme and I'm having issues with the page templates. I'm trying to do the following. I have a static front page, one custom post type and single "pages" that are hierarchical. The individual pages are as follows. Pages: /artist/album/songs/ eg: /jay-z/the-black-album/interlude/ Custom post type /cpt_name/post_name/ My problem is whenever I add the static home page it appears to override the default permalinks and the /artist/ first level pages show the front page template while the rest of the pages /album/ and /song/ still work as expected. I have tried front-page.php home.php creating a custom home page post with a custom template assigned. I can get the pages to work if I reset the database back to default then create each new page by hand. But as soon as I import the custom post types everything messes up and the default homepage overrides the first level /artist/ page template. Even if I echo the page ID to the pages template it says that the default /artist/ first level page is ID of 1 when in fact its 16. Any suggestions would be greatly appreciated!


How can I remove data-target="#" from bootstrap dropdown menu?

I've created a mega menu with wordpress. The theme I'm working with happened to use bootstrap and adds so much weird stuff to my menu, and one of those things that seem pretty weird is that it has added a `data-target="#"` to my parent menu items which basically makes them useless as links. This might work for some, but I'm trying to make those links clickable, because the children is always displayed. Here's my menu script:               <?php wp_nav_menu(       array(           'theme_location' => 'primary',           'container_class' => 'collapse navbar-collapse navbar-responsive-collapse',           'menu_class' => 'nav navbar-nav',           'fallback_cb' => '',           'menu_id' => 'main-menu',           'walker' => new wp_bootstrap_navwalker()       )     ); ?>      Does anyone know how to remove this feature?


Widget form method does not work properly

I need your help. I have this code                 <?php         class Messenger extends WP_Widget         {           function __construct()           {             $widget_ops = array('name' => 'Messenger', 'description' => 'Displays messages for users' );             parent::__construct('Messenger', '', $widget_ops);           }               public function form($instance)           {             extract($instance);                  ?>             Title                 <input class="widefat"                        id="<?php echo $this->get_field_id('title') ?>"                     name="<?php echo $this->get_field_name('title')?>"                                                         value="<?php  if(isset($title)) echo $title;  ?>"                 />             <?php                     }                public function update()           {           }                public function widget()           {           }              }         add_action( 'widgets_init', function(){return register_widget("Messenger");});?>      but unfortunately this error occurred > Warning: extract() expects parameter 1 to be array, null given in > C:\wamp\www\pt\wp-content\plugins\Messenger\Messenger.php on line 22 I do not know why, I do not know why the `$instance` keep null after I submit the form.


How/Where is editor.min.js Added to the wp-admin Post Page?

How/Where is the `wp-admin/js/editor.min.js` file added to the backend WordPress post editing page (`wp-admin/post.php`)? How could I change this to use the non-minified file? I'm working on a browser extension that will interact with a WordPress installation. I'd like to add some temporary debugging code the the `editor.js` file. However, in a standard WordPress 3.5.1 site, this file is already minimized, and somehow loaded on the page via a mechanism that isn't a standard `<script/>` tag. I'd like to know how the WordPress core team includes (and/or a minimize workflow for) this file. Put another way, if I wanted to add a feature that required changing `editor.js`, how would I go about developing that. Competent programmer here, not super familiar with WordPress's architecture. In case my words failed me above, I'm not looking to extend WordPress, I'm trying to diagnose existing system behavior. Thanks in advance!


an action hook when a post reaches a certain number of views

I am using WP Post Views plugin to display the post number of views. I use:               <?php if(function_exists('the_views')) { the_views(); } ?>      I am creating a badge system for my wordpress site. My actual goal is to create a badge for number of post views: If a post has a number of views exceeding a certain threshold, then the author is awarded this badge. How can I achieve this using action hooks? Till now, all the badges I have created use the priciple of action hooks (For instance, the badge related to the number of an author published posts uses post_publish action hook). Should I look for another approch for the views badge other than hooks? Thank you for your help.


Limit length of headline in Editor

I`m searching for a function to limit the number of characters a user can type into the headline field in the editor.


Create a front user register/login/profile & logout without interfering with wp-login.php?

I need to create a register and login link on my home page.   Users get to take a quiz on their profile which they can update and what gets posted to a database. How can I do this without interfering with the wp-login?   All needs to be done on the front end.


String regex match replace for role 'contributor' only

currently I'm using the below code to add `rel=nofollow` and `target=_blank` to all external links of my site's content but I would like this to happen **only** on Contributors posts. IE, Authors posts and above have no rewrite rules.               <?php          add_filter( 'the_content', 'cn_nf_url_parse');          function cn_nf_url_parse( $content ) {          $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>";     if(preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) {         if( !empty($matches) ) {                  $srcUrl = get_option('siteurl');             for ($i=0; $i < count($matches); $i++)             {                      $tag = $matches[$i][0];                 $tag2 = $matches[$i][0];                 $url = $matches[$i][0];                      $noFollow = '';                      $pattern = '/target\s*=\s*"\s*_blank\s*"/';                 preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);                 if( count($match) < 1 )                     $noFollow .= ' target="_blank" ';                      $pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/';                 preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);                 if( count($match) < 1 )                     $noFollow .= ' rel="nofollow" ';                      $pos = strpos($url,$srcUrl);                 if ($pos === false) {                     $tag = rtrim ($tag,'>');                     $tag .= $noFollow.'>';                     $content = str_replace($tag2,$tag,$content);                 }             }         }     }          $content = str_replace(']]>', ']]>', $content);     return $content;          }


Disable disqus on pages

I have installed Disqus Comment System 2.74 in my Worpress version 3.5.2.   I want to disable disqus from all pages except Blog post. Is there any way to do this?


Wordpress function/template tag to get first n words of the content

OK, this might be a duplicate, I was just unable to put my idea in proper search terms, sorry for that! Is there a built-in function or template tag to get the first `n` words of the content? I mean `the_content()`. Thanks!


Get post closest to today

as the title indicates I am trying to make a query for the post closest to today's date. I know this is a duplicate post but the ones I have found on the topic has not been able to solve my problem. my code:               $args = array( 'type'=>'post', 'orderby'=>'name',                'order'=>'ASC', 'taxonomy'=>'category' );     $categories = get_categories( $args );          foreach ( $categories as $cat ) {     $args = array( 'post_type'      => 'event',                    'numberposts'    => 1,                    'cat'            => $cat->cat_ID,                    'meta_key'       => '_date',                    'order'          => 'DESC',                    'order_by'       => 'meta_value',                    'no_found_rows'  => true,                    'meta_query'     => array(array(                        'key'    => '_date',                        'value'  => date('Ymd'),                        'compare'=> '>=',                        'type'   => 'NUMERIC'                    ))                   );     $query = new WP_Query( $args );      I have been looking to this post for help: Arrange Posts By Date In Order Of Closest To The Current Date What works: The query does not return post's with a date that has passed. What does not: The query will not order by the meta key '_date', I always end up with the most/least recently created post rather than what I am trying to achieve. Any help is appreciated, thank you.


How to apply pre_get_posts to a custom query?

How can I apply `pre_get_posts` to a custom query? For example, if I have:               $custom_query = new WP_Query(...)     //code here      How can I apply the `pre_get_posts` for this `$custom_query`?


How to get_posts having post thumbnail?

I have following code:               $posts = get_posts(array(       "meta_key" => "special",       "meta_value" => "surprise",       // "has_post_thumbnail" => true, // how to do that?     ));      What should I do to select posts having post thumbnails?


WordPress uploads directory. Featured Images storage

WordPress stores all uploads in: _**/uploads/year/month/_** I want to store featured images of my custom post type like: _**/uploads/myCustomPostType/_** No date subdirectories etc. I want all the files to be EXACTLY in the same directory. Also I'd like to have these files resized before placed in the folder(I guess `set_post_thumbnail_size()` will be good enough). Is it possible? **[edit]** If you wonder why I'm asking for that - the answer is Piecemaker I (I don't like the latest version). I want it to display images from **Slider** custom post type automatically and unluckily Piecemaker takes two arguments - filename (different for every file) and file directory (the same in all cases, so images added in different months won't be displayed together).


How to re-run the main query based on meta data value?

When a user requests a custom post url like _*_ /books/best-book-eva, I want to (with a plugin) hook in before the page is displayed (and the main query run if possible) check that posts meta value (needs_updating) and if that value is true, I want to fetch the data about the book from a third party api, process it, save it to database and only then run the query so the updated book gets displayed, if needs scraping is false then it should continue as normal. Would be really grateful if anyone could point me to general direction of achieving this, primarely - what hooks to use and maybe if there's a function that could re-run the main query (not from cache) if it has already been run.


Can i use multiple 'the_content' filters?

I am currently using a 'the_content' filter to add some HTML to the bottom of my posts and pages. But, I want to add another 'the_content' filter to a handful of specific pages (using page IDs). Is it ok to use multiple 'the_content' filters? here is my current code:               add_filter( 'the_content', 'my_content_filter' );          function my_content_filter( $content ) {     if ( is_single() || is_page()) {       $content .= '[html goes here]';     }     return $content;     }


Why does has_nav_menu return false when get_registered_nav_menus shows the opposite?

I'm working on a new theme to replace an old one. The existing theme has custom menus and I can't figure out why in my new theme a call to `has_nav_menu` is always coming back false. In my `functions.php`, I register the menus:                   function register_menus() {                  register_nav_menus(                 array(                     'global-nav' => 'Global Navigation',                     'footer-nav' =>  'Footer Links',                     'sitemap' =>  'Site Map',                     'share-ideas' => 'Share Ideas'                 ));         }              add_action( 'init', 'register_menus' );      Then in a test page, I have the following:
         <?php         if ( has_nav_menu( 'global-nav' ) )         {             echo '
menu found
';              } else {             echo '
menu not found, menus registered are:
';             $menus = get_registered_nav_menus();                  foreach ( $menus as $location => $description ) {                      echo $location . ': ' . $description . '
';             }         }         ?>
      The weird thing: while `has_nav_menu` always returns false, the `get_registered_nav_menus` loop shows the locations exist. Also, in the admin->menus screen, the menus all show up fine. So clearly I'm missing something as `get_registered_nav_menus` says I have registered them properly **but** `has_nav_menu` fails. Unfortunately, I can't figure out what step I might have skipped.


404 Error On Custom Taxonomy Pages 2, 3, etc

I've been reading a bunch of posts about this with no luck so far. I can't seem to figure out what is the problem. I have the following: Custom Post Type: Sermons Custom Taxonomy: Series My urls right now look like this mysite.com/Sermons/ParentTerm/ChildTerm/Post When viewing the Parent Term of the series taxonomy the first page works fine. However when navigating to the next page using wordpress' pagination it throws a 404. So trying to view mysite.com/Sermons/ParentTerm/page/2/ does not work. I'm guessing I need to do a URL rewrite? I tried the following with no luck:               function sermon_rewrite_rules() {       add_rewrite_rule('sermons/%series%/([^/]+)/?$',       'index.php?post_type=sermons&%series%=$matches[1]', 'top');       add_rewrite_rule('sermons/%series%/([^/]+)/page/([0-9]+)?$',       'index.php?post_type=players&type=$matches[1]&paged=$matches[2]','top');     }     add_filter('init', 'sermon_rewrite_rules');      I've tried reading up on everything I can about this and it's all starting to blur together, any help would be greatly appreciated. Thanks. **EDIT** So after some tinkering around I have this working and allowing for paginaiton on taxonomy pages, but it's breaking my actual post now and displaying the terms there. I feel like I'm super close to the answer, any ideas?               function sermon_rewrite_rules() {      add_rewrite_rule(          '^sermons/([^/]*)/([^/]*)/(\d*)?',         'index.php?series=$matches[1]&p=$matches[2]&paged=$matches[3]',         'top'       );     }     add_filter('init', 'sermon_rewrite_rules');


Two different conditions with a single WP_Query

I need to get custom posts with next conditions:   1. Custom post with meta `'key1' => 'public'`   2. Custom post with meta `'key1' => 'private'` and `'author' => 'current_user_id'` Code:               $args = array(             'post_type' => $post_type,             'posts_per_page' => -1,             'meta_key' => 'key1',             'meta_value' => 'public'     );          $args2 = array(             'post_type' => $post_type,             'posts_per_page' => -1,             'meta_key' => 'key1',             'meta_value' => 'private',             'author' => get_current_user_id()     );          $get_posts = new WP_Query($args);     $custom_posts = $get_posts->get_posts();          $get_posts_2 = new WP_Query($args2);     $custom_posts2 = $get_posts_2->get_posts();      and then I merge them:               $merged_posts = array_merge($custom_posts2, $custom_posts2);      It works, but I have problem with pagination and total items count. And it is two query instead of one. How can I achieve this with a single query?


Why checkbox is not saved in user profile page?

I added new options in user profile page. I added checkbox but it is not saving if all multiple options are checked.               <input type="checkbox" name="neww" class="neww" value="one"<?php  checked(get_the_author_meta( 'neww', $user->ID ),'one' ); ?> />     option one
     <input type="checkbox" name="neww" class="neww" value="two"<?php  checked(get_the_author_meta( 'neww', $user->ID ),'two' ); ?> />     option two
     <input type="checkbox" name="neww" class="neww" value="three"<?php  checked(get_the_author_meta( 'neww', $user->ID ),'three' ); ?> />     option three
      When i var_dump to see what is saved it is saving only the last checked item. Why is this happening? While saving with register settings options i haven't experianced this. can anyone let me know the difference? Thanks


How to protect pages with double authentication: password + email (in custom field)

I would like to extend the WordPress password protection of posts by adding extra input field for user email. So in order to see the content user will have to know the password and previously given email that is stored in custom meta field of the protected post. I was trying to find a good hook checking that extra field but without any success. Could you give me some ideas how to make it? I don't want to create user accounts for this kind of feature.


How to display WordPress User Registration Form in front end of the website?

How to display the WordPress user registration form (the form that appears in "www.mywebsite.com/wp-register.php" page) in the front end of my blog? I have customised the registration form. But don't know how to call that form in the front end page. Any support will be really great help. Thanks in advance. :)


How to make the registration form as page

I am currently using 'Cimy User Extra Fields' plugin for adding extra fields on my registration form. But i want to move the whole registration form on a single page so i have all the website footer and header and etc. So I am making a new page template but don't know how to hook registration form to it. Any ideas?


How to display pagination links for WP_User_Query?

I think I'm nearly there with this, but I can't get the pagination links to show for a directory of authors I'm creating. My code is below, but I don't know how to get the links to navigate between pages of authors to work. Can anyone help me? I've got the feeling this might be of use, but I don't know how to implement it: paginate_links() Thanks Osu                   <?php      /* ****************************************************************** */                             /* !LIST AUTHORS */     /* ****************************************************************** */           // THANKS TO:     // http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/          // pagination     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // Needed for pagination     $paged -= 1;     $limit = 2;     $offset = $paged * $limit;          // prepare arguments     $args  = array(         // search only for Authors role         'role'      => 'Subscriber',         // order results by display_name         'orderby'   => 'display_name',         // return all fields         'fields'    => 'all_with_meta',         'number'    => $limit,         'offset'    => $offset           );     // Create the WP_User_Query object     $wp_user_query = new WP_User_Query($args);     // Get the results     $authors = $wp_user_query->get_results();     // Check for results     if (!empty($authors))     {         echo '
';         // loop trough each author         foreach ($authors as $author)         {             $author_info = get_userdata($author->ID); ?>                  <?php echo get_avatar( $author->ID, 50 ); /* http://codex.wordpress.org/Function_Reference/get_avatar */ ?>             First name : <?php echo $author_info->first_name; ?>
             Last name : <?php echo $author_info->last_name; ?>
             Email address : <a href="mailto:<?php echo $author_info->user_email; ?>"><?php echo $author_info->user_email; ?>
             Website : <a href="<?php echo $author_info->user_url; ?>"><?php echo $author_info->user_url; ?>
                  Bio :
<?php echo $author_info->description ; ?>

              <?php          }         echo '
';     } else {         echo 'No authors found';     }     ?>          <?php /* WHAT DO I PUT HERE TO CREATE THE PAGINATION LINKS? */ ?>


How to remove dates from existing permalinks?

After doing some research about dates on blogs, it seems like it is a good idea to remove them from the existing posts. Consider:   1. Self-hosted (on Bluehost)   2. Over 1,000 existing posts   3. All posts are indexed by Google and many are linked to from other domains. Many posts are linked to within the blog. Don't want to break links.   4. Don't want to lose Pagerank or age of the posts within Google. This is very important because most of the traffic is from Google, and many pages rank well.   5. The current URL is: `http://www.thedomain.com/blog/2012/07/01/blah-blah-blah-blah/`   6. New URL should be `http://www.thedomain.com/blah-blah-blah-blah/` I know that it can be done with ModRewrite, but is this the best way? Will Google know that it is the same post? Is it possible to change permalinks?


Which Versions of WordPress Ship with the Patched TimThumb?

Do you recall when the TimThumb exploit occurred? Which versions of WordPress bundled with this exploit? I need to inform a client that they should be upgrading to at least the version of WP when this exploit was patched. Yes, I'm aware of the separate issue where TimThumb is also used in plugins -- that's a separate issue. I'm talking about the TimThumb used inside WP in older versions.


Change the name of the root name of an already built Wordpress theme

If I have built a site using an existing theme (i.e. "Twenty-Ten"), but then modified it considerably and want to re-name it entirely, how would I go about doing this without breaking all the links? I know I can simply text-edit the style.css to change the name there, but I'm referring to the root all throughout the install:               <link rel='stylesheet' href='http://myWebsite.com/wp-content/themes/CURRENTTHEMENAME/styles/style.css" />      to ....               <link rel='stylesheet' href='http://myWebsite.com/wp-content/themes/NEWTHEMENAME/styles/style.css" />


get_query stops working after post filter

I'm currently trying to set up some filters for a custom post type within my admin. The custom post type is 'players' and I'm filtering them by another custom post type 'teams'. To create my dropdown list of teams I use get_posts to retrieve all my teams:               $args = array( 'numberposts' => -1, 'post_type'=> 'team', 'order' => 'ASC', 'orderby' => 'title' );     return get_posts( $args );      This works when I first arrive at the edit screen. Drop down list is rendered perfectly. I then perform the filter ( say by the Ladies 1st XI team ) and it works as expected, only players in the Ladies 1st XI are output. But my filter list isn't working any more, and I've narrowed this down to get_posts not retrieving anything from my database. I've done a few tests and no matter what I do get_posts stops working after I've performed the filter. For note this is the code I use to output my team filter and perform the filter when required:               add_filter( 'parse_query', 'esf_admin_posts_filter' );     add_action( 'restrict_manage_posts','esf_restrict_listings_by_team' );          function esf_restrict_listings_by_team( ){     global $typenow;     if ( $typenow=='player' ) {         $teams = esf_get_teams();              ?>         <select name="esf_team_select">             <option value=""><?php _e('Filter By Team', 'baapf'); ?></option>             <? foreach( $teams as $team): ?>             <option value="<?=$team->ID?>"><?=$team->post_title?></option>             <? endforeach; ?>         </select>         <?     }     }          function esf_admin_posts_filter( $query ){     global $pagenow;          if ( is_admin() && $pagenow=='edit.php' && isset( $_GET['esf_team_select']) && $_GET['esf_team_select'] != '') {             $query->query_vars['meta_key'] = 'esf_mm_teams';             $query->query_vars['meta_value'] = $_GET['esf_team_select'];     }          return $query;     }      Thanks in advance for any help you can offer! Helen


WP newbie: using else/if statements to show multiple headers. bonks

This code is fine but if I try to copy the last 3 lines and add a new custom page with a new custom header class, it doesn't work. I just want to add 2 new pages to my WP site with different headers from the front page and the rest of the site (which is set to use wrapper8 for the rest of the site pages which don't have specific headers). _see: www.friendsofnamibianchildren.org_ Instead, very annoying, it applies wrapper8 to any new pages I add, thus applying the wrong template.               <?php if(is_front_page()) {?>
     <?php } else { ?>
     <?php }?>     <?php if (is_page('About Us')) {?>
     <?php }?>     <?php if (is_page('Our Work')) {?>
     <?php }?>     <?php if (is_page('Get Involved')) {?>
     <?php }?>     <?php if (is_page('About Namibia')) {?>
     <?php }?>     <?php if (is_page('Donate')) {?>
     <?php }?>     <?php if (is_page('Photos')) {?>
     <?php }?>      If try to add these 3 lines below (basically a new Sitemap page with a 'wrapper9' header) then all the site templates get messed up.               <?php if (is_page('Sitemap')) {?>
     <?php }?>      thanks.


How to directly preview an image upload from a custom meta box?

I created a plugin which adds a custom post type with an extra meta-box. The extra meta-box has an image upload which triggers this .js               jQuery(document).ready(function($){              // Instantiates the variable that holds the media library frame.         var meta_image_frame;              // Runs when the image button is clicked.         $('#meta-image-button').click(function(e){                  // Prevents the default action from occuring.             e.preventDefault();                  // If the frame already exists, re-open it.             if ( meta_image_frame ) {                 //wp.media.editor.open();                  meta_image_frame.open();                 return;             }                  // Sets up the media library frame             meta_image_frame = wp.media.frames.meta_image_frame = wp.media({                 title: meta_image.title,                 button: { text:  meta_image.button },                 library: { type: 'image' }             });                  // Runs when an image is selected.             meta_image_frame.on('select', function(){                      // Grabs the attachment selection and creates a JSON representation of the model.                 var media_attachment = meta_image_frame.state().get('selection').first().toJSON();                      // Sends the attachment URL to our custom image input field.                 $('#meta-image').val(media_attachment.url);             });                  // Opens the media library frame.             //wp.media.editor.open();              meta_image_frame.open();         });     });      Now this works but i like to show the image immediately after upload. At the moment the new image is shown after the post have been saved. But i like the image upload to behave as the feature image. any tips, suggestions?


Buddypress Filter Multiple Activities

I'm trying to exclude activity updates (ones users actually post) from a custom "ticker" I'm running. With the below code, I am only displaying activities where friendships are created. How do I add another argument to allow for another activity action to display?               <?php if ( bp_has_activities('action=friendship_created&max=5') ) : ?>


What would be the advantages/disadvantages of remote plugin installation?

Most of us are used to installing plugins directly from the WordPress.org plugin repository. This is the "official" list of available add-ins, and everything hosted there is guaranteed to be GPL. But occasionally developers will list beta releases and non-GPL plugins on their own sites. To install these, you have to download a ZIP file, then either upload it to WordPress through the plugin installer or via FTP. For the unaware, it can be a complicated process because there's no one-click setup. So what would be the potential benefits and drawbacks of enabling one-click plugin installation from any site? I'm thinking something along this process:   1. You go to a site hosting a cool plugin.   2. You enter your blog's address (`http://mycoolwordpressblog.com`) in a box somewhere.   3. An oAuth-type box pops up asking you to log in to your blog.   4. Once you're authenticated, the plugin is added to your site automatically and you're given the option to activate it. I suggest oAuth so that you only log in to _your_ site (I don't want to give my admin credentials to someone I don't know), but there might be other ways to do it. Remotely uploading the plugin could likely happen using WordPress' built-in XML-RPC system since it already allows you to upload files. Ideas? Comments? Feedback?


Is there a list of all display functions for templates?

I am going to write my own post display thing, and I cannot find a list of all these type of functions:               the_date();     the_title();       the_excerpt();      I'm sure there are more, but where can I find a list?


Paginate the_content automatically?

> **Possible Duplicate:**   >  Automatically create pages in a post based on number of words Can Wordpress automatically paginate large amounts of content? A user wants to enter a document that is 3000 words long. They just want to paste this into `the_content` via the cms. Can Wordpress then automatically paginate that into separate pages that are say 300 words long? Or would it have to be done manually? Where they separate the content into 10 separate pages?


how to get all post with the same post meta?

some of my posts have the post meta of "project_id". How can I retrive all the posts which have the meta key of "project_id" ? I tried:               $meta_key = 'project_id';     return $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key));      It returns nothing. Please help! Thanks!


Need help understanding/coding with Settings API

So I did something like below, but I get just (I am expecting a Facebook textbox?) ![](http://i.stack.imgur.com/dWtKM.png) I hope its not too messy. I am new to Settings API ...               add_action('admin_init', function() {         register_setting('elem_opts', 'elem_opts', 'elem_validate_opts');       add_settings_section('elem_opts_form', 'Elements Theme Options', 'elem_opts_form_cb', 'elems_opts');       add_settings_field('elem_opts_form', 'Facebook', 'elem_opts_social_fb_cb', 'elems_opts', 'elem_opts_form');     });          function elem_opts_social_fb_cb() {       $opts = get_option('elem_opts');       if (empty($opts) || !is_array($opts)) {         $opts = array();       }       ?>       <input type="text" name="elem_opts[fb]" value="<?php echo $opts['fb'] ? $opts['fb'] : ''; ?>" />       <?php     }          add_action('admin_menu', function() {         add_theme_page('Elements Options', 'Elements Options', 'manage_options', 'elem_opts', 'elem_opts_cb');     });          function elem_validate_opts($input) {       return $input;     }          function elem_opts_form() {       ?>
Enable social network links, by entering your username for the respective social networks
       <?php     }          function elem_opts_cb() {         ?>

Elements Theme Options
                  <form action="options.php" method="post">                 <?php                  settings_fields('elem_opts');                  do_settings_sections('elem_opts');                 ?>                 <input type="submit" name="Submit" value="Save changes" />             </form>
         <?php     }


Url rewrite with htaccess

I've just updated a website that used `.php` urls, to a Wordpress 3.1 site, that uses no file type extentions, (custom permalinks). They have a lot of references in their imported content to an old page ending in `.php` which now goes to an error 404 page. My question is this: What is the rewrite rule I should use in my htaccess file that would redirect someone clicking on a link to `www.somesite.com/glossary.php#anchor`, to `www.somesite.com/glossary/#anchor`? Any help gratefully appreciated, S.


Dynamically Creating Meta Boxes

So I was wondering if it's possible to dynamically create meta boxes in the post admin. I have a lot of data but don't want to hardcode every meta box needed in functions.php. An example would be a custom post type for movies, I want to create different meta boxes for all the actors in the movie. Is it possible to add meta boxes dynamically with the ability to add and delete them within the post admin? Thanks!


How do I find non-SSL problems on my SSL page?

I have a couple of pages on my WordPress site that need to run over SSL. I've installed the WordPress HTTPS plugin and configured the pages to use SSL. However, I'm still getting the error message that some of the items are coming over unsecured and that is a concern for some users. I've looked into the generated source code and I can see some items that are still going over non SSL channels, such as the following tags at the top of the page when I view source:               <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">      <head profile="http://gmpg.org/xfn/11">      The browser only gives me the generic error message about mixed content. How do I determine which resources are causing the error?


Why don't posts show up in my categories on the frontend?

The posts in a category don't show up in their category pages, like this one: http://www.kaerumusic.com/portfolio-category/japanese/ . On this page, ( http://www.kaerumusic.com/artists/ ) you're supposed to be able to sort the portfolios (artists) by category, but when one is clicked, they all disappear. Is there anything that can help get me to the right direction in solving this?


previous / next post with thumbnail

I've got another question regarding next / previous post. At the moment I'm working on our portfolio with several items. Each item is a post with a title, category & featured image. When viewing an item there are 4 next/previous posts. How do I display the next 2 and previous 2? And If the next or previous don't exist how do I show only 4 previous or 4 next posts (at the first and last post)? Currently I'm using twitter bootstrap CSS/HTML:

THUMBNAIL

TITLE

<?php                                     foreach((get_the_category()) as $childcat) {                                     if (cat_is_ancestor_of(3, $childcat)) {                                     echo 'cat_ID).'">';                                      echo $childcat->cat_name . ' ';                                     }}                                     ?>

THUMBNAIL

TITLE

CATEGORY

THUMBNAIL

TITLE

CATEGORY

THUMBNAIL

TITLE

CATEGORY


what are the chmod rights recommended to give for every folders of wordpress projects

When deploying a wordpress project on a server , what are the rights to set for each folders and files of wordpress for it to be safe and fonctionnal?


How to dropdown custom taxonomy?

To make a dropdown list from categories I can use **wp_dropdown_categories** function. http://codex.wordpress.org/Function_Reference/wp_dropdown_categories But how can I do the same thing but for my custom taxnomy called e.g. post_city ? So, far I tried:               <?php          $args = array(             'taxonomy' => array(                'post_city',              )          );         ?>     <?php wp_dropdown_categories($args); ?>      but only the first tag is shown in the dropdown ;(


Domain mapping the top-level site in wordpress multi

I'm using donncha's WordPress MU Domain Mapping. But I noticed that it doesn't allow to domain map the top level site. Blog id 1, all other blog id's works fine to map. Is there a work around without moving the top blog to a subdomain blog? Needs to be a permanent redirect (301). I'm using cpanel as hosting management. Big thanks! Dennis, Norway


I am trying to call external database recieving error

My case is different from the case defined here .. I am calling an external databse in my functional.php file by this method               function newdata()         {         $newdb = new wpdb("onlinedu_newuser","oeb_new%12", "onlinedu_schooldata", "localhost");         $newdb->show_errors();         }      Now the problem is In this database there are college and universities name, which I want to use in a form to calculate the competition, the calculator is made in java and jquerry. When I load this function               newdata();      At the top of my calculator.php which have a scrtip of calculation and college name fields. Every thing seems fine the college name appears but when I click calculate it is returning an error               Class 'Wpdb' Not Found In /Home/Onlinedu/Public_html/Wp-Content/Themes/Edu_2013/Db.Php On Line 9      Please Guide me How I can call this database in jquery ? No I am using it in function.php file the data base is in the same server.. shall I also provide jquerry as it has nothing to do with jquerry I just need a method How can I connect and use the tables in my jquerry ? as in wamp I use connectmysql command at the beggining of jquerry seems fine but not working on live server.


How to make checkboxes from taxonomy terms?

I can populate selectbox options like this:                   <?php              $args = array(                 'taxonomy' => array(                     'country',                 ),                 'hide_empty' => 0,                 'name' => 'country'             );         ?>         <?php wp_dropdown_categories($args); ?>      But the problem is how to make a checkbox list instead of a dropdown? I mean something like this: ![enter image description here](http://i.stack.imgur.com/iWPFT.gif)


Post type cloud like tag cloud?

Anyone know if it's possible to create something similar to the wordpress built in tag cloud (wp_tag_cloud) but instead of displaying tags, display custom post types? Thanks


Wordpress plugin not eching popular posts

I created a plugin in wordpress to show popular posts, but this is not returning the post and number of comments properly. Even I have comments in my post(approved as well, so this is not the case) its displaying -               "No commented post this time!!";      Although If i put `echo` at this line around Line 78 - `$popular .= '</li>';` it shows popular post, although I think there is something wrong still(either with logic or in code). Debug option is set `true` define('WP_DEBUG', true); My code -->               <?php     /*     Plugin Name: Sw Popular Post Widget     Plugin URI: http://demo.test.com     Author: Swapnesh Kumar Sinha     Description: Go your Widget Section to check the widget. It is a general purpose plugin that creates a widget to limit the popular post display from 1 to 10 at front end of your site. Please leave your honest comments,suggestions, bugs etc regarding the plugin at my email id - "swapnesh20032003@gmail.com". The plugin is in working condition, tested at - WordPress 3.5.     ########     INSTALL it via plugin section in your Wordpress Admin panel and then find it under APPEARANCE -> WIDGETS section.     ########      Version: 1.0     Author URI: http://swapneshsinha.wordpress.com     */          class SwPopularPostWidget extends WP_Widget {          public function __construct() {         //Widget actual processes         $widget_options = array( 'Description' => 'Show Popular Posts' );         parent::__construct( 'SwPopularPostWidget', 'Sw Popular Post Widget', $widget_options);      }          public function form( $instance ) {         //outputs the options form on admin     $instance = wp_parse_args( (array) $instance, array( 'popularpostcount' => '','popularpostheading' => '' ) );     $popularpostcount = $instance['popularpostcount'];     $popularpostheading = $instance['popularpostheading'];     echo "Heading Title";        echo "<input type='text' name='".$this->get_field_name('popularpostheading')."' id='".$this->get_field_name('popularpostheading')."' value='".$popularpostheading."' />";     echo "Number of post to show ";      //echo "<select name='popularpostcount' id='popularpostcount'>";     echo "<select name='".$this->get_field_name('popularpostcount')."' id='".$this->get_field_name('popularpostcount')."'>";         for( $i =1; $i<=10; $i++ )         {             if ( $i == $popularpostcount )             echo "<option value='".$i."' selected>".$i."</option>";             else             echo "<option value='".$i."'>".$i."</option>";         }      echo "</select>";     }          public function update( $new_instance, $old_instance ) {         //processes widget options to be saved         $instance = $old_instance;         $instance['popularpostcount'] = $new_instance['popularpostcount'];         $instance['popularpostheading'] = $new_instance['popularpostheading'];         return $instance;     }          public function widget( $args ,  $instance ) {         //outputs the content of widget         extract($args);         $popularpostcount = apply_filters('widget_title', $instance['popularpostcount']);         $popularpostheading = apply_filters('widget_title', $instance['popularpostheading']);         echo '';         echo  '
'.$popularpostheading.'
';         echo  "
";         echo $this->popularPosts($popularpostcount);         echo  "
";     }               public function popularPosts($num)     {          global $wpdb;              $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $num");         //echo "
";print_r($posts);die;         foreach ($posts as $post) {             setup_postdata($post);             $id = $post->ID;             $title = $post->post_title;             $count = $post->comment_count;                  if ($count != 0) {                 $popular  = '
';                 $popular .= '' . $title.' '." - ".$count." Comments";                 $popular .= '
';             }             else             $popular = "No commented post this time!!";         }         return $popular;     }               }          add_action( 'widgets_init' , create_function('', 'register_widget( "swpopularpostwidget" );' ) );


Search.php - return number of results but cannot loop through

I have a following search.php page (this is just the code required for problem presentation). Why is my `$total_results` returning a number of posts found, but when I do a loop though it always print `No posts found` ?               <?php          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $query_args = explode("&", $query_string);     $search_query = array('posts_per_page' => 10, 'paged' => $paged);          foreach($query_args as $key => $string) {          $query_split = explode("=", $string);          $search_query[$query_split[0]] = urldecode($query_split[1]);     }      $search = new WP_Query($search_query);     $total_results = $search->found_posts; // this returns 50          ?>               <?php if ($search->have_posts()) : ?>     <?php while ($search->have_posts()) : $search->the_post(); ?>         loop  through posts     <?php else : ?>          No posts found.     <?php endif; ?>      Any suggestion much appreciated.


Exporting just posts of a specific category

I have found the export tool particularly useful for moving posts from sites to site, and even once wrote an extension for Elgg to export its content into wordpress export format for migration to BuddyPress. However, I now find I'd like to export just the posts of a single category, so that I can put those posts on a different wordpress install whilst leaving the other posts on the original site. Given the number of posts on the site, I'd rather not have to export everything and manually edit the xml file. Is there a way I can export posts of just one category into a standard wordpress import/export xml file? The site being imported to is on the same multisite install, with shared user base, so post and comment attribution should be preserved.


Authors List page - How to include only those with wp_user_level as Author

At my Authors template page, I want to show a complete list of Authors only (i.e. wp_user_level=2) the code I used is like this:               $current = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;          $rows = $wpdb->get_results("SELECT ID, display_name from $wpdb->users      WHERE ID NOT IN (1,2)     ORDER BY display_name");     $author_ids = $wpdb->get_results($query);     global $wp_rewrite;          for ($i=$start;$i < $end ;++$i ) {        $row = $rows[$i];      $curauth = get_userdata($row->ID);      $user_link = get_author_posts_url($curauth->ID);      $post_count = get_usernumposts($curauth->ID);     ?>      But the problem is, this list is showing the "subscibers (wp_user_level=0)" as well. How can I exclude the users with **wp_user_level=0**


how do I write this wp_query select statement?

I would like some help in creating a SQL statement that will query my WordPress database and return results based on search terms a user enters. Basically it would be like this. User term 1 (general string) User term 2 (zip code) Return results if general string and/or zip code is found in either the title, description of the post, or the category of the post. The hard part (for me) is getting the category part. My guess is that it would be a simple SELECT statement with an INNER JOIN, but I my SQL skills are very limited. Any help would be greatly appreciated. Edit post Delete post Reply with quote


Custom post types archive redirect

I had a custom post type with slug as ( **sometext** ) which I changed to ( **someothertext** ) And it works great So for example : my posts with urls like               http://localhost/sometext/innerposts      gets redirected to               http://localhost/someothertext/innerposts       but not my archive page basically I would like to redirect               http://localhost/sometext/ to     http://localhost/someothertext/       in my .htaccess file I tried adding a string to make it work               RewriteRule ^/sometext$ ^/someothertext/$ [R=301,L]      but it fails. I'm very poor with .htaccess rewrites. I'll really appreciate if someone helps me out with this. Thanks.


Can you use the buddypress profile system without installing the whole of buddypress?

I am a novice with wordpress but doing my best to learn. Is it possible to use the buddypress profile system without installing the whole of buddypress? I appreciate any feedback even if it is just a yes, just so I know my options. Thank you!


How to get featured post title & image using JSON API?

Is there any possibility to get featured post title and image using the JSON API. I tried using this:               example.com/?json=the_post_thumbnails&count=3      But instead of recent posts, I get featured posts.


Multiple User-Meta Values in One User-Meta Key

Currently, I am adding user metadata with the key `position_name` and a string value representing a user's position, such that I can retrieve a user's position by way of a call similar to:               $position = get_user_meta(22, 'position_name', true);      This works perfectly for one position per user, but I'd like to be able to associate each user with several positions. Would adding a serialized array within the `position_name` field be an appropriate way of achieving this? I hope that makes sense..


php function to display commenter username or login

I want to display the commenters username or login name in a comment template. I know there is a function `comment_author_link()`, but this displays the "display name publicly as" name and not necessarily the username. Usernames have to be unique so I would prefer to display the username. I have tried some other functions and have been looking all over for this. The closest I got was the following function:               <?php     if ($comment->user_id) {         $user=get_userdata($comment->user_id);         echo $user->user_login;     }     else {         comment_author_link();     }     ?>      But for some reason this only displayed the name for the first commenter and then it does not display a name. How do I display the commenters username or login name? Thank you.


is_mobile as shortcode

I installed the Plugin "mobble" which provides some more conditional tags. As I want to hide some content for mobile devices I tried to build a shortcode [is_mobile]. But I tried many different ways with `return do_shortcode($content);` and `return $content;`or `return apply_filters('the_content', $content);`but it's simply not doing what I want.. ;(               add_shortcode( 'is_mobile', 'is_mobile_shortcode' );          function is_mobile_shortcode( $atts, $content = null) {          if ( !is_mobile( ) );             return $content;         return '';     }      I would be very happy about some help! Cheers!


How to get posts using category slug in ClassiPress?

I'm using the ClassiPress theme as a base for a new theme. If you have worked with classipress, you should know that classipress handles its own category using the taxonomy `ad_cat`.   That said, I have a category named `7star` and the following query to get the posts inside that category:               $the_query = new WP_Query( array('post_type'=>'ad_listing','category_name'=> '7star') );      Unfortunately this query does not work. It only fetches the posts withing categories that are of type `category` not `ad_cat`.   Anybody got any idea how to solve this?   I'm trying to avoid using manual sql query.


Bulk term assignment for attachment taxonomies

I've created a custom taxonomy for attachments. Everything ok, but now I want the ability to bulk assign its terms to attachments using the default wordpress media admin ('upload.php') bulk actions. Here in wpse I've found a couple of questions/answers regarding bulk actions for admin media table. Like this one and this other. These give me a direction on how to add the bulk action on the select menu (there is no filter for it, so I've to use javascript) but my case is different: In linked questions/answers when a bulk action is selected the page form is immediately submitted, instead I want that when I select my bulk action (e.g. "Assign Terms") and I press the "Apply" button instead of submit the form, I want to show an UI very similar to the one shown when on standard posts the bulk 'Edit' action is chose (see image below). ![enter image description here](http://i.stack.imgur.com/PL0bg.jpg) Here I want to select terms and finally, by clicking 'Update Button', bulk assign terms to attachments. How can I achieve this?


include any plugin within other plugin or use other plugin within other

I want to do something like: want to display one plugin's page on other plugin's page. I have read Including file or library from other plugin but its not working for me or either am doing something wrong let say I want to use plugin-1 into plugin-2 here whats the meaning of               do_action( 'my_library_loaded', plugin_dir_path( __FILE__ ) );      plugin_dir_path( **FILE** ) path of which plugin (plugin-1 or plugin-2 ?) and where I have to put this? (in plugin-1 or plugin-2 ?) same question for `add_action( 'my_library_loaded', 'other_plugin_init_handler' );` any suggestion please


How to add style to a string of text throughout WordPress website?

I am building a site for a friend, the site has launched, now he tells me he wants his site name to appear green everywhere it appears on the website. Immediately, I thought of the plugin SEO Smart Links, which automatically links a string of text. Is there anything like this for applying styles or classes to a string of text? OR a suggestion for another method to complete this task?


Genesis Child and Custom Post Type

I'm working on Custom Post Type and Genesis Child Theme. My code is               add_action( 'init', 'register_cpt_testimonial' );          function register_cpt_testimonial() {              $labels = array(              'name' => _x( 'Testimonials', 'testimonial' ),             'singular_name' => _x( 'Testimonial', 'testimonial' ),             'add_new' => _x( 'Add New', 'testimonial' ),             'add_new_item' => _x( 'Add New Testimonial', 'testimonial' ),             'edit_item' => _x( 'Edit Testimonial', 'testimonial' ),             'new_item' => _x( 'New Testimonial', 'testimonial' ),             'view_item' => _x( 'View Testimonial', 'testimonial' ),             'search_items' => _x( 'Search Testimonials', 'testimonial' ),             'not_found' => _x( 'No testimonials found', 'testimonial' ),             'not_found_in_trash' => _x( 'No testimonials found in Trash', 'testimonial' ),             'parent_item_colon' => _x( 'Parent Testimonial:', 'testimonial' ),             'menu_name' => _x( 'Testimonials', 'testimonial' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => true,                  'supports' => array( 'title', 'thumbnail' ),                  'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 10,                  'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'testimonial', $args );     }      If I pasted the codes into function.php of Genesis Framework, worked for me. But when I used the codes into function.php of a Genesis Child, nothing was happened. Please help me to find out the mistake I made.


Style custom columns in admin panels (especially to adjust column cell widths)

I am using Wordpress as a CMS for a project which makes extensive use of custom post types. I need to display columns in admin panels for each custom post type in a different way. I've already created the necessary columns and populated them. What I need to do is to adjust the CSS a bit. Most importantly I'm trying to tweak the width of certain columns. For example I don't need a column listing the post ID to be as wide as the post name. I enqueued a stylesheet in the admin panels for my custom post types but I can't get it right to style the column widths. I tried to adjust the max-width of th or td elements, but it's ineffective. From firebug I can see the css style is there, but it's doing nothing. While I could find a lot of tutorials to add/edit custom columns, I didn't really gather much information about how to style such columns. Any hint? Thank you!


What makes WP so SEO friendly?

I keep hearing that Wordpress is the best SEO solution, better than most static websites because of multiple reasons. I then go on to hear contradicting information elsewhere. So: Is Wordpress generally more SEO friendly/ready then most static html websites? What makes it more SEO friendly? Can I take any SEO tips from a Wordpress installation to improve a static HTML page SEO?


Orderby = none not working

I'm trying to set 'orderby = none' to my loop but it is not working. Here's my code:               $query = new WP_Query(array('showposts'=>2, 'post__in' => array(99,4,5,2,8,55), 'orderby'=>'none'));      Could anyone help me? Thanks.


how to retrieve WP_Query without ordering by date

> **Possible Duplicate:**   >  Orderby = none not working I want to use `$query = new WP_Query( 'post__in' => array( 2, 5, 12, 14, 20 ) ) );` to retrieve posts by ID, I do and the result ordered by publish date but I want to retrieve in same of IDs in this example in this order: 2, 5, 12, 14, 20


where to split off footer.php

Is there any particular reason why index.php in most templates usually seems to go all the way from just after the start of #main to right before it's closing tag, with that closing tag contained in footer.php. In my theme it would be handy to have #main's closing tag in the index/single/page files not in footer.php ( so the split would be another couple of lines down the code from where i normally see it ). And if there's no real difference then should i also move the header/index split up a line to get the #main div start tag into the index/single/page etc files ?


Order by custom date field

This one has been bugging me for a while. I've used Verve Meta Boxes plugin to add a date field to a custom post type I created, and I would like to somehow order by this field when using `query_posts` in PHP. What's the best way to do this? I haven't been able to figure out a way that didn't involve complicated custom queries.


Hide custom post type field from author?

For a business association website, I've built a membership database using a custom post type. Businesses sign up with an online form, which creates a custom post for that business, and when the administrator receives the new member's dues, she creates a WordPress user for that business and makes that user the author of the post. This is so that the business can update the business's information when necessary. The problem is that this scheme allows the business to also update some fields that they really shouldn't be able to update, such as the expiration date. So, what I want to do is to either hide those fields or make them uneditable when the author edits the posts, but editable when a WP admin edits the post. Does anyone know a way to do this?


Change role's settings influence post-thumbnail

In my theme functions.php i get code:                   add_action( 'admin_init', 'my_remove_menu_pages' );     function my_remove_menu_pages() {     if(!current_user_can('delete_others_posts')) {     remove_menu_page('edit.php?post_type=page');     remove_menu_page('edit-comments.php');     remove_menu_page('edit.php?post_type=slide');     }     }      but then in role Author user can't edit images for thumbnail - he gives info:                   Invalid argument supplied for foreach() in /wp-admin/includes/plugin.php on line 1286      Could anyone tell me what's wrong?


Wordpress comment hook before it is saved

When I try to submit comments it shows a simple error on a different page "Please Enter a comment" or something like this and this line is the result of wp-comments-post. What I am looking for is a hook to call before comment is send so I can check if user entered any text and show error message.


Using $wpdb to update current post

I have a function that expires posts on a date, and adds a check to the database. Now, I'd like the ability to "recycle" those posts with new expiration date, but in order to do this, I need to erase the _expiration_date_processed entry. Is the function below the best way to achieve this, especially in the case where there is a status change for multiple posts using quick edit? Thank you for any insights.               add_action('draft_to_published','gcpl_draft_to_published');      function gcpl_draft_to_published($post){       global $post;       global $wpdb;          $current_id = $post->ID;          $processsql = 'select meta_value from '.$wpdb->postmeta.' where meta_key = "_expiration-date-processed" AND post_id = '.$current_id.'';          $processresult = $wpdb->get_col($processsql);           if (!empty($processresult)) foreach ($current_id as $a) {            delete_post_meta($a->post_id, '_expiration-date-processed');          }      }


URL Variables in a Certain Page

I have a product loop in a certain page,   and I want to filter its categories via URL such as:               mysite.com/products // Shows all products     mysite.com/products/sculptures // Shows only sculptures     mysite.com/products/sculptures/2 // Shows only sculptures paged 2     mysite.com/products/paintings // Shows only paintings      So I am trying to map like this:               mysite.com/products/{category}/{paged} // Shows only sculptures      But this hasn't worked so far. By the way, my code also works as shortcode.


meta post search

I need to query post meta fields, filtered by a multi checkbox ![\(image\)](https://dl.dropbox.com/u/1129958/Screen%20Shot%202555-11-04%20at%2020.06.46.png) Currently, the query works only with second parameter (People) when the form is submitted. How can I filter with two parameters? HTML (Form submit)               <input type="checkbox" id="inlineCheckbox1"  name="category[]" value="Planet">     <input type="checkbox" id="inlineCheckbox2" name="category[]" value="People">      PHP (Search)                               $category = $_GET['category'];                          $category_planet = $category[0];                     $category_people = $category[1];                          $argsearch      = array();                                         $argsearch["post_type"] = "projects";                     $argsearch['showposts'] = -1;                          if( $advtext!="" ){                         $advtxtQuery ="select ID from $wpdb->posts                         LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id where {$wpdb->posts}.post_status = 'publish'  ";                         $where =" (( post_typs LIKE 'projects') AND ( post_title LIKE '%".$advtext."%')) ";                         $where .=" AND ( $wpdb->postmeta.meta_key = '_cmb_project_category' AND $wpdb->postmeta.meta_value LIKE '%".$advtext."%')";                         $mypostids = $wpdb->get_col($advtxtQuery." AND ( ".$where." )" );                                   if(count($mypostids)>0){                             $argsearch['post__in']=$mypostids;                         }else{                             $argsearch["s"] = $advtext;                         }                          }                          if( $category_planet!="" ){                         if(!isset($argsearch["meta_query"])){                             $argsearch["meta_query"] = array();                         }                         $argsearch["meta_query"][] = array(                                 'key' => '_cmb_project_category',                                 'value' => $category_planet,                                 'compare' => 'LIKE'                         );                          }                               if( $category_people!="" ){                          if(!isset($argsearch["meta_query"])){                               $argsearch["meta_query"] = array();                          }                          $argsearch["meta_query"][] = array(                                    'key' => '_cmb_project_category',                                    'value' => $category_people,                                    'compare' => 'LIKE'                          );                          }                          global $wp_query, $post,$wpdb;                     $query =  new WP_Query($argsearch);                     while($query->have_posts()):                         $query->next_post();                     $project_list = $query->post->ID;     ?>


Adding a custom field or metabox to the post-thumbnail widget?

Is it possible to add a custom field to an existing "widget" in the backend? What I wanna do is provide a way to have a checkbox to apply a thumbnail that is double the size of the normal one on the frontend. So I'm thinking of simply adding a custom field as a checkbox that says "Double the size" and when checked I return a different output on the frontend. That is not the problem, I know how to do so. However I wonder if it possible to locate this checkbox in the post-thumbnail widget in the backend? ![enter image description here](http://i.stack.imgur.com/uRMjr.jpg) Normally when adding a custom field it appears underneath the excerpt or content area. Is it possible to locate this checkbox inside the post-thumbnail widget? Thank you in advance


Getting RID of thickbox!

I want to get rid of the complete thickbox css js and loading gif. Can anybody give me the correct way to get rid of it all via functions.php ? Cheers, Alex


How to get all post except particular category without breaking the paging

I'm trying to get all post except particular category this works fine but it cause the pagination button/link to render the same posts again on page 2, 3, 4 and so on not rendering the older post. Here is how I am trying to exclude a particular category               <?php query_posts('cat=-22');?>      This excludes the category but prevents pagination buttons/link from showing older posts, instead it shows the same first 5 posts as on page 1. I tried moving the category exclusion bit into the `<?php if ( have_posts('cat=-22') ) : ?>` line but this doesn't change anything. I'm trying to do this on the `index.php` and `archive.php` I've also tried excluding the category by its name and I get the same results.


How to use custom page templates in a theme that hides page template option?

My client uses a theme called "Imbalance2", which hides the template option in dashboard "page attributes" section. Is there a way to assign a custom template to a page despite this - rather irritating - limitation imposed by the theme?


How does one delete orphan custom post type?

I created some posts using a custom post type, then I decided to delete this custom post type but of course the old posts remained orphan inside the database. How can I remove these orphan posts and all related attachment (post meta, etc.) safely from DB?


media_sideload_image file name?

I'm using media_sideload_image to download images from the web and store them. However, the problem is that the ones from youtube are always called "hqdefault.jpg", which means that it will override the existing image. There are three ways of fixing this:   * How can I change the attachment structure so that it includes the postname? (Current: http://example.com/wp-content/uploads/2011/10/hqdefault-40x40.jpg)   * How can I set the filename of the attachment to the postname, thus preventing overrides.   * How can I set a new filename of an existing attachment thumbnail? Many thanks, Dennis


Buddypress - New user type with no profile and can't interact but can be admin of a group

I need an easy way to create a set of users who cannot interact with the other users, all they can do is administrate a group (they can upload documents to the group-documents plugin and maybe change the name and description and avatar). Apart from that they're not allowed to have a profile, they're not allowed to interact with other users, post to groups or anything. All they can do is log in and administrate their group. Any ideas? I'd greatly prefer to create this in plugin format, and don't really want to edit any core files. Thanks for any help. Tom


WordPress Custom Page Template in a different directory

Is it possible to have a custom page template in a different folder? I'm setting up a little framework for WordPress that I can use over and over for themes and just for the sake of being tidy I want to put custom page templates inside a different folder rather than the root of the theme directory. How would one go about this?


Uncaught SyntaxError: Unexpected Token Illegal

I have a local install of Wordpress running & I am suddenly getting these errors in my console when I open a modal window (such as file upload):               Uncaught SyntaxError: Unexpected token ILLEGAL     media-upload.php:75Uncaught ReferenceError: jQuery is not defined     media-upload.php:89Uncaught ReferenceError: SWFUpload is not defined     media-upload.php:156Uncaught ReferenceError: jQuery is not defined     load-scripts.php:1Uncaught SyntaxError: Unexpected token ILLEGAL      Non-wordpress site's work fine and I've never had any issues like this before, it seems to be limited to Wordpress. What I don't understand is that the modal window is being called and loading AJAX content, additionally all the transitions work in the rest of the Wordpress admin area. Does anyone have any suggestions? Thanks


Can I use numberposts=-1 and offset together when using get_posts()?

I'm currently using get_posts() for a little part of a theme I'm working on. However, I've run into one little hiccup. **If I want to show all posts for a category, I set the 'numberposts' argument to '-1'. However the issue is that when I do this, the offset no longer works.** I do see that I'm telling the function to return all posts, but then I'm expecting it to not actually return all posts. So, I do see the dilemma in the logic. So using get_posts, is there a way to show all posts except for posts offset at the beginning? I realize there are a few hacky ways you could this, but I'm just wondering if I'm doing something incorrectly here that is obvious? I'd like to work within the constraints of the get_posts function if possible. I did start to rig up something sort of hacky. This works, but wondering if there was another way to go about this.               // Get posts     $posts = get_posts( $args );          // Adjust offset if neccesary     if( $args['numberposts'] == -1 && $args['offset'] > 0 ) {         $i = 0;         while ( $i < $args['offset'] ) {             unset( $posts[$i] );             $i++;         }     }          // ... now do my foreach() and setup_postdata      ![Visual representation](http://i.stack.imgur.com/cpy8b.png)


How to conditionally add a widget via a hook in functions.php

I'm trying to add some widget areas to the homepage only using functions.php - so that the client won't be able to accidentally destroy shortcode when editing the page. I've registered the widget area and can see it in admin, but nothing shows up on the frontend, except my test text which is outside of the widget area. This is what I have so far:               <?php          add_action( 'widgets_init', 'register_widget_area' );     function register_widget_area() {         // Add fox_home_news_widget to admin         if( function_exists( 'register_sidebar' ) ) {             register_sidebar( array(                 'name' => 'Fox News',                 'id' => 'fox_home_news_widget',         'description' => "Latest news widget area for homepage",                 'before_widget' => '',                 'after_widget' => '

',                 'before_title' => '
',                 'after_title' => '
',             ));         }     }          // add widget areas to homepage      add_action( 'woo_post_after', 'fox_home_news_widget' );     function fox_home_news_widget () {      if( is_page( 15 ) ): ?>
                      <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('fox_home_news_widget') ) ; ?>
this is a test

              <?php endif;     }          ?>      Any help would be much appreciated, thanks :)


How can i display a 4 diferent themplate for the archive page

How can i display 4 diferent themes for an archive page When i click on the right in corner i want to display another theme, another Css style (my own) Something like this.               http://tvpedia.org/lista-seriale/seriale-noi-2012      Thanks


Invalidate username if it contains @ symbol

I would like to let the user login either using username or email. The only way to find the email is by detecting `@ symbol` using `strpos`. However WordPress allow `@ symbol` in username too. Can someone help me to invalidate username if it contains @ symbol in it..


Ordering custom posts

I have a page on my site that has customer testimonials. Each testimonial is a custom post. I want to order the testimonials arbitrarily. What's the best way to do this?


How to remove the tag cloud from custom taxonomy admin page?

When I register the taxonomy I have this which I thought might hide it:               'show_tagcloud' => false      The default category page does not show a tag cloud so why does my custom taxonomy page, how do I disable it? ![enter image description here](http://i.stack.imgur.com/X1TQU.png)               register_taxonomy('gmc_region', 'recipe',      array(       'labels' => array(          'name' => _x( 'Regions', 'taxonomy general name' ),          'singular_name' => _x( 'Region', 'taxonomy singular name' ),         'popular_items' => __( 'Popular Regions' ),         'search_items' => __( 'Search Regions' ),          'all_items' => __( 'All Regions' ),          'parent_item' => __( 'Parent Region' ),          'parent_item_colon' => __( 'Parent Region:' ),          'edit_item' => __( 'Edit Region' ),          'update_item' => __( 'Update Region' ),          'add_new_item' => __( 'Add New Region' ),          'new_item_name' => __( 'New Region Name' ),          'menu_name' => __( 'Regions' ),        ),       'rewrite' => array(          'slug' => 'regions',         'with_front' => false       ),        'show_in_nav_menus' => false,       'show_ui' => false,       'show_tagcloud' => false     )     );      Thanks, Kevin


Advanced Multi Tier Navigation across columns

I've been struggling with this for a while now and need some help. I'm trying to create a quite specific navigation setup for a client. I have a top level navigation which is hard coded and not a problem. The second level of navigation should populate the left sidebar of the site, it should also show a third level of nestled/folding navigation within it. The fourth level of navigation is then shown separately in a column next to the left sidebar. The illustration below or this image example should help explain:               ------------------------------------------------------------------------     | topNav | topNav | topNav | topNav | topNav | topNav | topNav | topNav |     ------------------------------------------------------------------------     | childNav01  v | greatgrandchild > | Content Goes Here                 |     |---------------|-------------------|                                   |     | grandchild    | greatgrandchild   |                                   |     |---------------|-------------------|                                   |     | grandchild    | greatgrandchild   |                                   |     |---------------|-------------------|                                   |     | grandchild  > | greatgrandchild   |                                   |      |---------------|-------------------|                                   |     |               |                   |                                   |     | childNav02    |                   |                                   |     |---------------|                   |                                   |     | childNav03    |                   |                                   |     |---------------|                   |                                   |     | childNav04    |                   |                                   |     |---------------|                   |                                   |     |_______________|___________________|___________________________________|                  The issues I'm having is no solution I've come across can do all of these things. In an ideal world I'd love to have one dynamic template rather than having lots but any help would be great.


How do I set user account inactive?

One solution is to remove all roles. But the user will still be able to log in. Should we at the same time delete password? **Scenario:** * * * > Users "delete" their account and account is set to innactive in our system. > 2 months later, the user want's to sign up again. > > Since e-mail is already registered, he gets a message that the email exists. > > What do we do now? > > Well, if user request a new passord, he will get one. But he still doesn't > have any user roles. Doe anyone have any suggestions on how this may be solved?


query usermeta from custom field

I am using a plugin to create custom fields in the user registration. I have created a check box field called g300 which is the name of the meta_key stored in wp_usermeta. It looks like the value in the database is a comma when the checked it off. How could I return a list of users that checked off this box?


Custom search page and search by title, content and tag

Can someone review my code , I need to know better solutions or any bug. Okey ! , I made a PHP file to get search results by parameters and search by title , content and tag **PHP's head look like:**               include('../../../../wp-config.php');     header('Content-type:text/html;charset=utf-8');     $keyword = $_GET['k'];      That I will bring search results by jQuery after. My main search function to show result from database:               function search($keyword,$mark){         while($data=mysql_fetch_array($keyword)){             if($data['post_status']=='publish'){                 echo '
#'.$data['ID'].' '.htmlentities($data['post_title']).' ('.$mark.')
';             }         }     }       **Search by title function :** Full keyword (ex : "jack daniels")               $sql_full_keyword       = "SELECT * from wp_posts WHERE post_title LIKE '$keyword%'";     $search_full_keyword    = mysql_query($sql_full_keyword) or die(mysql_error());     search($search_full_keyword,"Full keyword(s) = '$keyword'");      So i split keyword for next steps like :               $keywords_split         = explode(" ",$keyword);      **Search by title function :** multi keywords (ex : jack + daniels)               for($i=0;$i<count($keywords_split);$i++){         $sql_split_keyword      = "SELECT * from wp_posts WHERE post_title LIKE '$keywords_split[$i]%'";         $search_split_keyword   = mysql_query($sql_split_keyword) or die(mysql_error());         search($search_split_keyword,"Split keyword = '$keywords_split[$i]'");     }      **Search by content function :** (same above, but search by content)               for($i=0;$i<count($keywords_split);$i++){         $sql_split_keyword      = "SELECT * from wp_posts WHERE post_content LIKE '$keywords_split[$i]%'";         $search_split_keyword   = mysql_query($sql_split_keyword) or die(mysql_error());         search($search_split_keyword,"Split keyword = '$keywords_split[$i]' (Content)");     }      Than close mysql               mysql_close();      **Search by tag function :** (using normal wordpress query)                   $tags = str_replace(" ","-",$keyword).",".str_replace(" ",",",$keyword);         query_posts(array('post_type'=>array('one','two','three') ,'tag' => $tags,'posts_per_page'=>-1));              while (have_posts()):the_post();         echo '
#'.get_the_ID().' '.get_the_title().'
';         endwhile;      Everything work now and I need someone to review my code, tell me better things or tong ... Full code here : http://snipt.org/zpz0 Thanks


Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms

I am importing a large DB from an Excel spreadsheet into a wordpress DB. I was going to do it manually by creating a new table but decided to import it into the existing wordpress framework as it will allow me to change information manually in the wordpress back end. I was importing all 2000 rows into the wp_posts table when I realised this table doesnt have a term column. The terms are stored in other tables. My question is... how can I import the spreadsheet into the database and keep all of the important data, especially the terms, as my site queries all information by the "term" and uses jQuery tabs to display the different terms as sub-categories. My information looks like this:               post-title(title)---category(term)---description(content)---imageUrl---price      Note: I will create a seperate column in the wp_posts table to handle the price, or any other information I need bringing in, Im just unsure about how I can get the term information into the corresponding tables... Thanks :)


Static files or dynamic WP pages for "static content"?

Ok = I've looked around a lot for a clear answer to this, but find very few real answers. I would really appreciate some info from experienced individuals. A tiny bit of background. I've worked content generation (among other thing) on a largeish website for many years, and it follows the pretty basic file system and discreet html (.aspx) pages for content. You want a new page, you make a new file and build your content. Done. I've built a dozen or so brochure sites like this as well. This is the system that makes sense to me, and I find myself a little hesitant to veer away. CMS systems, like WP, obviously do not work like this. I am not inexperienced with wordpress. I've built and implemented a couple custom themes, but have "tried" to make the above file structure work "along side" of a wordpress install - mostly leading to headaches. That is where I currently sit, having spent a couple of months of weekends building my new personal site (which is almost finished). The format of the site is pretty straightforward - its a developer blog (I do a lot of AS3), a portfolio for artwork, and a main intro page that contains a bit of both. My file structure looks a bit like so:                mysite.com-          /css/           /home/           /images/           /javascript/          /portfolio/           /php/ (holds a lot of php snippets that is included elsewhere)          /swf/          /wordpress/../theme/ (draws upon img/css/php in external folders)          index.php      While I do very much like the familiarity of this structure, the cross sharing of assets between static files and dynamic wordpress content is a pain. My option is to turn all static files into templates, and make use of WP's database driven page system. What do I stand to gain from "buying into" the WP system completely? Or, conversely, is a static file structure external to wordpress "workable" - and are there preferred methods of doing so? I realize this question is somewhat subjective, however, the proper handling of static content is, I think, a quite valid point of inquiry (tho... you might not think it, considering how little info there is to be found on the subject). Thanks


Hide content from Post Preview

Is it possible to hide content in Post Preview (that is not hidden when the post is published)? I have customised `single.php` quite extensively and there are a few elements that I do not want my authors to load up every time they preview their post.


wp.getComments is returning nill, when i called from my iphone app

i have called **`wp.getComments`** from my iphone app, but its returning nil,, following r my parameters can anybody tell me where i gone wrong               NSDictionary *DicCommentStructure = [NSDictionary dictionaryWithObjectsAndKeys:@"",@"Approved",@"50",@"10",nil];              // Send XMLRPCRequest to the server         NSArray *arrParameters = [NSArray arrayWithObjects:@"1", @"username", @"password",DicCommentStructure, nil];         NSString *strServer = [[[NSString alloc] initWithString:@"http://xyz.com/xmlrpc.php"] autorelease];         // the server         NSString *strMethod = [[[NSString alloc] initWithString:@"wp.getComments"] autorelease];                        // the method         XMLRPCRequest *objXMLRPCRequest = [[XMLRPCRequest alloc] initWithHost:[NSURL URLWithString:strServer]];         [objXMLRPCRequest setMethod:strMethod withObjects:arrParameters];      thanx in advance!!


Wordpress update and plugin install not working

I am working on a website that I installed WP on a few months back but haven't worked on beyond the install of WP and a theme. I went back to it today and needed to update WP and install a few plugins. When I went to do that it started asking me for FTP info, which was new to me. After research I added said FTP info into the wp-config file. Now when I go to update WP or install a plugin, where it should start putting info on the screen about downloading and updating the files I get nothing in the right pane of the dashboard. I've tried chmod wp-content to 777 and still nothing. I can FTP but I need to be able to update via WP. I'm stumped. Any thoughts?


Comment forum to display under the comment you're replying too

I am making a theme where I have built in my own custom threading and such using twitter bootstrap. I have it now so that, as per default, when you click reply you are shot down to the WordPress comment forum. Is there a way to make the comment forum come to you? to display right under the comment you are replying too?


How code a redirect back to page from form thanks

I building a site in WordPress (my own theme) that includes a very simple "sign up" email form. Person enters name and email address and hits submit button. Client currently using a script through Bluehost so I want to recreate vs. using a form plugin. The form is fine. After hitting "submit" person is redirected to a "Thank You" page. I would like to be able to add a "back to page" link after the "Thank You for signing up" message that would take them back to whatever page they were on (the form will be on most site pages). Tried adding this to the template:                   <?php     $url = htmlspecialchars($_SERVER['HTTP_REFERER']);     echo "Back to Page";     ?>      but it generates an error message because it's kicking back to Bluehost, not to the original page. Can anyone help? Thanks!


Password Protect Pages Not Working

I recently switched to a new theme, and it does not seem to have the functionality to password-protect individual pages. It only displays "Protected" in page title, but still shows the content without prompting for password. How can I enable this manually? I tried to add (if ( post_password_required( $post ) ) { into a custom page template, but it didn't work. Please help me with correct code here or some other solution. Thanks a lot!                <?php      // Template Name: Password Protected      get_header(); ?>

<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>

                              <?php                                   $my_postid = get_page( $page_id );//This is page id or post id                             $content_post = get_post($my_postid);                             $content = $content_post->post_content;                             $content = apply_filters('the_content', $content);                             //$content = str_replace(']]>', ']]>', $content);                             echo $content;                              ?>

         <?php         if ( !function_exists('dynamic_sidebar')             || !dynamic_sidebar(2) ) :          endif;              ?>

                    <?php get_footer(); ?>


Ending Pagination loop in PHP

<?php next_posts_link('←') ?>

             <?php                 global $wp_query;                 $big = 9999;                 echo paginate_links(array(                     'base' => str_replace($big, '%#%', get_pagenum_link($big)),                     'format' => '?paged=%#%',                     'total' => $wp_query->max_num_pages,                     'current' => max(1, get_query_var('paged')),                     'show_all' => false,                     'end_size' => 1,                     'mid_size' => 5,                     'prev_next' => false,                     'prev_text' => 'Prev',                     'next_text' => 'Next',                     'type' => 'list'                 ));             ?>

<?php previous_posts_link('→') ?>

      Hi, I have a pagination loop setup and am choosing to display both the numbers and the prev / next links. However, I'm trying to figure out how I can end the #'s at the most recent 5 articles [1,2,3,4,5] instead of it carrying over to [1,2,3,4,5,6,7]. How would I go about ending it at the most recent 5 articles published on my blog? "I'm just wanting to edit the div-class pages part so it just ends at 5." - If that makes any sense. ![Screenshot](http://i.stack.imgur.com/1cyXV.png)


Does WordPress cache get_user_meta() results?

If I call get_user_meta() to retrieve a value, does WordPress cache the value? If I call get_user_meta() to retrieve the same value, does WordPress have to query the database again or is it stored in PHP memory?


Get posts from current category?

How can i display 5 posts from current category (exclude current post). Order by post time. _**Example:_**   * To day news to reading 3 (12/11/2012 - 8:10 PM)   * To day news to reading 2 (12/11/2012 - 6:07 AM)   * To day news to reading 1 (12/11/2012 - 6:05 AM)   * Yesterday news to reading 2 (11/11/2012 - 9:10 PM)   * Yesterday news to reading 1 (11/11/2012 - 7:12 AM)


remove_action returns FALSE

I'm trying to remove the canonical link reference from my page headers and I'm using the following code in my `functions.php`:               remove_action('wp_head', 'rel_canonical');      However, when I test the return value of remove_action it's value is `FALSE` and I notice that the canonical link reference is still rendered in the `head` of my pages. I've tried wrapping the `remove_action` in an `init` but I get the same result:               function my_init()     {        remove_action('wp_head', 'rel_canonical');     }          add_action('init', 'my_init');      How do I remove the canonical link reference from my page headers?


Custom Post Type / Tab Limit

I've created a site with **nine** (gulp) custom post types. It's a huge site unsurprisingly. The 9 post types fit on the admin menu but I was wondering if there is a limit to the number of extra post types you are allowed in WordPress? Say this because when enabling PollDaddy that adds two more tabs (Polls and Ratings) which then hides two of my custom post types from the menu. Anyone know if there's a limit and how/if I can increase it? I may try adding a 10th custom post type and see if that displays