title: How to get the post id (of the parent custom custom type) in a loop inside a widget?

text:
Below there is a widget with a Wordpress loop inside. It works as expected. The only problem is this part:               'post_parent' => $post->ID,      The widget is not getting the `post->ID` of the parent of the current `topic` custom post type (with is another custom post type called `forum`). It does work when I place the loop in a template file. This:               <?php $current_post_id = $post->ID; ?>
<?php echo $current_post_id; ?>
      Outputs a post id (the forum custom post type which is the parent of the topic custom post type).               /**      * Most voted topics widget      */     class MostVotedTopics extends WP_Widget {         /** constructor */         function MostVotedTopics() {             parent::WP_Widget(false, $name = 'Most Voted Topics');         }              /** @see WP_Widget::widget */         function widget($args, $instance) {             extract( $args );             $title = apply_filters('widget_title', $instance['title']);             ?>               <?php echo $before_widget; ?>                   <?php if ( $title )                         echo $before_title . $title . $after_title; ?>                          <?php // Display the top topics of current forum                         $args = array(                             'post_type' => 'topic',                             'posts_per_page' => '3',                             'post_parent' => $post->ID,                             'gdsr_sort' => 'thumbs',                             'gdsr_ftvmin' => '1',                             'gdsr_order' => 'desc',                             'order' => 'DESC'                         );                     ?>                      <?php query_posts( $args ); ?>                         <?php while ( have_posts() ) : the_post(); ?>

                          <?php $current_post_id = $post->ID; ?>
<?php echo $current_post_id; ?>

<a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?>
                                     <?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?>                  <?php echo get_avatar(get_the_author_meta('user_email'), 64); ?>                      <?php the_author_meta('nicename'); ?>
Last modified on the: <?php the_modified_date(); ?>. by: <?php the_modified_author();?>

Time last modified: <?php the_modified_time(); ?>
             <?php echo time_ago(); ?>

<?php wp_gdsr_render_article_thumbs(); ?>
                                              <?php preg_match( '!
(.*)
!si' , wp_gdsr_render_article_thumbs(0, false, "", 0, "", false) , $n );                                         $thumbs_number = strip_tags( $n[1] ); ?>                                              <?php if ( $thumbs_number == 1 || $thumbs_number == -1 ) : ?>                                             <?php _e( 'vote' ); ?>                                         <?php else : ?>                                             <?php _e( 'votes' ); ?>                                         <?php endif; ?>

<?php bbp_topic_reply_count(); ?>
                                         <?php if ( bbp_get_topic_reply_count() == 1 ) : ?>                                             <?php _e( 'reply' ); ?>                                         <?php else : ?>                                             <?php _e( 'replies' ); ?>                                         <?php endif; ?>

<?php bbp_topic_freshness_link(); ?>
                                                                                <?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'size' => 14 ) ); ?>
                          <?php $most_voted[] = get_the_ID(); // get the id of the most voted post ?>
                         <?php endwhile; ?>                 <?php wp_reset_query(); ?>                 <?php print_r($most_voted); ?>                        <?php echo $after_widget; ?>             <?php         }              /** @see WP_Widget::update */         function update($new_instance, $old_instance) {         $instance = $old_instance;         $instance['title'] = strip_tags($new_instance['title']);             return $instance;         }              /** @see WP_Widget::form */         function form($instance) {             $title = esc_attr($instance['title']);             ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
             <?php         }          } // class FooWidget          // register FooWidget widget     add_action('widgets_init', create_function('', 'return register_widget("MostVotedTopics");'));      Any suggestion to fix this?


title: programmatically adding categories to custom taxonomy

text: wp_create_category() adds new categories to the 'content' taxonomy associated with the post type... Simple question really neither wp_create_category() or wp_insert_category() allows configuration for taxonomy type... so how can I can do it?


title: populate array with posts

text: I want to generate an array of custom post types to add it to a options array. I'm doing this to show a checkbox group populated with custom post type. I have this array:               'options' => array (           'one' => array (               'label' => 'Option One',               'value' => 'one'           ),           'two' => array (               'label' => 'Option Two',               'value' => 'two'           ),           'three' => array (               'label' => 'Option Three',               'value' => 'three'           ),           'four' => array (               'label' => 'Option Four',               'value' => 'four'           )       )      How can i replace this with a custom post type? i'm trying this:               function get_sponsors()     {         $args = array(         'numberposts' => -1,         'post_type' => 'movies'         );              $my_movies = get_posts( $args, ARRAY_A );              return $my_movies;     }      I'm using the code in this article: Reusable Custom Meta Boxes Part 2


title: Remove "Content" and "Discussion" from Right Now Dashboard Widget

text: How do I hide "Content" and "Discussion" element in the "Right Now" dashboard widget? Here's a screenshot: ![right now dashboard widget](http://i.stack.imgur.com/EtPQT.png)


title: Why does this loop only work on the homepage?

text:
I've been trying to figure this out all day now. Consider the following code below:

<?php            wp_reset_query();              if(have_posts()) :                 while (have_posts()) :                   the_post();                  if(is_sticky()) : ?>
<a rel="bookmark" href="<?php the_permalink() ?>"><?php echo the_post_thumbnail('full'); ?>
<?php the_title(); ?>

                  <?php endif;                endwhile;               else: ?>
Sorry, no posts matched your criteria.
              <?php endif; ?>

      The loop above doesn't work on the site's pages (e.g: page 2/3/4) or 404.php, but works perfectly fine on page 1 (the index.php). Why is that and how do I fix this?


title: Custom post type navigation - 404 on page 2

text: I have a custom post type `portfolio` and now I'm trying to enable navigation for the template where 10 portfolio items are shown. I'm using the following code to query the posts:               if ( get_query_var('paged') )          { $paged = get_query_var('paged'); }     elseif ( get_query_var('page') )          { $paged = get_query_var('page'); }     else          { $paged = 1; }     $posts_per_page = get_option('posts_per_page');          $offset = ( $posts_per_page * $paged ) - $posts_per_page;          query_posts(array('paged'=>$paged, 'posts_per_page'=> $posts_per_page, 'post_type'=>'portfolio', 'offset' => $offset));      The current link structure is as follows:               domain.com/portfolio //main portfolio page, showing 10 portfolio items     domain.com/portfolio/item //shows a single portfolio item     domain.com/portfolio/page/2 //should show the next set portfolio items, but shows a 404 error instead.      I'm assuming the problem is that when you visit `domain.com/portfolio/page/2` that WordPress assumes that `page` is a portfolio item, so it looks for that specific portfolio item rather than showing the next portfolio page. How could I solve this issue? I'd rather not change the link structure for easier browsing. I do not want to use a plugin like `WP Page Navi`, so this is not a duplicate with Pagination not working with custom loop


title: Archive page for custom post type not working

text: I use a plugin called CPT-onomies to create Custom Post Types. I created a post type called "case", and set "Has Archive Page" to true, but when i try to view a single case, i just get 404'd. Same thing also happens if i try to view the actual archive, eg. "site.com/case" and not "site.com/case/case-item". Here's a screenshot of my settings: http://i.imgur.com/6rJgdhS.png I've tried disabling/enablind it, no success. I also tried changing permalink structure of the whole site (from settings -> permalinks) because sometimes that doesn't update. Have i missed something in the settings or is this a bug in the plugin? I've gone through it several times and i can't find anything that would prevent it from working. I have a template file called `single.php` that should be used. I also tried `single-case.php` but that didn't make any difference. # Solution I found a solution here: http://gabrieleromanato.name/wordpress-fix- the-404-error-on-custom-post-types/


title: get_all_category_ids for bookmark

text:
I was wondering how to create a list of categories name and ids for Wordpress Bookmarks such as `get_all_category_ids` for post. I tried using the `get_bookmarks`, but the category does not appear in it. **Update** : Based on advice from @Mridul-Aggarwal, I wrote code that might be useful:               <?php         $tautan=get_terms('link_category');//get links category object         $html="
\r\n";//Init              /*Looping*/         foreach($tautan as $isi) {             $nama=$isi->name;             $id=$isi->term_taxonomy_id;             $html.="\t
$id - $nama
";         };         $html.="
\r\n";              /*Output*/         echo $html;     ?>


title: Wordpress admin right sidebar isn't working

text: I don't what happened but few times ago its working and now i don't what i did so it stops working, I want its quick fix, Currently when we're adding new post it looks like that screenshot : ![enter image description here](http://i.stack.imgur.com/JOI0t.png) Column is already 2 and nothing changed when we use 1 column, I want its right sidebar.


title: Load .txt file for login_message in wp-login.php

