title: Best way to create list of gigs for Wordpress theme?

text: I'm currently designing a musician's wordpress theme, and am looking to create a user-controlled dynamic gig list. It doesn't have to have a link to any event pages, just a simple "where, when, with who" kind of thing. I've done this before using PHP, but am wondering what the best way to do it IN WORDPRESS would be. I've tested a method using custom post types, but I feel like some users would be confused about creating "post" for a an event, and then having to write the date in a custom field at the bottom. Can I get my theme to create it's own table in the wp database? Can I avoid that and make my own "instert gig" interface that creates a custom post type, but with an easier to understand "date, venue, about" way of inputting the info? I don't need a FULL walk-through, but a point in the right direction would be great :)


title: Get content from other database table based on an ID and rewrite URL

text: I am currently using WordPress with SEO friendly permalinks. One page of my website is a special one though, let's call it `http://example.org/locales`. It is using a custom page template that loads values from a database table called "locales" and echoes the content to a html table. _Database columns:_ **id** , **location** , **address** , **type** , **guid** _Example content:_ **3, Yale, Burberry street 21, Apartment, 40VIEOUKK2VA07F2** I have currently configured my PHP code in the custom page template so that the _location column_ contains a link to the guid for each item like this:               echo "" . $row['address'] . "	";      This gives me a link that looks like this:               http://example.org/locales/?guid=40VIEOUKK2VA07F2      Now I have two questions:   1. How do I proceed to actually load the details from a locale with a specific guid if they are stored in a different database table?   2. How do I make an URL rewrite for `/?guid=40VIEOUKK2VA07F2` so that it becomes something like `http://example.org/locales/burberry-street-21` ?


title: Display image in descending order from database table

text: I have used woo commerce plugin ,I am trying to display images in descending order by order_id in word press dashboard on orders tab.I tried lot's but not getting any idea how to do that.Bellow is my code.                <td class="thumb">                 <?php              global $wpdb;                 //$result = $wpdb->get_results ( "SELECT * FROM user_templates  where id= ".$_SESSION['user_te']);            //$result = $wpdb->get_results ( "SELECT * FROM ca_woocommerce_order_items ORDER BY order_id");     $result=$wpdb->get_results("SELECT BgImageName FROM ca_woocommerce_order_items ORDER BY order_id DESC ");                //foreach ( $result as $print )             //$img_post=$print->BgImageName;                 //  $img_post=$result;                                  ?>                  <image height="100"src="../user_templates/<?php echo $result;?>" />         </td>


title: Can I have a specific template for products even if they are standard posts and not CPT?

text: I'm attempting to manipulate a plugin for a client (the plugin author is unresponsive), and I'm wondering if/how to go about doing this. It's an ecommerce plugin, however does not create a custom post type. What the client is wanting is for a product listed on the main products page to link to the individual product's full information (i.e. single-product.php). My first thought was to link each product to it's ID using               $productid = $p->id;     echo get_permalink( $productid );      but of course this just link's to a post's page with the same ID. Because products aren't custom post types, there is no difference than say post ID 1 and product ID 1. Is there a way to link to a single product's page if it isn't a custom post type, or how to create a single product page?


title: 'rewrite_rules_array' or 'generate_rewrite_rules' for adding custom rewrite rules?

text: Is there any reason why I should use `rewrite_rules_array` instead of `generate_rewrite_rules`? `generate_rewrite_rules` works out of the box, but I couldn't get `rewrite_rules_array` to work. And I am told that any array actions [when adding custom rewrite rules] should be done via `rewrite_rules_array` and the rest of `*_rewrite_rule` filters (e.g. `add_rewrite_rule`). It's unclear why.


title: Post removes any text from post that's following special characters

text: I have a weird problem with losing content in posts with special characters in it. Let's say I inserted the following content into a post: * * * Hello, 👿 This is my post * * * Wordpress would remove the special character (👿) and the text following, and save the post like this: * * * Hello, * * * I tried playing the charset in wp-config file but no luck.


title: PHP Call outside class function inside anonymous function

