Admin ToolBar not being displayed at top of site

Not sure what's going on, but even when I checked the "Show Toolbar when viewing site" and on functions.pho placed: `if (! current_user_can('manage_options')) { add_filter('show_admin_bar', '__return_false'); }` I can see the space where the admin bar is supposed to be placed but it is empty, a white bar, nothing on it, checked the source code and found this: `<style type="text/css" media="print">#wpadminbar { display:none; }</style> <style type="text/css" media="screen"> html { margin-top: 28px !important; } * html body { margin-top: 28px !important; } </style>` So not sure what else to do, any help? Thanks! A.


Menu id in nav menu ignored

<?php      wp_nav_menu(          array(              'theme_location' =>'main_menu',             'container' => false,             'menu_id'=> 'nav'         )     );      ?>      After updating WordPress to 3.8 menu id is not working. Where is the problem ? I like to get menu as

Home

About


WP Theme Customizer - Responsive Elements

Within WP Theme Customizer, I am wondering if it is possible to allow users to set the size of a thumbnail based on the size of the screen? For example, the user could select (1) for screens above 981px, the thumbnail would be 300px, and (2)for screens less than 980px, the thumbnail would be 200px. I developed two options: Thumbnail Size - Medium Screen   Thumbnail Size - Large Screen                   <?php if( get_option('thumbnail_size_medium') ) { ?>.thumbnail {width: <? php echo get_option('thumbnail_size_medium'); ?>;}<?php } ?>              <?php if( get_option('thumbnail_size_large') ) { ?>.thumbnail {width: <?php echo get_option('thumbnail_size_large'); ?>;}<?php } ?>      With the code above, I would be using two, separate options to update the same CSS element - .thumbnail. Within my CSS stylesheet, I use "@media" to make responsive elements. Within the Theme Customizer, how do I account for the screen size?


Query users base on custom meta data

I have no idea how to write this and need a helping hand. What would be the query for users with custom role of "gamer"and by custom meta "location" and SORT by custom meta "position"? I've tried coping others and using their queries but I can't quite get it to work. Thanks in advance for any help!


Custom single.php files for different post formats