text: How do I load the contents of a text file - or any other file, like .php - and use the test for the `login_message` hook that prints a message above the `#login` box in wp-login.php? _(BTW, this is in a child theme, if it makes a difference.)_               function custom_login_message() {          $message = get_bloginfo('stylesheet_directory')."/tos.txt";     return $message;     }     add_filter('login_message', 'custom_login_message');      Right now, the function above prints out the URL of the file, not the text in the file, i.e.: ![enter image description here](http://i.stack.imgur.com/xb3QP.png)


title: How to re-arrange the MENU of "Allure Real Estate Theme for Placester" wordpress theme?

text: I am using "Allure Real Estate Theme for Placester" wordpress theme, I tried the below three methods but no positive result in realtypointusa.com   1. I tried in Dashborad-> Appearance-> Menus and re-arranging but it didn't worked. I got a blank white screen as output on pages.   2. Rearranged the below code, (As its a html code with embedded PHP, it not being rendered here properly. I tried posting it as an image but new users are not allowed so please click on the below link to look on the snippet or code.) CLICK HERE TO SEE THE CODE USED TO RENDER THE MENU BAR Finally, this option I am very well aware that the 'page order' in wordpress is used for webmaster convenience and it cannot impact menu ordering on the menubar of website but I still tried it to look out for a change but it didn't worked not re-arrangement happened. **HOW TO REARRANGE THE MENU IN "Allure Real Estate Theme for Placester" WORDPRESS THEME?**


title: How to keep WP from recompressing Full Size images

text: I have noticed that WP does have the bad habit of recompressing Full Size images during uploads. I mean, it does make sense creating several smaller versions of each uploaded image, applying a default 90% JPEG quality setting, but why compressing twice also the Full Size images, as they are fine just as they are? My problem is that usually 90% of the large JPEGs I'm uploading through WP are usually set to a 50-75% quality to decrease their size, so when WP re-compress them it causes a further loss in quality and their size is being bloated between 100-200%. Is there any way to keep WP from changing the size and quality of Full Size JPEGs?


title: plugin's script and style enqueing not working on Thesis

text: I've published a plugin on WP repository that allows some theming for Gravity Forms. This plugin as been tested with Twenty Ten, and Twenty Eleven. When I've tried to test it in a site that uses Thesis 1.8.5, I've found out that something wasn't working. What this plugin does is to extend the Gravity Forms shortcode with a new action. When this action is called, the whole form is wrapped in a div with an appropriate class, then in this case the plugin includes a skin's function.php for further customizations. Basically the plugin checks two directories: - `/themes` directory inside the plugin directory - `/mgft-themes` directory inside `/wp-content` For both directories, it lists all subdirectories and consider them as available `themes`. When a GF shortcode has a 'theme' action and a 'themename' value, my plugin check what is available in the selected theme folder: - It enqueue all *.js and *.css files located in theme's root - It includes all *.php files located in theme's root For the moment I always have a functions.php file like this:               wp_enqueue_style("misamee-themed-form-$theme[name]", "$theme[url]css/misamee.themed.form.$theme[name].css");     wp_enqueue_script('tooltipsy', "$theme[url]js/tooltipsy.min.js", array('jquery'));     wp_enqueue_script("misamee-themed-form-$theme[name]-js", "$theme[url]js/misamee.themed.form.$theme[name].js", array('jquery'));      This function.php is included as such (you can grab the full code here):   1. __construct()              add_filter("gform_shortcode_theme", array(&$this, "misamee_themed_form_theme"), 10, 3);        2. The misamee_themed_form_theme method:              function misamee_themed_form_theme($string, $attributes, $content)     {     extract(shortcode_atts(array(         'title' => true,         'description' => true,         'id' => 0,         'name' => '',         'field_values' => "",         'ajax' => false,         'tabindex' => 1,         'action' => 'form',         'themename' => '',         'cssclass' => ''     ), $attributes));          /** @var $themename string */     /** @var $selectedTheme string */     $selectedTheme = $themename;          /** @var $id int */     $theme = $this->misamee_themed_form_setTemplate($selectedTheme, $id);          $additionalClasses = ($theme['name'] != '') ? " class=\"themed_form $theme[name]\"" : "";          //$newString = str_replace('action="prettify"', 'action="form"', $string);          $attributes['action'] = 'form';          $formString = RGForms::parse_shortcode($attributes, $content = null);     //$formString = do_shortcode($newString);          if ($additionalClasses != '') {         return "<div$additionalClasses>$formString</div>";     }     return $formString;     }        3. $this->misamee_themed_form_setTemplate():              private function misamee_themed_form_setTemplate($themeName, $formId)     {     $theme = $this->misamee_themed_form_getThemeByName($themeName);     //echo "<pre>";     if (strtolower($theme['name']) != "none") {         if ($theme['name'] == 'default') {             wp_enqueue_style('misamee-themed-form-css', $theme['url'] . 'css/misamee.themed.form.css');             wp_enqueue_script('tooltipsy', $theme['url'] . 'js/tooltipsy.source.js', array('jquery'));             wp_enqueue_script('misamee-themed-form-js', $theme['url'] . 'js/misamee.themed.form.js', array('jquery'));         } elseif (is_dir($theme['dir'])) {             //get all files in specified directory             $files = glob($theme['dir'] . "/*.*");                  foreach ($files as $file) {                 $fileData = pathinfo($file);                 switch ($fileData['extension']) {                     case 'css':                         wp_enqueue_style($fileData['filename'], $theme['url'] . $fileData['basename']);                         //echo "wp_enqueue_style('$fileData[filename]', '$theme[url]$fileData[basename]')\n";                         break;                     case 'js':                         wp_enqueue_script($fileData['filename'], $theme['url'] . $fileData['basename']);                         //echo "wp_enqueue_script('$fileData[filename]', '$theme[url]$fileData[basename]')\n";                         break;                     case 'php':                         include($theme['dir'] . '/' . $fileData['basename']);                         //echo "include($theme[dir]/$fileData[basename])\n";                         break;                 }             }         }         add_action("gform_field_css_class", array(&$this, "add_custom_class"), 10, 3);     }     return $theme;     }      It works, at least with the default theme, but with Thesis, this php file doesn't seem to work. It doesn't raise any error: simply id doesn't do anything. If I add a `echo 'OK';` in this file, I can see the "OK" string in the HTML, but enqueuing doesn't work. With other themes my code works though, so I can't see how to solve this issue. I've tried any other option, including hooking the three lines to 'wp_print_footer_scripts', 'wp_print_scripts', 'wp_enqueue_scripts', 'init' (I know I should user wp_print_* or init hooks, but _desperate times, desperate measures_ ): nothing helped. Right now the only way to "make it work" seem to replace the `wp_enqueue_*` function with straight rendering of the `'<script ...>'` and `'<link ...>'` tags: something I really don't like.


title: Can I force WP_Query to return no results?

text: I'm working on a website with a search feature that allows users to search through a lot of post meta. There is a specific search pattern that I would like to forcibly return no results for. The WP_Query technically will find results in the database, but I'd like to override that somehow to force it to return no results to trigger the `if( $example->have_posts() )` to fail. Is there some sort of parameter I can pass to WP_Query like `'force_no_results' => true` that will force it to return no results?


title: Which actions can update/change .php files?

text: As a followup to my question "How to find out if an wp-admin action edited a file?" I now could use a list of actions and files that can actually cause an update or change to .php-files in a default Wordpress installation on the file system. Right now I think of:   * Adding themes   * Editing themes   * Adding plugins   * Updating plugins   * Updating core Did I miss something?


title: Need a wordpress plugin to show tutorial difficulty

text: In my blog, I sometimes post "how to" style tutorial posts. I would like to show a difficulty gauge next to the post title like 'assumed knowledge', 'time to complete', 'frustration level', 'cost' etc. They should show up in excerpts, the main page and in posts too. Unfortunately googling with keywords "wordpress tutorial difficulty plugin" gave me irrelevant result (pages of plugin making tutorials, or plugin installation difficulties.) The only relevant thing I found is this abandoned stack overflow post: http://stackoverflow.com/questions/4619178/wordpress-plugin-to-show-tutorial- difficulty Anyone know a plugin that can be used for this?


title: Why won't these imported images show up?

text: I recently imported posts from another WP install, and everything seemed to go smoothly - except in specific cases where images are placed into a Post with the dimensions in the url. For example...we have a full-size image on the server called "lindsay- wedding.jpg". The imported post, however, uses "lindsay-wedding-300x255.jpg" (which doesn't exist on the server). I am assuming that WP takes the additional parameters at the end of the file name to automatically resize the image...but, in this case, it is simply showing a broken image...as if nothing exists there. I don't remember this being an issue before the switch... Things that I'm wondering:   * do i need to somehow update the rewrite?   * is there a WP setting that I am missing?   * if none of the above, do i need to manually adjust every single image?


title: $wpdb->insert() does not Insert record in a table

text: I'm trying to understand and get hold of the $wpdb global object but can't seem to make it work. Basically, I'm trying to insert a single record into a custom table in wordpress DB. Instead of creating your own connection string and using that, I've seen the Global $wpdb object do the trick for us. I followed the codex example and tried to do it on my own but failed. I don't get any error but the record does not insert as well. It been hours figuring the issue. Your help would be appreciated. Thanks in advance. **Code:**               <?php     class Listings{              private $buisnessName;         private $contactName;         private $categories;         private $websiteURL;         private $telephoneNum;         private $address;         private $socialLinks;         private $shortDescription;         private $images;         private $fullDescription;         private $tags;              function __construct($buisnessName, $contactName, $categories, $websiteURL, $telephoneNum,$address,$socialLinks, $shortDescription, $images, $fullDescription,$tags){                  $this->buisnessName = $buisnessName;             $this->contactName = $contactName;             $this->categories = $categories;             $this->websiteURL = $websiteURL;             $this->telephoneNum = $telephoneNum;             $this->address = $address;             $this->socialLinks = $socialLinks;             $this->shortDescription = $shortDescription;             $this->images = $images;             $this->fullDescription = $fullDescription;             $this->tags = $tags;                 }              function Insert_Listing(){             global $wpdb;             $wpdb->insert('wp_listings_info', array("Buisness_Name" => $this->buisnessName,"Contact_Name" => $this->contactName, "Categories" => $this->categories, "Website_URL" => $this->websiteURL, "Telephone_Number" => $this->telephoneNum, "Address" => $this->address, "Social_Network_Links" => $this->socialLinks, "Short_Description" => $this->shortDescription, "Images" => $this->images, "Full_Description" => $this->fullDescription, "Tags" => $this->tags), array("%s", "%s","%s", "%s","%s", "%s","%s", "%s","%s", "%s","%s"));         }          }     ?>      **Table Structure:**               CREATE TABLE IF NOT EXISTS `wp_listings_info` (     `L_ID` int(11) NOT NULL AUTO_INCREMENT,     `Business_Name` varchar(100) NOT NULL,     `Contact_Name` varchar(100) NOT NULL,     `Categories` varchar(100) NOT NULL,     `Website_URL` varchar(150) NOT NULL,     `Telephone_Number` varchar(20) NOT NULL,     `Address` varchar(250) NOT NULL,     `Social_Network_Links` varchar(500) NOT NULL,     `Short_Description` text NOT NULL,     `Images` varchar(100) NOT NULL,     `Full_Description` text NOT NULL,     `Tags` varchar(500) NOT NULL,      PRIMARY KEY (`L_ID`)     )      and I'm calling the object of the class like this:               $listingObj = new Listings($buisnessName, $contactName, $categories, $websiteURL, $telephoneNum,$address, $socialLinks, $shortDescription, $images, $fullDescription,$tags);     $listingObj->Insert_Listing();      Again I'm saying that I'm not getting any error at all, It's just the code does not insert the record as well. **EDIT:** Ok, After debugging I get this error but 2 records having the same value are inserted each time the script runs. Though Insert function is only being called once. I get this error:               WordPress database error: [Unknown column 'Buisness_Name' in 'field list']     INSERT INTO wp_listings_info (          Buisness_Name, Contact_Name, Categories, Website_URL,         Telephone_Number, Address, Social_Network_Links, Short_Description,          Images, Full_Description, Tags     ) VALUES (         'My Buisness Name', 'My Buisness Contact Name', 'My Categories',         'My Website URL','1234567','My Address','My Social Links',         'My Short Descriptions','My images Path','My Full Description',         'My Tags comma seperated'     )


title: Large Number of Wordpress Posts

text: I am in process of setting up a catalog website and it has some 1.5 Lac products. I will write some script to import all the products but I am not sure whether WordPress will be able to handle such a large amount of posts. Have any one imported so many posts in WordPress and how much is the degrade in the performance of the website. And any solutions to fix that performance. Can any one suggest any other CMS or framework to handle such a large data?


title: wpautop on section

text:
I removed automatic formatting in my WP site by adding this to functions.php:               remove_filter( 'the_content', 'wpautop' );     remove_filter( 'the_excerpt', 'wpautop' );      Now I need to add it back into one section only. On page.php, I want to replace the_content with wpautop formatted content. I replaced this:
         <?php the_content(); ?>
      With this:
         <?php             $c = the_content();             $format_c = wpautop( $c, false );             echo ($format_c);         ?>
      Unfortunately it is not adding paragraph tags here. Can anyone help me to add paragraph tags only at this location in my theme? I do not want them in the page custom templates or any of the posts. Thanks!


title: Split function "the_tags" in 2 columns

text:
I have the following function that returns the tags of the current post:               <?php the_tags( '

', '

', '

' ); ?>      Example: ![enter image description here](http://i.stack.imgur.com/7A8dG.png) Is there any way to split the result into 2 columns? Would return something like this: ![enter image description here](http://i.stack.imgur.com/hBClY.png) Any hint is welcome. Thank you friends!


title: wordpress video sharing clone script?

text: Is there any wordpress video sharing clone script like youtube? i have seen many, but they only allow the admin to upload videos, i want a script where users can register and upload their videos other users can comment and like. Is it feasible using wordpress?


title: Post thumbnail size for custom field only

text: I'm using advanced custom fields (the plugin), and I have some image upload fields. The images that I'm uploading via this custom field need to have a specific size, but I don't want to create images with this dimensions on every image that is uploaded elsewhere. I just don't want to have hundreds of images being generated that are never going to be used. Thanks


title: How to modify product page for Jigoshop

text:
Hi I am editing Jigoshop loop-shop.php to create a customize look list and the code is below .... Please do let me know where I can get below things ...   1. Add to Cart - Link Only    2. Price Text - List item   3. and Product Description ![enter image description here](http://i.stack.imgur.com/F24Qv.png) Below is my code of loop-shop.php               <?php     global $columns, $per_page;     do_action('jigoshop_before_shop_loop');     $loop = 0;     if (!isset($columns) || !$columns) $columns = apply_filters('loop_shop_columns', 4);     //if (!isset($per_page) || !$per_page) $per_page = apply_filters('loop_shop_per_page', get_option('posts_per_page'));     //if ($per_page > get_option('posts_per_page')) query_posts( array_merge( $wp_query->query, array( 'posts_per_page' => $per_page ) ) );     ob_start();     if (have_posts()) : while (have_posts()) : the_post(); $_product = new jigoshop_product( $post->ID ); $loop++;          ?>

       <?php do_action('jigoshop_before_shop_loop_item'); ?>

           <?php do_action('jigoshop_before_shop_loop_item_title', $post, $_product); ?>
<a href="<?php the_permalink(); ?>">               <?php the_title(); ?>

	           <img src="<?php bloginfo('template_directory'); ?>/img/add-tocart-button.png" alt="Add to Cart">	           <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/img/product-description.png" alt="Product Information">

     <?php              if ($loop==$per_page) break;             endwhile; endif;              if ($loop==0) :             $content = '
'.__('No products found which match your selection.', 'jigoshop').'
';             else :                 $found_posts = ob_get_clean();                 $content = '
' . $found_posts . '

';             endif;                  echo apply_filters( 'jigoshop_loop_shop_content', $content );              do_action('jigoshop_after_shop_loop');


title: Custom content plugin for front page in wordpress

text: Is there any plugin available which I can use to post custom content on My front page?? I am using front page which has link to other blog pages. I want to put custom content on this front page but i am unable to find any plugin. whatever plugins which i searched gives this facility for sidebar in a widget format there were no option for manually putting content in my theme. Also is it possible to put latest post by a particular author on this page??


title: Plugin creation - how to add user rights?

text: I wrote a little wordpress plugin and I want to grant only specific roles or users access to it. Is there a way to do this?


title: Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?

text: I have a custom post type with a custom taxonomy (to show some "best practice" examples on my website). On the single-post-page (single-bestpractice.php) I wanted to show all the terms (categories) like this: **Parent:** Child, Child, Child I tried this code:               $customPostTaxonomies = get_object_taxonomies('bestpractice');     if (count($customPostTaxonomies) > 0) {         foreach ($customPostTaxonomies as $tax) {             $args = array(                 'orderby' => 'name',                 'show_count' => 0,                 'pad_counts' => 0,                 'hierarchical' => 1,                 'taxonomy' => $tax,                 'title_li' => ''             );               wp_list_categories( $args );         }     }      which outputs: Child, Child, Parent, Child, …so, is there a way to sort it by parent/child and make the parent one start with a ":" and remove the "," of the last child? thanx, Jochen


title: How to remove website field in comment form?

text:
I am using `<?php comments_template(); ?>` to show my comment form and I'm trying to remove the url field so I added this to my functions               add_filter('comment_form_default_fields', 'clear_url_box');     function clear_url_box($fields){         if(isset($fields['url']))         unset($fields['url']);         return $fields;     }      this is my single.php               <?php get_header(); ?>

         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                      <div id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                         <?php the_content('Read more on "'.the_title('', '', false).'" »'); ?>                              <?php wp_link_pages(array('before' => '
Pages: ', 'after' => '
', 'next_or_number' => 'number')); ?>
<?php the_tags( '
Tags: ', ', ', '
'); ?>

              <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
              <?php endif; ?>
     <?php comments_template(); ?>
     <?php get_footer(); ?>      but it's not working. Anyone know how to fix this? my site is `http://toarumajutsunoindex.me/test/`


title: Custom index.php in custom plugin

text: I have created a custom plugin and created 2 folders inside it: `http://example.com/wordpress/wp- content/plugins/myplugin/firstfolder/secondfolder/index.php` I want to collect a POST request from the server. This is what I am doing in my index.php, but I am getting NULL.               function _process_response($response){         $xml = new DOMDocument();             $result = $xml->loadXML($response);             $data =array();              foreach($xml->childNodes as $nodes){                 foreach($nodes->childNodes as $node){                     $data[$node->nodeName] = $node->nodeValue;                 }         }         return $data;     }          $response = file_get_contents('php://input');         $h = fopen('./test.txt','w');         fwrite($h,"hello world");         fclose($h);         $res_array = _process_response($response);      Help is appreciated


title: Remove the blog slug from Wordpress Multisite root node

text: I have been looking at whether it is possible to remove the blog from the post & caetegory URL's in a multisite setup on the root node. I have found the Multisite sites settings and removed the blog/ part of the URL and saved. Despite it changing all of the links correctly when I click them I just end up with a 404. If I go to the node dashboard itself and resave I get the blog URL re-written into the changed multisite permalinks. Sometimes creating something like this blog/news/postname Has anyone managed to do this in the past? I am wondering if it is possible without hacking the core or getting a bit more hands on with some .htaccess rules.


title: sessions for individual pages in wp

text: will it be wrong to wrap a session function in if statement. Basically I want it to work only on one specific page. The code below goes to one of my page- templates at the very top before header.               if (is_page('20199')) {     session_start();     }      There is a form on this page and I intend to use `session_destroy()` at the end of it on submit. If this approach is wrong, what is the right way to create and destroy sessions on individual pages in wordpress ?


title: Post AND page parameter for WP function

text: Is there no post AND page parameter for WordPress functions? So would I have to create a custom post type to define post AND page? For example, `add_meta_box( $id, $title, $callback, $post_type, $context, $priority, $callback_args );` you need to define what type of `$post_type`. The options are 'post', 'page', 'link' or a custom post type. I'd like to define a meta box that applies to both the post and page. Surely copying and pasting the function and then replacing the $post_type with post and page would work but it wouldn't be very efficient. I know that `is_singular()` defines both a post and page, but that is for a query. Any ideas? I'd prefer not to install another plugin. One reason I am creating a meta box is so that I _don't_ have to install a plugin.


title: Getting "Error Establishing a Database Connection" on localhost in new Mac OSX Lion environment

text: I just got a new Macbook Air and I've been manually migrating my files and code over from my old Macbook (instead of using Migration Assistant, to avoid bringing cruft). I had several sites running Wordpress locally (on my old Macbook), as well as several sites running just statically with no CMS. I think I've gotten Apache and MySQL all configured (installed MySQL on the new Mac with Homebrew, and using Sequel Pro to admin it) correctly, but I keep getting the "Error establishing a database connection" for all of my Wordpress sites. The static sites are running on their local domains just fine, so that's why I think I have Apache and relevant files set up correctly (hosts, httpd.conf, httpd-vhosts.conf all just copied over from the old machine). And, I have the wp-config.php files matched up correctly with the MySQL db's, users and pw's. So what on earth am I missing that's giving me this error on all my Wordpress installs??


title: Check to see if page exists problems

text: I've created a class to dynamically create pages. I'm checking to see if the page exists by comparing the new page's title to `post_name`. The comparison seems to work ok, but even if there is a match the page is created anyway and I can't figure out why. My code looks like this:               class createDynamicPage {          public function __construct( $nameArray ) {         $this->title = $nameArray['title']; //Title of the page         $this->slug = $nameArray['slug']; //Page slug     }          public $pageContent = '';          public function rps_createPage(){         $allPages = get_pages();         $exists = false;         foreach( $allPages as $page ){             if( strtolower( $page->post_name ) == strtolower( $this->title ) ){                 $exists = true;             }         }         if( $exisits == false ) {             $new_page_id = wp_insert_post(                 array(                     'post_title' => $this->title,                     'post_type'     => 'page',                     'post_name'  => $this->slug,                     'comment_status' => 'closed',                     'ping_status' => 'closed',                     'post_content' => $this->pageContent,                     'post_status' => 'publish',                     'post_author' => 1,                     'menu_order' => 0                 )             );         }     }          }          $cdArray = array( 'title' => 'Biography', 'slug' => 'concert-diary' );     $pageConcertDiary = new createDynamicPage( $cdArray );     add_action('init', array( &$pageConcertDiary, 'rps_createPage' ));      I assume I'm being very stupid, but I can't figure it out! Also, being a OOP newbie, I'd happy take criticism/pointers on how I've outlined the class. Cheers


title: Display posts in row Horizontally

text: On index.php page, I am showing only thumbs and two custom fields. How can I set specific number of posts in one row like this one; http://www.whatmobile.com.pk


title: How to update custom field of a posts in a particular category

text: I have a lot of posts under category 'tution', which has custom field called 'video'. i need to update the 'video' value with same youtubeurl i.e all post would have the same value in the custom field 'video'. how should i proceed. Is their a query?


title: How to make Wordpress write links as https regardless of environment?

text: Here is my situation: SSL certificate is on one server, Website is being served from a different server. Somehow the SSL certificate is getting proxied so that my whole WordPress website can be https. I have installed a plugin (WordPress HTTPS) that is not working. (the url paths are not being written with https and instead are just plain http). So I'm getting a bunch of mixed content errors. So the plugin is not doing what is supposed to be doing because it thinks is on http, probably because the SSL certificate is on another server. So there is an idea that they want me to rewrite the native WP rules to always write to https. Does that make sense? But i dont necessarily want to mess with the WP innards..and maybe try to write a small plugin? What would I need to change so that Wordpress always writes https regardless of the environment? Any ideas would be appreciated. UPDATE: I tried a redirect method recommended - (placed this in my functions.php file)               /* redirect to SSL */     function wpse_ssl_template_redirect() {     if ( !is_ssl() ) {         if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {             wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']), 301 );             exit();         } else {             wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );             exit();         }     }     }          add_action( 'template_redirect', 'wpse_ssl_template_redirect', 1 );      And received the following errors: The webpage at https://wptest.test.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Error code: ERR_TOO_MANY_REDIRECTS Any ideas why?


title: Including Custom fields within the_content

text: I’m designing a site for a client and I’m using custom fields for buy links to her books. I only want buy buttons to appear for fields that contain a URL, so I’ve hooked this just below the_content:               <?php if( get_field('kindle') ): ?>                <a href="<?php the_field('kindle'); ?>"><?php endif; ?>          <?php if( get_field('nook') ): ?>                <a href="<?php the_field('nook'); ?>"><?php endif; ?>      This code works perfectly but I would like to be able to customize the position of the buy links a little more. I thought of creating a shortcode to insert into the content of the post, but while I can create one that includes just text, when I put the above code into the shortcode.php file, it breaks. This is the code I'm using for shortcode.php:                   <?php     function buy_links(){               <?php if( get_field('kindle') ): ?>                    <a href="<?php the_field('kindle'); ?>"><?php endif; ?>          <?php if( get_field('nook') ): ?>                    <a href="<?php the_field('nook'); ?>"><?php endif; ?>          <?php if( get_field('kobo') ): ?>                    <a href="<?php the_field('kobo'); ?>">     <?php endif; ?>          <?php if( get_field('itunes') ): ?>                    <a href="<?php the_field('itunes'); ?>">     <?php endif; ?>          }// End buy_links()          ?>


title: Update post title from external file?

text: I have an external script I wrote (for admins only) that loads in the following at the top:               require_once('./../wp-blog-header.php');      I'm aware that it can be a plugin, but it's just not right now.. it's just a standard php script. Inside this script I have a form where it allows the person viewing to update a title. Here is my code when they submit the form:               $post_data = array(       'ID'         => $_POST['post_id'],       'post_title' => $_POST['post_title']     );     wp_update_post($post_data);      wp_update_post() actually returns an ID, which makes me think its working, but the post simply doesn't change, and the title never updates. What might I be missing here? At the very least I would expect an error if it doesn't work. I'm positive the ID and the Title are correct/filled in.


title: Custom Post Type and taxonomies's labels localization not working

text: after a few hours serching on the net I decided to ask here my problem. I'm in a multi site environment and I have this custom post type code:               $products_labels = array(         'name'                => _x( 'Prodotti', 'General post type name', 'textdomain' ),         'singular_name'       => _x( 'Prodotto', 'General post type name', 'textdomain' ),         'menu_name'           => _x( 'Prodotti', 'General post type menu label', 'textdomain' ),         'parent_item_colon'   => __( 'Genitore elemento:', 'textdomain' ),         'all_items'           => __( 'Tutti gli elementi', 'textdomain' ),         'view_item'           => __( 'Vedi', 'textdomain' ),         'add_new_item'        => __( 'Aggiungi nuovo elemento', 'textdomain' ),         'add_new'             => __( 'Aggiungi nuovo', 'textdomain' ),         'edit_item'           => __( 'Modifica', 'textdomain' ),         'update_item'         => __( 'Aggiorna', 'textdomain' ),         'search_items'        => __( 'Cerca', 'textdomain' ),         'not_found'           => __( 'Non trovato', 'textdomain' ),         'not_found_in_trash'  => __( 'Non trovato nel cestino', 'textdomain' ),     );     $products_args = array(         'label'               => __( 'Prodotti', 'textdomain' ),         'description'         => __( 'Prodotti', 'textdomain' ),         'labels'              => $products_labels,         'supports'            => array( 'title', 'thumbnail', 'editor', 'excerpt', 'revisions', 'page-attributes' ),         'taxonomies'          => array( 'product_category' ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => '',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );      One of my sites is on german language and the backoffice has been set in german as well. All the strings are correctly translated (the frontend works without problems) and the de_DE.mo file is well loaded but the labels from the admin perspective are not localized and I can't understand why not :( This is the load text domain               load_theme_textdomain( 'textdomain', THEMEPATH . '/languages' );      pls find the attached image ![enter image description here](http://i.stack.imgur.com/DEldW.png) Hope you can help me :( UPDATE: I'noticed that all strings written in functions.php file are not translated. The only way to translate them is to insert strings in a new function called on init action. exemple: NOT TRANSLATED               $str = __('My string','textdomain');      TRANSLATED:               function my_function_name()     {         $str = __('My string','textdomain');         echo $str;     }          add_action('init','my_function_name', 0);      UPDATE 2: SOLVED. You have to load the load_theme_textdomain not by action but directly written as first line on the file functions.php Now my custom post type labels are finally translated :)


title: Using Pages to display custom post type content for a nested site build

text:
When i first began the latest project i'm working on a few weeks ago i was a total noob to the WP scene. This great QA site and the awesome people here helped me tremendously so i wanted to start by saying thank you. My initial approach to build a site on Washington DC that started at the top level with Neighborhoods which linked to a list of neighborhoods which linked to a single neighborhood and within that single neighborhood was where the meat of the content for each neighborhood was supposed to display. At the single neighborhood level there were links to (mainly text and image content) a Gallery page, History page, Points of Interest page and a Places page which mimicked the top level Neighborhoods page but instead of displaying a list of all neighborhoods it listed all Places that resided within that specific neighborhood. I really thought this somehow to all be possible through Parent/Child relationships and since i was storing ALL of my neighborhood pages content within a single post (obviously different posts for each neighborhood) i would just call on the custom field content that i required depending on what page was being rendered (History, Gallery, POI, etc.). I did the same thing for the places. I created a custom post type titled Places that listed all the relevant info of a place within it's own post (again each place has its own post). Then i thought that all i'd have to do is make the Neighborhoods Custom Post Type the Parent of the Places Custom Post Type and all would be well. Then i learned (in this QA site) that Custom Post Types are non-hierarchical so you can't do that. I briefly read about the Posts 2 Posts plugin but don't really understand how to use it so i put it off to the side and attempted to explore another option. The next option was to just abandon the idea of ever making the Neighborhoods CPT the Parent of the Places CPT. I already made Neighborhoods a Page that would call on all the titles of the Neighborhoods CPT's and arrange them as a list with permalinks to render the single-neighborhood.php template that would then display other content parts within that same CPT (remember i grouped all relevant content despite what page it would render on into one single post and used the templates to call on specific parts of that post). I then took that same thinking and created a Places, Gallery, History, and Points of Interest page each with their own template. So now i can at least render the content of a single post type within one neighborhood post but now every neighborhood post just renders the exact same first neighborhood's content and not their own. My question then is what kind of values do i need to add to this array so that it knows to pull the content from it's specific post type? Or would a query work best and how to sort of go about creating this query. Here is the code i'm using for my loop on the single neighborhood level for each template. Single Neighborhood Template:                <?php              $bg = get_field( 'bg_img' );              ?>            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>              <div class="bg-img-default" style="background-image: url(<?=$bg?>); ">
      This code simply gets the value from the field (which is and Advanced Custom Fields Plugin template tag) which uses a variable to call the specific background image for this neighborhood. Then within the loop i call on that variable within the inline background image style tp call on that specific background image. Here's a link to a single neighborhood page so you can see what i mean by each neighborhood has a different background color: http://www.kualitydesign.com/mark2/neighborhood/adams-morgan/ You can also click on neighborhoods and go to different neighborhoods and see their different background colors. All Places Template: (This page is linked to from any single neighborhood ex: Adams Morgan)                <?php                $args = array(             'post_type' => 'neighborhood',             'posts_per_page' => 1           );                $the_query = new WP_Query( $args );                ?>                     <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                  <div class="container-hdr-neighborhood" style="background-color: <?php the_field( 'bg_clr' ); ?>">      This code is what i also use on the Neighborhoods page to list all the neighborhoods. That of course was much easier to do because i just called on the "neighborhood" custom post type and only on the "title" custom field and wrapped it within an list item tag and anchor tag that went to the_permalink(); In this case though i would now have to do either something involving adding more parameters to the array or some kind of custom query in order to display all of the places associated to this specific neighborhood. Also bare in mind i have a meta box created for a neighborhood taxonomy so at the very least each place has been associated with a specific neighborhood at the post level which i thought would allow WordPress to automatically associate only places that had the specific neighborhood taxonomy but that wasn't the case so there's some other element missing. Here is a places list page within a specific neighborhood (in this case Adams Morgan) but you may notice that every neighborhood when you click on "Places" will bring up this same global list regardless of the taxonomy assigned to the place at the post level. http://www.kualitydesign.com/mark2/places/ The following codes snippets are for the Gallery, History and Points of Interest pages that as i described above are Pages with custom templates for each one. Again i feel, but am not certain, that the culprit for why it only calls on the content of the first neighborhood custom post type (in this case Adams Morgan) is due to a missing parameter in the array or some kind of query i just am not sure. Gallery Page:               <?php            $args = array(         'post_type' => 'neighborhood'       );            $the_query = new WP_Query( $args );          ?>
            <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>              <?php the_field( 'gallery' ); ?>            <?php endwhile; else: ?>

There are no posts or pages here.
          <?php endif; ?>      In this case it only calls on the Gallery content for Adams Morgan's post type and not depending on which neighborhood it's on. (See gallery page on any neighborhood as i can't post more than 2 links yet) History Page:               <?php            $args = array(         'post_type' => 'neighborhood',         'posts_per_page' => 1       );            $the_query = new WP_Query( $args );          ?>            <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>              <?php the_field( 'history' ); ?>            <?php endwhile; else: ?>
There are no posts or pages here.
          <?php endif; ?>      I can't post a link to the History page but simply click on any History page within any neighborhood and it takes you to the History of Adams Morgan. Points of Interest Page:               <?php            $args = array(         'post_type' => 'neighborhood',         'posts_per_page' => 1       );            $the_query = new WP_Query( $args );          ?>            <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>              <?php the_field( 'points_of_interest' ); ?>            <?php endwhile; else: ?>
There are no posts or pages here.
          <?php endif; ?>      I can't post a link but go to the Points of Interest on any neighborhood page and you'll notice you always go back to the Adams Morgan version. The codex is great but it doesn't really break down what each piece of syntax does and i know that would require learning more about PHP in and of itself but it's a lot to take on at one time so i'm trying to work with pieces i can understand and go on from there. Thank you to anyone that took the time to ready this and any help or advice would be great.


title: Hierarchial Wordpress Gallery - Each image on its own page

text: I'm currently looking for a way to create a url structure so that I have a gallery page with a specific name for each of the galleries and each images in that gallery have its own URL segment. So ideally the URL structure would be:               http://urlhe.re/gallery/<gallery-name-here>/image-id      The client has said that they do not want an inline JavaScript powered gallery for traversing through and that each image be o it's own page. Would this be possible in WordPress? The closest I can think of doing is using CPT's to create a gallery post type and using taxonomies for each gallery, but the client is thinking of having hundreds of galleries and therefore it may get confusing and complex after a short time.


title: htaccess getting overwritten over and over = 404 error

text: I have been having a big issue on my wordpress blog and don't know what to do right now. To make it short, my .htaccess file is getting overwritten over and over... These lines :               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      are duplicated a hundred or thousand times with NUL characters, and my .htaccess is now 1.5 Mo ! I can fix the issue by uploading a clean .htaccess, but the issue occurs a few hours/days later, again and again, and the pages of my websites just show a 404 error... I also tried to put the htaccess file attributes to 404 instead of 604 to stop it from being rewritten, but my host doesn't allow this and it came back to 604... Wordpress : 3.6.1 Plugins : Akismet, Anti-spam, DB Cache Reloaded Fix, Do Follow, Google Analytics for WordPress, Post Ratings, Recipe Card, Tweet, Like, Google +1 and Share, UberMenu, WordPress Database Backup, WordPress SEO, WP Sitemap Page, WP Super Cache Any clue ? Best regards :)


title: Extending Walker class for Bootstrap 2.3.2

text:
I would like to extend the walker class so that I can show a menu in this format:

                        Top Item

menu item

menu item

menu item

      I've seen a couple of examples and read the WP Documentation, but I'm still a bit lost on where to start to get it working for this particular issue. Will the start_lvl method start off my submenu items the same way as it did for parent items? If anybody has seen a solution to this issue before, I'd greatly appreciate a point in the right direction.


title: Twenty Twelve theme search returns Nothing Found

text:
I am using WP 3.6.1 With Theme Twenty Twelve. The search will not return any thing. No matter what term I use it just goes to the search return page and says the following > Nothing Found > > Sorry, but nothing matched your search criteria. Please try again with some > different keywords I have tried Deactivating every plugin and using different themes I have tried Search plugins that use the themes search.php file and I continue to get these same results. I have just add the plugin Relevanssi but its the same issue no changes. Here is the code from the search.php I have not made any changes and IM using the default search widget. I have tried all day long to research and find a solution I am not sure where else to look or what to try next.

              <?php if ( have_posts() ) : ?>
<?php printf( __( 'Search Results for: %s', 'twentytwelve' ), '' . get_search_query() . '' ); ?>
                               <?php twentytwelve_content_nav( 'nav-above' ); ?>                  <?php /* Start the Loop */ ?>             <?php while ( have_posts() ) : the_post(); ?>                      <?php get_template_part( 'content', get_post_format() ); ?>             <?php endwhile; ?>                  <?php twentytwelve_content_nav( 'nav-below' ); ?>              <?php else : ?>

<?php _e( 'Nothing Found', 'twentytwelve' ); ?>

<?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentytwelve' ); ?>
                     <?php get_search_form(); ?>

              <?php endif; ?>


title: Remove an action from an external Class

text: I'm trying to do something similar to this question here: remove_action or remove_filter with external classes? I'm trying to remove the > `<!-- This site is optimized with the Yoast WordPress SEO plugin v1.0.3 - > http;//yoast.com/wordpress/seo/ -->` message from the plugin. And before you yell at me about how this may be unethical the author says it's okay to do here: http://wordpress.org/support/topic/plugin-wordpress-seo-by- yoast-how-to-remove-dangerous-inserted-yoast-message-in-page- headers?replies=29#post-2503475 I have found the class that adds the comment here: http://plugins.svn.wordpress.org/wordpress-seo/tags/1.2.8.7/frontend/class- frontend.php Basically the `WPSEO_Frontend` class has a function named `debug_marker` which is then called by a function named `head` which is then added to `wp_head` in `__Construct` I'm new to classes but I found a way to completely remove the head by doing               global $wpseo_front;         remove_action( 'wp_head', array($wpseo_front,'head'), 1, 1 );      but I only want to remove the `debug_marker` part from it. I tried this but it dosen't work `remove_action( 'wp_head', array($wpseo_front,'head','debug_marker'), 1, 1 );` As I said I'm new to classes so any help would be great.


title: Wordpress Site footer on Firefox displays a error

text: On Firefox I get the following below the footer `Performance Optimization WordPress Plugins by W3 EDGE Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /somedirectories/wordpress/wp-includes/plugin.php on line 405` On Chrome it works fine and the last line on the footer is `Performance Optimization WordPress Plugins by W3 EDGE`


title: Problem with sorting entries in a plugin's admin interface table

text:
I'm developing a WordPress plugin that will display a publicly accessible noticeboard on a page. I've been asked to add the means to delete existing posts from the noticeboard using the WordPress admin interface, and I've used this tutorial for guidance on creating the table to hold the details of each entry. It's working to the extent that I can display the table and move between pages, but there's rather an odd error with the sorting. The hyperlink for sorting by each individual column only shows the first character of the column name in the orderby parameter, thus breaking this functionality. For instance, the link for sorting by the description is > `http://example.com/wordpress/wp-admin/options- > general.php?page=Noticeboard&orderby=d&order=desc` and should be > `http://example.com/wordpress/wp-admin/options- > general.php?page=Noticeboard&orderby=description&order=desc` ... which works. Now, I've taken a look in `wp-admin/includes/class-wp-list-table.php`, in the print_column_headers method, and the problem appears to arise on `line 679`, which reads as follows:               list( $orderby, $desc_first ) = $sortable[$column_key];      If I do a `var_dump` of `$sortable[$column_key]`, I get exactly the value I would expect, which in this case is a string with a value of `"title"`, since that's the first column I want to show. But the actual values held by `$orderby` and `$desc_first` are `"t"` and `"i"`, so it appears `list()` is treating `$sortable[$column_key]` as an `array` and returning the first two elements. I'm assuming this isn't a bug in WordPress as I could not find any mention of a bug like this in the version of WordPress I'm using for development purposes, so I think the most likely explanation is that I've done something wrong somewhere along the line. It looks like where I define the `get_sortable_columns method`, I should be passing through an array containing two or more values as the value for each element in the `$sortable` associative array. Here's the code I've written for the admin:               <?php     // Retrieve any recaptcha keys sent via POST     if($_POST['recaptcha_public_key'])     {         update_option('recaptcha_public_key', $_POST['recaptcha_public_key']);     }          if($_POST['recaptcha_private_key'])     {         update_option('recaptcha_private_key', $_POST['recaptcha_private_key']);     }          // Create a class for the post list table     class Post_List_Table extends WP_List_Table {         /*          * Constructor          */         function __construct() {             parent::__construct( array(                 'singular'=> 'wp_list_post',                 'plural' => 'wp_list_posts',                 'ajax' => false             ) );         }              function get_columns() {             return $columns = array(                 'title'=>__('Title'),                 'description'=>__('Description'),                 'submissionDate'=>__('Date submitted'),                 'name'=>__('Author name'),                 'email'=>__('Author email'),                 'post_title'=>__('Page this has been posted on')             );         }              public function get_sortable_columns() {             return $sortable = array(                 'title'=>'title',                 'description'=>'description',                 'submissionDate'=>'submissionDate',                 'name'=>'name',                 'email'=>'email',                 'post_title'=>'post_title'             );         }              function prepare_items() {             global $wpdb, $_wp_column_headers;             $screen = get_current_screen();                  // Prepare query             $query = "SELECT ".$wpdb->prefix."noticeboard_posts.title, ".$wpdb->prefix."noticeboard_posts.description, ".$wpdb->prefix."noticeboard_posts.submissionDate, ".$wpdb->prefix."noticeboard_author.name, ".$wpdb->prefix."noticeboard_author.email, ".$wpdb->prefix."posts.post_title FROM ".$wpdb->prefix."noticeboard_posts INNER JOIN ".$wpdb->prefix."noticeboard_author ON ".$wpdb->prefix."noticeboard_posts.authorId = ".$wpdb->prefix."noticeboard_author.authorId INNER JOIN ".$wpdb->prefix."posts ON ".$wpdb->prefix."noticeboard_posts.pageID = ".$wpdb->prefix."posts.ID";                  // Parameters that are going to be used to order the result             $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'ASC';             $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : '';             if(!empty($orderby) & !empty($order)){ $query.=' ORDER BY '.$orderby.' '.$order; }                  // Parameters for pagination             $totalitems = $wpdb->query($query);                  // How many to display per page?             $perpage = 5;                  // Which page is this?             $paged = !empty($_GET["paged"]) ? mysql_real_escape_string($_GET["paged"]) : '';                  // Page number             if(empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }                  // How many pages do we have in total?             $totalpages = ceil($totalitems/$perpage);                  //adjust the query to take pagination into account             if(!empty($paged) && !empty($perpage)){                 $paged = (int)$paged;                 $offset = ($paged - 1) * $perpage;                 $query .=' LIMIT '.(int)$offset.', '.(int)$perpage;             }                  // Register the pagination             $this->set_pagination_args( array(                 "total_items" => $totalitems,                 "total_pages" => $totalpages,                 "per_page" => $perpage,             ) );                  // The pagination links are automatically built according to those parameters                  // Register the columns             $columns = $this->get_columns();             $hidden = array();             $sortable = $this->get_sortable_columns();             $this->_column_headers = array($columns, $hidden, $sortable);                  // Fetch the items             $this->items = $wpdb->get_results($query);         }              function display_rows() {                  // Get the records registered in the prepare_items method             $records = $this->items;                  // Get the columns registered in the get_columns and get_sortable_columns methods             list ( $columns, $hidden ) = $this->get_column_info();                  // Loop for each record             if(!empty($records)){foreach($records as $rec){                      // Open the line                 echo '
postId.'">';                 foreach ( $columns as $column_name => $column_display_name ) {                          // Style attributes for each column                     $class = "class='$column_name column-$column_name'";                     $style = "";                     if ( in_array( $column_name, $hidden ) ) $style = ' style="display:none;"';                     $attributes = $class . $style;                          //Display the cell                     switch ( $column_name ) {                     case "title": echo ''.stripslashes($rec->title).'	';  break;                     case "description": echo ''.stripslashes($rec->description).'	'; break;                     case "submissionDate": echo ''.stripslashes(date("j F Y", strtotime($rec->submissionDate))).'	'; break;                     case "name": echo ''.$rec->name.'	'; break;                     case "email": echo ''.$rec->email.'	'; break;                     case "post_title": echo ''.$rec->post_title.'	'; break;                 }             }                  //Close the line             echo '
';         }}         }     }     ?>

Noticeboard administration
         <form name="notification_admin_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
reCAPTCHA public key <input type="text" name="recaptcha_public_key" size="60" value="<?php echo get_option('recaptcha_public_key', '');?>" />

reCAPTCHA private key <input type="text" name="recaptcha_private_key" size="60" value="<?php echo get_option('recaptcha_private_key', '');?>" />
             <input type="submit" name="Submit" value="Update reCAPTCHA key details" />         </form>
Edit posts
          <?php     //Our class extends the WP_List_Table class, so we need to make sure that it's there     if(!class_exists('WP_List_Table')){         require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );     }          //Prepare Table of elements     $wp_post_table = new Post_List_Table();     $wp_post_table->prepare_items();          //Table of elements     $wp_post_table->display();     ?>
      Any ideas as to where I might have gone wrong?


title: How to Override A Function in ms-functions.php

text: I want to execute my own welcome new user email notification instead of `function welcome_user_msg_filter(){}` located in ms-functions.php I recently learned how to override functions in pluggable.php, but the function I am referencing does not have its own `if ( ! function_exists( 'welcome_user_msg_filter' ) ) {}`. Has anyone ever overridden a function that lives in `ms-functions.php`? If so, how do you go about it? Thanks


title: <?php echo $title ?> vs <?php echo esc_html( $title ); ?> Wordpress Security

text: Reading this great article **Data Validation and Sanitization in Wordpress** I've noticed that in my blog, in header.php, I used `<?php echo $title ?>` in a pair of codes. According to the above article, in order to secure data, it is important to validate the data itself for data's without validation are vulnerable to hackers. As suggested by the author, I changed my initial `<?php echo $title ?>` into `<?php echo esc_html( $title ); ?>`. This is the code _before_ changes:                    <?php     if ( is_user_logged_in() ) {     echo 'Pubblica il   tuo annuncio gratis: è facile e veloce!';     } else {     echo '<?php echo $title ?>Pubblica il tuo annuncio gratis: è facile e veloce!   ';     }     ?>           This is the code _after_ changes:                    <?php     if ( is_user_logged_in() ) {     echo 'Pubblica il   tuo annuncio gratis: è facile e veloce!';     } else {     echo '<?php echo  esc_html( $title ); ?>Pubblica il tuo annuncio gratis: è facile e veloce!   ';     }     ?>           Now my question is (I guess it's a newbie one!): the change I made is good for my blog' security? * * *


title: delete unused postmeta

text: I love the comment by s_ha_dum : http://wordpress.org/support/topic/sql-query- to-delete-postmeta and havent tried it yet, but Im wondering just how 'clever' this actually is? Does the unused postmeta affect the speed of my database? Does removing the postmeta in this way affect anything else I would later regret? Is there any practical way to test this on a database with 1000's of posts and multiples of this in postmeta rows?


title: twentyeleven theme: Where is the code that handles moving the search bar on resize?

text: When twentyeleven theme gets too small, the search bar that was in the nav bar is moved up into the header image. My question is, where is this behavior handled in the theme? I would like to modify it slightly to fit better with my child class.


title: Display only posts from a specific parent category

text: I have a category structure similar to the below: Grand parent cat   - Parent cat 1   -- Child cat   -- Child cat   -- Child cat   -- Child cat   - Parent cat 2   -- Child cat   -- Child cat   -- Child cat ... if I query Parent cat 2 for posts, I get all posts in that category AND its child categories. How do I query the Parent cat and exclude posts in its children?


title: Moving my current wordpress blog to a subdomain

text: I currently have a blog set up on my domain (eg domain.com), but I would like to move it and all of its contents to a subdomain (eg sub.domain.com). Is there anything I need to watch out for or modify? Is there a tool which might do this more easily? I'm afraid of database issues (it will be using the database instance as it is now) or calls from within the blog itself not resolving.


title: Custom Post Type sorted by Title

text: I created a non-hierarchical custom post type and, by default, it's sorted by date published. I know I can reorder them by Title with `query_posts()` in the archive template:               global $query_string;     query_posts( $query_string . '&orderby=title&order=ASC' );      but it takes another SQL query on each archive page. Is there a way to register the sort order natively, eventually to get posts sorted by title even in the admin?


title: Can't pass table to $wpdb->prepare

text: I'm having trouble passing a table variable to $wpdb->prepare(); Here is functioning code:               $table = $wpdb->get_blog_prefix( $blog_id ) . 'my_table';          $voters = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE user_id= %d AND post_id = %d;", $user_ID, $post->ID  ));      This works great. However I think I should also be including my table in the prepare statement. But, it breaks when I change it to this:               $table = $wpdb->get_blog_prefix( $blog_id ) . 'my_table';          $voters = $wpdb->get_row($wpdb->prepare("SELECT * FROM %s WHERE user_id= %d AND post_id = %d;", $table, $user_ID, $post->ID  ));      Any ideas on why it might be breaking?


title: How to include jquery-ui library in WordPress?

text: I'm trying to load the jQuery UI library into a WordPress plugin using this enqueue statement:               wp_enqueue_script('jquery');     wp_enqueue_script('jquery-ui-core');      The jQuery library loads fine, but the ui-core is MIA. The only way I can get ui-core functions to fire is to load the library with a static include like this:               <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js"></script>      What am I missing?


title: Integrate Wordpress Blog with Moodle LMS

text: I would like to know if it is possible to integrate Wordpress and the Moodle LMS application? I would like the users to only sign in once to access both applications. I was hoping it will be possible to edit both application login processes to add whatever code is needed for both applications to create a cookie etc... I'm already using one Database for authentication for both applications but this will just make it easier for the users. I'm not expecting a solution but just some advice from anyone if they think it will be possible.


title: How do you get the docroot directory?

text: I'm trying to include a file in the docroot when I'm in the admin area. (Yes, I know this is bad form: I'm only doing it for debugging purposes.) How do I get the fully qualified docroot directory?


title: How to get "Widget Logic" plugin's input value in a custom widget code (to display on the Widget admin page)

text: I've got the "Widget Logic" plugin installed. I have created my own widget called "Buzz". I have a sidebar with multiple instances of my custom widget "Buzz". Now, on the Widgets admin page when a sidebar is toggled open and all of the widgets in that sidebar are closed up, you can see a widget name and widget instance title (if one is specified). For example, if I have 2 instances of my "Buzz" widget with different titles, on the Widget admin page it looks something like:               Buzz: Title 1     Buzz: Title 2      What I would like to do is to display "Widget Logic" value specified for a widget instance under the "widget name: widget instance title" line on the Widget admin page. So, for example:               Buzz: Title 1     Displayed on: is_front_page()          Buzz: Title 2     Displayed on: is_page("page_slug")      Hope that makes sense. Would really appreciate if any one could help me out with this: how to get the value specified in the "Widget Logic" input box and display it under the widget instance title on the Widget admin page. Many thanks, Dasha


title: Colorbox ajax loading of outside HTML content works perfect on localhost but not on server

text:
I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it on localhost but it's not working on the server. Here is the link to my site - http://shabdcreatives.com/portfolio The links themselves are not invalid, for example the following link works fine on its own: http://shabdcreatives.com/wp- content/plugins/catgrid/includes/CatGridPost.php?ID=33 I just won't open inside the colorbox. Also the php file I am trying to load is just a fragment and DOES NOT CONTAIN any or tags. I tried the colorbox support group but no replies from them yet This is the code in the CatGridPost.php file that i am calling in the colorbox.. i tried calling a plain text file too... it returned no error.. but the colorbox did not show its contents either               require_once("../../../../wp-blog-header.php");     $thepost = get_post($_GET["ID"]);     $thecontent = $thepost->post_content;     $thetitle = $thepost->post_title;     $thelink = get_permalink($_GET["ID"]);     ?>

     <a href="<?php echo $thelink; ?>"><?php echo $thetitle; ?>

           <?php echo $thecontent; ?>


title: Why does this fail: Disabling plugins enqueue_script() in functions.php

text: I'm trying to use the method presented here: Restricting a Plugin to Only Load its CSS and JS on Selected Pages? In the plugin 'syntax-highlighter-compress' I've got the following code:               function wp_shc_head_scripts() {             wp_register_script( 'shCore',       plugins_url('syntax-highlighter-compress/scripts/shCore.js') );         wp_register_script( 'shAutoloader', plugins_url('syntax-highlighter-compress/scripts/shAutoloader.js') );         wp_enqueue_script('shCore');         wp_enqueue_script('shAutoloader');     }     add_action('wp_print_scripts', 'wp_shc_head_scripts');      And in functions.php I have:               function remove_shc() {         remove_action('wp_print_scripts', 'wp_shc_head_scripts');     }          if ( is_single( array( 17, 19, 1, 11 ) ) ) {         add_action('wp_print_scripts', 'remove_shc');     }      I've tried various priorites after each add/remove and have tried various hooks (wp_head, shutdown, init) but I can't seem to get this to work! (Whilst testing, I have the is_single() condition commented out so that the plugin should never load, but it always does.) What am I missing? Thanks, Tim (In future, I'll prob use get a post_meta value to trigger plugin activation, ideally, the plugin should set this on use.. but first things first, eh?)


title: What is the_permalink() on a category page?

text: When I echo get_permalink() in a function that's called from archive.php, it reflects the permalink of the last post that's assigned to the category. How can I echo the permalink of the category page instead?


title: Fulltext search in posts sorted by relevancy

text: I'm building a custom search page and what I need is to sort results by relevancy (eg. occurences of a keyword) Using MySQL docs I've built this query:               SELECT ID     FROM $wpdb->posts     WHERE MATCH (post_title, post_content) AGAINST ('$keyword_list')     AND post_status = 'publish'     AND post_type = 'issue'      **Problem A)** If I test it using a keyword(s) that appears multiple times in my test posts, it does find those posts, but it's not sorted correctly by relevancy. For example the first found posts has around 3 occurences of the keyword while the posts returned on 3rd place has roughly 15 occurences. **Problem B)** There are two posts that contain keyword "medicare", if I search for "medicare" it does return those posts, however when I search for "medi", "medic" etc. it doesn't return anything. Is there a way to query it using MATCH/AGAINST or do I have to use LIKE % - in that case, how to sort by relevancy. Thanks


title: How do you move custom fields to custom taxonomies using WP Queries

text: To save complication I have imported a custom fields (categories & terms) to the wp_postmeta table, which are linked to respective posts. Shown as listed in wp_postmeta:               meta_id post_id meta_key                meta_value     183     45      job_listing_region      Kingston     208     46      job_listing_region      Fajardo     233     47      job_listing_region      Letchworth     258     48      job_listing_region      Oxford     283     49      job_listing_region      Beaulieu-sur-Mer      Using a SQL query how do you move these to taxonomies & terms to the following tables?               wp_term_relationships     wp_term_taxonomys     wp_terms      I'm finding the table relationship a little confusing, whether to JOIN or UPDATE in this instance. A good reference article below for someone who knows what they're doing. Thanks in advance, Murray SQL to update custom post taxonomies


title: Password-protected Posts lead to 404 Error

text: I was just testing the password-protected posts functionality and when I submit the password it sends me to a 404 page. The password I typed in was correct, I made sure. The URL bar says: `www.mydomain.com/wp-pass.php` but shows a 404 page. Whether the password is correct or wrong, it should either show some message about it being wrong or the post that was protected. Not just a 404 page. What could be causing this? Thanks in advance for any ideas.


title: Permalinks by Post Name Are Not Working

text: My WordPress Project is hosted on fatcow. The **Post Name** permalinks, are not working, but the **Default** permalink setting does work. There are many options in google, but I didn't find a simple way to resolve my issue.


title: Video uploaded with the native media uploader gives Error 404

text: I created a `shortcode` to make an HTML5 player insert into my post, but my problem is when I attempt to view a video that I've uploaded with the native `Media Uploader`, I get a file not found error. The test video I used is an `.mp4`. Is there a block on using videos in the `Media Uploader` that needs to get removed? This does not appear to be a file permission issue, because the file uploads. When I browse the remote server via FTP, I see my file was added into the `/wp-content/uploads` directory. Any reason why it wouldn't show up by accessing the file from the browser directly?


title: how to automatically cleanup failed Wordpress uploads in /tmp?

text: How do we automatically cleanup failed Wordpress uploads that are in /tmp ? Say delete everything that is 3+ days old.


title: combining js scripts from a js newb

text: I've got a small .js file on my wp site where I have been adding in all of my small js scripts. It works perfectly, but I am stuck trying to figure out how to add in another script. So far jslint does not complain about my current file and says it is ok. my script:               jQuery(function ($) {     function mycarousel_initCallback(carousel) {     jQuery('.jcarousel-control a').bind('click', function() {         carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));         return false;     });          jQuery('.jcarousel-scroll select').bind('change', function() {         carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);         return false;     });          // Next Button     $('#mycarousel-next').bind('click',     function() {         carousel.next();         return false;     });          // Prev Button     $('#mycarousel-prev').bind('click',     function() {         carousel.prev();     return false;     });     };     }      The script I want to add in starts like this:               jQuery(document).ready(function($) {     var gallery = $('#thumbs').galleriffic({         delay:                     3000, // in milliseconds      });     });      Where I keep getting stuck, is that I am finding a lot of scripts that start with the jQuery(document) part. When I try to add scripts that begin like that then everything breaks. I'm guessing this is a really stupid question, but what do I need to change in the new addon script so that it will play nice with my current file? thank you for your help and time on this one. Trying hard to learn js though it's a slow process here.


title: Smarter navigation plugin and custom taxonomies

text: I am trying to make work Smarter Navigation's `get_referrer_category()` with a custom taxonomy that I have created. The custom taxonomy I've included into functions.php is the following:               add_action( 'init', 'create_colors_nonhierarchical_taxonomy', 0 );          function create_colors_nonhierarchical_taxonomy() {            $labels = array(         'name' => _x( 'Colors', 'taxonomy general name' ),         'singular_name' => _x( 'Color', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Colors' ),         'popular_items' => __( 'Popular Colors' ),         'all_items' => __( 'All Colors' ),         'parent_item' => null,         'parent_item_colon' => null,         'edit_item' => __( 'Edit Color' ),          'update_item' => __( 'Update Color' ),         'add_new_item' => __( 'Add New Color' ),         'new_item_name' => __( 'New Color Name' ),         'separate_items_with_commas' => __( 'Separate colors with commas' ),         'add_or_remove_items' => __( 'Add or remove colors' ),         'choose_from_most_used' => __( 'Choose from the most used colors' ),         'menu_name' => __( 'Colors' ),       );             register_taxonomy('colors','post',array(         'hierarchical' => false,         'labels' => $labels,         'show_ui' => true,         'show_admin_column' => true,         'update_count_callback' => '_update_post_term_count',         'query_var' => true,         'rewrite' => array( 'slug' => 'color' ),       ));     }      Now, as I need to highlight not only the category, but also the tag and the custom taxonomy that the user came from, I've changed the following block of code inside this plugin file:               // Retrieve the category, based on the referrer URL. Useful if you have posts with multiple categories     function get_referrer_category() {         global $posts;              if ( ! $referrer_url = get_referrer_url( false ) )             return false;              foreach ( get_the_category( $posts[0]->ID ) as $cat ) {             $cat_link = get_category_link( $cat->term_id );                  if ( false !== strpos( $referrer_url, $cat_link ) )                 return $cat;         }              foreach ( get_the_tags( $posts[0]->ID ) as $tag ) {             $tag_link = get_tag_link( $tag->term_id );                  if ( false !== strpos( $referrer_url, $tag_link ) )                 return $tag;         }              foreach ( get_the_terms( $posts[0]->ID, 'color' ) as $term ) {             $term_link = get_term_link( $term->term_id );                  if ( false !== strpos( $referrer_url, $term_link ) )                 return $term;         }              return false;     }      and I've added these lines to content-single.php:               <?php       if ( $cat = get_referrer_category() )         echo 'Exploring // term_id ) . '">' . $cat->slug . '';     ?>      Category and tags work fine, but I still can't display custom taxonomies. I am not good at all with PHP and I am quite sure I am missing something. Help is greatly appreciated ;)


title: order post my meta value m/d/y format with year as included value

text: current order: 01/01/2013   12/07/2012   12/08/2012   .   .   .   .   12/31/2012   -------------      01/01/2013 should appear last      My code:               $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;     $today = date('m/d/Y');     query_posts(array(         'post_type' => 'post',         'category_name' => 'flavors',         'paged' => $paged,         'meta_key' => 'flavor_date',         'orderby' => 'meta_value',         'order' => 'ASC',              'meta_query' => array(             array(             'key' => 'flavor_date',             'value' => date("m/d/Y", strtotime('-6 hours')),             'compare' => '>=',             'type' => 'CHAR'             )         )     ));     if (have_posts()) :     while (have_posts()) : the_post();      Function Used:               add_filter('posts_join', 'new_join' );     function new_join($pjoin){         if(is_category()){             global $wpdb;             $pjoin .= "LEFT JOIN (     SELECT *     FROM $wpdb->postmeta     WHERE meta_key =  'flavor_date' ) AS metasort     ON $wpdb->posts.ID = metasort.post_id";         }         return ($pjoin);     }           add_filter('posts_orderby', 'new_order' );     function new_order( $orderby ){         global $wpdb;         if(is_category()){             $orderby = "metasort.meta_value ASC";         }              return $orderby;     }


title: Can't load JS File

text: I'm trying to load two JS files. But some how its not working. Tried both of these, and the console window doesn't complain of unable to load the file, it never was in the head.   Also, I'm having a weird issue (not sure if related) that CSS file would not be loaded if not specified explicitly in the header. However, if specified, it would be loaded twice. ### version 1               add_action( 'after_setup_theme', 'theme_initialization' );          function theme_initialization() {         add_action( 'wp_enqueue_scripts', 'enqueue_scripts' );     }          function enqueue_scripts() {         $template_dir = get_template_directory_uri();              wp_enqueue_script( 'xxxx', $template_dir . '/js/xxxx.js', array( 'jquery' ), '1.0', true );         wp_enqueue_script( 'xxxx', $template_dir . '/js/xxxx.js', array( 'jquery' ), '1.0', true );     }      ### version 2               add_action( 'wp_enqueue_scripts', 'enqueue_scripts' );     function enqueue_scripts() {         $template_dir = get_template_directory_uri();              wp_enqueue_script( 'xxxx', $template_dir . '/js/xxxx.js', array( 'jquery' ), '1.0', true );         wp_enqueue_script( 'xxxx', $template_dir . '/js/xxxx.js', array( 'jquery' ), '1.0', true );     }


title: Broken pagination, need help figuring out why!

text:
I just tried slapping together a poor-man's "featured post" section with this exact code out of my index.php:
     <?php if (is_home() && !is_paged()) : ?>              <?php query_posts('cat=13&showposts=1'); ?>         <?php while (have_posts()) : the_post(); ?>                  <div class="sticky" id="post-<?php the_ID(); ?>">
<a class="post-title" href="<?php the_permalink(); ?>"><?php the_title(); ?>
                      <?php include('meta.php'); ?>
                          <?php the_excerpt(); ?>
                         <?php if (has_tag()) { ?>
                                 <img src="<?php bloginfo('template_url'); ?>/images/tag.jpg" alt="Tagged as:" />                                 <?php the_tags('', ', ', '
'); ?>
                         <?php } ?>
                             <a href="<?php the_permalink(); ?>">Read More »

         <?php endwhile; ?>          <?php endif; wp_reset_query(); ?>          <?php query_posts('cat=-13'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>               So as you can see, I've tried using multiple loops (first time trying that too :P) and the result is great...on the front page of the blog! If I were to go to the 2nd page however, it displays only the non-Feature posts that were on the first page. So in essence, it's almost working but I need your help resolving this issue! Also, if anyone reads this and has a better way of doing it I am all ears! This was simply my first attempt at making this feature without the use of a plugin :) Thanks in advance, and any/all help is much appreciated! **EDIT :** Issue resolved. Wasn't correctly querying all other posts in 2nd loop. Replaced:               <?php query_posts('cat=-13'); ?>      with:               <?php query_posts($query_string . '&cat=-13'); ?>      and that simple fix did it for me :) hope someone else stumbles onto this and is helped as well!


title: wp login redirects to homepage

text: wp login redirects to homepage just started to happen. I login to my admin area using /wp-admin no problem but instead of being redirect to the admin area i am redirected to a incomplete version of the frontpage. This started to happen no upgrades or new plugins or messing about with the back end * * * I have disabled all the plugins and its still happening - any other ideas


title: How do I get my child-theme to work with my theme's includes folder?

text: I am using the Canvas WordPress theme (by WooThemes.com) and successfully made a child-theme to override my CSS. However, I would also like to apply the same child-theme principles to my theme's "includes" folder which contains a variety of .php files. Any idea how I can go about doing this?


title: Include a specific page in your template

text: How do you include specific pages into a template? Like for example on my websites main page I want to have about 3 different content areas that the client can regularly update as he needs to. I figure maybe the best way to do this is to just nest pages into the template and he can edit the page. How can I set this up? The wordpress codex, the wordpress forum, and google have all failed to give me ANY solution. I know there is a plugin that allows this but its not compatible with 3.1 and above. I dont like the idea of using a plugin anyhow, I figured that wordpress would have a simple template tag system setup for this, wrong.... PHP is probably where the answer lays. Thanks for your help p.s. also if you know of a better way to go about this other than using nested pages then please let me know. I'm just a wordpress noob and I figured this would be a straightforward way to accomplish the task.


title: Theme Live Preview on Front End?

text: I have a membership site where a member will fill out a form (FormidablePro, if that matters). This form contains information that will be the content on a site which will be created once the form is submitted automatically (how that happens isn't my question). Here's the question: On the form, a list of possible themes is offered up to the member. Is it possible, similar to what is happening on the WordPress backend, to present a live preview of the theme using the information captured in the form? Outlandish, I know. :-) Thank you! P.S. I'm not referring to the Theme Switcher Reloaded functionality.


title: Is it possible to show custom comment metadata in the admin panel?

text: I've customized my comment form with a new field (city, but that doesn't really matter). I've hooked and filtered and added my comment metadata with add_comment_metadata. I want to show that metadata in the Comments admin panel (wp-admin/edit- comments.php). Google searches prove fruitless. **Is this possible? If it is, how does one go about it?** I'd like to show it in the author column, but I'll settle for viewing the metadata in the edit view for each individual comment.


title: Wordpress Uploads Folder can't be Written to

text: ### This one has me stumped I'm sure it is something really small that I am overlooking but I think I've been looking at it too long to see what the problem is. ### Wordpress is telling me: > "Upload folder is not writable. Export and file upload features will not be > functional." Well...specifically it is **Gravity Forms** that is producing that error message, but uploading media isn't working either. ### Here's what I've checked:   1. Uploads folder and all sub-folders permissions are set to 755   2. Uploads folder has same owner and group as every other script   3. Upload folder setting on Settings->Media page has been set to: empty and wp-content/uploads (with and without trailing slash) I'm not sure where to go from here. What am I missing?


title: How to get Category Id from Post Id ?

text: I need to get any post category id from the post id(Not for current) Post. How can i ? Thanks


title: wp_query->set for several categories

text: $wp_query->set( 'cat', '1, 2, 3' )       forms sql query like               term_id IN (1, 2, 3)       but I need               term_id = 1 AND term_id = 2 AND term_id = 3`      How to do it with `$wp_query->set()`?


title: Display post thumbnail for specific category outside the loop

text: I'm building a theme that features a section wherein I'd like to have the single most recent post's thumbnail of a single category displayed between the header and blog sections. Something like               <?php if ( has_post_thumbnail()) : ?>         <?php the_post_thumbnail(); ?>     <?php endif; ?>      would work within the loop, but I'm wondering how I can make this work outside of, or separate from the loop. Any suggestions?


title: Ascending Order is not Working in Custom Post Type Listining

text:
Can you please let me know why this code is not listing Custom Post Types?               <?php      $loop = new WP_Query(                   array(                     'post_type' => 'product',                     'tax_query' => array(                         array(                             'taxonomy' => 'genre',                             'field' => 'name',                             'terms' => 'ne',                             'order' => 'ASC',                         )                     ),                     'posts_per_page' => 10                   )              );     ?>     <?php      if ( $loop->have_posts() ) :     echo '
';      while ( $loop->have_posts()) : $loop->the_post();      $custom = get_post_custom($post->ID);      echo '
'.the_title().'
';     endwhile;     echo '
';     endif;     ?>      Thanks