text: hey guys i wanna call my function inside class A than call it inside class B within anonymous function how to do that ? here my sample code.               <?php               class A extends Z{             public function sampleFunction($post){                // code here             }               }               class B extends A{            public __construct(){              $this->anotherClass();            }         // add_action() and update_meta_box() is function from wordpress                 public function anotherClass(){              $post = $_POST['test'];              add_action('save_post',function($id){                if(isset($post)){         // here i dont know how to call it inside anonymous function                  $this->sampleFunction($post);                   update_meta_box(                    $id,                    'key',                    strip_tags($post)                  );                }              });            }               }              ?>


title: JetPack Infinite Scroll not working on custom theme

text: I have a custom theme where I've tried to integrate the Infinite Scroll option within JetPack. Per this article, I've added the following code to functions.php (in addition to activating the module) -               <?php          add_theme_support( 'infinite-scroll', array(                  'container' => 'content',                  'footer' => 'page',            ) );     ?>      The live site can be found here. My problem is that the infinite scroll function doesn't seem to be, well, functioning. Pagination still occurs when 10 posts are reached. I'm not exactly sure where I've gone wrong as I followed the articles steps as they were written. Any ideas?


title: get wpautop to not wrap tags but only text

text: Is it possible for wpautop to only wrap plain text, so that e.g. here:               text          link      only the "text" gets wrapped. Why would you want to wrap tags anyway? Maybe anyone has a custom function?


title: After inserting jquery weather code, my responsive menu is lost

text: Site with issues - http://rheareview.com I have a community news website built on wordpress (multisite). The task was to place a weather feed including current temp including nice weather condition icon. I thought I found a solution with zweatherfeed http://www.zazar.net/developers/jquery/zweatherfeed/. I found after inserting the jquery weather... my menu doesn't display once it reaches the first responsive breakpoint which is browser width 768px. I know it is the weatherfeed giving me issues. When I remove the feed from my header.php it works correctly. BTW, I have called the 'jquery.min.js' and 'jquery.zweatherfeed.min.js' from my header.php. Thanks in advance for any help. ![Here's a screenshot pointing out my issue.](http://i.stack.imgur.com/B16he.png) Seamus... I add the following to the bottom of my functions.php :               function newsplus_add_scripts() {     // Register the zweatherfeed script     wp_register_script(         'zweatherfeed', // The name for the script          get_template_directory_uri() . '/js/zweather/jquery.zweatherfeed.min.js', // Here         array( 'jquery' ),         '1.0.1',          false       );          wp_enqueue_script( 'zweatherfeed');     }          // Call our function for the 'wp_enqueue_scripts' hook     add_action( 'wp_enqueue_scripts', 'newsplus_add_scripts' );          function newsplus_add_script_config() {     if ( wp_script_is('zweatherfeed') ) { // check that the zweatherfeed script is printed         echo "<script> jQuery('#test').weatherfeed(['USTN0132']);</script>";       }     }     add_action( 'wp_head', 'newsplus_add_script_config', 20 );      It is now calling the zweather script, but it's not showing. I am actually using a child theme of the newsplus theme names 'newsplus-child'. Should I be using the functions.php in the child theme directory? It is currently empty.


title: Marketpress php warning on server, no problem on localhost

text: I have this in my functions.php that creates a shopping cart widget with the plugin Marketpress.               <?php function marketpress_get_cart_subtotal($format_currency=true) {         global $mp;              $selected_cart = $mp->get_cart_contents(true);         if (!$selected_cart) return;              foreach ($selected_cart as $bid => $cart) {                  if (is_multisite())                 switch_to_blog($bid);                  foreach ($cart as $product_id => $variations) {                 foreach ($variations as $variation => $data) {                     $totals[] = $mp->before_tax_price($data['price'], $product_id) * $data['quantity'];                 }             }                  //go back to original blog             if (is_multisite())                 switch_to_blog($current_blog_id);              }         $total = array_sum($totals);         if ($total > 0)             return $mp->format_currency('', $total);         else             return '$0.00';     }     ?>      This works fine locally on MAMP, but when I upload it to my server I get "Warning: array_sum() expects parameter 1 to be array, null given in functions.php on line 255" instead of the cart total. What is wrong with the code, and why is there a discrepency between the same file on my localhost and the online server?


title: how to get path to images in the uploads folder to be used in a plugin

text: I have some folder with images in `/wp-content/uploads`. I also have a plugin file in `/wp-content/plugins`. I want to retrieve the images stored in `/wp- content/uploads` and use them in the plugin file. I have tried               echo'';      can someone show me how I can get the path to these images? thanks.


title: Give a permalink to Custom Post Types without title

text: I have a "report" Custom Post Type registered in this way:               register_post_type(         'report',         array(             'label' => 'Reports',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array('slug' => ''),             'query_var' => true,             'exclude_from_search' => false,             'supports' => array('custom-fields','comments','author',),             ...         )     );      As you can see, my `report` _does not support`title`_, but only `custom- fields`, `comments`, and `author`:               'supports' => array('custom-fields','comments','author',)      Hovewer, since the permalink of a post normally is something like:               http://mywebsitename.com/report/the-title      now I always get something like:                http://mywebsitename.com/report/auto-draft/      I suppose that "auto-draft" is the title that is given by default to my report. I have no idea how to give a reasonable permalink. I would like to give one based on the `custom-fields`.


title: Page versus post ID specific CSS ID?

text: I'm trying to change the background color Of the page below. I have had problems with identifying individual pages before – but perhaps something has changed. Any quick thoughts? http://artbeyond.co/the-mcgladrey-art-gallery/gallery-photos/               .page-id-165 #wrapper {     background-color:#252525;      }


title: Template tag for custom field sub heading in post - error

text: Im trying to create a template tag for a subheading for a post which is entered as a custom field. This is the function I have:               function spost_subheading() {     $key = get_post_meta($post->ID, '_subheading', true);         if ($key != '') {              echo $key;          }          else {}      }      But I'm getting these two errors when I use `spost_subheading();` in the loop and it doesn't output any subheading.   * Notice: Undefined variable: post in C:\wamp\www\wordpress\spost\wp-content\themes\spostfeb14\inc\template-tags.php on line 135   * Notice: Trying to get property of non-object in C:\wamp\www\wordpress\spost\wp-content\themes\spostfeb14\inc\template-tags.php on line 135 (line 135 is the line that begins $key = get_post_meta...) Any help or advice would be much appreciated?


title: Date Ordered Archive Page for single category?

text:
The code below enables an archive of posts in date order. But I can't figure out how to change this so it only pulls one category of posts. Link Any help greatly appreciated               <?php          //* Template Name: Custom Archive          //* Remove standard post content output     remove_action( 'genesis_post_content', 'genesis_do_post_content' );     remove_action( 'genesis_entry_content', 'genesis_do_post_content' );          add_action( 'genesis_entry_content', 'sk_page_archive_content' );     add_action( 'genesis_post_content', 'sk_page_archive_content' );     /**      * This function outputs posts grouped by year and then by months in descending order.      *      */               function sk_page_archive_content() {              global $post;                  $lastposts = get_posts('numberposts=-1') ;             $year = '';             $month = '';             foreach($lastposts as $post) :                 setup_postdata($post);                      if(ucfirst(get_the_time('F')) != $month && $month != ''){                     echo '

';                 }                 if(get_the_time('Y') != $year && $year != ''){                     echo '

';                 }                 if(get_the_time('Y') != $year){                     $year = get_the_time('Y');                     echo '

' . $year . '

';                 }                 if(ucfirst(get_the_time('F')) != $month){                     $month = ucfirst(get_the_time('F'));                     echo '

' . $month . '

';                 }                  ?>
                     <?php the_time('d') ?>:                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php endforeach; ?>
             <?php                }          remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );     remove_action( 'genesis_entry_footer', 'genesis_post_meta' );     remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );          genesis();


title: How to add Report Link button

text: I see "How to make simply "report" button on posts". But I wonder how to add the button beside content instead inside?


title: Starting from what version WordPress provides own embedded audio player without need a plugin?

text: According to **THIS PAGE** Wordpress now provides own embedded audio player. Does anyone know starting from what version this became available?


title: Underscores.me retrieve next / previous post thumbnail in post_nav function

text:
I am using Underscores.me for a project. I'd like to add the featured image (thumbnail) to the previous / next post links. They have a function which I'm trying to edit called `THEMENAME_post_nav()`. I am struggling to tweak this function to make it include the thumbnails. Can anyone help please? Here's the code:               function THEMENAME_post_nav() {     // Don't print empty markup if there's nowhere to navigate.     $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );     $next     = get_adjacent_post( false, '', false );          // This is how I'm trying to include the thumbnails     $prevthumbnail = get_the_post_thumbnail($previous->ID);     $nextthumbnail = get_the_post_thumbnail($next->ID);          if ( ! $next && ! $previous ) {         return;     }     ?>
<?php _e( 'Post navigation', 'THEMENAME' ); ?>

             <?php                      previous_post_link( '
%link
$prevthumbnail', _x( '← %title', 'Previous post link', 'THEMENAME' ) );                 next_post_link( '
%link
$nextthumbnail', _x( '%title →', 'Next post link', 'THEMENAME' ) );             ?>
          <?php     }


title: Change custom post type slug from plugin options

text: I'd like to give users the option to change a custom post type slug in my plugin. Using this answer, I'm able to hardcode it into a function: Redeclare/Change Slug of a Plugin's Custom Post Type So how can I rewrite this to update when the user updates the plugin option? I tried something like this:               function add_custom_rewrite_rule() {          $slug = get_option('change_rewrite_slug'); // my plugin option          // First, try to load up the rewrite rules. We do this just in case     // the default permalink structure is being used.     if( ($current_rules = get_option('rewrite_rules')) ) {              // Next, iterate through each custom rule adding a new rule         // that replaces 'movies' with 'films' and give it a higher         // priority than the existing rule.         foreach($current_rules as $key => $val) {             if(strpos($key, 'my_post_type') !== false) {                 add_rewrite_rule(str_ireplace('my_post_type', $slug, $key), $val, 'top');                } // end if         } // end foreach          } // end if/else          // ...and we flush the rules     flush_rewrite_rules();          } // end add_custom_rewrite_rule     add_action('init', 'add_custom_rewrite_rule');      This doesn't work. I feel like I am missing a step: once the plugin option is saved it needs to tell this function to fire and get the new slug. Or maybe there is a better way to do it. Also, once it is changed, I need the function to update that, get the current option and then change the slug based on any new input. The reason I need this is that the plugin has a post type of one kind of event but I want people to be able to customize it so instead of 'event' the slug could be 'show' or 'gig' or whatever they want. Update: I'm using this class: http://tareq.wedevs.com/2012/06/wordpress- settings-api-php-class/ Here is a section of the options page code:                function flush_settings() {              if( isset( $_REQUEST['settings-updated'] ) )         flush_rewrite_rules();     }          /**      * Returns all the settings fields      *      * @return array settings fields      */     function get_settings_fields() {         $settings_fields = array(              // Other settings here             'djgigs_basic_settings' => array(                 array(                     'name' => 'djgigs_rewrite_slug',                     'label' => __( 'Permalink Slug', 'wedevs' ),                     'desc' => __( 'Enter a custom permalink slug. The default is \'djgig\' but you could change it to \'gigs\' or \'events\'. ', 'wedevs' ),                     'type' => 'text',                     'default' => 'djgig',                 ),             )              );              return $settings_fields;     }      Not sure if that is the correct location to add the flush function or if there is something in the Class that is making this not work.


title: Is there a way to reorder a collection of posts to read from top (oldest) to bottom (newest)?

text: After I complete a collection of posts, can I reorder them in reverse to read from the top (oldest post) to bottom (newest post)?


title: Strange wordpress slowness

text: I read a lot about my problem. I have 4 years old Wordpress (with newest 3.8.1 Wordpress) site. And last months it become really slow. It takes about 3-5seconds to render page. In administration area is situtation more critical, there is 6-8seconds render time. MySQL queries are only 41 (when I disable all plugins) a it takes same time. But in frontend there is significant time reduction when I disable all plugins, but I want to use them. But there is almost no diffrence between 400+ queries (plugins on) and 60queries (plugins off). I use WP SUper Cache, which server pages really fast. But I want to debug my wordpress to see where exactly is the problem. I know that it might be a lot queries, but PHP works same time with 400queries and 60queries. So there must be some PHP bug, or something wrong. I would like to have option to see what is taking so long to PHP, when it process all queries. Queries time is under 1second everytime with any amount of queries. * * * UPDATE: Ok, I got an idea. Because I am not a well skilled in MySQL or PHP I can share Debug Objects querry list. Is that good idea, to help me sort out this problem?


title: Custom excerpt length on home page

text: I thought that I got this working but unfortunately it is not. I need my static home page to have an excerpt length of 50 and every other pages to have one of 20. Here is my code so far:               function custom_excerpt_length( $length ) {        if(is_front_page()) $content='excerpt';        return 50;     }          add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );      I can tell it's not working because on seamlessthemes.com the excerpt is 50, but on seamlessthemes.com/themes the excerpt is still 50. Please note this theme had a default one of 20 for some reason, so the themes page should still be 20. Thanks in advance!


title: Warning: Illegal string offset on theme options page

text:
Im creating custom theme options and Im getting this PHP error: Warning: Illegal string offset in ... on line 75               // adding the page to menu     add_menu_page('Theme Options', 'Theme Options', 'manage_options', 'rm-options', 'rm_display_options_page');          // form to display options     <form method="post" action="options.php">                 <?php                     settings_fields('rm_theme_options'); // options name                     do_settings_sections('rm-options'); // page                     submit_button();                 ?>     </form>          // adding a section     add_settings_section('rm_general_section', 'General options', 'rm_general_section_callback', 'rm-options');          // register the options     register_setting( 'rm_theme_options', 'rm_theme_options', 'esc_attr' );          // register a field     $some_option_args = array('type' => 'text', 'id' => 'some_option_name', 'name' => 'some_option_name', 'desc' => 'Description');     add_settings_field('some_option_name', 'Some Option', 'pu_display_setting', 'rm-options', 'rm_general_section', $some_option_args);          // finally a function to display the fields     function pu_display_setting($args){         extract( $args );         $options = get_option( 'rm_theme_options' );              switch ( $type ) {                 case 'text':                   //$options[$id] = stripslashes($options[$id]);                     //$options[$id] = esc_attr( $options[$id]);                   // this is line 75 where im getting the warning                   echo "<input type='text' id='$id' name='" . 'rm_theme_options' . "[$id]' value='$options[$id]'>";                   echo ($desc != '') ? "
$desc" : "";                 break;           }     }      Now when Im trying to save the option, the error is still there and the value of the input is "A", when I check the database, the actual value is just "Array". Whats wrong with the line 75? In the tutorial where I got the display setting function, there were also two more lines which are stripping the slahes and esc_attr. ## EDIT: Thats now how my code actually is, Im using the function to display the page but I just didnt want to put every piece of code here so it isnt a big mess. This is how it looks complete:               function rm_display_options_page() { ?>

<?php echo 'Theme options: ' . wp_get_theme(); ?>

