title: Ajax custom search not functioning as expected

text:
I have a custom search I have created that is handled by an ajax call. It functions correctly for the admin but not for non-admin, but logged in, users. Admin will get the expected results returned. A logged in user that is NOT admin will get an ajax error and never even reach the memberSearchAjax function that is added with `add_action( 'wp_ajax_memberSearchAjax', 'memberSearchAjax' );` It's like when the ajax request attempts to hit `admin-ajax.php` it fails in some manner, but only if the logged in user is NOT admin. **My question... why might this Ajax request only work for Admin and not for other logged in users?** Some code... I enqueue and localize my custom script:               function memberSearch_scripts() {         wp_enqueue_script( 'memberSearch', get_stylesheet_directory_uri() . '/js/memberSearch.js', array( 'jquery' ) );         wp_localize_script( 'memberSearch', 'memberSearchObject', array(                 'ajaxurl' => admin_url( 'admin-ajax.php' ) )         );     }          //add_action( 'wp_enqueue_scripts', 'memberSearch_scripts' );     add_action( 'init', 'memberSearch_scripts' );      Then a fairly complex function named memberSearchAjax handles the search. I use add_action on this like so:               add_action( 'wp_ajax_memberSearchAjax', 'memberSearchAjax' );     add_action( 'wp_ajax_nopriv_memberSearchAjax', 'memberSearchAjax' ); <-- added this to see if it would help... doesn't      My javascript ajax looks like this:               $('#searchMembersForm').on('submit', function (e) {                 e.preventDefault();                 $('.searchMembersLetter').removeClass('active');                 var spinner = '

';                 $('#memberSearchResults').html(spinner);                 $.ajax({                     type: 'POST',                     dataType: 'json',                     url: memberSearchObject.ajaxurl,                     data: {                         'action': 'memberSearchAjax',                         'firstName': $('#firstName').val(),                         'security': $('#security').val(),                         'datasource': 1                     },                     error:function(jqXHR, textStatus, errorThrown){                         console.log(textStatus);                         console.log(errorThrown);                         console.log(jqXHR);                         $('#memberSearchResults').html('
There was an error with your request. It is:
' + errorThrown.message + '
');                     },                     success: process                 });             });      The success function, named "process" is quite complex so I'm not including it but non-admin users never reach it anyway.


Unable to add custom fields in custom taxonomy meta box in wordpress-3.5.2. I have checked solution in various blogs but Unable to solved this problem. I am using wordpress-3.5.2 What I am trying is :-               // A callback function to add a custom field to our "adtag" taxonomy     add_action( 'adtag_edit_form_fields', 'adtag_callback_function', 10, 2);          // A callback function to save our extra taxonomy field(s)      add_action( 'edited_adtag', 'save_taxonomy_custom_fields', 10, 2 );      I have tried solution from below link:- http://www.codehooligans.com/2010/07/07/custom-meta-for-new-taxonomies-in- wordpress-3-0/ http://sabramedia.com/blog/how-to-add-custom-fields-to-custom- taxonomies http://www.wpbeginner.com/wp-tutorials/how-to-add-additional-custom-meta- fields-to-custom-taxonomies/ http://shibashake.com/wordpress-theme/add-term-or-taxonomy-meta-data Please refer image where I need to add custom fields:- ![enter image description here](http://i.stack.imgur.com/mp61K.png)


title: Query sql for truncate post_content in wp_posts table

text: Hello all i need remove all info in Wordpress posts content and i'ld like do it from phpmyadmin with a query. I need remove only the text and images from all posts content but not the entire post, so i need know the sql query for do it, please someone can help me? Stew


title: Is there any fundamental difference in developing a wordpress multi-network site?

text: I would really like to know: Is there any fundamental difference in developing a multi-network site as opposed to a normal wordpress site? More Specifically:   1. Is the wordpress plugin development process the same?   2. Is theming the same? Can I use common AND separate stylesheets?   3. Will my old WP queries continue to work the same across the site network?   4. Can I expect popular wordpress plugins for taxonomies, custom fields and custom posts to work seamlessly across the network?   5. Can I create custom post types that are unique to each network? I am completely new to multisite but am totally game with the single wordpress install. Would really appreciate guidance from this community.


title: How to hook wp_list_pages?

text: How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?


title: Google Map Integration

text: I want to create a Interactive google map as per http://www.rightmove.co.uk/property-for- sale/map.html?locationIdentifier=REGION%5E93932 .. I just wanna ask if I can do that using wordpress plugin, or can I have that kind of fucntionality even without using wordpress plugin? but how?.. here are the details.. any tip please.. do I have to do to manually or there is an easy way for me to be able to do that.. please help me :)


title: Not Getting Sidebar

text:
The sidebar I'm using uses an if else statement. No matter what I do it always displays the else default sidebar. They seem to be registered, as they show up in the admin widgets section. I can can add widgets to them, but they do not show up in the page. Only the default sidebar. This is the sidebar template                                <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

Search
                         <?php get_search_form(); ?>

Categories

                             <?php wp_list_categories('title_li='); ?>

Archives

                             <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>

Meta

                             <?php wp_register(); ?>
<?php wp_loginout(); ?>
                             <?php wp_meta(); ?>

                 <?php endif; ?>                       this is what calls it                  <?php get_header(); ?>
         <?php get_sidebar(); ?>
             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <article id="post-<?php the_ID(); ?>" class="post postbrdr" role="article">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                          Published <time datetime="<?php echo the_time('Y-m-j'); ?>"><?php echo the_time(get_option('date_format')); ?></time> by <?php the_author_posts_link(); ?>.     Filed under <?php the_category(', '); ?>. Total of <a href="<?php comments_link(); ?> "><?php comments_number( 'no comments', '1 comment', '% comments' ); ?> in the discussion.<?php edit_post_link('Admin Edit', ' ', '.'); ?>
                     <?php the_content(); ?>

             <?php endwhile; ?>

                     <?php previous_posts_link( "« Older Entries"); ?>

                     <?php next_posts_link( "Newer Entries »"); ?>

             <?php else : ?>

Whoops! Looks like we can't find this post.

It seems like this post is missing somewhere. Double-check the URL or try navigating back via the website menu links.

             <?php endif; ?>

          <?php get_sidebar( 'responsive' ); ?>     <?php get_footer(); ?>      and here is responsive.php                            <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>

Blog Categories

     <?php wp_list_categories('title_li='); ?>

Post Archives

     <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>

                   <?php endif; ?>              >      and this is the registration               * Setting up custom sidebars      *      */     if(function_exists('register_sidebar')) {         register_sidebar(array(             'name' => 'Main Sidebar',             'id' => 'main',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));              register_sidebar(array(             'name' => 'Responsive Sidebar',             'id' => 'responsive',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));


title: "Reversable" and "Re-useable" Subcategories (or other taxonomic structure)

text: Hope you can help a WP newbie :) It is my understanding (and please correct me if I'm wrong!) that I cannot use the same subcategory slug in multiple parent categories, i.e. this structure is impossible with WP's category functionality: > >        example.com/design/exotic/my-post/ >        example.com/travel/exotic/another-post/ >   My question is a two-parter:   1. Are there any plugins or code I can use to coax WP into structuring URLs this way?   2. Is there a way to tweak the category archive page template to generate `example.com/exotic/`, which would include posts from `/design/exotic/` and `/travel/exotic` If this is way more trouble than it is worth, please let me know. If so, I'm willing to sacrifice the subcategory in the URL structure. #2 is the most important to me: being able to have a `mysite.com/exotic/` page that draws from multiple categories. Thanks!


title: Calling setup_postdata() causes "Call to undefined function get_userdata()" error?

text: The exact error is: > Call to undefined function `get_userdata()` in /wp-includes/query.php on > line 3567 I am using `get_posts()` in my plugin, which in turn uses `setup_postdata()` wherein `get_userdata()` is executed. I have no clue what's going on. I looked at `query.php` and it looks like `get_userdata()` is a global function, it shouldn't have any problem accessing it right? **MORE DETAIL** : My plugin is in a class form. This is just the basic structure. There are multiple functions in the actual code actually. Please take note of the `get_posts()` function where the post query occurs. If I remove it, the error won't show up.               class myPlugin() {        var $post_type = '';             function __construct($post_vars = array()){            if ($post_vars) $this->post_type = $post_vars['post_type']            $this->get_posts();        }             function get_posts() {            $args = array('numberposts' => -1, 'post_type' = $this->post->type, 'post_status' => 'publish');            $myposts = get_posts( $args );            foreach( $myposts as $post ) : setup_postdata($post);                print_r($post->ID);            endforeach;        }     }          return new myPlugin($_POST);      If I place the query in functions.php(and maybe outside the class or function scope which I have not tried), it works. That's my workaround for now, but I'd like to integrate it into my plugin.


title: Query posts from a child taxonomy term id

text: this is my structure.... State1               CT1-1          - Car_Model Post-CT1-1 (the posts of child)          - Car_Model Post-CT1-2     CT2-1          - Car_Model Post-CT2-2     CT3-1          - Car_Model Post-CT3-1      State2               CT1-2     CT2-2     CT3-2      State3               CT1-3     CT2-3     CT3-3      Here is the logic of what i have done to display triple drop down for displaying 2 taxonomies and a child   * 1st drop ------> State (Taxonomy)   * 2nd drop ------> City (child of State Taxonomy)   * 3rd drop ------> Manufacturer (Taxonomy) now instead of manufacturer in the 3rd drop i have to Query posts from a taxonomy term id on selecting the 2nd drop                <!-- WORKING LOGIC Triple Drop Down Start -->           <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>      <script type="text/javascript">     $(function()     {         $('#main_cat').change(function()         {             var $mainCat=$('#main_cat').val();                  // call ajax             $("#sub_cat").empty();             $("#manu_cat").empty();             $.ajax             (                 {                     url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",                          type:'POST',                     data:'action=my_special_ajax_call&main_catid=' + $mainCat,                          success:function(results)                     {                         //  alert(results);                         $("#sub_cat").removeAttr("disabled");                                $("#sub_cat").append(results);                     // it should be closed here an perform new ajax call not in success ok ?                          // Passing the sub_cat to the function for displaying 3rd drop down list                         $(function()                         {                             $('#sub_cat').change(function()                             {                                 var $subCat=$('#sub_cat').val();                                      // call ajax                                 $("#manu_cat").empty();                                 console.log($("#manu_cat"));                                 $.ajax                                 (                                     {                                         url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",                                              type:'POST',                                         data:'action=my_special_ajax_call&main_brand_id=' + $subCat,                                              success:function(results)                                         {                                             //  alert(results);                                             $("#manu_cat").empty();                                             $("#manu_cat").removeAttr("disabled");                                                   $("#manu_cat").append(results);                                          }                                     }                                 );                                                                 });                         }); // function end for manufature jQuery                     }                 }             );                                             });     });          // for manufacturer logic paste here           </script>      <style type="text/css">      #content{width:auto; height:400px; margin:50px;}      </style>           <form role="search" method="get" id="searchform" action="<?php echo get_option('siteurl');?>/">     <div id="content">         <?php              wp_dropdown_categories('show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=1&show_option_none=Select State&name=main_cat&taxonomy=state');         ?>         <select name="sub_cat" id="sub_cat" disabled="disabled"></select>         <select name="manu_cat" id="manu_cat" disabled="disabled"></select>              <input type="submit" id="searchsubmit" value="Search" />             </div>     </form>                <!-- WORKING LOGIC Triple Drop Down End -->      **Functions.php**               function implement_ajax() {     if(isset($_POST['main_catid']))             {             $categories=  get_categories('child_of='.$_POST['main_catid'].'&hide_empty=0'.'&taxonomy=state');     //change the taxonomy state in your case               foreach ($categories as $cat) {                 $option .= '<option value="'.$cat->term_id.'">';                 $option .= $cat->cat_name;                 //$option .= ' ('.$cat->category_count.')';                 $option .= '</option>';               }                    echo '<option value="-1" selected="selected">Select City</option>'.$option;             die();             } // end if          if(isset($_POST['main_brand_id']))             {             $categories=  get_categories('&hide_empty=0'.'&taxonomy=manufacturer');     //change the taxonomy manufacturer in your case               foreach ($categories as $cat) {                 $options .= '<option value="'.$cat->term_id.'">';                 $options .= $cat->cat_name;                 //$option .= ' ('.$cat->category_count.')';                 $options .= '</option>';               }                    echo '<option value="-1" selected="selected">Select Make</option>'.$options;             die();             } // end if               }     add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');     add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.      The logic starting from this line **if(isset($_POST['main_brand_id']))** has to be replaced, so here **if(isset($_POST['main_brand_id']))** i have to pass the term_id of the taxonomy to retrieve the post, kindly help how to query the logic to retrieve the relevant posts titles. Hope someone will help me........


title: Creating a table from shortcode avoiding wpautop for each row

text:
I'm probably doing this all wrong, and there'll be a much simpler solution. Basically, I'm trying to build a table of tour dates that'll be editable by someone with little technical knowledge, but can handle shortcodes. There's also some custom functions in the table (with regards to displaying the date, and having an expiring ticket link) that makes me want to avoid a clunky table plugin. So here's the code I'm experimenting with, that's working apart from it's introducing a   tag for each new line of and separate short code. I don't want to disable wpautop completely, as it's used widely throughout the website and elsewhere on the page that this table will be appearing on.               [tour_table tour_name="The Tour Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [/table]      The parsing of the table is all handled in functions.php by the wrapping function tour_table() and the function [tour_table_line] which is executed inside a do_shortcode() function (from the wrapping function). So the basic problem is that each new line is earning itself a new   tag, which is placing a massive space above the table. If anyone has any more elegant solutions, or can help me get the functionality I'm looking for, I'd be very appreciative of your help. If you need more detail, please let me know. Edit to add functions (probably quite a bit of convoluted code in there:               function tour_table($atts,$content = null){         extract( shortcode_atts( array(             'tour_name' => '',             'anchor_table' => ''         ), $atts ) );              if($anchor_table!=""){             $hid = "id=\"tourscrollto\"";         }else{             $hid = "";         }              $theoutput = "
";         $theoutput .= $tour_name;         $theoutput .= "

";         $theoutput .= do_shortcode($content);         $theoutput .= "

";         return $theoutput;     }          function tour_table_line($atts){         extract( shortcode_atts( array(             'tour_date' => '',             'ticket_link' => '',             'venue' => 'The Venue'         ), $atts ) );              $date_original = $tour_date;         $date_unix = strtotime($tour_date);              $theoutput = "
";         $theoutput .= date('D',$date_unix);         $theoutput .= "	";         $theoutput .= date('j M',$date_unix);         $theoutput .= "	";         $theoutput .= $venue;         $theoutput .= "	";         //$ticketlink = ticketlinkexpire($date_original,"Buy Tickets","");         //$theoutput .= $ticketlink;         $theoutput .= "
";              return $theoutput;          }          add_shortcode( 'tour_table' , 'tour_table' );     add_shortcode( 'tour_table_line' , 'tour_table_line' );


title: On cliking add new post redirect user to a custom page first

text: Probably my question title is confusing. I want something like this:   1. I have custom post type   2. When I click on add new, I would like to go to a "select" page   3. The select page allows you to make a choice (by clicking the appropriate box)   4. You are then redirected to the standard 'add new' custom post type page. However, a custom metabox will be pre-filled with data based on the choice in step 3. The url would have a custom query variable e.g. "wp-admin/post-new.php?post_type=my-box&box_id=3" Ok, hope you understand me now, how can I force that before I go to add new page, to show that my "select page" ?


title: can't import xml file

text: While i upload xml file to my site , the following error message occur and uploading fail > Sorry, there has been an error. File is empty. Please upload something more > substantial. This error could also be caused by uploads being disabled in > your php.ini or by post_max_size being defined as smaller than > upload_max_filesize in php.ini I can't edit the stuff mentioned in above (php.ini) becoz of mine is hosted on shared hosting and i don't wanna migrate from database or something like that . Is there a ways from migrating from wordpress scope ???


title: How to add CSS Class to previous_post_link or get previous/next post link URL

text: How can I add a CSS Class to the `previous_post_link` output or just get the URL and create the HTML markup myself


title: Dynamically Register Sidebars For Each Top Level Page

text:
I have a small website that wants a different sidebar for each page containing blocks of text, blocks of images, and blocks of links, etc. What I'm trying to do is register a sidebar for each top level page:               if ( function_exists('register_sidebar') ){         $topLevel = get_pages(array(             'sort_column'   => 'post_date',             'hierarchical'  => 0,             'parent'        => 0,             'post_type'     => 'page',             'post_status'   => 'publish'         ));              foreach($topLevel as $page)         {             //make alphaunermic             $sidebarID = preg_replace("/[^a-z0-9_\s-]/", "", strtolower($page->post_title));                  //Clean multiple dashes or whitespaces             $sidebarID = preg_replace("/[\s-]+/", " ", strtolower($page->post_title));                  //Convert whitespaces and underscore to dash             $sidebarID = preg_replace("/[\s_]/", "-", strtolower($page->post_title));                  register_sidebar(array(                 'name' => $page->post_title,                 'id'   => $sidebarID,                'description'   => '',                 'before_widget' => '
'                 'after_widget'  => '
',                 'before_title'  => '
',                 'after_title'   => '
'               ));         }     }      1) is this possible? 2) is there a better way to go about this? 3) I'm getting a few errors...


title: Creating a Horizontal menu

text:
i'm new to creating wordpress themes and want a menu at the Top of my page. I do have the following: Header.php                         <title>Tutorial theme</title>     <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
     <?php wp_nav_menu( array('menu' =>'Top Navi', 'container' => '', 'items_wrap'  => '
%3$s
'  ) ); ?>

      functions.php               <?php     add_theme_support( 'menus' );     if (function_exists('register_nav_menus')) {     register_nav_menus(         array(             'main_nav' => 'Main Navigation Menu'             )         );     }     ?>      And finally my css file http://pastebin.com/Pjr3THJm However my menu comes out in a list, not horizontally. What am i doing wrong?


title: How to protect wp-admin through .htaccess?

text: I'd like to protect the /wp-admin/ directory at the server level. This means two logins. One through the server and another through WordPress. I believe this can be handled through .htaccess. Does anyone know how? Also, are there any files that will need access (i.e., admin-ajax.php)?


title: How do spam users register while I've only enabled registration by Gmail via Janrain?

text: In wp-login.php?action=register, I've disabled text fields (sorry this web site is in Japanese only but hope you can see that there's no text field) and enabled registration only via social login by janrain plugin, and set it to accept `GMail` only. In this way I expect all new users have `GMail` addresses. However there are still new users who aren't using `GMail`, and what's worse is they look like spam. Examples are:               Account name: Anddcusd, cqbx33@groupd-mail.net     Account name: Anddcuse, cqbx34@groupd-mail.net     Account name: Anddcusg, cqbx36@groupd-mail.net      How can they still create accounts, with non-approved email addresses? Thanks! `WP` 3.5, `Janrain Engage` 1.1.1


title: How to upload an image using media uploader and return the image link to javascript?

text: I'm new to Wordpress, and i'm developing a plugin. I'm havin some troubles with image upload... Is there a way to call a JavaScript function in a onClick tag, that calls the Wordpress media uploader, and after the upload, saving the uploaded image link into a JavaScript variable? Without leaving the page, using thickbox. Every single option i tried on google, leaves the page after the image upload.               function imageUpload() {             formfield = jQuery('#upload_image').attr('name');             tb_show('', 'media-upload.php?type=image&TB_iframe=true');             return false;              window.send_to_editor = function(html) {             imgurl = jQuery('img',html).attr('src');             alert(imgurl);             tb_remove();         }      }      and calling in the html using `<input onClick=\"imageUpload();\" id=\"upload_image_button\" class=\"alterar- logo onetarek-upload-button button\" type=\"button\" value=\"Upload Image\" />` It makes the upload, but when i click in "insert into post" it won't copy the variable Using WP 3.6, by the way... Edit: i managed to do it by removing `return false;`


title: How to add enctype to multipart/form-data to comment form?

text: I need a way to change the encoding type for my comment form, without hacking the core files. I'm aware of the function to work on the post editing form: `post_edit_form_tag`. I've tried this:               jQuery('#comment_form').attr("enctype","multipart/form-data");      But it doesn't work, the only next step I know of is to hack the source code... Any help would be very much appreciated—thanks in advance!


title: Parent for a single (single.php)

text: Is it posible to get the parent ID of an single page.... I mean not a Page I mean an is_single()... page. I have a page witch contains some custom posts and when I click on one of these i came to the single page of these entree. I would like to get the permalink of the parent page, the page i come from.


title: Server-side subscribe by email?

text: Is there a server-side email solution that will allow users to subscribe to updates via email and, specifically, also be able to do this by category? I'm aware of Aweber and Feedburner being able to provide this kind of functionality, but my client has requested this as a server-side solution, with a database on-site. Any suggestions?


title: Get Value of Post before

text: I have a normal loop in wordpress and in every post i need to check the value of the post before to compare it with the current post. -- POST 1 -- ** DO NOTHING ** -- POST 2 -- ** GET VALUE FROM POST 1 ** -- POST 3 -- ** GET VALUE FROM POST 2 **               <?php          if ( have_posts() ) {             while ( have_posts() ) {                 the_post();                            $description = get_post_meta( get_the_ID( ), 'metabox_description', true );                              echo $description;                            // Add: echo $description_from_post_before;                  } // end while         } // end if     ?>


title: Changing Admin Menu Labels

text: I have spent the last day using the functions.php file to fully customize WordPress for my client sites. I am amazed at how much I have been able to accomplish and how much easier it will make things for my clients. I have removed certain menu items for users that are not logged in as an admin. What I am hoping (and from what I have read know it can be done) is to find a way to rename some of the menu items (left sidebar in the admin area). For instance change Posts to Articles. If anyone can supply the code for the functions.php file or point me in the direction I would greatly appreciate it!


title: Regex problem in an add_rewrite_rule

text: I'm working on a category page for a custom post type called articles in WP 3.1, and I'm having some trouble with extracting the page number. The url: `/articles/category/background/` Currently, what works for me, from my `functions.php`:               add_action( 'init', 'wpse7379_init' );     function wpse7379_init() {         add_rewrite_rule(             'articles/category/([^/]+)(/page/([0-9]+))/?$',             'index.php?post_type=articles&category_name=$matches[1]&paged=$matches[2]',             'top'         );     }      This internally rewrites the url to: `/index.php?post_type=articles&category_name=background` I'm trying to make the pagination work by expanding the rewrite rule, but it's not working for me. The pagination works as follows: `/articles/category/background/page/2/` New rule:               add_rewrite_rule(         'articles/category/([^/]+)(/page/([0-9]+))/?$',         'index.php?post_type=articles&category_name=$matches[1]&paged=$matches[2]',         'top'     );      This should rewrite the url to: `/index.php?post_type=articles&category_name=background&paged=2` I'm using a query with args on my `archive-articles.php` page, but just a regular loop on the `categories.php` page, where the posts are displayed. When I try `/index.php?post_type=articles&category_name=background&paged=2` it works, but the url that gets rewritten doesn't. Its just displaying the first page, no matter what I enter as pagenumber. Does anyone know how to fix this? **I think I'm looking for a proper regex, I kinda suck at regexes, so I guess thats the problem.**


title: Why is previous_post_link and next_post_link working outside of the Loop?

text:
**This is my single.php file:** I'm using `previous_post_link();` and `next_post_link();`. In the Worpress codex it says that it only works inside the loop.               <?php     /**      * The Template for displaying all single posts.      *      * @package WordPress      * @subpackage Starkers      * @since Starkers 3.0      */              get_header(); ?>              <?php get_sidebar(); ?>
             <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Work&section=Intro');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>
                     <?php the_post_thumbnail('large'); ?>
             <?php endwhile; ?>                  <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Work&section=Tagline');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>
                     <?php the_content(); ?>
             <?php endwhile; ?>             <?php wp_reset_query(); ?>                  <?php // Display the thumbnails of previous and next posts ?>
                 <?php // Display the thumbnail of the previous post ?>
 <?php                         $prevPost = get_previous_post();                         $prevthumbnail = get_the_post_thumbnail($prevPost->ID); ?>
<?php previous_post_link('%link', 'Previous'); ?>
                         <?php previous_post_link('%link', $prevthumbnail); ?>
                      <?php // Display the thumbnail of the next post ?>
 <?php                         $nextPost = get_next_post();                         $nextthumbnail = get_the_post_thumbnail($nextPost->ID); ?>
<?php next_post_link('%link', 'Next'); ?>
                         <?php next_post_link('%link', $nextthumbnail); ?>

                  <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Front Page&section=Sidebar');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                     <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail(); ?>
<?php the_excerpt(); ?>

<?php echo get_post_meta($post->ID, "Other_Work", true); ?>

             <?php endwhile; ?>                  <?php // Start the main loop                 if ( have_posts() ) while ( have_posts() ) : the_post();             ?>
                     <?php the_content(); ?>
             <?php endwhile; // end of the loop. ?>                  <?php get_sidebar('secondary'); ?>
              <?php get_footer(); ?>


title: Redirect to Current Page after Login

text: In my wordpress page, I add Login- logout item to the main menu using the code (in functions.php) below :               add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);     function add_login_logout_link($items, $args) {             ob_start();             wp_loginout('index.php');             $loginoutlink = ob_get_contents();             ob_end_clean();             $items .= '<li>'. $loginoutlink .'</li>';         return $items;     }      When login is performed using this button, It should redirect the current page where login is clicked. How can I do that? I think `wp_loginout('index.php')` needs to change because after login and logout I redirect to home page. What should I write to go previous page ?


title: RSS Subsriber count without using feedburner

text: Currently, I have a blog which is running on wordpress. I want to know how many users subscribe my feeds. I know that if i used feedburner, I can get the counter from there. But I was really wondering if there's anyway that we can track the subscriber easily. Please kindly share the code or ideas. Thanks.


What is the difference between these two methods of writing $ instead of jQuery in WordPress               (function($) {          // $ Works! You can test it with next line if you like     // console.log($);          })( jQuery );      ... Which I found here and               jQuery(function ($) {     /* You can safely use $ in this code block to reference jQuery */     });      ... Which I found here


title: Search Results with googlemaps

text: I have made a custom search for houses. The problem is that I have to show in the search results page, a "googlemaps" with the points at which there is a house, according to the search results obtained. How can I do it? Thanks.


title: Enqueue scripts to a specific header-<name>.php?

text: I've multiple header files (header-name.php), they are mainly being used by different custom post types. Is there any way to enqueue script to only a specific header? At this moment I'm targeting it with conditional tag like if `( 'MYPOSTTYPE' == get_post_type() )` but I'm looking for a better alternative. do we have something like `is_header('name')`?


title: firing function at login within class

text: I've got a function that I'm trying to fire at wp_signon (grabs data from a remote server and updates accordingly). I'm running the function within a class that is on a secondary file in a plugin (i.e. brought in with a require_once). For the life of me, I cannot get this function to run at all.               add_action( 'wp_signon', array(&$this, 'login_pull_updates'), 40, 3 );                  function login_pull_updates() {                 update_option('ap_login_run', 'YES I DID');             }      I'm using that now to just test and confirm it's running at all, and it won't fire. Any ideas?


title: sort post attachments by title order (numerical)

text: I have been assigning numerical values to all the post attachments as their titles. I am trying to set order of these attachments based on their titles, which is a numerical value then I was trying to use a simple argument like the one shown below.               $images =& get_children( array (                 'post_parent' => $post->ID,                 'post_type' => 'attachment',                 'post_mime_type' => 'image',                 'orderby' => 'title',                 'order' => 'ASC'                 ));      But this just gives something in this order 10, 1, 21, 29, 2 ..... which is more of an alphabetical sorting rather than a numerical sorting I seek eg 1, 2, 10, 21, 29 ... I am aware of the meta_value_num function but I am not dealing with custom fields here. Also FYI this is NOT the only loop on page, as I have two other loops on my single.php. Inspired from here and there I have put put together a code below but does not seem to work. Could you please help me correct this.               function orderby_post_title_int( $orderby ) {                 global $wpdb;                 if(!is_admin && is_single()){                 $orderby = '(wp_posts.post_title+0) ASC';                 return $orderby;                 }                 }                 add_filter('posts_orderby', 'orderby_post_title_int' );                            $images =& get_children( array (                   'post_parent' => $post->ID,                   'post_type' => 'attachment',                   'post_mime_type' => 'image',                   'orderby' => 'title',                   'order' => 'ASC'                       ));                 }                  remove_filter('posts_orderby', 'orderby_post_title_int' );


title: how to group custom post type posts by custom taxonomy terms

text: I would really appreciate if you could help me :) I'm very stuck and don't know how to proceed. I have a custom post type called `event` and 2 custom taxonomies registered for it:   1. `event_type` with tag-like functionality (ex. of event type: yoga, voice work)   2. `event_location` with category-like functionality (ex of event location: uk->brighton, london; europe->paris). There are pages on the website like `Yoga -> Upcoming events`; `Voice work -> Upcoming workshops`. Depending on which page we are on I'd like to display appropriate events. For example, if we're on page `Yoga -> Upcoming events` I'd like to display all `event` custom posts with `event_type` being yoga and then group the results by `event_location` taxonomy terms. For example, list all yoga events for UK, Brighton then UK, London and then Europe, Paris and so on. What I currently do in a template is the following:   1. I get the slug of the current page and its ancestors.   2. I get slugs of all terms in the `event_type` taxonomy, that have some events associated with them.   3. I determine which event types to display, by intersecting previously gathered values.   4. Then I construct a WP_Query to get `event` posts with determined `event_type` taxonomy terms. This seems to work. However, results came back unordered and I would like them to be ordered by `event_location` taxonomy terms. For example:   * UK     * Brighton        * Event 1       * Event 2      * London         * Event 3   * Europe      * Paris        * Event 4 I would also like to display only non-expired `event` posts and order them by `event_date`. The `event_date` value is stored as meta value along with the rest of `event` post details under a single meta_key. **Here is my code so far:**                   //pull in the appropriate events depending on the page type: yoga/voice work         /* get the ancestors and current page slugs */         // collect ancestor pages         $relations = get_post_ancestors($post->ID);         // add current post to pages         array_push($relations, $post->ID);         // get pages slugs         $relations_slugs = array();         foreach($relations as $page_ID){             $page = get_page($page_ID);             array_push($relations_slugs, $page->post_name);         }              /* get the term slugs (non-empty) for event_type taxonomy */         //get the event_type taxonomy values         $event_types = get_terms( 'event_type', 'hide_empty=true' );         $event_types_slugs = array();         foreach($event_types as $event_type){             array_push($event_types_slugs, $event_type->slug);         }              /* find what event_type to display on the current page */         $page_event_types = array_intersect($relations_slugs, $event_types_slugs);         $page_event_types_string = implode(",",$page_event_types);              /* find the events of the event_type to display on the current page */         $args = array(             'post_type' => 'event',             'tax_query' => array(                 array(                     'taxonomy' => 'event_type',                     'field' => 'slug',                     'terms' => $page_event_types_string                 )             )         );         $temp = $wp_query; //assign orginal query to temp variable for later use            $wp_query = null;         $wp_query = new WP_Query($args);              /* run the loop to output the event's details */         get_template_part( 'loop', 'event-details' );      I'm not great at constructing SQL statements. I would really appreciate if you could help me. Thank you very much!!! **EDIT** I have significantly simplified the functionality (as I got quite confused and lost in the original one). Please see my answer. Thanks to @Bainternet for taking the time and trying to help me out!


title: changing notification emails from WordPress <wordpress>@mydomain.net to something else

text: How do I change notification emails address from WordPress @mydomain.net to something else. I want to do this because WordPress @mydomain.net ends up getting flagged as junk mail. Thanks Daniel


title: Wordpress Image update filter

text: I can't seem to find the filter for an image update. Right now I have the code below, which works great until someone clicks on an image in the editor and updates it. Then it throws the height and width back in. Is there a filter I can use to stop this? I've tried several to no avail.               add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );     add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );          function remove_thumbnail_dimensions( $html ) {         $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );         return $html;     }


title: How to Sort Custom columns in admin

text: I have set a custom column for date in admin, but the sorting is not working, when I click to sort the dates are jumbled up and not sorted correctly. This is the sorting function Im using               function sortable_columns() {         return array(             // meta column id => sortby value used in query             'publishdate' => 'date', // e.g. 1344964575                     );     } add_filter( "manage_edit-post_sortable_columns", "sortable_columns" );


title: How do I link to the posts page?

text: How can I link to the posts page that has been set in Settings > Reading? This is for a premium theme so it can't just be the page's permalink.


title: WordPress linking

text: On my homepage, I have several links that should link to different parts of my website. The first link should be redirected to a custom post type that has the slug portfolio. The other links should be redirected to different custom template pages like contact page , about us page, etc. Are there any functions in WordPress that allow me to link to this pages?


title: How to change order of posts in admin

text: Hi I have set a custom post type with some custom fields, one of the custom fields is a date field which is different from the publish date of the post itself, which is by default used by WordPress to sort the posts. I would like posts on this screen to be by default sorted using the custom field. How can I do that, is there some filter? Secondly, I would also like to have a dropdown at the top of the page, so a user can filter posts by custom field.


title: Error: Options page not found when saving my Plugin-Settings

text: after saving my options for my plugin I am getting the options page not found error. After some research, I found, that I may have forgotten to register my option or registered the wrong one. I checked my code, but I do not find the mistake: in **settings.php**               /**     * Register and add settings     */     public function page_init()     {                 register_setting(             'general', // Option group             'my_connect_options' // Option name             //array( $this, 'sanitize' ) // Sanitize         );              add_settings_section(             'general', // ID             'General Settings', // Title             array( $this, 'callback_general_section' ), // Callback             'my_connect_settings' // Page         );                add_settings_field(             'email', // ID             __('Email Adress'), // Title              array( $this, 'email_callback' ), // Callback             'my_connect_settings', // Page             'general' // Section                    );     }          public function callback_general_section()     {         _e('Set you general settings here.');     }          public function email_callback()     {         printf( '<input type="email" id="email" name="my_connect_options[email]" value="%s" />',         isset( $this->options['email'] ) ? esc_attr( $this->options['email']) : '');     }      and in **plugin.php**               public static function init()     {         add_option('my_connect_options');     ...      init() is called by the `plugins_loaded` hook. `page_init` is called by the `admin_init` hook


title: Setting up PubSubHubbub (PUSH) with Wordpress

text: I'm trying to set up PubSubHubbub (PUSH) with WordPress so I can allow updates to be seen in real time, without refresh. I have read many, many tutorials online on how to implement this plugin with WordPress but none have got it working for me yet. Here is what I have done so far: 1) I Downloaded the official PUSH plugin for WordPresss 2) I Created a Hub using Superfeedr with the following settings:   * Sub-domain: http://ianamador.superfeedr.com/   * Name of service: iantest   * URL / Service of service / application: http://caclord.com/buddy1/ (my test website) 3) I Added "http://ianamador.superfeedr.com/" under "Hubs" in my PubSubHubbub WordPress plugin settings. At this point, I am unsure of what to do next in order to get this integrated with an RSS feed and allow automatic real time updates. And I am also wondering if PUSH only works with RSS Feeds or if it could work with other content like blog posts within a loop aswell. Here is my test website: http://caclord.com/buddy1 Here is the URL for my feed: http://caclord.com/buddy1/feed _Any help would sincerly be appreciated guys! :)_


title: DWQA Plugin filters not working for logged in users

text: I am using the DWQA plugin in my wordpress site : http://getlegal.co.in But I am facing a problem. The filters in the plugin such as page navigation, category selection etc don't work for a logged in user whereas they function perfectly fine for a non logged in user. I think there is some problem with the ajax calling. Is there any code in wp-admin/admin-ajax.php and wp- admin/includes/ajax-functions.php which differentiates the way ajax calling is done for logged in and logged out users ? ![When user is not logged in](http://i.stack.imgur.com/WZadu.png) ![When user is logged in](http://i.stack.imgur.com/D6Uz8.png)


title: Shortcodes in Options Panel textareas

text: I am using an Options Panel to create my themes, and I would like to make the textareas from this OP to support my shortcodes too. The code for that creates the textarea fields:               case 'textarea':                 $cols = '8';                 $ta_value = '';                      if(isset($value['options'])) {                         $ta_options = $value['options'];                         if(isset($ta_options['cols'])) {                         $cols = $ta_options['cols'];                         }                      }                          $ta_value = stripslashes($data[$value['id']]);                          $output .= '<textarea class="of-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';             break;      Any idea how can I do that? Please let me know if I should provide more details. Thanks.


title: Error after updating to WooCommerce 2.0.15

text: Warning: in_array() expects parameter 2 to be array, null given in /home/semprebemcasados/www/wp-includes/taxonomy.php on line 2092 Warning: Invalid argument supplied for foreach() in /home/semprebemcasados/www/wp- includes/taxonomy.php on line 2856


title: Redirect to custom login page

text: I have created a custom page for login/registration. Is there any automated way to redirect all wp-login.php calls to that page, or will I need to replace all links manually. For example, on the comments form, I have this default message: > You must be **logged in** to post a comment. The _logged in_ links to the               http://localhost/wp-login.php?redirect_to=url      How can I change this to:               http://localhost/my-custom-login-page


title: Updating wp_attachment_metadata and woothemes catalog images

text: The problem: Need to change the size of all catalog images in my woocommerce themed website. For example: All catalogs images need to be resized from 112w x 112h to 160w x 160h (px) Here are the steps taken so far. The steps below work, but I am looking to see if there's a best solution.   1. Change woocommerce settings to display catalog images 112 x 112px to 160 x 160px   2. Resize all thumbnails using a plugin (a couple of plugins out there)   3. Go to the database, find wp_attachment_metadata and do a search and replace on all entries with width = 112, height = 112, and image name ending in 112x112 Step 1 ensures that all new images upload will be resized to the new size Step 2 resizes all physical images again Step 3 changes all current images attachment sizes in the database to the new size, so that woocommerce can show them properly. If this step is not done, the current images will be displayed with the same height and width and same path as before. First I had assumed that by changing woocommerce settings to 160px (in step 1) would also update the database wp_attachment_metadata, but it doesn't. I don't see anywhere in WP where I can update that information either. WP doesn't seem to keep track of image attachments on the back-end. So I guess my questions is... is this the best or only way to do it? I found a lot of plugins that re-size the actual image, but none of them seem to update wp_attachment_metadata. I searched a lot for just wp_attachment_metada but there doesn't seem to be much on it. I just would like some input from people who have been using woocommerce longer than me, and have more experience with it. Thanks.


title: posts page - different lengths of excerpt

text: is it possible to get wordpress on the posts page to do the following example. the first three posts need to have a large image spanning the width of the title box and a longer excerpt. the rest of the posts need to be thinner and a smaller featured image floated left. How would I go about changing this in the template or loop?


title: Change plugin author after someone leaves the company

text: My company owns several plugins on Wordpress.org. The original creator of these plugins created them using his own Wordpress account, and has now left the company. How can we assume ownership of these plugins (preferably without contacting the former employee)?


title: Get categories names as an array to use it in theme settings

text: I am building a theme and for the Theme Settings Page I followed this tutorial: http://wp.tutsplus.com/tutorials/using-the-settings-api- part-1-create-a-theme-options-page/ What I want now is to have a multi-checkbox with every category. This is what I should have:               $options[] = array(         "section" => "zzz",           "id"      => HS_SHORTNAME . "_multicheckbox_inputs",           "title"   => __( 'Multi-Checkbox', 'hs_textdomain' ),           "desc"    => __( 'Some Description', 'hs_textdomain' ),           "type"    => "multi-checkbox",           "std"     => '',           "choices" => array( __('Category 1','hs_textdomain') . "|category1", __('Category 2','hs_textdomain') . "|category2", __('Category 3','hs_textdomain') . "|category3")     );      However I've tried multiple options but none of them gives me exactly as shown above. I think the answer is close to get_categories() function with no luck. Also tried:               function my_list_cats() {         $cats = get_categories();         foreach($cats as $cat) {             $catsArray[] = __('' . $cat->cat_name . '','hs_textdomain') . "|" . $cat->category_nicename . "";         }         echo implode(', ', $catsArray);     }      And then:               "choices" => array(my_list_cats())      But no luck. Does anyone know a solution? Thank you very much


title: Page vs Custom Post Type - which to use

text: I am creating a few pages (Company, Offices, Contact) and would like to have custom meta boxes for each of those pages. I want the meta boxes to be different for each page, and I don't know if that is possible to have meta boxes be unique for separate pages. On the other hand, I don't know that custom post types are the right way to go either, because I don't want to have multiple Company, Office, and Contact posts. What would be the right way to go about this so that they are single static pages and can have their own unique meta boxes in the admin?


title: Permanently modifying the W3 Total Cache's nginx.conf file

text: I want to have an `add_header` directive inside a location block of the `nginx.conf` (inside the document root) generated by W3 Total Cache like this               # BEGIN W3TC Page Cache cache     location ~ /wp-content/cache/page_enhanced.*html$ {     expires modified 3600s;     add_header Vary "Accept-Encoding, Cookie";     add_header MyHeader "Value";     }     location ~ /wp-content/cache/page_enhanced.*gzip$ {     gzip off;     types {}     default_type text/html;     expires modified 3600s;     add_header Vary "Accept-Encoding, Cookie";     add_header Content-Encoding gzip;     add_header MyHeader "Value";     }     # END W3TC Page Cache cache      Since W3 Total Cache overwrites this file I'd to know a method to keep it permanent.


title: custom uploader in the admin area

text: I am building a wordpress plugin that needs to allow the admin to upload CSS documents, and attach thumbnails. I want to know if there are any methods within wordpress that would be useful in assisting me in building an admin page that allows upload and deletion of css documents and images.


title: Sort search results asc for a custom field

text: i am not a very good developer (better: i am not a developer :), however i want to sort the search results in order of the value of a custom field. the reason is we are using ratings and it would be great to sort search results in order of the rating. everything else should stay the same. i tried severak plugins, none is offering this function. thx so much for any advice! best regards f


title: Wordpress WP_Query() Not working properly

text:
I would like to know why we get an error when we implement this code in our `sidebar.php`:               $categories = get_categories();      foreach($categories as $category)      {        printf('
%s

', $category->cat_name);       $posts = new WP_Query('cat='.$category->cat_ID);       while($posts->have_posts())       {              $posts->the_post();         echo '
', the_title(), '
';        }          print '
';       }      The error we are getting is: > Fatal error: Cannot use object of type WP_Query as array in > C:\xampp\htdocs\wordpress\wp-includes\query.php on line 2374


title: Database tables for sports betting integrated in Wordpress

text: I am currently building a sports betting website, and have problems creating database tables for tipsters who writes sports picks. All the picks should be stored in a database table, with information about the pick, result, statistic etc. Very similar to the tables seen at betshoot.com, betrush.com etc. Can this be done by using custom posts or a specific plugin?


title: Exclude specific taxonomy term when using wp_get_post_terms

text:
i have a single-post_type.php file where i constructud a breadcrumb (or similer to) **i am currently using this to get the terms of this taxonomy:**               $terms = wp_get_post_terms( $post->ID, 'wedding_cat');      .   **Later on i am showing that term like this:**
<?php $term = array_pop($terms);   echo ''. __('Home', 'sagive') . ' » '.__('Wedding Rings', 'sagive').' » slug, 'wedding_cat').'">'.$term->name.','?>
      That way i am only getting one term which is gr8 but..   i need to exclude a specific term comepletly from apearing. How can i do that?


title: Display admin notice only on main dashboard page

text:
I'm using following code to display a notification in the admin dashboard. I want to display only on the main dashboard page (index.php), however the following code would display on all pages in the dashboard. Is there anyway to restrict it only to the dashboard main page? Thanks.               function my_admin_notice() { ?>

<?php _e( 'some message', 'my-text-domain' ); ?>

         <?php     }     add_action( 'admin_notices', 'my_admin_notice' );


title: How to make wp dropdown category load with selected option on top?

text: I have the selected option saved correctly, but when load the page, wp_dropdown_categories still load the list by its order. I prefer to load the selected item on top. How to do this?


title: Functions.php in child theme that loads CSS file breaks website

text: I created a child theme and created a functions.php file in the child theme directory that also has the required style.css file and a seperate custom CSS file that I want to load. This is the code I use:               <? php           add_action('wp_head', 'add_landing_css');     function add_landing_css() {          wp_enqueue_style('landing_css', get_stylesheet_directory_uri().'/landing.css','screen');     }     ?>      When I add this code to functions.php every page on my website is blank. It doesn't load anything. When I delete functions.php file my website works as normal. I use a theme called Modest from elegant themes.


title: Why would post_type be ignored in this query?

text:
In the following query, post_type seems to get ignored resulting in display of all posts from my installation. What have I done wrong?               <?php     function filter_where( $where = '' ) {         $where .= " AND post_date > '2009-03-01'";         return $where;     }     add_filter( 'posts_where', 'filter_where' );          $posts = query_posts( '&showposts=-1&post_type=listings' );          remove_filter( 'posts_where', 'filter_where' );          echo '
';     foreach ($posts as $post) {         echo '
' . get_the_title() . '
';     }     echo '
';     ?>


title: Wordpress adding in anchor elements when I save a page in html editor

text:
This page I am editing in the html editor. I pasted in my list from my text editor. You'll notice that the second last list item is all a link, thats because wordpress has taken it upon itself to wrap the whole thing in an empty tag! Why is it doing this and more importantly, how do I stop it? FYI here is the relevant ul

Target Health & Fitness

7 Sheffield Road Holmfirth HD9 7BW

01484 681000

enquiry@target-leisure.com

      inside that wordpress has added an anchor, if you inspect it using inspector or firebug. I've added these filters thinking they'd work but they haven't               remove_filter( 'the_content', 'wpautop' );      remove_filter( 'the_excerpt', 'wpautop' );


title: wordpress multi user question

text: The blog I'm implementing will have more than one user (different analysts) but there will be only one user (call it the publisher user) who will be checking through the posts and uploading them for everyone. The client wants me add a feature that will allow the publisher user to select which author he is posting on behalf of and that will then display that author's name. How could a approach this issue? I was told to try something with custom fields?


title: Error in buddypress when using wp_editor

text: Since none of plugin works with new wordpress and buddypress for rich text editor I have started to implement it myself manually directly into the theme. After using wp_editor() I got the editor on my fourms and it is posting forums content well without issue. However when I am trying to edit forums post it is not loading any content into the text editor. I am using below code if anyone can help me.               $content = bp_the_topic_text();         $args = array(         'quicktags' => true,        'editor_class' => 'frontend',        'textarea_rows' => 5,        'tabindex' => 1         );     wp_editor( $content, 'topic_text', $args);      This doesnt load the forum post content just wonder. I have tested with the sting and just works fine it loads the string but not the actual content with the function. I dont know either this is the right function to get the content or not. Thanks a lot in advance.


title: Call a function on every wordpress pages only

text: I have written a security function.I want to call this function in all pages which are created by wordpress back end only (Does not want want to called by all php files).Is there any hook available?.Please Help


title: Buddypress: Add a tab in buddypress with wordpress recent posts, blog posts?

text: I trying to create a buddypress profile tab that takes in recents blog posts, either by using a blog page the is read within the tab och feeding recents post only? I found this code, but I don't know how to extend this further:               //Buddypress add profile tab Latest Post     add_action( 'bp_setup_nav', 'latest_post_nav' );          function latest_post_nav() {         global $bp;         $parent_slug = 'recent_post';         $child_slug = 'recent_post_sub';         //name, slug, screen, position, default subnav         bp_core_new_nav_item(                          array(                                 'name' => 'Posts',                                 'slug' => $parent_slug,                                 'screen_function' => 'my_profile_page_function_to_show_screen',                                 'position' => 50,                                 'default_subnav_slug' => $child_slug                          )          );     }     function my_profile_page_function_to_show_screen() {              //add title and content here – last is to call the members plugin.php template         add_action( 'bp_template_title', 'my_profile_page_function_to_show_screen_title' );         add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen_content' );         bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );     }          function my_profile_page_function_to_show_screen_title() {         echo 'Recent Post';     }          function my_profile_page_function_to_show_screen_content() {         echo 'See the latest articles';     }


title: Buddypress: Adding several profile tabs in buddypress with differents links to pages?

text: I want to create several custom tabs in the profile that are linked to different pages? Example, I click that tab, it gets me to a page..But each tab goes to different pages..


title: Twitter share button displays 1 share in single post but 0 in the post index page?

text: I'm displaying the Twitter button this way in both single.php and index.php: **index.php:**               <?php if (have_posts()) : ?>              <?php while (have_posts()) : the_post(); ?>                        (etc...)                        <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-via="ChineseLearnOL">Tweet           **EDIT:** button from single.php:               <iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.1397165098.html#_=1398689426849&count=horizontal&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&size=m&text=Learning%20Mandarin%20Chinese%20Insights&url=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&via=ChineseLearnOL" class="twitter-share-button twitter-tweet-button twitter-count-horizontal" title="Twitter Tweet Button" data-twttr-rendered="true" style="width: 104px; height: 20px;">      button from index.php:               <iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.1397165098.html#_=1398689298272&count=horizontal&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&size=m&text=Learning%20Mandarin%20Chinese%20Insights&url=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&via=ChineseLearnOL" class="twitter-share-button twitter-tweet-button twitter-count-horizontal" title="Twitter Tweet Button" data-twttr-rendered="true" style="width: 104px; height: 20px;">      Seems like a different button with the same URL. How to fix that?


title: How can I determine what mode the editor is in and when it changes?

text: I need to determine if the page/post editor is in Visual or Text mode. I also need to determine when this changes. Does WordPress provide some kind of functionality for doing this? I am writing some JS that requires this information.


title: Custom editor preview of shortcode?

text: With the new WordPress 3.9 release, the official WP gallery shortcode has a beautiful preview functionality. I have an old slideshow plugin written and now I'm wondering where I should start looking if I want to make a similar preview functionality for my plugin.


title: Different styles on multiple pages

text: I'm using _s to build a theme. I want to have different styles for different pages. I can figure out how to get two pages working but I want different styles for 5 pages? Maybe an else if statement? I would really appreciate some help. here is my code.                if (is_page_template('page-templates/page-about.php')) {             wp_enqueue_style( 'sentiencesentient-layout-style' ,    get_template_directory_uri() . '/layouts/about.css');         } else{             wp_enqueue_style('sentiencesentient-layout-style' , get_template_directory_uri() . '/layouts/content-full.css');                  }      many thanks


title: Why are plugin settings not all nested in one place?

text: Through my modest usages of WordPress, i have encountered many plugins. Some of them have menus displaying at the bottom of the menu panel, some are inserted within the menu panel as if they were WP native, and some are hidden away in the settings tab. My question is in two parts : 1 - What are the historical reasons for this variety ? 2 - Is it seen by the WP team as something that should / will be fixed ? It feels confusing to new users !


title: How to automatically trigger a link if user has already been in the page?

text: I need a solution in php or javascript to make trigger a link to a internal #anchor when the user has visited the page for second time. can you help? the theme is a SINGLE PAGE one that shows all the pages in 1 and user when a link is clicked slides to the next page. I would like the script to detect if it is more than the 1st visit and automatically slide to a page... I tried different approachs, I don't know how to do it more efficient. Would like to do it with PHP.. This code I added to functions.php but doesnt work!               function redirect_user() {                 $expire = time() + 60 * 60 * 24 * 30; // expires in one month                $visits = 1;                 if(empty($_COOKIE['visits'])){                      setcookie('visits', $visits, $expire);                 } else {                       $visits = $_COOKIE['visits'];                       $visits++;                        setcookie('visits', $visits, $expire);                   }                  if($visits <= 1){                    wp_redirect('http://www.page.com');                   } else {                   wp_redirect('http://www.page.com/');                  }         }          add_action( 'init', 'redirect_user');      Maybe there is a better approach... i feel lost :( I want to really add this php not to the functions.php but to the page template so it slides...


title: Conditional Tags If Custom Post Parent & Child?

text: Check on the single-artists.php whether we are viewing the parent or child of the said custom post? Tried this but always shows the top child content, rather then showing the two different area               <?php if ('artists' == get_post_type()  || $post->post_parent=='artists') { ?>                     the child single-artists.php          <?php } else { ?>                     the parent single-artists.php               <?php } ?>


title: Ajax (jquery) wp_query pagination returns -1

text:
I am currently developing an ajaxified theme for wordpress. I am listing the posts in a particular category, but the pagination returns -1 when clicked. Lets say I set showposts to 3 and a particular category has 2 posts, the link to previous posts does not show up as expected. Now if the category has 5 posts, the link to previous posts shows up, again as expected, but when I click on it, -1 is returned. Here is my code:               <?php     $category = get_category_by_slug($_POST['catname']);     $wp_query = new WP_Query();     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $wp_query->query('cat='.$category->term_id.'&showposts=1&paged='.$paged);     ?>          <?php     while ($wp_query->have_posts()) : $wp_query->the_post();         get_the_title();     endwhile;     ?>
<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>
     <?php     ?>      Also, the link of the previous post is `http://domain.com/wp-admin/admin- ajax.php?paged=2` which I suspect might be the root of the problem. Can anyone help please? Thanks


title: Creating my own portfolio custom-type

text: I'm using WordPress to build my photography portfolio. So far I've created a _Custom Post Type_ called `session` for each photo session, and I've managed to list all the sessions with each thumbnail in the home page. Now, however, I have to create the content of each `session`. I'd like to keep it simple:   * The title   * A small description (if any).   * A set of pictures, that should appear straightaway in the post.  The problem is that I don't know how to face the inclusion of the images. Looks like using a _gallery_ is not what I'm looking for, because it generates a set of thumbnails, and I just want the images in full size in the post. What's the best way of doing this? The ideal case would be to have something like `the_images_of_this_post()` so I could place them at will from the template file. Thanks!


title: how to programmatically change post tags

text: Is there a php function which can add/remove tags of posts? If not how would I do this? I am looking for something like this:               add_tag($post_id, 'tag-name');     remove_tag($post_id, 'tag-name');


How to change the default orderby from "Date" to e.g. "Title" or my custom column in content type records list in admin? Right now the created or cahnged is always the first. But I want to order the records by my custom field (I already have created it with a sort functionality following the advice here: http://justintadlock.com/archives/2011/06/27/custom-columns-for-custom-post- types) My question is how to set the orderby as default to e.g. title or my custom column called "expiration". Is there any hook for that?


title: The Loop for my theme with static front page is not working

text: I'm developing a wordpress theme that uses a static page as front page. My wordpress is configured to use "Home" page as its front_page and "Blog" page to show the blog posts. When i try to use the loop on my "Blog" page to list the posts i get a odd behavior, the loop runs fine but any method to get the post information returns an empty string. Sample code:               if (have_posts()) {       while(have_posts()) {         the_post();         $posts[$index] = array(                     'title' => get_the_title(),                     'permalink' => get_permalink(get_the_ID()),                     'content' => get_the_content(),                     'day' => get_the_date('j'),                     'month' => get_the_date('M')                     );         $index++;            }     }      If i have 5 posts that yould return me an array with 5 elements, all of them with empty strings as the values. If i add `query_posts('posts_per_page=5');`. it works, but that shouldn't be needed. What am i missing? You can check the complete source code on github: https://github.com/albertein/coltsintheme Thank you _UPDATE_ : Even if i avoid using a static page as front page (delete front- page.php and configure wp con Settings>Reaging) I'm getting the same results which seems weird to me, it seems I'm missing something.


title: JavaScript enque stopped working

text: Somewhere along the line I have messed up my js enqueue I am not sure how. I have the following in my functions.php file and I am including `<?php wp_footer(); ?>` in my footer.php before the js files were outputting in the footer no problem, but now it isn't working and I don't know why?               function foundationScripts() {         if (!is_admin()) {              wp_deregister_script('jquery');         wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false, '1.7.1',true);         wp_enqueue_script('jquery');            wp_enqueue_script('modernizr.js',get_template_directory_uri() . '/javascripts/modernizr.foundation.js',false,false,true); // for some reason this adds extra quotation marks in the body       wp_enqueue_script('foundation.js',get_template_directory_uri() . '/javascripts/foundation.js',false,false,true);       wp_enqueue_script('app.js',get_template_directory_uri() . '/javascripts/appF.js',false,false,true);       }              add_action('init', 'foundationScripts');     }


title: wp_nav_menu doesn't generate parent/ancestor classes

text: I don't know why the proper classes for menu item are not generated - all the elements in the tree which has subtree get only `menu-item menu-item-type- post_type`. The elements, which don't have children, get proper classes after being clicked (active). Link: http://lichens.ie/ Part of the menu structure: http://imgur.com/5Lj00.png Code               $args = array(         'menu'      => 'Main menu',         'container' => '',         'menu_id'   => 'nav',     );     wp_nav_menu($args);      When you visit e.g. http://lichens.ie/view-lichens-by/lichens-by-habitat/ you can see that it has no 'current' class. As well as it's parent. PS Sorry for posting 'not working links' - it's because of reputation limitation Any ideas - help much appreciated.


title: List Category Plugin - Changing the links

text: Using the list category posts plugin I'm trying to work out how to include a title for the link In my main theme the links are styles as follows:               Post title      I want to do that using the category list plugin too, can that be done using the shortcode tags or would I need to put together a template?


title: Customizing page content layout

text: For a while now I have been building WordPress based sites for clients. These sites tend to be brochure sites so feature a collection of pages all with slightly different layouts within an overarching main layout and style. Upto this point I have either created Pages in the WordPress admin panel and then created a page template with the content embedded into it (not great when the client want to be able to update the page) or created a new page and a generic "page" template and then placed content into this using HTML in the editor (not great for the user trying to edit the content in the editor, or when the editor decides to add more HTML tags) Is there another way to easily create pages where the user can easily update the content using the editor but wont risk screwing up the layout? something like multiple editors or content areas in the admin panel?


title: Adding a pagenavi to function for displaying bookmarks

text:
I have a plugin user bookmarks - see here -  and I'm trying to add a to it so the bookmark posts don't pile up like crazy. How can I do it? This is the function that displays the bookmarked posts.               function upb_list_bookmarks( $delete_link = true, $delete_text = 'Delete' ) {     if(is_user_logged_in()) {         $display = '
';             $bookmarks = upb_get_user_meta(upb_get_user_id());             if($bookmarks) {                 foreach( $bookmarks as $bookmark) {                     $display .= '
';                     $display .= '
';                     $display .= '
';                     $display .= '';                     $display .= '';                         $display .= '';                         $display .= '';                         $display .= '
';                                               $display .=  limit_text(get_the_title($bookmark), 25);                                              $display .= '
';                         $display .= '';                         $display .= '';                          $display .= '';                         $display .= '

';                         $display .= '

';                             if($delete_link) {                             $display .= '' . 'remove' . '' ;                         }                         $display .= '
';                                            $display .= '
';                 $display .= '
';                 }             } else {                 $display .= '
You do not have any favorited looks :(
';             }         $display .= '
';     }     else {         $display .= 'You must be logged in to view your bookmarks.';     }          return $display;     }


title: Category slug field missing with registered custom taxonomy

text: I have registered a new taxonomy term using the same code on two different sites. On one site (a vanilla install), If I go to my taxonomy term in the admin menu, I see a 'slug' option for the add category screen. On my other site, with all plugins disabled, this slug option does not appear. Anyone know what might cause this? Register taxonomy code:               register_taxonomy( 'my_topics',      array( 'post', 'page' ),      array( 'hierarchical' => true,      'label' => 'my Categories',      'query_var' => 'topics',      'rewrite' => array('slug' => 'topics')     ) );


title: Single random post in homepage

text:
I want to display single random post in it's entirety in the homepage.I've tried many methods, but the main issue was that it won't display the content, only heading, or display content, but only an excerpt. Now I have this code:               <?php     query_posts(array('orderby' => 'rand', 'showposts' => 1));     if (have_posts()) :     while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php the_content(); ?>          <?php endwhile;     endif; ?>      One problem is that it doesn't display full post, only excerpt.Another problem is that it displays only heading and content and I want all the things I get in single.php.The biggest problem is that my custom code:               <?php          if(in_category('afghanistan')) {     $recent = new WP_Query("pagename=asia/afganistanas"); while($recent->have_posts()) : $recent->the_post();?>
<?php the_title(); ?>
            <?php the_content(); ?>     <?php endwhile;     }     else {     echo "Klaida!";     }     ?>      which displays a page inside of post depending on the category of post doesn't word in index, but does work in single.php **Is there any method to use a copy of single.php in index and give it a random post to load every time the page is refreshed ?**


title: Using custom taxonomies to display hierarchical URLs?

text: I can't seem to get my custom taxonomy hierarchy working properly. It seems like many other have had this problem but none of their fixes work for me. I would like to have a URL structure similar to the default category functionality. **Example**               http://domain.com/category/sub-category/subsub-category/postname      But it currently works like this               http://domain.com/custom-post-slug/post-name      I would like to be able to have an archive page for each category and sub category with the specified taxonomy. Is this possible? I've tried everyones proposed solutions, but nothing seems to work. Any advice?               function social_create_venue_post_type() {              register_taxonomy("venues",             array("venues"),             array(                 "hierarchical" => true,                 "label" => "Venue Type",                 "singular_label" => "Type",                 'rewrite' => array('hierarchical' => true, 'slug' => 'type' )             )         );              register_post_type('venues',             array(                 'labels' => array(                     'name' => 'Venues',                     'singular_name' => 'Venue',                     'add_new' => 'Add Venue',                     'edit_item' => 'Edit Venue',                     'new_item' => 'New Venue',                     'add_new_item' => 'Add New Venue',                     'view_item' => 'View Venue',                     'search_items' => 'Search Venue',                     'not_found' => 'No Venues Found'                 ),                 'public' => true,                 'has_archive' => true,                 'hierarchical' => true,                 'menu_position' => 5,                 'capability_type' => 'post',                 'supports' => array('title','editor','page-attributes','excerpt','thumbnail'),             )         );     }


title: Add url from Custom Field as 'Featured Image'. Code not working

text: I'm trying to migrate a site to WP. We have a whole bunch of pictures, and I have done some research and figured -- I think -- my best bet is a CSV import of the data, storing the relative URL of the image as a custom field. So, I found this --which looks ideal -- and I implemented it thus (in functions.php with a global call added as I was getting a 'no object' error):               function store_cf_featured_image() {     global $post,$wpdb;          $uploads = wp_upload_dir();          // Get all attachment IDs and filenames     $results = $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file'");          // Create an 'index' of attachment IDs and their filenames     $attachments = array();     foreach ($results as $row)         $attachments[ intval($row->post_id) ] = $row->meta_value;          // Get all featured images     $images = $wpdb->get_results("SELECT post_id, meta_value AS 'url' FROM $wpdb->postmeta WHERE meta_key = 'featured_image'");          // Loop over each image and try and find attachment post     foreach ($images as $image) {         if (preg_match('#^https?://#', $image->url))             $image->url = str_replace($uploads['baseurl'], '', $image->url); // get relative URL if absolute              $filename = ltrim($image->url, '/');              if ($attachment_ID = array_search($filename, $attachments)) {             // found attachment, set post thumbnail and delete featured image             update_post_meta($image->post_id, '_thumbnail_id', $attachment_ID);             delete_post_meta($image->post_ID, 'featured_image');         }               }               }          add_action( 'init', 'store_cf_featured_image' );      However, when I put a link in my custom field 'featured_image', and save it... nothing. No errors, but no nothing. I update the post and come back to it, but the link is still just a link the the custom field and no 'featured image' has been set. Does anyone have any ideas what the issue might be? an am I right in thinking this will store the image as part of built in 'Media Library', now? AlsoAlso: Will I be able to adapt this code to pull in Alt text etc for each image from custom fields. Any input greatly appreciated! Thanks.


title: Plugin that generates a page of post content

text: My script is generating a duplicate **post** even after I explicitly state that the post_type should be a **page**. It also ignores the `$post_title`, which I do not want to create a duplicate post if the title already exists. Can anyone figure out why it's creating a post instead of a page?               function av_generate_page($post_id) {          $post_info = get_post($post_id);     $post_slug = $post_info->post_name;     $post_title = $post_info->post_title;     $page_exists = get_page_by_title($post_title);     if($page_exists){ exit(); }     $detail_level = get_post_meta($post_id, 'detail_level', true);     $formats = wp_get_post_terms($post_id, 'formats', array('fields'=>'slugs'));          $page = array(         'post_type' => 'page',         'post_title' => $post_title,         'post_content' => '[['.$post_slug.']]',         'post_status' => 'publish',         'post_parent' => 8800     );     if( !$page_exists ) {         if (in_array('brief-segment',$formats)){             // Do not create a page for brief segments         }else{             $new_page_id = wp_insert_post($page, false);             update_post_meta($new_page_id,'suf_hide_page_title','on');             update_post_meta($new_page_id,'_wp_page_template','no-sidebars-no-comments.php');                 if(in_array('internal-only',$formats)){                   add_post_meta($new_page_id,'InternalOnly','yes',true);                 }         }     }else{         // Do not create a page     }        } add_action('publish_post', av_generate_page, 12);      **EDIT** How _would_ I pass the current post id to be used as my ID for generating a page? As a premise for why I'm embedding a post into a page (provided that that page has not already been created), I'm creating a **hierarchical treeview of pages**. Because posts are flat, I need to create a page each time I create a post and move it to the appropriate place in the hierarchy. Why am I not simply creating a page instead? Because I need to create multiple pages for each post based on the multiple categories that they apply to. Yes, they are tagged with the categories in the post, but I still need to provide the list of pages that I cannot do with a post. Therefore, I'm creating a page that can live in a hierarchy and references a post that I can thus reference in other pages as well.


title: Custom Post Type Single Loop Outputting Wrong Post

text:
I have been unable to get my single-portfolio.php template to behave properly. So I have a custom post type called portfolio. I am displaying all of those posts in the front-page.php and it works perfectly fine. Here is the loop for the front-page.php: http://pastie.org/4268087 For the life of my however, I cannot get the right post to show up in my single-portfolio.php template. Basically, if I go to one of my posts (so for example, lets say http://example.com/portfolio/test-post/) I end up with a single post page that displays the wrong post (so instead of "test-post" I get "wrong-post"). No matter what post I open up, it will be the exact same post that is displayed ("wrong-post"). If I set the posts_per_page to infinite, it will show me all of the posts. I have tried many different Loops. I have tried the exact same loop as shown above, as well as the default custom post type loop found in the Wordpress Codex:               $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();         the_title();         echo '
';         the_content();         echo '
';     endwhile;      Any suggestions on how to solve this? Thanks,


title: Failed to load resource:404 image

text: website is http://pleevi.com. when i look on the problems with the website, i get this. http://i.imgur.com/aHQky.png here is the entire list of what i get as i cannot post more than 2 hyper links :( none of the images on my website will load. strange thing is that on my computer the images show up and everything is normal, but when i go to another computer, none of the images show up. any help would be appreciated


title: Unable to access new installed theme

text: Bear with me as I am new to this.I am running 13.10 desktop. I installed Wordpress LOCALLY on my computer. I already have a website that will eventually be replaced and want to create the site myself then load to our hosting servers. I am unable to access the theme that I purchased and installed through my Dashboard. The theme file is located with the other theme files that already come with WP. The new Theme file has the same read/permissions as the rest of the themes. I can access the new file and see all its contents but unable to access through Dashboard and customize. Mysql and PHPMYADMIN are all current. Any idea?


title: Things to take care before installing wordpress Manual v/s Softaculous

text: I have cleared up the first step  on moving to Self-hosted wordpress. Now I have a confusion if someone can answer: 1: My hosting provider's tutorial shows installing WP from cPanel using tool called Softaculous. Is it a good way to use that utility or do by grabbing the wp package from wordpress.org and do everything manually? I tried and it was easy but want to know pros/cons. Using Softaculos I am confused with the two things: a: Choose protocol: It has options: `http://, http://www, https:// and https://www` I know my site isn't using ssl so now what should I choose `http:// or http://www` And why should I chose one over other? b: In Directory: Asking me where should I install it? in the root or sub- directory e.g. `http://mydomain/wp` What should I choose there? And why? Primary purpose of my site is I will be blogging. In future I don't know what it could turn out? If I install it in say a sub-directory say root/wp, I found that I can set the Site Address(Url) from WP Admin panel. I want to do it right in terms of SEO rankings, maintenance and future changes. Any explanation / suggestions appreciated. Thanks.


title: How do I remove the entire Media section from the main WordPress navigation without just hiding it?

text: I would like to remove the entire "Media" section from the main WordPress admin navigation ont he left hand side. What I don't want to do is just "hide" it with CSS or a plugin/function like I have done so below, because it's still accessible via the URL. This is crucial users shouldn't see each others uploads by any means. Here's what I currently have, which just hides it. If you went to upload.php in the url, you could still access it.               add_action( 'admin_menu', 'remove_menu_links' );     function remove_menu_links() {         remove_menu_page('upload.php'); //remove media     }      Any ideas? A suitable method I believe would be to just direct the user to the dashboard with an error message if they tried to access the upload.php url? Not sure how to do this though.


title: Trying to avoid including wp-load.php

text: I am working a plugin where I am trying to connect an HR system with WordPress. There is an XML API on the HR system so I have written the plugin to take the data and put it into a WordPress database table specific to my plugin. This is all done via the built in AJAX etc but there was a request for the person to be able to schedule a task so that it wasn't querying the HR system on every site visit (the list of positions need to be displayed on the site front page). Then the problem becomes syncing. This is an IIS environment so they want to use Scheduled Tasks to sync the site. I explained the WordPress scheduled task API but they prefer to have it sync manually through their own infrastructure. How do I create code (essentially a php file) that can be run by a scheduler without username/password without calling wp-load.php? Their scheduler needs to be able to run a URL alone so this makes it somewhat difficult. I'm trying to explain this without code since its a generic problem but in this case, the bulk script I have created and works looks like this:               if ( !defined('WP_LOAD_PATH') ) {              /** classic root path if wp-content and plugins is below wp-config.php */         $classic_root = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/' ;         //echo $classic_root;         if (file_exists( $classic_root . 'wp-load.php') )             define( 'WP_LOAD_PATH', $classic_root);         else             if (file_exists( $path . 'wp-load.php') )                 define( 'WP_LOAD_PATH', $path);             else                 exit("Could not find wp-load.php");     }          // let's load WordPress     require_once( WP_LOAD_PATH . 'wp-load.php');          // If the plugin class is not found, die.     if (!class_exists('Aragon_eRH_RSS')) {         die('Aragon-eRH RSS not installed.');     }          $core = new Aragon_eRH();     $core->aerh_xml_parser_bulk();      Now they can run http://site.com/wp-content/plugins/aragon-erh-rss/lib/bulk- sync.php?nonce=thenonce This performs the syncing function. Note that there is a nonce required and can be changed from the plugin's admin menu. See screenshot below: ![Admin Screnshot](http://i.stack.imgur.com/tO305.png) Note: I want to avoid it because:   1. Considered bad practice   2. Plugin was rejected due to including WP-Load


title: Custom Post Types cause 404 for pages?

text: I have looked at the previous post here regarding a similar issue but what resolved them issues doesn't want to work for me. Basically, I have a custom post type for football players for my home team, the slug for this post type is players and my permalink structure is /%category%/%postname%/ Now when I create a new player, and go to view the post, I get a 404, so I go to permalinks and click save. The custom post type of the player now works but with a strange issue, my pages now come back with a 404, post seem to work fine and aren't effected? Now I am using a plugin called Easy Custom Content Types by Pippin, but this error also happend for me when using the Custom Post Type UI. I have tried different themes, deleting the .htaccess and nothing seems to work. The strange thing is that if I change the permalink structure back to default there is no issue, but I don't want that, I want to be able to use the permalink structure I'm currently using minus the errors. So can anyone help to resolve this annoying error. Thanks


title: High traffic management in WP

text: I have to develop a site in Wordpress similar to an already existing site in JSP which handles approx.`50K users a day and 200 users` at a time. And in load testing i get that wordpress can handle only `40 users` at a time (with `Super Cache` plugin `ON`). Also I have hosted my site on a `Shared hosted server`. So please suggest me some way or guide me to `optimize` my wordpress site so that it can also handle the same traffic. Thanks in advance.


title: hybridauth (google OAuth integration) and WP problems

text: I'm trying to implement the script shown here: http://hybridauth.sourceforge.net/userguide/Integrating_HybridAuth_SignIn.html To allow people to sign in with Google to my site. However I am getting 302 moved, or "`headers already started`" errors. I suspect it has something to do with paths; whereas the hybridauth code is in my theme folder (thats the only way I can include it, or am I wrong?) the callback API can't access /wp- content/themes and so on. Does anyone have any advice on these and what to do?


title: Change the functionality of wordpress users module in admin

text: I want to restrict wordpress admin to view all users in user list. For say, I have created custom roles (company users, employee). A company user type role can have multiple employees. I want wordpress admin to only view company users. I got, `args` in `function prepare_items()` inside `WP_Users_List_Table` class can filter this. So have tried to override this in my theme's functions.php.               function my_prepare_items(){              //my custom code goes here          }     add_action( 'prepare_items', 'my_prepare_items' );      But it's not working. How and where I can override this functionality without touching core wordpress methods? EDIT : This I want in admin UI. Thanks in advance.


title: Blog only showing code

text: I would like to have some help. I host a wordpress blog in my raspberry pi running apache2, but when I browse the blog it only shows the code as you can see here http://lifeonpi.sytes.net/raspgrammer/ what can i do? what is the problem with it? any help?


title: Get new (not old) post inside transition_post_status hook

text: Following up the ticket 'transition_post_status' is executed before 'save_post', I'm still struggling how to access the **new** `$post` (after it has been saved) inside a `transition_post_status` hook. Right now, I'm getting the old $post data (before it has been saved). Example:               add_action('transition_post_status','myfunc',10,3);     function myfunc($new_status,$old_status,$post){           if ( $new_status == 'publish' && $old_status != 'publish') {      // a post is getting published              if(!check_my_post($post->ID)){ //how can I get the saved/new post here?                ...             // do something              }            }          }      Changing priorities does not make any difference. Any ideas how to achieve this?