I have 3 custom post formats. One is for image, one for video, and, one for gallery besides the default post and they each have a view comments link on the bottom right corner at the end of the post. Here is the code for that(it's in every formats php file):

 <a href="<?php comments_link(); ?>"> View responses

 -->
      **Check it out here:** http://benlevywebdesign.com/wordpress On the single.php page I would like to get rid/remove the view comments link because you don't need to see it when you are viewing the comments already(its redundant). I am new at wp and php so I need help I have already read the wp codex that tells you to just make single.php and single-post_type.php and I didn't work. I am not sure what to do now. Here is the current loop code in the single.php file: (it says in comment code "You are now viewing single.php" to see if goes to the single.php page as a test)
          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>              <?php get_template_part('content', get_post_format()); ?>          <?php endwhile; else: ?>
Hmmm? Can't. Find. Post.
     <?php endif; ?>


Wp_redirect and sending variables

How to send some variables with wp_redirect() from function.php file in my theme folder?               if ( $post_id ) {             $variable_to_send = '1';             wp_redirect( home_url(), $variable_to_send );             exit;     }      And on homepage I will catch the variable in if-else condition to show some confirmation or not depending if $variable_to_send = '1' or not. How to do that in WordPress?


Create a short code to display a specific loop

I'm breaking my head trying to create a short code to display certain loop, however I'm totally cut, I can not figure it out how to do it, since it's the first time I try to do it... I do now want to set any parameter, just put exactly as it if... I would appreciate if anyone can light me... This is the code I want to put into the shortcode

        <?php       $the_query = new  WP_Query(            array(               'post_parent' => '8',               'post_type' => 'page',               'posts_per_page' => 4,               'sort_column'   => 'menu_order'           )       ); ?>      <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
             <?php the_post_thumbnail('home-thumb') ?>
<?php the_title() ?>
             <?php the_excerpt() ?>             <a class="read-more" href="<?php the_permalink() ?>">en savoir plus <img src="<?php bloginfo( 'template_url' ); ?>/images/read-more.png">
       <?php endwhile; ?>      <?php wp_reset_query() ?>


Changing the Permalink Structure without Resetting the Facebook Like Counts?

When changing the permalink structure of a blog, Facebook and Twitter will treat the articles with new URLs as brand new articles and will reset that Tweet/Like counters. Is there a way to resolve this issue? Thanks.


Block metabox - No expanding, no moving around

I would like to make metaboxes as fixed elements, removing the expand function and the drag-and-drop function. Any ideas?


OOP Plugin and Menu - Call to undefined function register_setting()

WordPress documentation seems spotty on object-oriented code. I'm setting up a few plugins and the first should register settings and a menu page. It's throwing "undefined" for the `register_setting()` or `add_settings_field()` calls. Should these go elsewhere? I'm not seeing the admin settings page get created either? Thanks for any help.               <?php     //$c = new mySettings();     class mySettings {              public function __construct() {             $this->add_hooks();             $this->register_settings();         }         public function add_hooks() {             add_action('admin_menu', array($this, 'admin_menu'));             add_action('admin_init', array($this, 'register_settings'));         }         public function register_settings() {             //exit('register_settings'. microtime());             register_setting('mySettings', 'mySettings', null);             add_settings_field('myUrl', 'API URL', array($this, 'myUrl_callback'), 'my');             add_settings_field('myOauthUrl', 'API Host', array($this, 'myOauthUrl_callback'), 'my');             add_settings_field('myClientId', 'API Client Id', array($this, 'myClientId_callback'), 'my');             add_settings_field('mySharedSecret', 'API Shared Secret', array($this, 'mySharedSecret_callback'), 'my');         }         public function admin_menu() {             exit('admin_menu'. mircotime());             add_options_page('my API Settings', 'my Settings', 'manage_options', 'my-my', array($this, 'settings_page'));         }         public function settings_page() {             if (!current_user_can('manage_options')) {                 wp_die(__('You do not have sufficient permissions to access this page.'));             }             print '
my API Settings
<form action="options.php" method="post">';             print settings_fields('mySettings');             print do_settings_sections('mySettings_selections');             print submit_button() .'</form>';         }         public function myUrl_callback() {             $options = get_option('mySettings');             $option = isset($options['myUrl']) ? $options['myUrl'] : '';             print '<input id="myUrl" name="mySettings[myUrl]" type="text" value="' . $option . '" />';         }          }


Wrap wp_nav_menu output around option tags for select menu

I have set up a wp_nav_menu in Wordpress. I have 2 parent categories, with 2 sub-categories each, so this produces a nested list. My current code to call this menu is...               <?php wp_nav_menu(              array(                  'theme_location'    =>  'shop-categories',                 'container'         =>  'nav',                 'container_class'   =>  'shop-cat'             )          ); ?>      ... which outputs this... (I have simplified the code so you just get an idea of the markup)

           Clothing

T-Shirts

Tops

           Accessories

Earings

Hats

             Now I would like to output this...               <select>       <optgroup label="Clothing">         <option value="T-Shirts">T-Shirts</option>         <option value="Tops">Tops</option>       </optgroup>       <optgroup label="Accessories">         <option value="Earings">Earings</option>         <option value="Hats">Hats</option>       </optgroup>     </select>      ...is this possible to do dynamically? Or will it be better to do this manually? I have had a look around but couldn't find any help on this. Any help appreciated.


Is it possible to get the currently logged in admin's IP?

Given a wordpress (3.4.x) install that only has 1 admin, how would I grab, from within a plugin, the IP of the currently logged in admin, if there is an admin logged in? In other words: I need to obtain the IP of the admin, IF there is admin is logged in, and use this IP for other purposes. The request will not necessarily come in from the person logged in as admin. If there is no admin logged in, the function should return empty, as I only need the IP of the admin WHILE he/she is logged in.


Walker_Nav_Menu creating too many closing tags?

created this walker below to create a set of tabs. All looks ok but in the source there are several more than there should be causing validation errors. I only want to generate a tab for 'question' post types. code -                       $mmArgs  = array(               'menu'            => 'competitionmenu',                'container'       => 'div',                'container_class' => 'summary_chart_tab_icons',                'menu_id' => 'summary_chart_tab_icons',               'menu_class'      => 'summary_chart_tab_icons clearfix',                'echo'            => true,               'walker' => new summary_walker_2013_TABS()         );              wp_nav_menu($mmArgs);          class summary_walker_2013_TABS extends Walker_Nav_Menu{          function start_el(&$output, $item, $depth, $args){              global $wp_query, $current_user;         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';              $class_names = $value = '';              $classes = empty( $item->classes ) ? array() : (array) $item->classes;              $voted = hasVoted($item->object_id,$current_user->ID);         $voteMade = $voted[0];              $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );         $class_names =  ($voted ? ' voted' : '');         $icon_state=  ($voted ? '-voted' : '');              $class_names = ' class="tab-icon '.the_slug($item->object_id). esc_attr( $class_names ) . ' clearfix " ';              $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';              $icon_name = child_template_directory. '/images/images/tab-icon-'.the_slug($item->object_id).$icon_state;              if($item->object=='question' ) :                   $question = get_post($item->object_id);                  $output .= '
post_name.'"  ' . $class_names .'>';                  $output .='
';                  $item_output .=  ''.$args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );              endif;            }      } and extra closing li s are in twos before each * . I think it might be the menu items that aren't 'questions' coming through but how can i omit them in a walker? best, Dc


subdomain mulitsite on localhost in a subfolder

I have a sudomain-based WPMU installation locally with xampp. My `vhosts` lists domains like follows:               127.0.0.1 mainDomain.com     127.0.0.1 siteA.mainDomain.com     127.0.0.1 siteB.mainDomain.com     127.0.0.1 siteA.com     127.0.0.1 siteB.com      The `WordPress MU Domain Mapping` PlugIn maps "real-domains" on system- subdomains. To have a standard project structure, I would like to move my installation from the documentRoot to a subfolder. My question is, what do I need to do, to accomplish that and will it have any consequences for the compatibility between my local- and a live-system?


Wordpress functions give fatal error in included php file

First, my problem is similar to this thread. However, the solution posted there doesn't work for me. I'm creating a plugin that displays a contact form on a page using the Shortcode API. Plugin folder contents:   * contact.php (main plugin file)   * validate.php (included php file) The main file has the usual plugin header, and WordPress functions called in it work as expected [i.e: get_permalink()] The validate.php file is included in contact.php as follows:               define ("PLUGIN_PATH", plugin_dir_path(__FILE__));     include_once dirname( __FILE__ ) . '/validate.php';      My problem is any WordPress functions called in validate.php will throw a fatal error. PHP functions work as expected, only WordPress functions are throwing a fatal error:               Fatal error: Call to undefined function sanitize_text_field() in /{FULL WEBSITE PATH}/ralrom-contactform/validate.php       How should I be including the validate.php file to be able to call WordPress functions from it? I have tried "require" and "include" variations and all throw the same fatal error. **Before using multiple files, I had a working version as a single file shown here:** Orignal working code under a single php file: http://pastebin.com/qM5aj9qY Broken code under two php files: http://pastebin.com/KUCbg6rJ


Function to remove all classes on images inserted into posts?

I'd like my images to have no classes assigned to them by default, as I (sometimes) add my own classes to create custom 2 column layouts... can I do this without hacking the core? From my googling it looks like image_send_to_editor would work, but creating a regex for this is beyond me...                     to


Getting thousands of registration spam

We have tried the range of Captcha options, and now have Facebook Connect with Akismet installed as a constant, but still can't stop thousands of spam registrations from attacking our WordPress site. There must be a solution. Can anyone help?


$before/after_widget/title not displaying anything

I have built a custom widget with this code:               class rfw_dock extends WP_Widget {         function __construct() {             parent::__construct('rfw_dock', __('TITLE'), array( 'description' => __( 'DESCRIPTION')));         }         function widget($args, $instance) {             $title = $instance['title'];             $rss_url = $instance['rss_url'];             $rss = fetch_feed($rss_url);             $rss_items = $rss->get_items( 0, 1 );             echo $before_widget;             if ( $title )                 echo $before_title . $title . $after_title;             foreach ($rss_items as $item) {                 echo '
get_permalink() ) .'" target="_blank" rel="nofollow">
'. $item->get_title() .'

';             echo $after_widget;             }         }         function form($instance) {             $title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';             $rss_url     = isset( $instance['rss_url'] ) ? esc_attr( $instance['rss_url'] ) : '';             $number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 6; ?>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title (optional):' ); ?>              <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />

<label for="<?php echo $this->get_field_id( 'rss_url' ); ?>"><?php _e('Enter the RSS feed URL here:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'rss_url' ); ?>" name="<?php echo $this->get_field_name( 'rss_url' ); ?>" type="text" value="<?php echo esc_attr( $rss_url ); ?>" />
<?php          }         function update($new_instance, $old_instance) {             $instance = array();             $instance['title'] = strip_tags($new_instance['title']);             $instance['rss_url'] = strip_tags($new_instance['rss_url']);             $instance['number'] = (int) $new_instance['number'];             $instance['show_feed_title'] = ($new_instance['show_feed_title']==true);             $instance['feed_words'] = (int) $new_instance['feed_words'];             $instance['content_display'] = strip_tags($new_instance['content_display']);             return $instance;         }     }     register_widget('rfw_dock');`      And registered this sidebar:               register_sidebar( array(         'name' => __('Søstersider'),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
'     ) );      Pretty straight-forward, right? Well, my problem is that the `$before_title`, `$after_title`, `$before_widget` and `$after_widget` doesn't return anything, even though they're specified in the code. Isn't those variables how you're supposed to define the information in the register_sidebar? At least, it is in default-widgets.php. I'm sorry, but I'm not the best in PHP, although I consider myself to have a medium-levelled knowledge in it. I've tried a lot before posting this, but nothing works. Can someone please help me out? Thanks.


Covert Wordpress Blogname into JQuery

Here is the blogname in php `<?php $blog_title = get_bloginfo('name'); ?>` I want to convert it to javascript. The file I want the blog name is in a .js file so I cant create the variable with php.


Woocommerce display one random product via php

I am trying to display one random product in my template header. So each time someone visits or refresh there will be a different product displayed in the header. I searched and found this               <?php     echo do_shortcode('[products ids="1, 2, 3, 4, 5"]');     ?>      But this only displays products which have ids mentioned in this call. Is there anyway to get one random product?


How to block a someone from commenting?

I keep getting spammed by the same user, well different name and site listed but always the same email, IP, and comment. the email is `1p@ultradrugbuy.com`, the IP is `31.184.238.9`, and the message is long and always the same. I want to do 2 things:   * How can I block this person from commenting?   * I have over a hundred pending from them, is there a way to mark them all as spam?


How can i increase the login expiration length?

As the title says, how can i increase the login expiration period? Running a local install it's a little annoying to have to keep logging in, despite the fact i have the browser remember login credentials it's an extra step i have to perform everytime i fire up the local server. I assume if i increase the cookie expiration period i'll avoid the need to keep logging in(as often). Have googled and searched the forums, but all i found were unresponded to threads and i'm not in the mood for digging through code to work it out. I don't need an in-depth answer, just some pointers on suitable hooks(if any exist for this purpose), i can work out the rest from there. Off to find somewhere cool to sit now, upstairs is roasting hot right now(hot weather here) i think the laptop might just die if i keep it on any longer, i'll be keeping tabs on the question from another system in a cooler area of the house though and looking forward to any pointers you guys have for me.


Display thumbnail of child, parent and ancestor using featured thumbnails

I have tried to achieve that the Home page displays featured images of all it's child pages and in turn some child pages are displaying the featured images of their child pages. This is my code so far!               <?php             global $post;                  if ( is_page() && $post->post_parent ) :                   elseif ( is_page() && $post->post_parent && $post->child_page ) : ?>                  <?php else : ?>                 <?                 $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT');                      if ( $child_pages ) :                     foreach ( $child_pages as $pageChild ) :                         setup_postdata( $pageChild );                         $thumbnail = get_the_post_thumbnail($pageChild->ID, 'index-thumb');                         if($thumbnail == "") continue; // Skip pages without a thumbnail                 ?>
                         <?php                             echo '
' . get_the_post_thumbnail($pageChild->ID, 'index-thumb', array('class' => 'img-responsive', 'id' => 'img-center')) . '
';                             echo '
' . get_post(get_post_thumbnail_id($pageChild->ID))->post_title . '
';                             echo '
' . get_post(get_post_thumbnail_id($pageChild->ID))->post_excerpt . '
';                             echo '
' . get_post(get_post_thumbnail_id($pageChild->ID))->post_content . '
';                         ?>
                 <?                     endforeach;                 endif;                 ?>             <?php endif; ?>


Sort posts after filtering them through multiple taxonomies

I'm using scribu's Query Multiple Taxonomies to filter posts through multiple taxonomies (which works great!). However, I'd like to allow people to perform further sorting on the results based on custom fields which have numeric values (eg. `rate_per__private_session` or `rate_per_group`) by clicking on a link. I thought that something like the following would be all there was to it but clearly it is not.               <a href="<?php query_posts($query_string . '&meta_key=rate_per_private_session'); ?>">Sort by Rate per Private Session |      <a href="<?php query_posts($query_string . '&meta_key=rate_per_group'); ?>">Sort by Rate per Group      How do I do this?


WordPress and $_GET Params

This is an odd problem that I have never run into before with WordPress. I have a site, permalinks enabled. The url can be http://mysite.com/page-name/?anyParamName=testing then when I use `print_r($_GET);` or echo `$_GET["anyParamName"]` I get an empty array or nothing respectively. A pure PHP file works fine so its not a server issue. Does WordPress do anything with rewiring the get params? Really puzzled by this.


Password protect media attachment - share across guests

I'd like to show certain content to people with a password, specifically links to media files like this:               <?php if($currentuserid == foobar): ?>        LINK     <?php endif; ?>      If I were to create a user with ID `foobar`, and then give its password to several people, would it cause any problems if they all decided to use it at once? I would only want to use their logged-in status to show/hide certain content - they would not be accessing the admin side.


Switching theme only changes style sheet being used

I have a plugin that I'm using to switch themes for a specific user for development. When logged in as that user they see the different style sheet but the themes files, function.php, header.php, etc are the active theme for everyone else. What I am doing wrong?               function change_user_theme($template) {         global $user_ID;              if ( in_array( $user_ID, array( 5 ) ) ) {             $template = 'fezmobile';         } else {             $template = 'fezforprez';         }              return $template;     }          add_filter('template', 'change_user_theme');     add_filter('stylesheet', 'change_user_theme');     add_filter('option_template', 'change_user_theme');     add_filter('option_stylesheet', 'change_user_theme');


How to query and update one colum in postmeta table?

I'm trying to make a popularity calculation for all posts, based on page view and date of creation. Initially, there's a default popularity value saved in postmeta. Every hour I want to recalculate the popularity among all posts by cron job. How can I update all post's popularity in postmeta table?


How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?

This seems like simple thing but I need way to determine whether the current screen is for **Add New** or **Edit** ( a sort of wordpress admin conditional tag). Is there a built in function for this already, or ... any idea how to accomplish?


What is wrong here? Issue with post_id and meta_value

I'm trying to create a loop to read all the meta_value records from a given post_id. The idea is to gather all the meta_value's data from wp_postmeta table related to post_id number and print them as a list. But so far, I couldn't make this work. The issue is my 'custom_fields' variable. There I need to put my meta_key. But I have several meta_key per post_id. For example, the post_id 2171 has data2,date3,data4,data5.. data19 as meta_key. So, how can I get this working?               function jb_applicant() {        global $wpdb;        $custom_fields = get_post_custom(2171); //2171 is the post_id that I'm trying to gather the data from        $my_custom_field = $custom_fields['data2'];        $op = '';        foreach ( $my_custom_field as $key => $value ) {           $op .= $key . " => " . $value . "<br />";        }        return $op;     }     add_shortcode('applicant', 'jb_applicant');      Thanks


Add multiple="multiple" attribute to categories dropdown

I have a dropdown with Regular select. I need a dropdown with Multiselect. I added the JavaScript script file inside `header.php`, now I need add string `multiple="multiple"`. In firebug I `multiple = "multiple"` in a string > ![enter image description here](http://i.stack.imgur.com/qxB6c.png) Now I need add string `multiple="multiple"` in to this block but I don't know how do this:               <?php        $terms = wp_get_post_terms( $post->ID,"listing_category" );       $terms = isset($terms[0]) ? $terms[0]->term_id : "";            if(get_field("custom_attributes_input_types","options") == "Dropdowns"):         wp_dropdown_categories(            array(              'taxonomy' => 'listing_category',              'hiera`enter code here`rchical'=>1,              'show_option_none'=>__('Choose Category:','um_lang'),              'name' => 'listing_category',              'hide_empty' => false,              'selected' => $terms           )         );       else:     ?>


Wordpress : Explain Plugins & Theme string value in database

i have installed wordpress and i i have installed couple of plugins and i have got two themes already came with wordpress. What i am asking about today is : what does the Plugins & Theme string value in database mean ? Example [When plugins are active] , there is a value on table of :               a:3:{i:0;s:19:"akismet/akismet.php";i:1;s:9:"hello.php";i:2;s:37:"one-click-logout/one-click-logout.php";}      Example [When there are themes on the Themes folder] , there is a value on table of :               a:2:{s:12:"twentyeleven";s:7:"/themes";s:9:"twentyten";s:7:"/themes";}      I could get an explanation of what does the "a" and "i" mean from HERE , but the "s:" is what i do not know what does it mean. If i tried to change the s:37 to s:6 or any other value , the plugin becomes deactivated , so the s:37 <<< the 37 must mean something or related to the plugin somehow and that`s what i am trying to find out.


Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme's index.php?

I've started to develop my own theme in the past couple weeks (and extracting WP functionality here and there in the past year), and I'm finding the structure of the WP templates awful redundant. Although that yes, technically, the blog starts somewhere higher above to load the WP functionality, the main WP_Query object, and some global variable preparation - I don't understand why every themes that I've stumbled upon so far splits the template files as:   * 404.php;   * archive.php;   * index.php;   * single.php;   * page.php;   * search.php;   * ... etc; Those files basically duplicate a lot of PHP code to fetch the Header, Sidebar and Footer. Wouldn't it be cleaner to have one (1) `index.php` file that includes the **Header** , **Sidebar** , **Footer**... and within the `index.php` file - you could decide how to show the content? I'm not sure I understand the need to have separate files. If you need to change the title in your `<head>` tag, why not use the power of **output-buffering** (`ob_start()` and `ob_end_clean()`)to get the posts first / the page / the single post / the search results... Is there performance issues using this technique? Could I run into problems if I wish to make my theme **mobile-friendly** , and readable by **RSS feed readers**? **-------------- EDIT:** I bring up this question because there is PHP methods that exists to detect in which section the user is visiting (ex: `is_single()`, `is_page()`, `is_archive()`, `is_home()`, etc...) and I would like to know if those could be used to achieve a central point for my `index.php` file.


Hide admin toolbar based on a query string

As far as I know the showing and hiding of the admin toolbar on the front-end is a global setting, which applies to any page containing `wp_footer()`. I want to have more specific control over the visibility admin bar—specifically, to be able to hide it based on a URL query string, such as (e.g., `?hidetoolbar` at the end of a URL). I know that I can hide the toolbar from a specific **template file** by adding this to the top:                    add_filter('show_admin_bar', '__return_false');      What hook would I use to apply the filter conditionally in **functions.php**?


The Pagination doesn't work

i have made a new WordPress Theme and ive done .. but i have one problem. I can't get the pagination work. I use the "wp-paginate" plugin and i have put the folloing code on my index.php               <?php if(function_exists('wp_paginate')) {     wp_paginate();     } ?>      But that doesn't work for my site. There is still nothing on the frontend and in the markup. What can i do? Here is my index.php:                   <?php get_header(); ?>

              <?php if ( ! have_posts() ) : ?>
Nicht gefunden!

Sorry, leider konnte der gewünschte Artikel nicht gefunden werden. Vielleicht hilft Ihnen die suche ja weiter!
         <?php endif; ?>              <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'loop-index', 'index' ); ?>
              <?php endwhile; ?>
           <?php if(function_exists('wp_paginate')) {         wp_paginate();     } ?>          <?php get_sidebar(); ?>          <?php get_footer(); ?>


Two wordpress mu installs, same settings/plugins/themes?

I run two wordpress mu installs. They are both indentical in terms of plugins, themes and network-wide settings. The reason I run two is because they have different root-domains and different superadmins. Is it possible to simplify this setup somehow?


The 'user_has_cap' hook seems to take two page loads to trigger

This question relates to another question I asked recently (http://wordpress.stackexchange.com/questions/29009/how-to-assign-specific- users-the-capability-to-edit-specific-pages-posts-cus/), the answer to which got me most of the way there to what I was trying to do. However, rather than keep updating that question I thought it better to post a new one as I really consider it more of a new issue now. I am basically restricting Read access to a custom post type (projects) on a per-user basis, I'm using the `user_has_cap` hook and I check whether the User trying to Read a page has the post type's ID in an array of IDs that are assigned to the User, depending on whether the array has the current post ID in it then Read capabilities are added / removed accordingly. This is done with the following code:               function allow_user_to_read_cpt_filter($allcaps, $cap, $args) {         global $current_user; // Get user id         get_currentuserinfo(); //...         $userid = $current_user->ID; //...         $wos_uspr_checked_read_ids = explode(',',esc_attr(get_the_author_meta('wos_uspr_read_data', $userid)));         /* The above is a comma separated list of IDS, e.g. 724,736,784 */         global $wpdb;         $post = get_post($args[2]);         if (!in_array($post->ID, $wos_uspr_checked_read_ids)) {             $user = wp_get_current_user();             $user->remove_cap('read_project');             $user->remove_cap('read_projects');             $user->remove_cap('read_others_projects');             $user->remove_cap('read_published_projects');                } else {             $user = wp_get_current_user();             $user->add_cap('read_project');             $user->add_cap('read_projects');             $user->add_cap('read_others_projects');             $user->add_cap('read_published_projects');         }              return $allcaps;     }          add_filter('user_has_cap', 'allow_user_to_read_cpt_filter', 100, 3);      (Yes, I have used different code than the answer given to my previous question, I don't _think_ this is contributing to the problem here though as I have used the other method of assigning capabilities, I just prefer using the above method.) Anyway, the problem I am encountering with this is that it is taking two loads of the page before my post types content is being hidden. The code I am using on my page looks like this:               if (current_user_can('read_projects')) {         echo '
Yes, you can read this.
';     } else if (!current_user_can('read_projects')) {         echo '
No, you cannot read this.
';     }      My guess was that the hook was not being triggered quickly enough when the page is loaded in order to show or hide the content on the first load, but I'm struggling to find an answer to when `user_has_cap` is triggered.


Will wp_get_attachment_metadata display PDF metadata (eg: keyword, author, description)?

I used this technique to display attached PDF metadata on a page. It shows the title and path but not info like keyword, author, and description. Can Wordpress access all the properties uploaded with a PDF file and if so, what's the best way to get at them? TIA


Custom Post Type With Categories

I have copied custom post type code from WordPress and modified and added to function.php but Where is the categories box. I cant seen anywhere. I want also for this post. ![I want to see this in my post](http://i.stack.imgur.com/65FJL.png) I am not good for WordPress So please guide me to solve this issue. Thanks :) **My Code:**               function codex_custom_init() {       $labels = array(         'name'               => 'Prices',         'singular_name'      => 'Price',         'add_new'            => 'Add New',         'add_new_item'       => 'Add New Price',         'edit_item'          => 'Edit Price',         'new_item'           => 'New Price',         'all_items'          => 'All Prices',         'view_item'          => 'View Price',         'search_items'       => 'Search Prices',         'not_found'          => 'No prices found',         'not_found_in_trash' => 'No prices found in Trash',         'parent_item_colon'  => '',         'menu_name'          => 'Prices'       );            $args = array(         'labels'             => $labels,         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'show_in_menu'       => true,         'query_var'          => true,         'rewrite'            => array( 'slug' => 'price' ),         'capability_type'    => 'post',         'has_archive'        => true,         'hierarchical'       => false,         'menu_position'      => null,         'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )       );            register_post_type( 'price', $args );     }     add_action( 'init', 'codex_custom_init' );


Uploading .webm format on WordPress results in security guidline breach and fail

I cannot upload the .webm video format on WordPress. This is after adding: AddType video/webm .webm into both: my .htaccess file (on the root folder of the WordPress installation) the mime type handler of our apache server (via our site cpanel) As far as i remember, at first this message instantly gave me the error, it would even begin uploading it. Now it uploads it all the way and then while crunching, i get the error. The error is               “1.webm” has failed to upload due to an error     File type does not meet security guidelines. Try another.      Has anyone else had this problem?! What's really peculiar is that another video format called ogv (Theora) was not being recognised in the html5 player, BUT it wasn't breaching security according to WordPress. So I added the mimetype to the apache (not via htaccess) and voila, it worked. Also, the file actually 'Uploads', it 'Crunches' and then rejects the file, which is odd, surely WordPress would deduce it can't upload the file format by just checking which file format it is first?


Category and guest post with 404

i use twenty twelve theme in wp with plugin of guest post and redirection because if any of user click on category and blank category shows a guest post page in redirection plugin i set one category redirection its work when i set another so its not work, i need a proper solution of 404 page not found and also blank category redirection, please suggest. > For details i share complete info of plugins here   1. Guest Posts By ericgrld   2. Redirection By johnny5   3. Theme : Twenty Twelve


Cron job not firing

I'm having this problem where cron jobs doens't seem to post delayed posts.. I'm using this cron job               wget -O /dev/null http://domain.com/wp-cron.php?doing_wp_cron      Am i doing something wrong?


__(): What if I have to pass in a variable?

In the docs for the translate function `__( $text, $domain )`, it states that you must put the string directly in place of $text, that you cannot do something clever such as `__( $my_text, 'text-domain' );`. However, I am writing a method which takes in a string and needs to pass it to `__(` ... `)` somehow. Is there a way, e.g. via `printf` or `sprintf` that I can work around this? Something like...               function print_description( $text ) {         echo '<p>' . __( printf( '%s', $text ), 'text-domain' ) . '</p>';     }


get_post_meta image width for lazy load

I'm trying to lazy load a page of images in Wordpress - I've tried the plugins but none of them seem to work(I only want to lazy load image on some pages.) So I'm now trying to do it with a plugin - http://www.appelsiini.net/projects/lazyload This plugin requires the image width and height in the img tag.                         I'm attaching the images from custom fields like                   <img src="<?php echo get_post_meta($post->ID, 'img1', true); ?>">      Is it possible get the images width and height from the get_post_meta I've looked at wp_get_attachment_image_src but I can't see how to use it get_post_meta


JW Player popup with s2member & amazon s3/cloudfront

I have been working on Developing a Tutorial site. I am using WordPress, ACF, s2member, amazon s3 & cloudfront and JW Player. I have integrated amazon cloudfront with s2member but now I am having problem to play video in JW Player. I actually want to open the video player in a new window. I am going to use a custom post type for tutorials. Then custom field for Video name & links. Can anybody help me find a way to play the video in a new window. Here is an exact demo of what I need to do : http://www.vtc.com/products/MasterClass!-Cinema-4D-Lite-in-Adobe-After- Effects-CC-Workflow-Tutorials.htm If you click on Input Devices, you will see the video open in a new window. Here is my site : http://demo.mamb2b.us/training/courses/photoshop-course-1/ And here is my single-courses.php ::               get_header('courses'); ?>                        <?php              /* Run the loop to output the posts.               * If you want to overload this in a child theme then include a file               * called loop-single.php and that will be used instead.               */              the_post();                   //get_template_part('loop', 'single');              ?>
          <?php do_action('icl_language_selector'); ?>
             <?php if(get_field('introduction')) : ?>

Introduction

                 Name	                 	                 Duration	                 Files
                  <?php while(has_sub_field('introduction')) : ?>
                 <a href="javascript:;" id="introduction<?php the_sub_field('sl._no.'); ?>"><?php the_sub_field('name'); ?>	                 <a rel="shadowbox" href="#introduction<?php the_sub_field('sl._no.'); ?>">	                 <?php the_sub_field('duration'); ?>
                      <?php endwhile;          endif;          ?>                               <?php if (current_user_is("s2member_level1")){ ?>             <?php if(get_field('basic_tutorial')) : ?>

Basic

                       <?php while(has_sub_field('basic_tutorial')) : ?>
                 <a href="<?php the_sub_field('video_link'); ?>"><?php the_sub_field('name'); ?>	                 <a href="<?php the_sub_field('video_link'); ?>">	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } else { ?>     <?php if(get_field('basic_tutorial')) : ?>

Basic

                       <?php while(has_sub_field('basic_tutorial')) : ?>
                 <?php the_sub_field('name'); ?>	                 	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } ?>                               <?php if (current_user_is("s2member_level1")){ ?>             <?php if(get_field('advanced')) : ?>

Advanced

                  <?php while(has_sub_field('advanced')) : ?>
                 <a href="javascript:void(0)" onclick="window.open('http://www.w3schools.com/html/movie.mp4<?php //the_sub_field('video_link'); ?>',     'welcome','scrollbars=yes,location=no, toolbar=no')"><?php the_sub_field('name'); ?>	                 <a href="<?php the_sub_field('video_link'); ?>">	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } else { ?>              <?php if(get_field('advanced')) : ?>

Advanced

                  <?php while(has_sub_field('advanced')) : ?>
                 <?php the_sub_field('name'); ?>	                 	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } ?>

Course Description:

<?php the_content(); ?>

         <?php //comments_template(); ?>         <?php echo do_shortcode('[facebookall_comments]'); ?>
     <?php get_footer('courses'); ?>      Thanks in Advance for your Help!


Making a string translation ready with html in it

I can make a simple translation string like this:               <?php _e('Hello world','text-domain'); ?>      But how to make a translation string if there is a markup in it? For example this:               <?php _e('Hello world','text-domain'); ?>      Is the above correct?


How to execute SQL SELECT query and see the results?

I want to run a SELECT query on the Wordpress database and get the results on the screen. Any widget which does it?


How to add font in wordpress

I have a oswald.woff font file downloaded from some free fonts site. Using ftp i have created folder called fonts in the themes folders. (i.e /wp- content/themes/esplanade/fonts). In the fonts folder i put the oswald.woff file.               @font-face {         font-family: "Oswald";         font-style: normal;         font-weight: 400;         src: local("Oswald Regular"), local("Oswald-Regular"), url("fonts/oswald.woff") format("woff");     }      I use this font for an heading h1. When open my site, it says "www.mysite.com/fonts/oswald.woff" (mysite.com used for representation, its not the origianl site) not found in the firebug errors console. how to get the url of the file oswald.woff


Writing Mysql and Php code in wordpress Posts

I am on wordpress and i am writing php or mysql code in a post but finally when i hit publish it gives an Server Error : 500 , i also trying putting my code under [code] [/code] tags nothing happened but when i remove my codes and hit publish then it's working Any idea guys Waiting for help


Featured Images on Front Page

I currently have a static front page and a /blog. My goal is to have the front page be a grid of hand selected images (similar to a portfolio). I would like to be able to easily switch the images are featured on this page without having to change the raw html. Is the best way to do this, using custom fields on a page? Or is there a better way to handle managing featured images on a static page? Thanks!


Side by side blogging?

I'm designing a blog with wordpress as my CMS. My client would like one page on the site to have two main content areas, each with a title above and streaming posts from different categories. So far I haven't seen any examples of this anywhere on the web. Is this possible to do? If so, whats the best approach?


Wordpress Development understanding core

Just like any other framework, I preassume that Wordpress is a framework that should be understood before any further development should take place. I am keen to know about the recommended steps to understand Wordpress. I am coming from .Net technology with more than 10 years of programming experience. I know how wordpress external. However, I want to know about internals' so that I can build my own plugins and stuff like that. Since it is the community dedicated to Wordpress development, I would like to know the best possible way of understanding internals and then write plugins. I just need a direction, I will find my way. thank you, Mr. Codebased.


line break are not working when editing a post

So I have a problem when making a post. If I press enter and make a new line in the editor and press safe the line break diapers. But when I show the post it have inserted a line break. So somehow the editor is not able to show the line break? If I save the editor again the line break disappears from the post as well. Any ideas? I read in a post to try and use:               remove_filter ('the_content', 'wpautop');     remove_filter('the_content', 'wptexturize');      Which I did and now line breaks don't work at all. I have build a custom page where the posts are shown with the               echo the_content();


Changing the display of the themename_posted_on() function

At present, this is what the `pl_dev_posted_on()` function is displaying: ![pl_dev_posted_on\(\)](http://i.stack.imgur.com/kHBPY.png) Where can I find this function to be able to edit what it displays?


WOW.js Script Tag Initialization Header/Footer

hope things are going well. I'm attempting to use WOW.js http://mynameismatthieu.com/WOW/docs.html with animate.css to add animations to my site. WOW.js requires me to initialize it by adding the following in the header:               <link rel="stylesheet" href="css/animate.min.css">     <script src="js/wow.min.js"></script>     <script>      new WOW().init();     </script>      The theme I'm using, JointsWP, is utilizing wp_register_style, wp_enqueue_style, and wp_enqueue_script to link the js and css files.               // register wow.js & animate.css         wp_register_style( 'animate-stylesheet', get_stylesheet_directory_uri() . '/library/css/animate.css', array(), '', 'all' );         wp_register_script( 'wow-js', get_stylesheet_directory_uri() . '/library/js/vendor/wow.min.js', array(), '', 'all' );          wp_enqueue_style( 'animate-stylesheet' );     wp_enqueue_script( 'wow-js' );      I've successfully linked the required css and js file using these WP functions.. I'm having trouble adding the inline `new WOW().init();` method to the page source. What would be the best way to add this to the page? I've attempting adding the function referenced in this link wp enqueue inline script due to dependancies but I wasn't able to successfully implement it. I've also added the script tag code to the header.php, but the animation isn't being applied. I greatly appreciate any help that can be provided. Thanks!


Another flat level URL question (no hierarchy)

I read some issues with related topics, but found no answer. I have categories and subcategories on my site. **The only reason having hierarchy is because I need to have on the category page all child subcategories.** I want this:   * `example.com\category`   * `example.com\subcategory`   * `example.com\postname` How can I get this?


Display results with an Autocomplete

Just need some help on this `function wp_ajax_nopriv_izwootsy_charity_autocomplete() { if (strlen($_GET['q']) > 1) { global $wpdb; //$results = $wpdb->get_results("SELECT post_title FROM ".$wpdb->prefix."posts WHERE post_type='store-charity' AND post_title LIKE '%".esc_attr($_GET['q'])."%'");                   global $posts;              $results = new WP_Query( 'post_type=store-charity&post_title='.esc_attr($_GET['q']) );              foreach($results as $result) {             print $result->post_title."\n";         }     }     exit;      }` I want this to load up post results and prepare them for an autocomplete Here is the JS ` jQuery(document).ready(function($) { $("#charity").autocomplete('/wp- admin/admin-ajax.php?action=izwootsy-charity-autocomplete', { width: 300, multiple: false, matchContains: true, formatItem: function(data, i, n, value) { return value; }, formatResult: function(data, value) { return value.split(".")[0]; } });               function formatResult(row) {         return row[0].replace(/(<.+?>)/gi, '');     }      });` For some reason it only shows the number 0. Any Ideas


How to add comment on scripts using function in wordpress?

this is the code im using to call script if the browser is ie               <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <style type="text/css"> .clear { zoom: 1;display: block;} </style> <![endif]-->      but how can i add this on function.php as normal way we do this to call the js               wp_register_script('html5js', ("http://html5shiv.googlecode.com/svn/trunk/html5.js"), false, '1.3.2');     wp_enqueue_script('html5js');      and i dont want to statically insert the code on header is there any other way to generate comment?


How do I retain url parameters the entire time a user browses my site?

We have customers that come from other sites and I would like to retain a url parameter /?lead=openeye throughout the time that they're browsing. That way when they fill out a form I can capture the lead for sales. How do I retain url parameters the entire time they're browsing the site. **Update..** I've began using a combination of sessions and cookies to accomidate this. It sort of works but doesn't seem to stick for more than a few seconds between pages. In the header               <?php          $lead = $_GET['lead']; $_SESSION['lead'] = $lead;         $url = parse_url(get_bloginfo('url'));         setcookie("lead", $lead, 0, $url['path'], $url['host']); (set)      ?>      To test               <?php          echo ($_COOKIE['lead']); // Lead Cookie     ?>


Why am I seeing 'yes' and 'no' in URLs crawled by Xenu?

This may not be a WordPress thing at all, but I've never seen it before and it's happening to a WordPress site we're completing. I use Xenu for checking sites for broken links, images etc. When I run it over our dev site I see loads of 404s for what are valid URLs, but with /yes and /no appended to them. i.e.               http://mysite/2014/04/my-fascinating-post/yes     http://mysite/2014/04/my-fascinating-post/no      Has anyone seen anything like this before?! Thanks, Toby


Possible to get all posts with my shortcode?

So here's what I'm trying to do. I'm building a plugin for a business directory. Each business is assigned to a category. There are two views, listing and detail. To give the user as much flexibility as possible, I have created a shortcode where they can pass in the category and that will display the listview. This works great. They can create a page, called "Fishing" with a permalink of "/fly-fishing" and the content is                  Here's some title information about our fishing.  Thanks yadda yadda.        [business-directory category=fishing]      Notice that the category and the permalink are different. Again, to show the flexibility I'm trying to achieve. In my listings, I would like a permalink to each business that uses the permalink of the category page that they select. So one might be /fly- fishing/abc-fishing. When that permalink is visited, I need my plugin to know that the category is actually fishing and the business is abc-fishing. I'm having trouble with creating the add_rewrite_rule such that it knows what page to pass back to. My thought was to query each page, look for my shortcode, and then add the rewrite_rules accordingly. This means I will have to do this on every page creating/update. Is there a better way?


Wordpress caching issue

I've updated a page in wordpress and can see the correct result in "preview mode", but if I view the page outside of the admin interface the update does not show. I've search around and tried the following, of which nothing worked:   * Disable or clear wordpress cache plugins, of which I have non installed   * Checked the wp-config.php file for anything referencing to cache    * Cleared browser cache, and tried multiple browsers   * Checked .htaccess file for any apache modules to do with caching Now I'm stumped and don't know where else to look.


Wordpress custom post type and taxonomy

So I have a custom post type called `Video` and a taxonomy called `category` that I use to group videos togheter, so I want to list them like this:               Taxonomy NAME 1     VIDEO 1     VODEO 2          Taxonomy NAME 2     Video 1     Video 2      So I tried something but it doesn't work, the problem is that for each video I also display the taxonomy name like this:               Taxonomy Name 1     Video 1     Taxonomy Name 1     Video 2      So this is not what I want, mabe you guys can figure it out, what I do wrong:               <?php get_header();?>     <?php         $args = array( 'post_type' => 'Video');         $loop = new WP_Query( $args );     ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>             <?php $fg = get_the_terms(get_the_ID(),'category'); ?>             <?php foreach($fg as $term): ?>
<?php echo $term->name; ?>
                     <?php wp_reset_postdata(); ?>                     <?php                             $posts = new WP_Query(array('post_type' => 'Video', 'category' => $term->name) );                             while ( $posts->have_posts() ) : $posts->the_post();                                 the_post_thumbnail();                                 ?>                                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                                 <?php                             endwhile;                     ?>             <?php endforeach; ?>     <?php endwhile; ?>          <?php get_footer(); ?>      If someone can help please do it :( I can't get this


Creating a blog on my companies new website using Wordpress but I have sidebar issues

As said in the title, I am creating a blog on my companies new website using Wordpress but I have sidebar issues. The website is only in production phase at the moment. The Link is so you can see is: http://madhousecreative.co.uk/completegroup/Blog/ Heres an image of what it is currently. ![enter image description here](http://i.stack.imgur.com/EtHGK.jpg) Whenever I try to move the sidebar up it messes up and the bit move up dissapears. Heres another image to show you what I mean: ![enter image description here](http://i.stack.imgur.com/2DH3r.jpg) I hope the images help explain what I am trying to say. Im really stuck on this so I hope someone can help.


Can't make permalink of CPT work

i'm learning how to use wordpress, but i've encountered a big problem. I'm trying to create a custom post type, i've used this code:               add_action('init', 'init_realizzazioni');          function init_realizzazioni() {          $labels = array(         'name'               => __('Realizzazioni'),         'singular_name'      => __('Realizzazione'),         'add_new'            => __('Aggiungi realizzazione'),         'add_new_item'       => __('Nuova realizzazione'),         'edit_item'          => __('Modifica realizzazione'),         'new_item'           => __('Nuova realizzazione'),         'all_items'          => __('Elenco Realizzazioni'),         'view_item'          => __('Visualizza Realizzazione'),         'search_items'       => __('Cerca Realizzazione'),         'not_found'          => __('Realizzazione non trovato'),         'not_found_in_trash' => __('Realizzazione non trovata nel cestino'),     );          $args = array(         'labels'             => $labels,          'public'             => true,             'rewrite'            => array('slug' => 'realizzazioni'),          'has_archive'        => true,          'hierarchical'       => false,          'menu_position'      => 5,          'supports'           => array(                                  'title',                                 'editor',                                 'thumbnail',                                  'excerpt'                                 ),     );                  register_post_type('realizzazione', $args);      }      and everything seems ok.. i can see the post type and create ne ones. The problem is that i can't visualize a the archive page. I've set has_archive and rewrite in the right way.. i can't figure out because when i go to: `localhost/wp/realizzazioni` or `localhost/wp/realizzazione` it give me 404. I've also tried to create an `archive-realizzazione.php` but it gives me 404 again. here is the archive-realizzazione code:               <?php     /*      * Template Name: realizzazione      */               get_header(); ?>                    <?php get_footer(); ?>


Earliest hook to reliably get $post/$posts

What's the earliest possible action I can hook into where I'll be able to access the global `$post/$posts` variables on both the front and back ends? I've tried looking through the Codex reference, Adam Brown's reference and skimming through the source several times but haven't had much luck finding a good one. `pre_get_posts` is too early; Using `posts_selection` doesn't work if you want to make a second get_posts() call during the callback; and `template_redirect` doesn't run on the admin side. `the_post` might be earlier than `template_redirect` for the front end, but it also doesn't run on the back end. Ideally I'd want something that runs right before `get_post()/get_posts()` returns, but I'm not seeing anything like that. I've used the `the_posts` filter in the past, but I'd prefer an action because it's more technically correct. Right now I'm just hooking in twice; once using `template_redirect` for the front end, and again using `admin_xml_ns` for the back end. I don't really like that, though, since the my logic isn't semantically related to either of those hooks, and it seems like this is a very common need and there should be a hook like "post_get_posts" (ala `pre_get_posts`) that works on both sides.


Get current Blog ID in Tinymce Plugin Dialog Window in WPMU

is there any way, to get the current blog id in a Tinymce Dialog Window? Currently I only get the id, from the main blog. This is my current code:               $wp_load = "wp-load.php";     while(!file_exists($wp_load)) {     $wp_load = '../' . $wp_load;     if(file_exists($wp_load)){         break;     }     }     require_once($wp_load);     global $blog_id;     echo $blog_id;     $blog = get_blog_details($blog_id);      Any help is welcome. Lars


Control term order on a per-post basis

I have a taxonomy in which term order matters, but varies from post to post. So I want to be able to set the order that terms are displayed in on a per- post basis:   * **My first post** | Tagged: Apples, Oranges, Bananas   * **Some other post** | Tagged: Oranges, Bananas, Apples Since this would vary from post to post, I need something other than the taxonomy-wide term ordering supported by plugins like Custom Taxonomy Sort and Taxonomy Terms Order. I am looking for advice on how to implement this. Here is an outline of my current thinking: ## Per-post term ordering using a custom field   1. Remove standard taxonomy metabox using `remove_meta_box()`   2. Add custom metabox containing term ordering interface, e.g., drag-and-drop (or simple text input next to each term for an integer describing term's order. (Or perhaps it's possible to add drag-and-drop to the existing meta_box without having to remove and add a new one?**)   3. Using javascript, save a comma-separated list of term IDs, in order, in a hidden custom field, _mytermorder_taxonomyname. (Separate custom field for each taxonomy, e.g., _mytermorder_category, __mytermorder_tags, etc.)   4. Create a custom function `my_get_the_terms()` that loops through the IDs in the _taxonomyname_termorder custom field. If a post has terms but no _taxonomyname_termorder field (as with old posts), just return get_the_terms().   5. In relevant theme files, replace instances of `get_the_terms()` or other native term functions with `my_get_the_terms()`. Do you have advice, alternatives, warnings, or related snippets? I'd be grateful for any thoughts. Thank you! ### Concerns   * What if the list in the custom field gets out of sync with the actual term list (as it would if terms were added through an interface other than the post edit screen, such as the quick-edit/bulk edit form or Front-End Editor). **Solution:** At the beginning of `my_get_the_terms()`, we can check whether the IDs in the custom field match the terms returned by get_the_terms. If not, default to get_the_terms.   * New terms wouldn't be captured on first use, because they don't yet have an ID. You'd have to save a new term before it would work. (I could live with this, but it is a problem.)   * The meta box has to list terms in the right order when the post edit page loads. * * * ** For drag-and-drop sorting in the default metabox, I discovered that I can use jQuery UI's .sortable, already available in the admin; for a non- hierarchical taxonomy, it's `$('#taxonomyname .tagchecklist').sortable()`.


Pagination on 2nd loop

OK, I am creating a business listing site that is using a custom taxonomy for the listing "type". I need to display two loops on the taxonomy archive page, one for "sponsored" listings and one for regular ones. taxonomy archive: http://pastie.org/3187162 pagination function: http://pastie.org/3187168 Both parts are doing exactly what I want, with one hitch: there are approx 50 non-sponsored listings in a specific category, but the 2nd query is maxing out at 5 "pages" (i.e. 25 listings if I set posts_per_page to 5, 35 if I set posts_per_page to 7) I'm stumped. Any ideas? **UPDATE** FWIW, I've been testing the code layout here: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination- without-plugin and it's working a bit better, in that I get the total number of "pages" it should have. But it still gives me a 404 after page 5.


Single page site (Wordpress) including posts

I'm creating a single page site and obviously want to include the blog posts. I'm currently looping through the pages and using the_content() and the_title() to display them. However, the_content doesn't include the blog posts on the blog page. I tried another loop in this one, but it didn't work. Any ideas to point me in the right direction? Thanks


"Error establishing a database connection" - Intermittent error on GoDaddy

After transferring a working WordPress site to GoDaddy hosting, we've begun getting "Error establishing a database connection" errors on all pages- first intermittently, and now consistently. It's strange because it worked most of the time, at least at the beginning, but now errors all the time. This is all within the first few hours of our install- I'm wondering if this might be a database caching issue on WordPress? Is there a cache to clear? Thanks-


Adding new Post through Custom Post Type only offers me "Slug" as an option, how do I get more?

I've just added a new Custom Post Type to my WordPress site. When I go to create a new post though, the only option I have to edit is "Slug". Normally with a regular post you would have Format, Categories, Post Tags, Featured Image, Excerpy, Send Trackbacks, Custom Fields, Discussion, and Author. How do I get all of these options to show up for me under a Custom Post Type? This is the code I used to create my custom post type.               function create_post_type() {               register_post_type( 'intrigue_faculty',                       array(                               'labels' => array(                               'name' => __( 'Faculty' ),                               'singular_name' => __( 'Faculty' ),                             'add_new_item' => __( 'Add New Faculty Member' ),                             'new_item' => __( 'Add Faculty' ),                             'add_new' => __( 'Add Faculty Member' ),                             'view_item' => __( 'View Faculty Profile' ),                             'not_found' => __( 'No faculty members found' ),                             'search_items' => __( 'Search Faculty Members' ),                             'edit_item' => __( 'Edit Faculty Member Profile' ),                             'description' => __( 'A collection of the profiles for Intrigue Dance Intensive faculty members.' )                         ),                   'public' => true,                   'menu_position' => 5,                   'rewrite' => array('slug' => 'faculty')                   )           );       }             add_action( 'init', 'create_post_type' );


Pretty URL with add_query_var

I'm trying to add a 'sub post' to each post on my site, eg site.com/product-one/changelog site.com/product-two/changelog site.com/product-three/changelog This is the code I'm using atm, which I found here somewhere:               global $wp,$wp_rewrite;     $wp->add_query_var('sub-page');     $wp_rewrite->add_rule('([^/]+)/(changelog)','index.php?pagename=$matches[1]&sub-page=$matches[2]', 'top');     $wp_rewrite->flush_rules(false);  // This should really be done in a plugin activation      This works fine if I browse to site.com/product-one?sub-page=changelog but if I goto site.com/product-one/changelog i just get redirected back to site.com/product-one So I disabled the canonical redirect as a test using:               remove_filter('template_redirect', 'redirect_canonical');       site.com/product-one/changelog then doesn't redirect but does return a 404 and site.com/product-one?sub-page=changelog still works. Is there something I can change with my rewrite to make this work? Note: I know I could do this easy with custom post types and I started to go down that route, but because the site is already using the %postname% permalink structure, I then wouldn't be able to have the custom post type have that structure as well as the sites pages.


Reapproval for edits and deletion after post is published

I regularly have guest authors who post one or more articles on a non specific schedule. So I provide them with permanent contributor accounts to avoid the hassle of making them accounts and deleting them every single time. Now this is my problem:   1. Once they submit an article for review and I publish it, they have the option by default to edit it and make changes accordingly.   2. They also have the option to delete it. I am looking for such a feature or way that:   1. Every time they have to edit a post after it has been published, they have to submit it for review before changes are applied. It doesn't mean the post is taken off the website, the original post stays live on the website but the edit can only be applied after being accepted by an editor or admin.   2. It can't be deleted or taken offline by the contributor once it has been published or permission is required to delete or take it offline by admin or editor by the contributor. Can this be achieved? If not, what is closest thing I can do to it to safeguard my information just in case?


Form action redirect to the same page

I'm making my own theme. In my theme I have a page that display custom post using a custom query. I added a form to this page. The form contain 2 comboboxes that contain values of meta data of my custom post. I want that when the user select values from this comboboxes and click the submit, Wordpress will show again the same page and will add the submit parameter to my custom query (something like filtering a table). The problem is that when clicking on the submit, Wordpress falling down to the index.php instead to my page. My form declaration is:               <form action='"<?php echo get_page_link(SHIURIM_PAGE)?> "' method='get'>";      Should I put something else in the action? Thank is advanced. My full page code:               <?php     /*     Template Name: Shiurim page     */          require 'search-form.php';     ?>          <?php get_header();           global $THEME_PATH;     global $IMAGES_PATH;          ?>          <link rel="stylesheet" type="text/css" href="<?php _e($THEME_PATH)?>/shiurim.css">
         <img src='<?php _e($IMAGES_PATH)?>/contact-header.jpg' alt="header picture" />

         <?php wp_title(); ?>

                    <?php          function getParam($paramName, $defaultValue) {             if ($_SERVER['REQUEST_METHOD'] === 'GET') {                 if (!empty($_GET[$paramName])) {                     return $_GET[$paramName];                 }             }             else {  // it's a post                 if (!empty($_POST[$paramName])) {                     return $_POST[$paramName];                 }             }             return $defaultValue;         }              $pageIndex = getParam('paged', 0);         $searchRav = getParam(SEARCH_RAV, 0);         $searchSidra = getParam(SEARCH_SIDRA, 0);         $searchText = getParam(SEARCH_TEXT, "");              $searchText = trim($searchText);              $queryArgs = array (             'post_type' => array( POST_TYPE_SHIUR ),             'orderby' => 'title',             'order'    => 'ASC',             'paged' => $pageIndex         );              $paginateSearchArgs = array();         $metaQuery = array();         if ($searchRav != 0) {             $metaQuery[] = array(                 'key' => POST_TYPE_RAV,                 'value' => $searchRav             );                  $paginateSearchArgs[SEARCH_RAV] = $searchRav;         }              if ($searchSidra != 0) {             $metaQuery[] = array(                 'key' => POST_TYPE_SIDRA,                 'value' => $searchSidra             );                  $paginateSearchArgs[SEARCH_SIDRA] = $searchSidra;         }              if (count($metaQuery) > 0) {             $queryArgs['meta_query'] = $metaQuery;         }              if (! empty($searchText)) {             $queryArgs['s'] = $searchText;                  $paginateSearchArgs[SEARCH_TEXT] = $searchText;         }          ?>
         <?php renderSearchFrom($searchRav, $searchSidra, $searchText); ?>

     <?php          //query_posts($queryArgs);         $shiurim_query = new WP_Query( $queryArgs );         global $wp_query;         // Put default query object in a temp variable         $tmp_query = $wp_query;         // Now wipe it out completely         $wp_query = null;         // Re-populate the global with our custom query         $wp_query = $shiurim_query;              $big = 999999999; // need an unlikely integer              echo paginate_links( array(             'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format' => '?paged=%#%',             'current' => max( 1, get_query_var('paged') ),             'total' => $wp_query->max_num_pages,             'prev_text' => '<<',             'next_text' => '>>'         ) );     ?>
          <?php         $is_first = true;         if ( $shiurim_query->have_posts() ) : while ( $shiurim_query->have_posts() ) : $shiurim_query->the_post();          ?>                 <?php if (!$is_first) { ?>

                 <?php } ?>                      <?php                     $is_first = false;                          get_template_part( "content", "shiur-list" );                 ?>      <?php endwhile; else: ?>
<?php _e('Nothing is found'); ?>
          <?php           endif;     // Restore original query object     $wp_query = $tmp_query;     // Be kind; rewind     wp_reset_postdata();           ?>

          <?php get_footer(); ?>      search-form.php (I'm using it in the index.php as well).               <?php          /**      *  Search panel      */          function renderSearchFrom($searchRav = array(), $searchSidra = array(), $searchText = "") {         $rabanimList = getPostArrayResult(POST_TYPE_RAV);         $sdatorList = getPostArrayResult(POST_TYPE_SIDRA);                $html = "
";         $html .= "  <form action='" . get_page_link(SHIURIM_PAGE). "' method='post'>";         $html .= "      By rav";         $html .= "      <select name='search_rav'>";         $html .= "          <option value='0'>All ravs</option>";              foreach ($rabanimList as $rav) {             $isSelected = ' ';             if ($rav['id'] == $searchRav) {                 $isSelected = ' selected ';             }                  $html .= "<option value='" . $rav['id'] . "'" . $isSelected . ">" . $rav['title'] . "</option>";              }               $html .= "</select>";              $html .= "      By sidra";         $html .= "      <select name='search_sidra'>";         $html .= "          <option value='0'>All sidras</option>";              foreach ($sdatorList as $sidra) {             $isSelected = ' ';             if ($sidra['id'] == $searchSidra) {                 $isSelected = ' selected ';             }                  $html .= "<option value='" . $sidra['id'] . "'" . $isSelected . ">" . $sidra['title'] . "</option>";         }              $html .= "</select>";              $html .= "      Free text";         $html .= "      <input type='text' name='search_text' class='searchFreeText' value='" . $searchText . "'/>";              $html .= "      <input type='submit' value='Search' />";         $html .= "  </form>";         $html .= "
";              echo $html;     }          ?>


Pageview confusion

I'm running a Wordpress website and track my pageviews with a few tools like Google Analytics, Jet Pack, Urchin on hosting and per post with wp_pageviews plugin. If I take yesterday for example I get the following stats: **Pageviews Wednesday May 29th**   * Urchin: 9468    * Google Analytics: 755   * Jetpack Site Stats: 652   * wp_pageviews for one post: 1500 times viewed I'm confused, what to believe? I know GA and Jetpack depends on Javascript, but all stats are different... is it that unreliable?


Conflict with wp_homeurl, wp_siteurl and admin interface settings

I'm starting wordpress development, and learning the platform. Now I'm stuck with a strange issue. I have created a virtual host configuration that works as expected. I'm using xip.io for dns resolution, that also works as expected I can access wordpress application from other devices. The thing that puzzles me is that if I define WP_HOMEURL and WP_SITEURL variables to the same values that are set via admin->options -> general settings the whole thing breaks. Nothing works anymore, I have to go directly to the database to reset site_url field. The virtual host file               <VirtualHost *:80>         ServerAdmin webmaster@dummy-host.example_dot_com         DocumentRoot "C:/server/wp/wordpress"         ServerName theme.local         ServerAlias local.191.161.3.101.xip.io         ErrorLog "logs/test1.com-error.log"         CustomLog "logs/test1.example.com-access.log" common     </VirtualHost>      Settings in the admin UI               WordPress Address (URL) :  http://local.191.161.3.101.xip.io     Site Address (URL)  :  http://local.191.161.3.101.xip.io      I thought that those values are the same, and that it makes no difference how you define them (`wp-config.php` or via admin interface)? Obviusly I'm doing something wrong, but I can't see what is it.


Unable to set right time in admin and frontend template

When I run a simple php file called test.php (placed in the root of the wp installation) that contains something like that:               <?php echo date('H:i:s'); ?>      The result is right: `15:30:00` and the timezone is set also correctly to Europe/Prague which is UTC+2 time However, if I place the same line within my e.g. footer or sidebar or even index file of my template than the result is `13:30:00` which is UTC time. The same in my custom plugin in WP admin. the time is 2 hours late. The time in admin options is set correctly to UTC+2. What is funny that if I create a new post or page the time is correct 15:30:00. I don't get it. Any idea why this happens? I have the latest fresh WP installation. 3.5.1 CZ version without any installed plugins. **UPDATE:** I have tried using WP function **date_i18n()** like: `<?php echo date_i18n('H:i:s'); ?>` and it's working as expected. However: `<?php echo date('H:i:s'); ?>` and it's still not working right. But outside wordpress `date()` is working correctly. Why is that? Why is wordpress screwing up `date()` function ?


Can't access login screen, wp-login.php 404's

When i navigate to `/wp-admin/` i am redirected to `wp-login.php` with the wp- admin URL in the `redirect_to` parameter. Like this:               http://www.domain.com/wp-admin     ... goes to ...     http://www.domain.com/wp-login.php?redirect_to=http%3A%2F%2Fwww.domain.com%2Fwp-admin%2F&reauth=1      If i just navigate to `/wp-login.php/` i get an endless redirect loop. Things i've tried:   * Removing the .htaccess file in the root   * Renaming the `/wp-content/plugins/` folder (to check if any plugins are messing things up)   * Renaming all cookie keys in `wp-config.php`   * Changing permissions of the wp-login.php file to 755 Those are solutions i've found through other forums. I haven't had any success with either of them. Basically what happened is a few months ago i was editing the site theme, and everything was working then. I haven't logged in until today, and now that i tried logging in i was met by this error. Any other ideas?


Fix existing media names with accents

Today, I updated the version from a wordpress blog and migrate to another server. But, I noticed that most of the image names has accents/special characters in the name. This make the browser doesn't show the images anymore. Is there a plugin/function/command to sanitize all my existing media files, and update the image names in the posts too?


How can I add a new CSS class to a widget?

I want to assign a new CSS class to default widget `<ul>` in Page/Post creating page in WordPress. How can I do this? See the image below. ![enter image description here](http://i.stack.imgur.com/J1XTy.png)


Check if post was modified by editor different than post author

Is there a way to check if a post written by user X is modified by a different user (for example admin, or an editor)? What I want to achieve: I have a site where posts are submitted for publication (pending). An editor can publish the post as it is or publish the post after he does corrections. If corrections are made, I'd like to display it in some way ("This post has been published with corrections"). Even better for me would be to display the corrections too (like in a wiki history, or simply with highlights to the changed parts), but I guess a similar feature is not supported by wordpress.


Limit Loop to 5 Posts?

Heres my current loop:               <?php if ( ! empty ( $GLOBALS['post'] ) && is_single() && in_category( 'movies', $GLOBALS['post'] ) ) :     $movies = new Wp_Query('tag=movie-reviews');      while ( $movies->have_posts() ) :     $movies->the_post(); ?>          <?php get_template_part( 'sidebar-reviews', get_post_format() ); ?>     <?php endwhile; ?>     <?php else : ?>     <?php get_template_part( 'no-results', 'index' ); ?>     <?php endif; ?>


Getting Post Permalink Outside of Loop Not Working

I'm trying to get post's permalinks outside of the loop via a wordress plugin. Nothing seems to be working. Here is the original code that does not link to any permalink.               public function get_comments_count($single){             if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){                 return '
Comments
';             } else {             return null;             }         }      To get the comments linking to the permalink, I tried adding echo get_permalink within the href link, like so..               public function get_comments_count($single){             if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){                 return '
<a href="<?php echo get_permalink($post->ID); ?>#disqus_thread">Comments
';             } else {             return null;             }         }      This just returned the link as mysite.com/< ? php echo get_permal... So, I then tried setting a function for permalink and putting it in the href link.. I did this like so...                   public function get_comments_count($single){                     $permalink = get_permalink($post->ID);             if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){                 return '
Comments
';             } else {             return null;             }         }      Unfortunately, this did not work. It just returned the link as mysite.com/#disqus_thread without the actual permalink. I have no idea why this isn't working. :( Any help would truely be appreciated, and if you would like me to paste the full plugin code via pastebin, I gladfully will! Please help a bro out!! :)


Editing the Backend Uploader

So my boss wants me to edit the backend of his WP site so that he can add a video link from a site called vzaar, which hosts all of our content. I need to know where in the backend I can edit to allow this to happen. I dont need to know how to do it, just need to know what I'm looking for. Here is an image of where he wants the option ![enter image description here](http://i.stack.imgur.com/WesRy.png)


Showing a link with Javascript based on log-in status

<?php     if ( is_user_logged_in() ) {     echo '';     } else {     echo 'Entrar';     }     ?>      Hello, I'm trying to make this work but i'm not sure how to do the syntax.... any help would be great! thanks!


Get Posts in a Custom Post Type category

I have trouble in getting post in a custom post type category. I have code below but it doesnt work well. It still get posts in another category.               <?php         $query= null;         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args=array(             'post_type' => get_post_type(),             'post_status' => 'publish',             'paged' => $paged,             'post_type_cat' => 'featured', // get_post_type() will return post_type, I add _cat -> post_type_cat             //'orderby' => 'rand',             'posts_per_page' => 1,             'meta_query' => array(                 array(                     'key' => '_expiration_date',                     'value' => array(0, current_time('timestamp')),                     'compare' => 'BETWEEN'                     )),                 );         $query = new WP_Query($args);     ?>     <?php if ( $query->have_posts() ) : $query->the_post(); ?>     <?php get_template_part( 'template/featured' ); ?>     <?php else : ?>     <?php get_template_part( 'template/nofeatured' ); ?>     <?php endif; ?>     <?php wp_reset_query(); ?>      Can you help me? Thank you


Hacked Site - slow pageload due to external ip address being called

One of our customer approached us and told us that one of their wordpress sites (which we did not develop) had irregular long page loading times. After some research we discovered (and removed) two security holes on this page:   1. On the search page the user input was not being escaped, therefore allowing you to execute javascript   2. In one of the uploads folder of a plugin (wysija) we found malicious files (including *.c and *.sh files) Unfortunately, the page load times are still high. We've contacted the hosting provider and they told us that the site spawns php processes which attempt to call an external ip address and whenever this external server does not respond these processes don't stop and eventually there will be too many processes spawned and the site will crash. At this time we are unsure how to "repair" this site. Blocking the external ip on the server is only a workaround since apparently the ip address changes from time to time.


Multiple content sections on a custom post

I have a custom post type called Case Studies, which I am then pulling out and displaying all on one page. Each Case Study has a few standard sections, and I want a separate editor for each section. For pages with multiple sections, I have been using MultiEdit, which works fine. However, it only works on pages so it isn't an option for this. How would I do this for my custom post type? Or am I approaching the problem wrong?


Nginx rules for subdomain multisite install (Bedrock)

I'm trying to move an existing Bedrock based multisite instance to nginx and am having difficulty getting a set of nginx rules to mimic the original .htaccess. Bedrock places the crux of the files in a wp/ subdirectory, but the urls still need to be accessible from the root domain. The .htaccess is here as follows:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) wp/$1 [L]     RewriteRule ^(.*\.php)$ wp/$1 [L]     RewriteRule . index.php [L]      I need these at least as nginx conf rules or preferably nginx vhost rules.


Using pre_get_posts to rewrite search query to display posts from multiple taxonomies

This seems like it should be straightforward, but I'm stuck on it! If a user searches for 'alice', I would like to show them all posts with the custom taxonomy terms of 'bob' and 'carol', regardless of if those posts contain the string 'alice' in them or not. I'm able to set the query's tax_query so that it only shows posts with 'bob' and 'carol' as terms, but I can't reset the actual search query so that it is showing all posts, not just posts with 'alice' in them. This is the filter I'm using to change the tax_query:               if ( !$query->is_search )         return $query;          $taxquery = array(         'relation' => 'OR',         array(             'taxonomy' => 'people',             'field' => 'slug',             'terms' => array( 'bob' ),         ),         array(             'taxonomy' => 'people',             'field' => 'slug',             'terms' => array( 'carol' ),         )     );          $query->set( 'tax_query', $taxquery );     return $query;      but using this to set the search query doesn't work:               $queryvars = array(             's' => ''     );     $query->set( 'query_vars', $queryvars );


Setcookie works on admin but not front end

I have a simple function to set a cookie to the value of whatever parameter is attached. For example, if I visit http://example.com/?devsource=http://dev.example.com/ it should set the value of the devsourceurl cookie to http://dev.example.com/ This function works great in the WordPress admin, but I cannot get it to work on the front end. I even tried checking to see if headers were already sent at the init action and they weren't. Any ideas what could cause this? Here's the code:               function set_devsource_cookie() {         if ($_GET['devsource']) {             $value = $_GET['devsource'];             setcookie("devsourceurl", $value, time()+3600, COOKIEPATH, COOKIE_DOMAIN, false );             echo $_COOKIE["devsourceurl"]; /* echo cookie if set */         }     }     add_action('init', 'set_devsource_cookie', 0);      Thanks for any help!


Using taxonomies to filter content

I have a wordpress install with ALOT of pages. These all have specific terms, from a custom taxonomy attached to them. Is it possible to have a `<form>` send a query with multiple terms selected, and then have a page show all pages with one or more of the selected terms attached to them? so a url could be "domain.com/taxonomy/term1+term2+term3 or something similar. I don't need to cross multiple taxonomies, just multiple terms. Is there are template file that would be good for this? archive.php? And how would i send and retrieve these terms? Im currently using this code to build the form:                   <form method="get" class="filter-dropdown-form" action="">             <?php $modules = get_terms( 'modules' ); ?>             <?php foreach( $modules as $module ){ ?>                      <div class="filter-item">                     <input id="module<?php echo $module->term_id;?>" name="test" value="<?php echo $module->slug;?>" type="checkbox">                     <label for="module<?php echo $module->term_id;?>"><?php echo $module->name; ?> </label>                 </div>                  <?php } ?>         </form>      Any help is appreciated!


Changing Font-Size based on specific Font thru javascript

I am using an 'rtl' font (named as JNN) in horizontal menu bar, which is normal & readable at 18px where as the alternate available 'rtl' fonts (like Tahoma & Arial Unicode MS) on Windows are too much big at 18px. Due to this dissimilarity in 'font-width', If a visitor to my wordpress-site has no JNN font installed on his computer, the menu-bar will shown to him in Tahoma/'Arial Unicode MS' font and hence these fonts disturb the menu-bar- length due to high font-size. Is there any solution through javascript to check the "font-availibility" at the user's end, and if found use "Font-Size-A" and if not then use "Font- Size-B" ? Any help will be highly appreciated.


How to have changes made in media library to be reflected on posts/pages

I have recently invested a bunch of hours updating the alt text of all the images in a media library, only to realise that the changes are not reflected on posts/pages. Whoops! Is there any way to force these changes across? Or have I no choice but to edit each page manually? Hope someone has good news for me! Thanks


Tinymce and uploading local pictures

I would like to extend the capabilities of the wordpress editor while keeping the option of uploading local pictures (in the simplest way possible:upload => insert). I found a plugin which seems to be simple and nice - "JBimages" - but there are others too.   All of them are supposed to be dropped in the "plugins" folder of TinyMCE. The thing is I can't find any version of the original tinyMCE (the one having the "plugins" folder).   Wherever I go I find the "Advanced Tinymce" or the "Ultimate Tinymce" but not the original one. And none of these Tinymce's have a folder called "plugins" where I can drop the "JBimages" extension (or any other one). Just to be sure, I went to the TMCE website and took an old version of the plugin but it doesn't seem to work within wordpress 3.x What can I do to add this "upload picture" functionality to a wordpress Tinymce plugin, whatever the version? JBimages would be my first choice but if there is any free and simple solution out there which would achieve my purpose, I'll take it (as long as its straight forward and easy to use).


WordPress multi-site, developing locally and syncing live changes

I've been working on a local version of a WP multi-site. Since I have been doing this, some of the live sites have been updated with new content. I was wondering if there was a better process to syncing content changes to what I'm planning to do. Which is:   * Download a WordPress XML Export file from each site on the live multi-site network.    * Import the XML files locally   * Push the dev version live. Is there a plugin for example that allows you to Export and Import from all sites on the network automatically? I'm mainly just intrigued to see if anyone else has had this situation and find out what they did.


Some doubts about WordPress handle the horizontal main menu visualization

I am pretty new in WP (I came from Joomla) and I have some doubt regarding how WordPress handles the main menu (I mean the horizontal menu in the header). As example I use this online test website: http://onofri.org/WP_BootStrap/ in this website I have install a theme (that use BootStrap CSS framework) and in the **Appearance > Menus** I have a menu called **Menu 1** that is correctly shown in the header (As you can see this menu contains the voices: **Home** , **Sample Page** , **Google** ) To show these voices I think that it use this code snippet take from the **header.php** theme file (Is it true?):                       <?php bloginfo('name'); ?>             <?php wp_nav_menu(                     array(                         'menu' => 'main-menu',                         'container_class' => 'nav-collapse collapse',                         'menu_class' => 'nav',                         'fallback_cb' => '',                         'menu_id' => 'main-menu',                         'walker' => new Bootstrapwp_Walker_Nav_Menu()                     )                 ); ?>      Ok, my doubt is related to he menu behavior in the others preinstalled theme. For example if I change theme using the preinstalled **Twenty Thirteen** theme I obtain this screenshot: ![enter image description here](http://i.stack.imgur.com/8A4G2.png) As you can see in the header I have a "menu" that show only the **Sample Page** voice and not also the other 2 voices that are in my **Menu 1** (Home and Google). Why? Looking in the **header.php** file of the **Twenty Thirteen** theme I can find this code snippet that I think represent the menu navabar:

<?php _e( 'Menu', 'twentythirteen' ); ?>
             <a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentythirteen' ); ?>"><?php _e( 'Skip to content', 'twentythirteen' ); ?>             <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>             <?php get_search_form(); ?>
      I have similar behavior using all the others preinstalled theme. Why in these theme I can't see all the **Menu 1** voices as in my actual theme? what is the difference? Tnx Andrea


paypal buynow button integration with wordpress for digital download

I found this helpful tutorial about integrating paypal buynow button with wordpress using custom post type.                <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">      <input type="hidden" name="cmd" value="_cart">      <input type="hidden" name="business" value="example@example.com">      <input type="hidden" name="lc" value="GB">      <input type="hidden" name="item_name" value="<?php $meta_values = get_post_meta($post_id, 'product-name'); ?>">      <input type="hidden" name="item_number" value="<?php $meta_values = get_post_meta($post_id, 'product-reference'); ?>">      <input type="hidden" name="amount" value="<?php $meta_values = get_post_meta($post_id, 'product-value'); ?>">      <input type="hidden" name="currency_code" value="GBP">      <input type="hidden" name="button_subtype" value="products">      <input type="hidden" name="no_note" value="0">      <input type="hidden" name="add" value="1">     <input type="hidden" name="bn" value="PP-    ShopCartBF:btn_cart_LG.gif:NonHostedGuest">     <input type="image"   src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0"   name="submit" alt="PayPal — The safer, easier way to pay online.">      <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">     </form>      But I am wondering if there is an option to add a redirect for downloading the product/file after payment is completed? I wanna build a wordpress digital sale shop the simplest way without relying on plugins. However, is this method secured at all or will I be better off using an SSL/secured connection? Any help will be appreciated.


How to use wp_update_post with ajax on frontend

I've been working hard trying to implement a frontend post editor "sidebar" on each post when I'm logged in. You can see what is going on here with a test post: http://www.bennettfeely.com/test-post/. After I get it working it will be restricted so only users with permission will be able to access the frontend editor, of course. Here is the important part of the jQuery/Ajax I'm using currently:               var post_data = $("#editor-post-form").serialize();       .ajax({         type: 'POST',         url: '/wp-content/....../update.php',         data: post_data     });      update.php consists of:               <?php                         $post_id = $_POST['post_id'];             $post_title = $_POST['post_title'];             $post_content = $_POST['post_content'];                      $the_post = array();             $the_post['ID'] = $post_id;             $the_post['post_title'] = $post_title;             $the_post['post_content'] = $post_content;                  $post_id = wp_update_post($the_post);     ?>      Using the awesome powers of the Chrome inspector, update.php is sending back an Error 500 (Internal Service Error). The form data appears to be sent correctly however. I'm guessing whatever problem I'm having is probably caused by some noobish mistake i'm making. Any help would be greatly appreciated. I would gladly give some more information or could try to clarify something if needed. Thank you!!