Theme options description
                  <?php settings_errors(); ?>                  <form method="post" action="options.php">                 <?php                     settings_fields('rm_theme_options'); // options name                     do_settings_sections('rm-options'); // page                     submit_button();                 ?>             </form>
     <?php     }      And the line 75 is:               echo "<input type='text' id='$id' name='" . 'rm_theme_options' . "[$id]' value='$options[$id]'>";


title: Filter out posts before display category count

text:
I have meta key "Due" for posts....if a post has expired (past the current date or not equal to it) then it should not be displayed in the count (i have code to display the count, which fades in over a thumbnail)..for example right now one says it has 89, but it should really only be 26 because the rest have expired....so how do I filter out posts before the count is displayed? Here is my code:               <?php     $categories = get_categories('hide_empty=0&exclude=13,1,1460&orderby=count&order=DESC&number=6');     if (!empty($categories)) {              $i = 0;              foreach ($categories as $cat) {             $class = ( $i % 3 ) ? 'span4' : 'span4';                  $thumbnail_id = get_option('seamless_term_thumb_' . $cat->term_id);             $image        = wp_get_attachment_url($thumbnail_id);                  get_the_category()          ?>                  <div class="<?php echo $class . ' ' . 'category-' . $cat->term_id;?>">
                     <?php                         echo 'ID) . '">' . '
' . $cat->count . '
' . '';                     ?>                     <a href="<?php echo get_field('category_link', $post->ID); ?>">                         <img src="<?php echo $image; ?>" alt="<?php echo get_cat_name($cat->term_id); ?>" class="item-image">

          <?php $i++; } } ?>      Here is the new and updated code which works, but created A LOT of queries:               /**      * Function to list all category with thumbnail custom link, etc..      *      * How to use this function:      * Add in template: <?php my_category_list(); ?>      *      */     function my_category_list(){          /* LIST OF CATS DATA */     $cats_data = array();          /**      * Get Categories      * @link http://codex.wordpress.org/Function_Reference/get_categories      */     $cat_args = array(         'hide_empty'    => 0,         'exclude'       => '13,1,1460'     );     $categories = get_categories( $cat_args );          /* If category found, load list of category */     if ( !empty( $categories ) ) {         $i = 0;              /* Foreach category: display the data */         foreach ( $categories as $cat) {                  /* ======= HTML CLASS ========= */             /* dynamic class (?) need fix */             $class = ( $i % 3 ) ? 'span4' : 'span4';             $classes = $class . ' ' . 'category-' . $cat->term_id;                  /* ======= POST COUNT ========= */             /* Get all posts in category + in due date              * this only to get the post count.              * @link http://themehybrid.com/support/topic/issue-with-filtering-due-meta-key              */             $query_args = array(                 'post_type'       => 'post',                 'category_name'   => $cat->slug,                 'meta_query' => array(                     array(                         'key'        => 'Due',                         'value'      => date( 'Ymd' ),                         'type'       => 'DATE',                         'compare'    => '>=', // greater than or equal to                     )                 )             );             $my_query = new WP_Query( $query_args );             $post_count = $my_query->found_posts;                  /* ====== CATEGORY THUMBNAIL ======== */             $thumbnail_id = get_option('seamless_term_thumb_' . $cat->term_id);             $image = wp_get_attachment_url($thumbnail_id);                  /* ====== LINK TO SEARCH: no need fields ======= */             $link_to = 'http://www.scholarships360.org/discover/?search_query=&orderby=blank&tax_category=' . $cat->slug .'&wpas=1';                  /* MERGE DATA IN ARRAY */             $cats_data[] = array(                 'classes'      => $classes,                 'post_count'   => $post_count,                 'image'        => $image,                 'name'         => $cat->name,                 'link'         => $link_to,             );                  $i++;         } // end foreach              /**          * NOW THE FUN PART          * =================          */              /* Sort Cat Data by Post Count */         usort($cats_data, 'my_sort_cat_data');              /* Cut only 6 item to display */         $cats_data = array_slice( $cats_data, 0, 6 );              /* Display it */         foreach ($cats_data as $cat_data ){ ?>                  <div class="<?php echo $cat_data['classes'];?>">
                     <a href="<?php echo $cat_data['link'] ?>">
<?php echo  $cat_data['post_count'] . ' Scholarships' ?>
                                          <a href="<?php echo $cat_data['link'] ?>">                         <img src="<?php echo $cat_data['image']; ?>" alt="<?php echo esc_attr( $cat_data['name'] ); ?>" class="item-image">

         <?php          }     }     /* No category found */     else {         echo '
No category found...
';     }     }           /**      * Sort Cat Data Helper Function      * @link http://stackoverflow.com/questions/2699086/sort-multidimensional-array-by-value-2      */     function my_sort_cat_data( $a, $b ){      return $b['post_count'] - $a['post_count'];     }


title: Rewrite URL variable to custom path

text: I am passing to my url some variables to display latest posts, most viewed etc. http://website.com/?r_sortby=highest_rated I am wondering how to create a custom path for it instead for SEO purpose ie. http://website.com/highest-rated/ Help anyone:)


title: Modify Javascript Configuration Options for Theme Customizer Colour Picker

text: I've started fully integrating the Wordpress Theme Customisation API into my Wordpress theme and it's phenomenal. One issue I've encountered is that including the default colour picker is great, but I am trying to determine how to change the configuration options for the Iris colour picker being used. By default the colour picker in the Theme Customization pane has a colour palette beneath the picker and on the right hand side it has a lightness vertical bar. I would like to mimick the settings I am using on the front-end of my theme (using the Iris picker). How would I go about changing the Theme Customization colour picker to use these settings? See below for the settings I am using for the front-end of my site for something completely different.                  $("#theme-color").wpColorPicker({             border: false,             controls: {                 horiz: 's', // horizontal defaults to saturation                 vert: 'l', // vertical defaults to lightness                 strip: 'h' // right strip defaults to hue             },             mode: 'hsl',             palettes: false,             width: 160,             change: function(event, ui) {                 var selectedColor = ui.color.toString();                      $.removeCookie('spot_colour');                      // Set our cookie to last for 1 day                 $.cookie('spot_colour', selectedColor, { expires: 1, path: '/' });                      // Apply any selected colours                 applySpotColours();             }         });


title: How to check if a user is in a specific role?

text: I have a pretty specific requirement to show different text in a field label on the user profile page based on the current user's role. I can't seem to figure out how to check whether the current use is an "author". I am looking for a function like:               is_user_in_role($user, "author");      I imagine this is pretty simple, but I have searched for too long without an answer so I thought I would post it here.


title: "More" span making trouble

text:
I've created my own custom post type using this tutorial: http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/ Everything works fine, but I'm having major problem with "Read more" feature. As we all know `<!--more-->` adds `<span id="more-[number]" />` at the start of hidden more paragraph. In my case this span breaks whole markup. See for yourself:
This is normal paragraph and should be visible everywhere.

This is read "more" paragraph that will be displayed only on a "single" page.

And another "more" paragraph.
      In my case it creates this strange code:
This is normal paragraph and should be visible everywhere.

This is read "more" paragraph that will be displayed only on a "single" page.

And another "more" paragraph.
      So the more feature in my case doesn't even work and doesn't even display "Read more" button. Any ideas? [EDITED] Ok, so I've added whitespace after and before my `<!--more-->` tag, so the post looks like this in admin panel now:               This is normal paragraph and should be visible everywhere.                    This is read "more" paragraph that will be displayed only on a "single" page.          And another "more" paragraph.      And it outputs the whole text because more span is getting an additional paragraph (why? :O):
This is normal paragraph and should be visible everywhere.

This is read "more" paragraph that will be displayed only on a "single" page.

And another "more" paragraph.
      And about "more button" - I'm using the_content unfortunately... And nothing helps, when I type 'TRUE' as the second parameter - the_content('Read more...', TRUE); - it hides everything BEFORE more tag (so it shows two last paragraphs and hides the first one). What's that? :O


title: Query two taxonomies via URL or link?

text: I've been banging my head about this, and have created a work-around, but it would be much nicer for my site's organisation if I could figure this out. I want to be able to query posts across two taxonomies (one of which is custom), I'd like to be able to do this automagically, without needing to create custom templates with custom DB queries. I want to have a 'platform' taxonomy, and be able to label articles in normal taxonomies (such as 'review' or 'preview'). At the moment I use a customised `Walker` to allow me to use the built-in Menu system to generate menus that point to specific archive pages. My URL looks like:               example.com/category/platforms/consoles-platforms/ps3+review/      This finds articles that are in the PS3 portion of platforms AND in the 'Review' category. Currently this is all done under the normal wordpress 'category' taxonomy. Ideally I'd want them to be separate taxonomies, ('Reviews' being part of normal 'Category' tax and then a 'Platform' tax for console organisation) so that the URL could look like:               example.com/platforms/consoles/ps3/review      It looks nicer and would let me keep my categories more tightly organised. BUT I can't for the life of me see how you set up WordPress to query across two taxonomies automatically. Has anyone else come up against this? _Edit: Following Rarst's comment, I have to wonder, am I being too ambitious with my URL requirement? I could feasibly set this up using GET parameters and just one template (i.e.,`example.com?platform=ps3&type=review`); is that the simplest/most robust way? Any other ideas on how to solve this?_


title: Migrate comments to Disqus

text: Is there a way to migrate all comments on my blog over to Disqus somehow? Thinking about using Disqus rather than the regular WordPress comments, but I don't want to lose the comments that are already written.


title: Taxonomy template shows only 10 posts

text: So I'm a little confused with this one. A blog I recently set up makes plenty of use of custom post types and custom taxonomies. In the reading settings the blog posts to show is at 100 but I can find no where to tell taxonomy pages to show 100 posts and they are stuck at 10. How do I change it without messing around with custom `get_posts();` or extensive `query_posts();` I have tried: A custom `query_posts();` loop


title: Is it possible to change the URL of custom post types to hide the post type slug?

text: I would like to turn /{custom-post-type}/{post-name} to /{post-name}, is this possible? If this is not possible, can I change the labels/terminology in Pages or Posts so that they could be called "Clients" or "Projects" etc?


title: Turn on again old expandable menu

text: In the latest WP the admin interface is changed and you have a popup submenu. I really liked the old version better with expandable menu. Is it somehow possible to get that back again for all users?


title: Author Link in Recent Posts Widget

text: I want to add author link into the recent post widget. For example if any user post on my web from his LinkedIn ID (which I have allowed) so in Recent Posts where it shows, `<time>` By: `<author>` so user can go to his/her LinkedIn profile by clicking on his name `<author>`. I know its code will be something like `get_author_link();` but don't know where and how to code it properly.


title: WooCommerce with thousands of products - site is very slow - optimize db queries?

text: So far I've got around 8,000 products in my WooCommerce and the product page on the front end takes several seconds to load, even after caching. My VPS host says that I should have multiple databases.   Is that the right method and if so, how is it possible? Any suggestions on speeding up my database queries or simply speeding up the front end would be great.


title: How to show a category post to a specific registered user

text: I'm working a private blog and I'd like to know if this can be done with any other plugin or any other way: Lets say we have 3 categories: CA, CB and CC, and 3 users, UA, UB and UC, all of them can post but only in a particular category, UA in CA and so on. Now when one of them login to see the blog, this will only shows the post category which he was allowed to for that user. Any suggestion? PD: Allow Categories Plugin was supposed to do that but it does not work at all in wp 3.4.2 and it has not been updated long time ago.


title: WP as a CMS menu

text: I've converted a client website from Joomla to WordPress. However, there is one aspect of the old site I haven't been able to replicate perfectly without modifying core WordPress. The goal is to automatically create a tree navigation menu where each link in the menu links directly to a page similar to the way Drupal and Joomla created the menus for this site previously. Obviously, I could build each link by hand using the new "menu" feature. But for 500 pages, this is going to take a long time and it would result in losing one of WordPress' best features! The only way I can think of to solve this is to make every blog post a 'page' so that articles can be children of parent pages. The drawback to this approach is that I can no longer create categories or tags which is a major setback. However, the main problem with this approach is that it changes the URL permalinks for the website which haven't been altered in over 7 years. Rather than having a URL of example.com/my-keyword-phrase/ the URL would become example.com/parent-keyword-phrase/child-keyword-phase/ I need a solution to keep the URLs the same, yet still have a hierarchical CMS style menu. The only solution I've found online is one that requires breaking updates by modifying core! http://wordpress.org/support/topic/page-permalinks-without-hierarchy-parents Any ideas?


title: How do I to override login redirect on specific pages?

text: # Description: I'm using a WordPress plugin that applies specific redirects after logging in based on users and roles. # The problem:   * I'm using a sidebar widget to allow users to log in on blog and forum (bbPress) pages.   * This widget doesn't have a perceptible redirect (stays on the same page).   * The plugin applies a redirect to this widget. I don't want it to. # Information: This is the documentation on how to extend the plugin: http://wordpress.org/extend/plugins/peters-login-redirect/other_notes/ It uses the following filters:               rul_before_user     rul_before_role     rul_before_capability     rul_before_fallback      ...and the following variable for each:               $empty     $redirect_to     $requested_redirect_to     $user      I'm using bbPress 2.0 as a plugin for WordPress. The log-in widget comes with this. # An example: This code shows how to write custom redirect logic for the plugin I'm using:               function redirectByIP( $empty, $redirect_to, $requested_redirect_to, $user )     {         $ip_check = '192.168.0';         if( 0 === strpos( $_SERVER['REMOTE_ADDR'], $ip_check ) )         {             return '/secret_area';         }         else         {             return false;         }     }          add_filter( 'rul_before_user', 'redirectByIP', 10, 4 );      I'm not sure how to manipulate this condition for it to read:               if (user has logged in using sidebar widget){     Keep on same page;     }     else{     Redirect the user as usual;     }      # My question(s):   * How do I set my log-in widget to ignore the redirect being applied by the plugin?   * Should I try to achieve this by tackling bbPress or the plugin?   * Any ideas on how to edit the above example?


title: How to change the setting so there is no post on home page

text: How do I set "Blog pages show at most 'Variable' posts" (under setting > reading) to 0 it isn't letting me. So what file do I need to edit so the value is 0?


title: Anonymous functions usage

text: Just wondering what the preferred method of using anonymous functions is. First I had some code like this:               function page_columns( $columns ) {         $columns = array(             'cb' => '<input type="checkbox" />',             'title' => 'Title',             'author' => 'Author',             'template' => 'Template',             'date' => 'Date'         );              return $columns;     }     add_filter('manage_edit-page_columns', 'page_columns');      But I know WordPress discourages using variables for things that will only be used once so I switched it to               function page_columns( $columns ) {         return array(             'cb' => '<input type="checkbox" />',             'title' => 'Title',             'author' => 'Author',             'template' => 'Template',             'date' => 'Date'         );     }     add_filter('manage_edit-page_columns', 'page_columns');      But now I'm thinking why even use a function at all?               add_filter('manage_edit-page_columns', function(){         return array(             'cb' => '<input type="checkbox" />',             'title' => 'Title',             'author' => 'Author',             'template' => 'Template',             'date' => 'Date'         );     });      What is the preferred method? Any reason why? Perhaps update the WordPress Coding Standards?


title: Add pagination to listing plugin

text: I am trying to figure out on how to add pagination to your listing. Think you could help me out? I have added the read more button and manage to customise the listing styles. What's left is the pagination. If its achievable, it did be one of the best plugins available. And how do I use the custom fields? I don't quite get what you mean in the instructions. I am planning to add more fields so I can add in phone number and so on. Your plugin has the potential of being a directory listing plugin that is customisable. Love it.


title: Costum Theme template directoy url problem

text: recently i've made a costum wordpress theme , i already made few before but this time i'm really confused about issue: issue is ; in costum theme i'm using this : get_template_directory_uri() to get the current theme 's url for getting his js files and css files work , but some how at the palce of my current theme name it is replacing with twenty twelve theme name , my costum theme is not an child of twenty twelve . style.css header code :               /*     Theme Name: Nicole 's New Theme.     Theme URI: http//:www.itmatic.io/.     Description: This Theme is created by itmatic , please do not edit anything , just make    an child theme and do the changes.     Version: 1.0     Author: Itmatic     Author URI: http//:www.itmatic.io/.     */     @import url("assets/css/reset.css");     @import url("assets/css/style.css");


title: Using Custom Fields in post, need to put into the_content

text:
I have some custom fields that I need to get inserted into the_content, specifically after a gallery, that's posted in the wordpress backend. Here's my current code for pulling the data out. I can use this in a template file, but need to get it integrated into a specific place in my template:               <?php                 $project_title = get_post_meta($post->ID, "Project_Title", true);                 $project_date = get_post_meta($post->ID, "Project_Date", true);                 $project_location = get_post_meta($post->ID, "Project_Location", true);                 { ?>

<?php echo $project_title; ?>

<?php echo $project_date; ?>

<?php echo $project_location; ?>

             <?php } ?>      Any help is appreciated.


title: WordPress Network for regional company websites

text: I am trying to setup a couple of company websites on a WordPress Network install running on IIS7 and SQL Server 2008. Ultimately, the sites will work together like this: Site 1 - All requests for this companies site (regardless of country/region) will go here. This site will just show a map to the customer allowing them to pick the regional site most suited to them (initially North America, Europe and Australia/NZ). Site 2 - North American site Site 3 - European site Site 4 - Australia/NZ site Sites 2-4 will share the same design and a lot of the same content. Where they will differ is in relation to news, contact information etc. Ideally, the same user accounts would be able to make changes to all of the sites with the one login and post news to each of the different sites. My current thinking to achieve this is to install WordPress at sites.domain.com and to then enable the Network feature (using sub-domains). Each regional site will then be region.sites.domain.com. Then, using a domain mapping plugin (recommendations? any IIS specific considerations?) I will redirect the regional domain names to the regional sub-domains I have created. Does anyone have any recommendations for the best approach to this setup and any tips/tricks to make it better?


title: Wordpress clean internationalization for menus?

text: I'm working on a Wordpress plugin that aims to solve content internationalization issues. The plugin enables users to publish content in different languages. It also offers a nice language navigation, so the visitors can switch between available languages. I've already achieved a good result: the plugin adds custom fields with WYSIWYG editor (according to the languages enabled by the administrator), so it becomes less boring to edit and publish translations of posts and pages. The only problem is: I haven't encountered a clean implementation to provide menu internationalization. Does anyone knows how to add custom fields to the menu administration screen to translate menu itens? Or maybe an alternative manner to handle that multiple language navigation deal? ps: I don't intend to add any kind of tweaking to Wordpress core ;]


title: how to put thumbnail below category's title?

text:
Edit : ok everything works fine : i finally had to use taxonomies and get_terms, and putting everything in divs work better than lis. Thanks for your help. Hi,   i have a problem with the categories and post thumbnail, my images are mixing up, the titles are OK, in the good order, but then the thumbnail of the first category goes under the second category title, and the second category thumbnail goes under the first title. I tried with "orderby" "name" on both `get_categories` or `$second` query but it's still the same : do you know how i could fix it?                       <?php

                             <?php                              //$tout = wp_list_categories();                             $tout = get_categories();                             foreach ($tout as $tou){                                 $mon_id = $tou->cat_ID;                                 echo '
';                                 echo ''.$tou->name.'';                                 $argu = array ('cat'=>$mon_id);                                 $second = new WP_Query($argu);                                 while ($second->have_posts()) : $second->the_post();                                     $res = '
'.the_post_thumbnail("mini", array("alt"=> the_post()->ID)).'
';                                 endwhile;                                 wp_reset_postdata();                             }                             echo '
';      and here's the markup :

Andalousia
Spain
Another post
      So all the code php in my first post is wrapped by "ul" tags, and this gives me the code just above : this seems ok, but the image of "Andalousia" is under the title "Spain", and vice versa... thanks a lot


title: WordPress permalinks with Windows Server IIS6 - without ISAPI access

text: I'm having trouble to export the website to my client hosting . . I get an index.php in the url all the time, I've research about it, change the permalink custom structure to: /%postname%/ and add this .htaccess in the root of the hosting:               RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule .* /index.php [L]      It doesnt change anything, I've read that I need ISAPI rewrite to make it work, problem is, I don't have the access of the Server to do this . . . only access to a part of their hosting dedicated for this website, and the DB SQL by Navicat. Is there any possiblity to make with work without access to it ? If yes, How is that possible ? Thank you so much :)


title: All in one calendar custom post type query doesnt work as expected

text: I did a custom post query for AIO Events Calendar, as described here: All in One Calendar Plugin Custom Post Type Query But it doesnt work.               <?php echo esc_html( $event->cost ) ?>      returns the cost, but               <?php echo $contact ?>      and any other variable without $event-> returns nothing.


title: Querying multiple taxonomies in URL leads to wrong taxonomy archive

text: My problem is very basic but so far I have not managed to solve it so I'll just post it here and hope one of you has got an idea. Basically, I have two custom taxonomies "autor" (writer) and "sprache" (language) for a custom post type that I want to use in an url like this: ... blog/datenbank/autor/steve-perry/?sprache=deutsch In the example, I want the "autor" archive page (Steve Perry) to show only the posts tagged with the language "deutsch". However, wordpress instead shows me the taxonomy archive template for "sprache" with the results for the author Steve Perry. In other words, Wordpress shows me this page ... blog/datenbank/sprache/deutsch/ with the results narrowed down to everything tagged "Steve Perry" But I want it to show this page ... blog/datenbank/autor/steve-perry/ with the results narrowed down to everything tagged "Deutsch" How can I tell wordpress which template to use?


title: Remove date from Google Search Results Description

text: How do I remove the date from the google search results of my posts? Is this related to WordPress or is it theme-specific?


title: Using full code instead of shortcode

text: How do I use a full code for JW Player plugin, not just the shortcode? I need it so that I can try and use the full code for Lightbox plugin.


title: Custom php page in WordPress theme?

text: For example I have in my theme folder named test-pages with some php web pages that display different message, in some part of process I want to pull with file_get_contents to get content of one page from that folder, but I can't do it, it just doesn't work, when I try to access directly to that page, I get 404 message like that pages doesn't exists. How can I make this page visible to WordPress, so I can access it without getting 404? Hope you understand me.


title: How to delete all records from or empty a custom database table?

text: I can't seem to find a simple reliable way to do this - perhaps?:               // delete row ##     global $wpdb;     $delete = $wpdb->query(          $wpdb->prepare(               "DELETE * FROM `wp_table_name`"         )     );          // return ##     $return = __('Table Emptied.');     if ( $wpdb->last_error ) {         $return = $wpdb->last_error;     }      But this gives me the classic: > You have an error in your SQL syntax; check the manual that corresponds to > your MySQL server version for the right syntax to use near '* FROM > wp_table_name' at line 1


title: Keeping get_posts' offset and is_paged() synchronized

text: I am developing the blog-template of my theme, which works as following: The user can input the total post-count to display on each blog-page (`$blogpost_count`). The blog itself lists post-entries in two different fashions, like so:   * first, the newest X (X being equal to $blogpost_count) posts are listed regularly with query_posts,   * then, the following 2 posts are listed with get_posts and an offset equal to `$blogpost_count`. Now, the different between both fashions/queries is merely CSS. Meaning, the first list of posts has a certain style, and the second another style. Furthermore, the second list is always offset by the specified `$blogpost_count`, essentially displaying the adjacent posts - if available. **Here's my issue:** This methodology works flawlessly on the first blog page. However, when the user navigates back to view older posts (i.e. with `next_posts_link()`, ending up on an `is_paged()` blog page), the offset does not "adjust" to the new number of displayed posts. Because of `'offset' => $blogpost_count`, that variable still applies on e.g. the second blog page, even if there is only 1 post listed. My logic tells me what I need something like this (simplified):               if(!is_paged()) {          'offset' => $blogpost_count;     } else {         'offset' => $number_of_currently_displayed_posts_PLUS_off_all_newer_posts;     }      I hope I explained myself thoroughly.   Thank you! **EDIT:** You can view a static HTML example of the blog-template, to hopefully, visually understand my concept better.


title: Custom Post Types and template_redirect

text: I have two custom post types (e.g. post_type_1 and post_type_2) that I would like to redirect to independent templates (single-post_type_1.php and single- post_type_2.php) to handle their display. I don't want to put the display templates in the theme folder as I want them self-contained in their respective plugin folders. How can I have each of them register a template_redirect hook without affecting the other? Or should I be using a different technique? Currently, I'm doing this in Plugin 1:               add_action( 'template_redirect', 'template_redirect_1' );     function template_redirect_1() {         global $wp_query;         global $wp;              if ( $wp_query->query_vars['post_type'] === 'post_type_1' ) {                  if ( have_posts() )             {                 include( PATH_TO_PLUGIN_1 . '/views/single-post_type_1.php' );                 die();             }             else             {                 $wp_query->is_404 = true;             }              }     }      And this in Plugin 2:               add_action( 'template_redirect', 'template_redirect_2' );     function template_redirect_2() {         global $wp_query;         global $wp;              if ( $wp_query->query_vars['post_type'] === 'post_type_2' ) {                  if ( have_posts() )             {                 include( PATH_TO_PLUGIN_2 . '/views/single-post_type_2.php' );                 die();             }             else             {                 $wp_query->is_404 = true;             }              }     }      Once I register plugin 2's template_redirect hook, plugin 1's no longer works. Am I missing something? What is the best way to do this?


title: How to add a SAVE button to replace PUBLISH on a custom post type?

text: I have a custom post type called 'contacts'. I want want to remove the status, post date and change the button from PUBLISH to SAVE. From what I can tell this may not be possible without changing core files (please correct me if I am wrong). So, instead of trying to hack the PUBLISH metabox, I have the ability to remove the PUBLISH meta box all together using the Access Manager plugin. But I need to know how to readd a SAVE button that works the same way PUBLISH would. Any ideas?


title: return paginate_comments_links() as array

text:
The documentation specifies: > type (string) (optional) Controls format of the returned value. Possible > values are: > >   * 'plain' - A string with the links separated by a newline character. >   * 'array' - An array of the paginated link list to offer full control of > display. > In order to add twitter bootstrap pagination styling to the wordpress comments pagination, I want to have the return be an array. When I add $args to the call, i get no return. My Code:
         <?php wp_list_comments('type=comment&callback=advanced_comment'); ?>

         <?php          $args = array(         'base'         => '%_%',         'format'       => '?page=%#%',         'total'        => 1,         'current'      => 0,         'show_all'     => False,         'end_size'     => 1,         'mid_size'     => 2,         'prev_next'    => True,         'prev_text'    => __('« Previous'),         'next_text'    => __('Next »'),         'type'         => 'array',         'add_args'     => False,         'add_fragment' => ''         );          paginate_comments_links($args);          ?>
      Is this because I am using a custom callback for `wp_list_comments`? My `advanced_comment()` callback:               <?php     function delete_comment_link($id)     {         if (current_user_can('edit_post'))         {         echo 'del ';         echo 'spam';         }     }      function advanced_comment($comment, $args, $depth)     {     $GLOBALS['comment'] = $comment; ?>     <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">

<?php comment_author(); ?> says: <?php echo substr(get_comment_excerpt(), 0, 25) . "..."; ?>

                 <?php echo get_avatar($comment,$size='75',$default='<path_to_url>' ); ?>
                 <?php if ($comment->comment_approved == '0') : ?>                 <?php _e('Your comment is awaiting moderation.') ?>
                 <?php endif; ?>

                     <?php echo get_comment_author_link($comment->ID); ?>
                                      <?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>                                                   <?php comment_text() ?>

                 <?php echo get_comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => "", 'after' => ''))) ?>                 <?php delete_comment_link(get_comment_ID()); ?>

        <?php      }      Please note: `paginate_comments_links()` works fine if I do not pass it `$args`. Solution:
         <?php              $pages = paginate_comments_links( array( 'echo' => false, 'type' => 'array' ) );             foreach($pages as $page)             {             echo "
" . $page . "
";             }         ?>


title: Need direction on a seemingly complex menu walker for automatically inserting a parent link li in it's submenu ul

text: I'd appreciate some direction on how to accomplish something with my WordPress menu. I've Googled this for hours without avail. I was to automatically insert a parent link into it's immediate submenu ul. For example, normal output is this: Parent Menu Item 1   Parent Menu Item 2   --Submenu Item 1   --Submenu Item 2   Parent Menu Item 3   I'm looking for this: Parent Menu Item 1   Parent Menu Item 2   --Parent Menu Item 2   --Submenu Item 1   --Submenu Item 2   Parent Menu Item 3   Again, any help and/or direction would be greatly appreciated.


title: WordPress comments on users profile

text: I have a profile page and I need to make a comment system on it. The comments system should work exactly the same way as standard WordPress comment system, but instead of posts it should work with users. For better understanding, I have 1 page which acts as a profile for every user (user_login is in the URL) and at the bottom of that page users can leave comments about ‘profile’ user. Any ideas how to achieve this? What should be changed? Is there any wordpress plugin for this of can you send me any PHP function for this.


title: How do I create a single.php for a specific category?

text: I am trying to create a single.php file for a specific category on my site. Instead of loading the single.php file I want WP to return that category in a file called single-category-53.php (the actual category id=53). I allow the selection of multiple categories on the site, and with the help of Hikari's permalink plugin, we choose the appropriate category for the permalink. Because of this I can't reference any built in functions for categories as Wordpress defaults to a numerical order. The code below works through the if ($catp == 53)... I've verified that. The issue seems to be in calling the single-category-53.php file, or I'm improperly doing the nested if statement. I have verified that I uploaded the single-category-53.php file to the child theme directory. Any help in correction of the code is appreciated!                   // A function which displays a specific catergory equal to the _category_permalink              function ag_templates($single_template) {              global $wpdb;         $table = $wpdb->prefix . "postmeta" ;         $query = $wpdb->prepare( "SELECT * FROM {$table}                                   WHERE `post_id` = %d                                    AND `meta_key` LIKE '_category_permalink' ",                                   $post->ID );         $perma = $wpdb->get_row( $query );         $catp = $perma->meta_value;         if ($catp == 53) {         if ( file_exists (STYLESHEETPATH . "/single-category-53.php") )          $single_template = STYLESHEETPATH . "/single-category-53.php"; }         return $single_template;         }              add_filter( "single_template", "ag_templates" ) ;              // End specific category template function.


title: Adminimize Plugin -- Is there an alternative to limiting Editor to 'Appearance > Widgets' only?

text: Adminimize > Menu Options: I want to grant access to "Appearance > Widgets" _only_ to select users (but not Themes, Editor, Add New Themes; nor Plugins, Settings). Although I have selected this in the Adminimize menu, "Appearance > Widgets" does not show on users' dashboard. Is there a solution? APPEARANCE (themes.php) -- Themes (themes.php) -- Widgets (widgets.php) -- Editor (theme-editor.php) -- Add New Themes (theme-install.php)


title: Widget logic not working

text: I am using the Widget Logic plugin to display a widget only on certain pages. I use the condition               is_page(10,16,19)      to specify the pages I want the widget to display on. However, the widget does not display on these pages. I have double checked the page ID is correct, and I have cleared my browser cache, yet the widget isn't being displayed.


title: How to rewrite URI of custom post type?

text: The site that I am working on uses the following "pretty" permalink structure:               http://example.com/blog/my-special-post      But for a custom post type my client would like to avoid having a "pretty" slug:               http://example.com/product/142      How can the post ID be used in place of the slug for the custom post type? I believe that this might be possible using WP_Rewrite, but I do not know where to begin.


title: Query posts to get all but the most recent post

text: I want to use the query_posts() function to limit the posts to all but the most recent on one of my templates. This is because the most recent post is a featured item alone on it's own page where as the rest of the posts are to be on another page. It was easy enough to display the most recent one on one of my templates:               <?php query_posts(array('category_name' => 'Recipe of the Week', 'posts_per_page' => 1)); ?>      So basically I'd like something like that but to limit it to all but the first post. Thanks, John.


title: How to use tinyMCE for user “biographical info” without messing with any core file?

text: I noticed when you typein the user's “biographical info” on the profile, it shows up in one page! Looks really terrible. So: Is there a way to use tinyMCE or other solution for user “biographical info” without messing with any core file, and without any plugin? Thanks a lot.


title: Suggest mp3 player plugin for a band website?

text: like I said, can you suggest a wordpress jquery plugin for a mp3 player/playlist , this is actually for a band website ...and it should have admin functionality where other users can just upload mp3 files or something like that any cool suggestions? Thanks


title: options validator input is false?

text:
I have a form that looks as such:               <form action="options.php" method="post">

           content

           content version 2

             <input type="url" name="aisis_core[index_more_posts]" placeholder="Url" />

             <input type="submit" value="Submit" />

           content for this tab as well

<input type="hidden" name="option_page" value="aisis_options" /><input type=       "hidden" name="action" value="update" /><input type="hidden" id="_wpnonce" name=       "_wpnonce" value="0360d57793" /><input type="hidden" name="_wp_http_referer" value=       "/wordpress/wp-admin/admin.php?page=aisis-core-options&settings-updated=true" />     </form>      The problem is, when I hit submit, the following options validator function is then called, based on the registered settings:               public function option_validator($input){         var_dump($input); exit;         $option = get_option('aitisis_core');         $option = $input;         update_option('success_message', true);         return $option;     }      The problem as you can see from the var dump is that the input is always null....no matter what I put into the url input. I registered the setting as such:               public function settings(){         register_setting(             'aisis_options',              'aisis_options',              array(                 $this,                  'option_validator'             )         );     }      any tips?


title: What is wrong with this wpdb update?

text: I've read a lot of documentation tonight, can't see why this isn't working. Obviously something I'm missing.               $newstr = "18,19";     $defid = 1;     $table = "wp_tablename";     $data = "array( 'somecol' => '".$newstr."' )";     $where = "array( 'id' => ".$defid." )";          if ($wpdb->update( $table, $data, $where) === FALSE)     {         echo "failure";     }     else     {         echo "success";     }      Comes up false every time. Any clues? What am i missing here? I did try using format_where and that didn't work either.


title: Custom archives function

text:
I'm working on building a custom archives page for my church's website. On my archives page I want to have last week's sermon shown at the top in a special box, followed by the future sermons and then finally the Sermon Archives. I'd like the future sermons and Sermon archives to be separated by a title... i.e. # Future Sermons the future sermons... # Sermon Archives the sermon archives... My problem is when I click the button to go to older Sermon posts with the pagination function, it displays the current and future sermons on every archives page I'm on! How do I get the current sermon and future sermons to only display on page 1, and not when I click to view older posts? Here are my functions:               // Create the loop for the sermons page     function sermon_posts() {         if(is_page('sermons')) {             current_sermon_archives(); ?>
Future Sermons
             <?php future_sermon_archives(); ?>
Sermon Archives
             <?php sermon_archives();          }      }          function current_sermon_archives() {         $thisSunday = date('d', strtotime('last Sunday'));         $thisSundayMonth = date('n', strtotime('last Sunday'));             $lastWeekSermon = new WP_Query(array( 'posts_per_page' => 1,                                             'post_type' => 'sermon_post',                                             'monthnum' => $thisSundayMonth,                                             'day' => $thisSunday) );          if ( $lastWeekSermon->have_posts() ) : while ( $lastWeekSermon->have_posts() ) : $lastWeekSermon->the_post();  ?>

Last Week's Sermon

<?php the_title(); ?>
 - <?php the_time(get_option('date_format')); ?>
                              <?php echo get_the_term_list( get_the_ID(), 'speaker' ) ?>     <?php the_content(); ?>
                             <?php $thereisdescription = get_post_meta($post->ID, "_description", true);                             if($thereisdescription){ ?>                                 <?php echo get_post_meta($post->ID, "_description", true); ?>                             <?php }else{ ?>                             <?php } ?>

         <?php endwhile; else: ?>             <?php wp_reset_postdata(); ?>         <?php endif;      }          function future_sermon_archives() {         $current_year = date(' Y', strtotime('next Sunday'));         $current_month = date('M ', strtotime('next Sunday'));         $current_day = date('d', strtotime('next Sunday'));         $futureSermon = new WP_Query(array( 'showposts' => '3',                                                 'post_type' => 'sermon_post',                                                 'monthnum' => $current_month,                                                 'day' => $current_day) );                  if ( $futureSermon->have_posts() ) : while ( $futureSermon->have_posts() ) : $futureSermon->the_post();  ?>

Last Week's Sermon

<?php the_title(); ?>
 - <?php the_time(get_option('date_format')); ?>
                              <?php echo get_the_term_list( get_the_ID(), 'speaker' ) ?>     <?php the_content(); ?>
                             <?php $thereisdescription = get_post_meta($post->ID, "_description", true);                             if($thereisdescription){ ?>                                 <?php echo get_post_meta($post->ID, "_description", true); ?>                             <?php }else{ ?>                             <?php } ?>

         <?php endwhile; else: ?>             <?php wp_reset_postdata(); ?>         <?php endif;      }          function sermon_archives() {         query_posts(array('post_type'=>'sermon_post', 'paged' => get_query_var( 'paged' ) ) ); ?>         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php the_title(); ?>
 - <?php the_time(get_option('date_format')); ?>
                              <?php echo get_the_term_list( get_the_ID(), 'speaker' ) ?>     <?php the_content(); ?>
                             <?php $thereisdescription = get_post_meta($post->ID, "_description", true);                             if($thereisdescription){ ?>                                 <?php echo get_post_meta($post->ID, "_description", true); ?>                             <?php }else{ ?>                             <?php } ?>

                  <?php endwhile; else: ?>         <?php endif; ?>
                     <?php if (function_exists("pagination")) {                       pagination($additional_loop->max_num_pages);                             } ?>
     <?php }      I know it looks like a lot of code, but really they are all pretty similar functions... How do I get the current sermon and future sermons to only display on page 1, and not when I click to view older posts?


title: Plugin temporary files and files to download via FTP

text: What is the best place to store temporary files for WP plugin which are not necessary for the future? And what is the best place to store files which will be downloaded via FTP?


title: How to copy an existing (custom themed) site to a new domain

text: I'm trying to find a way of duplicating an existing Wordpress site that uses a custom theme to a new domain. Once it's there I'll do a redesign of the site and redirect the old url to the new one. Just briefly... I tried following the instructions @ http://codex.wordpress.org/Moving_WordPress but when it told me to "3.Go back to your OLD blog and go to options and change the url (both of them) to that of your new site." It logged me out and caused about 3 hours of trying to get it fixed again !! So, my question is - how do I copy an existing, custom WP site & theme (including posts etc.) onto a new domain ? I'm a complete noob at Wordpress and would very much appreciate any help given... Thanks !


title: Shortcode not picking up custom field

text: I created a custom field that allows me to set the cropping style of timthumb, but I am also using short code to populate a page with blog posts, but the shortcode isn't picking up the customfield, so all the images look different. Here is the code from index.php               <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">       <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&h=150&w=600&zc=1&q=100&a=<?php echo get_post_meta($post->ID, 'thumbcrop', true); ?>"             alt="<?php the_title(); ?>" />           Here is the code from blog.php (shortcode)                                 The shortcode file hasn't been updated, as I'm not sure how to pass the customfield value. Can anyone help out. Much appreciated.


title: Rewrite of URL with '[' ']' or '(' ')' as literals

text: Trying to match and URL like this               linktosite/alphaNum/123/321/alphanum[alphanum].jpg      in .htaccess I can match and extract all the groups properly with               linktosite/(.+)/([0-9]+)/([0-9]+)/(.+)\\[(.+)\\]\\.(.+)$      in add_rewrite_rule I can not make it match. I've tried escaping the `[` with `\\\\[`, `\\\\\\\\[`, `\\\\\\\\\\\\\\\\[` and nothing works. I've also tried `\Q[\E` and using it as `\x5b` `\091` and nothing works. Also tried `([^\\\\[]+)` to match non `[` characters up to the `[` What's the proper way to match metacharacters like this?? Does the same for literal `\\()`


title: Custom Text Under Navigation Links

text: My navigation bar of my wordpress theme is set up to wp_list_pages. I'd like to display text underneath those page links. Like: * * * Home "Home Sweet Home" * * * Do I need a widget to accomplish this or is it relatively simple to implement?


title: Testing if current page is the static page set as home page

text: I set my 'About' page as home page, its permalink (my_site/about/) became my_site/ as a result. Is_page('about') returns TRUE on my local server but FALSE on online server. Why is that ?


title: Make Current/Active Page Number a Link (WP_LINK_PAGES)

text:
With the default wp_link_pages the current/active page number is not a link. I would like to find a code/hack which turns the current/active page into a link to the top of the page. I am already using a custom code for wp_link_pages which can be found below:               <?php     wp_link_pages(array(         'before' => '
' . __(''),         'after' => '
',         'next_or_number' => 'next_and_number', # activate parameter overloading         'nextpagelink' => __('Next'),         'previouspagelink' => __('Previous'),         'pagelink' => '%',         'echo' => 1 )     );      In my functions:               // Custom Next/Previous Page     add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');     /**      * Add prev and next links to a numbered link list      */     function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              if (!$args['next_or_number'] == 'next_and_number')             return $args; # exit early              $args['next_or_number'] = 'number'; # keep numbering for the main part         if (!$more)             return $args; # exit early              if($page-1) # there is a previous page             $args['before'] .= _wp_link_page($page-1)                 . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''             ;              if ($page<$numpages) # there is a next page             $args['after'] = _wp_link_page($page+1)                 . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . ''                 . $args['after']             ;              return $args;     }         ?>


title: Load an action which is in an url with Jquery

text: I'm using WP fvorite post. The action to make as favorite is in the url : http://mywebsite.com/?wpfpaction=add&postid=350 So when I click in a button with this url, it make it as favorite. I want to make it as favorite when I open the post directly. Each time I open a post, I want to make it as favorite. Is there a way to load the url when I open the post but I don't want to load the page one more time but just load the action. I tried this :               $( "#result" ).load( "/?wpfpaction=add&postid=350" );      and               $( "#result" ).load( "htp://www.mywebsite.com/?wpfpaction=add&postid=350" );


title: Uploading external web pages with limited rights

text: ## Context: We have a Wordpress website for our software. This software is not available to everyone. Moreover its users, according to their rights have access to different parts of the source code. In Wordpress we have created a role for each type of users. We would like to make the doxygen documentation available for the users according to their role. ## Problem: How can I upload the different folders of the documentation inside wordpress tree (each folder contains an index.html and other web files) in such a way that each user can only access the index.html of a folder if he has a role that allows it. ## My solultion: For now, all I can do is to put the folders outside the wordpress file structure and put links in wordpress pages (that have limited rights) toward those external pages. ## Why my solution is bad: If you know the exact link to some external file, you can access it without even being logged in wordpress. Can you please suggest a better solution ? Thanks in advance.


I have been searching why, but I am clueless, I cannot figure out what is happening... jQuery does not appear to be enqueued on static homepage (I am not used to work with static homepages). On regular pages (and blog), `wp_head()` loads javascript files, css and stuff. On static homepage, it loads everything **except** javascript files (none at all), including my dear jQuery... I just begun working on the theme, so I don't get it... It is based on a Twenty Twelve theme, so the code did not change much yet. I just touched `footer.php` and `style.css`, and I inverted sidebar & primary blocs on `index.php` and `page.php` (I am styling the sidebar horizontaly above the primary content). If anyone has an idea, I would be glad to get some help !


title: How to Associate Posts with Pages

text: This is more of a "how does this work", kind of question than a code question, though some code may be involved. I've been Googling, and reading other questions about custom post types and taxonomies, and haven't come across an answer that really suits my dilemma. Ideally, this is what I'm going for: I have a page titled "Guests". When you go to that page, it lists all of the pages that have a profile of each guest (one page per guest/one guest per page), with a thumbnail and a brief excerpt. When you click on one of the excerpted pages, you get the full biography of the guest, and a carousel of all the videos (posts) which feature that specific guest. The flow is basically, "Guests">"(Guest's Name)">"(Guest's Name)'s Videos". My dilemma: I realize that using categories for each individual guest is not a good idea. Would a custom post type and taxonomies be appropriate for this? There will be no limit to the number of guests (and, thus, the number of profile pages) that would need to be created. From what I've been reading, that doesn't seem like the proper use of custom post types. And, I'm also confused as to how to customize WP_Query args to get the specific video posts for each guest to show up on their own profile (I can't give pages categories, and I can't give posts parents). Any insights would be greatly appreciated.


title: adding access to a specific post in the wordpress admin left menu

text: I've added a custom post type on my wordpess called "Perso". here is the code :               // Register Custom Post Type     function custom_post_type() {              $labels = array(             'name'                => _x( 'Perso', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Perso', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Perso', 'text_domain' ),             'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),             'all_items'           => __( 'Rubriques', 'text_domain' ),             'view_item'           => __( 'View Item', 'text_domain' ),             'add_new'             => __( 'Ajouter', 'text_domain' ),              );         $args = array(             'label'               => __( 'personnalisation', 'text_domain' ),             'description'         => __( 'personnalisation', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 20,             'menu_icon'           => '',             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type'     => 'page',         );         register_post_type( 'personnalisation', $args );          }          // Hook into the 'init' action     add_action( 'init', 'custom_post_type', 0 );      it works fine. I had to create then a new post inside this custom post type called "HOME ADMIN", I use this to display specific on my home page using ACF. What I want to do is only get in my left admin page menu (see image) the direct access to this specific page ("HOME ADMIN") instead of the custom post type "Perso" with its chlid menu. ![enter image description here](http://i.stack.imgur.com/F16Xk.png) how can I add a direct link to "HOME ADMIN" page in the left menu, just after Posts for example ? thanks for your help


title: Trying to implement AJAX into my admin pages. Am I improperly enqueue and localizing my scripts?

text:
I'm trying to implement AJAX into my post edit form in order to hook a custom wp function into a link click. So far I've been able to register my custom js file into my admin header. However when testing my link click nothing is happening unless I do an alert() in my jQuery. Here is my code for the href link I want to hook into my custom function:               Delete      Here's my code in my functions.php for registering, enqueue, and localizing scripts, as well as my custom function (still work in progress):               //Add AJAX functionality to post.php to delete files     add_action('admin_enqueue_scripts', 'my_admin_enqueue_scripts');     add_action('wp_ajax_delete_meta', 'delete_pdf_and_metadata');          //Add my custom JS to the header of admin     function my_admin_enqueue_scripts($hook) {         global $current_screen;              if ( 'post.php' != $hook )             return;         wp_register_script('my-scripts', get_template_directory_uri() . '/js/custom/my-scripts.js' );         wp_enqueue_script('my-scripts');         wp_localize_script('my-scripts', 'wp_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));     }          function delete_pdf_and_metadata() {              global $post;              $the_id = intval($_POST['the_id'] );         //echo $the_id . '
';  //debugging         //echo $key . '
';  //debugging         wp_die($the_id);   //debuggin              //delete_post_meta( $post->ID, $key );  //TODO     }      Here's my jQuery in my `my-scripts.js` file I've successfully registered:               jQuery(document).ready(function($) {         $('.delete_pdf').each(function(i,e) { //grab the class delete-pdf             var id = $(this).attr('id').replace(/delete-/, '');             $(this).click(function(){                 //alert('Clicked! '+ $(this).attr('id'));  //THIS WORKS WHEN CLICKED                 $.post(wp_ajax.ajaxurl, { action: 'delete_meta', the_id: id }, function(data){                     });             });         });              function replace_pdf_with_file_upload(){             //TODO write to replace PDF link with File Upload              }     });      In my jQuery, if I do an alert() when clicking the link it works fine. However when I try to test my custom function `delete_pdf_and_metadata()` by simply doing a `wp_die()`, I get absolutely nothing. Not even exceptions in firebug where I'm debugging javascript. I think it has to do with the way I localized the scripts, but I'm not sure. this is my first dive into using AJAX with WordPress. Am I missing something?


title: Wordpress and a secondary database?

text: I have to achieve something on which I don't know how to approach it. **Base of the issue:** There's a bunch of data in another DB that I have to import into WP which so far wasn't possible due to them being multiple arrays that have to be repeated into fields(Advanced Custom Fields). As far as my research has gone I have not found an importer that supports them. **The problem:** Since I haven't found a solution and i'm not that far into developing WP(average maybe). The issue with WP (as far as I can compare with a self made CMS) is that it requires a certain format of the data that is inserted in the DB as it probably converts it when importing, thus you can't force plain data into it's DB. As well as i'll probably not be able to just do a query on which I do a query of for example `SELECT * FROM ...` to then show it on a plain page with a button that on click does `INSERT INTO wp_postmeta`. **The Questions** How can I achieve entering data from the secondary DB into the WP custom fields? As well as where do I even start researching how to do this? It probably is a core related thing and it also feels like I might need to create a plugin for this, please advice me as much as possible. Instead of a table example i'll show an example of where the issue would commence: ![The issue](http://imgur.com/TmtuSSk) As you can see there are multiple fields with a button to add even more in the DB I have a data that is inserted in the same way for instance:                Adress 1 Adress 2 Adress 3 Adress 4 Adress 5 Adress 6                    Data 1   Data 2   Data 3   Data 4   Data 5   Data 6         Thanks in advance!


title: Wordpress 3.6 - archive.php doesn't get triggered

text: I made a custom theme and just created an archive.php file. When I try to access `http://localhost/wordpress/?m=201308` for example it just triggers my index.php template. The link was generated by `wp_get_archives()` and should be right. What am I doing wrong?


title: Migrating site from stage to production server without particular dev. plugins?

text: I am thinking of some ways to exclude few development/staging related plugins(e.g P3, Query Monitor) from an automatic migration process to production server. For migration I use managewp.com. In the setup process they have facility to exclude particular folders from migration/backup/clone, so I thought perhaps I can stick in there corresponding directory paths of undesired plugins. But I am not sure such harsh removing way of plugins is the correct way. I know WP deactivates plugin in database if it's gone from radar and shows notification about it. But I haven't found any information on does WP clean up after that harshly removed plugins? Also mu-plugins directory buzzing in my head as other solution ... But never used it. though it looks like it doesn't have manual deactivation feature. So perhaps it works in the way I need? Or I have approached this process from wrong side? Thank you for your input in advance


title: Unable to install plugins

text: I downloaded a wiziapp plugin. Then I tried to install it on WordPress. It shows "file size exceed maximum in php.ini" How to install this plugin anyone help me


title: Get plugin versions in xml/json format

text: We have quite a few wordpress sites running and it would be nice to have the wordpress version and all of the plugins + version used in one seperate place. We have our own dashboard with information about each site already (uptime/loadings times etcetc) it would be nice to add installed plugins there. Is there a way to get all the installed plugins + their version in some format other than scaping the html?


title: fixing permalink structure

text: I am having trouble with my permalink structure of my site. I have a custom post type and custom taxonomy for that post type. These are both made within PODS if that makes a difference. For whatever reason, I am unable to get the permalink structure to work correctly. I would like to see: Domain.com/collection/%taxonomy%/%product-group Example: Domain.com/collection/gifts/puzzle collection is made with page-collection.php (an index of all taxonomy terms) %taxonomy% is made with taxonomy-collection.php (dynamic archive of all products within taxonomy) These both work fine. Then I have a single-pods_product_grps.php which displays the corresponding product in the pods_product_grps post type. the File in an of itself does work, but the URL and Breadcrumbs do not follow the pattern above. I have tried every possible rewrite rule in the pods UI, but nothing prepends the product with the collection/taxonomy/ I have updated the permalinks in settings after each change, and tried rewrite rules with and without the %'s and everything else I could think of. I don't know if it is the pods plugin itself that is preventing me from doing this or if there is something else I need to look at. I can manually code the post types if it will help. If there is an issue with wordpress thinking there may be multiple ways to access my product, there shouldn't be. It is a simple linear structure. The Collection page starts the index. it has multiple terms, each term has multiple products (pods_product_grps), and each product has many variants (not part of the url). My taxonomy is set to hierarchical, But there should be only one term selected per product. The current rewrite rules are set to pods_product_grps/(post-title) if I disable rewrite, its the standard format. If I change it to anything else, it gives me a 404 when trying to access the product link. And needless to say, when I do navigate down to the product page, the breadcrumbs are listed as Home>Product group>Puzzle instead of Home>Collection>Gifts>Puzzle If I click product group, it goes to an unformated archive that includes all my products no matter what taxonomy (category) they belong to.


title: How can I create a loop to build slides based on multiple categories using Coda Slider

text: I'm using a loop to generate the slides I need for a Coda Slider slideshow. The slides should be pulling the most recent post from 5 different categories. The problem I'm having is that it's pulling the 5 most recent posts from the 5 categories collectively and not individually. So it's pulling 2 posts from the 1st category and then 1 from each of the others. Any way to get this to work properly? This is the code I'm using:               <?php      $cat_post_query = new WP_Query($query_string . 'cat=7,8,10,9,11');     while ($cat_post_query->have_posts()) : $cat_post_query->the_post();     $do_not_duplicate = $post->ID;?>          <div>     * slide content *     </div>          <?php endwhile;  ?>


title: WordPress templating system for custom plugins

text:
I'm creating a custom plugin which needs to display HTML with dynamically updated values. To illustrate, here's what I want to achieve:
<?php print $title; ?>

<?php print $subtitle; ?>

<?php print $content; ?>
      How can I define a template, pass some variables and get output in return from my custom plugin? I do not want to embed everything as a variable name as it's messy; going back between PHP and HTML in a middle of a function doesn't seem any cleaner either. What is WP way of doing this? Thanks!


title: Error handling a plugin with exceptions

text: I'm creating a new plugin and I want to handle errors cleanly. I find the WP_Error class unwieldy so have decided to use exceptions. I am not bothered about lack of PHP 4 support.               $error = true;     if ($error) {         // Throw an error         throw new CustomException('A custom exception');     }      What I really want to be able to do is throw exceptions as per the code above in my plugin (and use try/catch blocks where appropriate), but when there is an uncaught exception, I want to be able to set an error handler ie:`set_exception_handler()` that only catches uncaught exceptions from my plugin. So if another theme exception handler has been set already, it doesn't interfere. Even better would be if I intercepted any of my plugin exceptions, dealt with them as appropriate, and then could choose to forward them onto any other already set exception handlers. Is this possible? Or is it possible to set an exception handler that only catches exceptions from within the class it is set? I was thinking along the lines of creating a customException that extended Exception and then somehow having a custom catch-all exception handler for it.


title: Limit Search to Post Type With Apostrophe return search not found

text: I limit the search to post type in wp default search engine by adding a hidden field.               <input type="hidden" name="post_type" value="books" />      But I got a problem when the search string that have apostrophes in it. For example, I got a post called 'Adam's Apple', when I enter exactly 'Adam's Apple' in search input, no post was found. But when I enter ' Adam' ' (with apostrophes bit without the 's'), the post was found. But not found again if I enter 'Adam's' . I tried it in normal post with same post's name and without limit to post type, everything working fine. So obviously the apostrophes is the cause of this problem. Any idea how I can fix it?


title: How to resolve 404 errors for wordpress comments/feed when I have disabled comments

text: I have disabled comments in my wordpress site. So comments/feed url is giving 404 error. So how should I resolve these errors? doaminname/feed works fine. But domainname/comments/feed is giving error. So I want to fix that error.


title: Making a thumbnail if there exist a link with. jpg or .png extension in Wordpress

text: I have changed my question. I was wrong. Check it out I'd say. Is this possible to make a thumbnail if a link contains a `.jpg` (or `.png`) extension? I want to make it a thumbnail automatically if there is a link like http://externalsiteorso.com/blablabla.jpg --> make this a thumbnail. If it's possible, how can I do this and solve the problem? I have found this, but it's not for `Wordpress`, I guess.               $extension = pathinfo($filename, PATHINFO_EXTENSION);          // Read source image     if ($extension == ('jpg' || 'jpeg')) {         $source_image = imagecreatefromjpeg($filename);          return '1';     } else if ($extension == 'png') {         $source_image = imagecreatefrompng($filename);         return '2';     } else {         return 'error';     }


title: Adding Meta Tags to a Post using its Tags, Excerpt and content

text: I run a multiple author platform where I have added conditions that force authors to add tags to their post. To improve SEO, I would like to add Meta Tags to the posts. Ideally, with a light solution (have high traffic) through functions or custom plugin. There are two meta tags that I want to add, first one is **description** :               <meta name="description" content="Description should be no more than 150 characters" />      For the description, I want to grab the excerpt of the post and strip it to 150 character max (including spaces). If the post doesn't have an excerpt, then grab the first 150 characters of the body text (excluding shortcodes if there are any). For the **keywords** :               <meta name="keywords" content="Keyword, Keyword 2, Keyword 3" />      Each keyword or keyword phrase need to be separated by a comma and then a space. I want to grab the category and tags of the post and add it here. For instance, if my post's category is `Movie`, and the tags are `Oldboy`, `Revenge` and `South Korean` - then the meta keywords would be: `content="Movie, Oldboy, Revenge, South Korean"` Also, obviously, the code need to be executed only on Post pages. And I am guessing that the `<head>` HTML tag comes far before the actual loop, so I'll need something else than the `global $post`. If you choose to answer, please be detailed and add comments in your code so that I can understand and learn from you.