title: Wordpress Child Themes

text: I'm trying to redeclare a function in a wordpress child theme that is already in use by the parent theme. However, I get a "Fatal error: Cannot redeclare" message when trying to do so. Also, I've tried using the following with no luck:               if (!function_exists('jr_load_scripts')) {       // do fancy things here...     }      Here's the link if you want to have a quick look... **EDIT:** Here's the full code:               if (!function_exists('jr_load_scripts')) {     function jr_load_scripts() {     global $app_abbr;          $http = (is_ssl()) ? 'https' : 'http';          // load google cdn hosted scripts if enabled     if (get_option($app_abbr.'_google_jquery') == 'yes') :              wp_deregister_script('jquery');         wp_register_script('jquery', (''.$http.'://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'), false, '1.4.2');         wp_register_script('jquery-ui-custom', ''.$http.'://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js', false, '1.8');          else :              wp_register_script('jquery-ui-custom', get_bloginfo('template_directory').'/includes/js/jquery-ui-1.8.custom.min.js', false, '1.8');          endif;          wp_enqueue_script('jquery');     wp_enqueue_script('jquery-ui-custom');          wp_enqueue_script('jquery-tag', get_bloginfo('template_directory').'/includes/js/jquery.tag.js', array('jquery'), '');     wp_enqueue_script('smoothscroll', get_bloginfo('template_directory').'/includes/js/smoothscroll.js', array('jquery'), '');     wp_enqueue_script('lazyload', get_bloginfo('template_directory').'/includes/js/jquery.lazyload.mini.js', array('jquery'), '1.5.0');     wp_enqueue_script('elastic', get_bloginfo('template_directory').'/includes/js/jquery.elastic.js', array('jquery'), '1.0');     wp_enqueue_script('fancybox', get_bloginfo('template_directory').'/includes/js/jquery.fancybox-1.3.4.pack.js', array('jquery'), '1.3.4');     wp_enqueue_script('qtip', get_bloginfo('template_directory').'/includes/js/jquery.qtip.min.js', array('jquery'), '1.0.0-rc3');     wp_enqueue_script('general', get_bloginfo('template_directory').'/includes/js/theme-scripts.js', array('jquery'), '3.0');          $jr_enable_indeed_feeds = get_option('jr_enable_indeed_feeds');     if ($jr_enable_indeed_feeds=='yes') :               wp_enqueue_script('indeed-api', ''.$http.'://www.indeed.com/ads/apiresults.js');          endif;     }


title: get term by id without taxonomy

text: Can I get the term by it's id without knowing to whish taxonomy it belongs? I have a meta field that stores term ids, but doesn't store the taxonomy. However, all the `get_term` function have taxonomy parameter marked as required. Maybe I can get the taxonomy of the term by it's (term's) id somehow?


title: Set default value for radio button in WP Alchemy custom meta box?

text:
I'm using the WP Alchemy Metabox PHP class (www.farinspace.com/wpalchemy- metabox/) to add a custom meta box with a radio select to a custom post type. The code below shows the code I'm using for the meta box, which works great. Does anyone know how I could set the first value, 'none', as default checked?               Feature project for category?          <?php $feature_cats = array('none', 'courtyard-gardens', 'external-commercial', 'internal-commercial', 'internal-domestic', 'international', 'show-gardens'); ?>          <?php foreach ($feature_cats as $i => $feature_cat): ?>         <input type="radio" name="<?php $mb->the_name(); ?>" value="<?php echo $feature_cat; ?>"<?php $mb->the_radio_state($feature_cat); ?>/> <?php echo $feature_cat; ?>
     <?php endforeach; ?>


title: Remove duplicates from foreach

text: I'm trying to loop through a custom post type and display all meta values for a meta key. I'm able to display all the values, however there are some duplicates. I want to remove those duplicates. I have tried using `array_unique` without luck. My code:                <?php     query_posts(array(     'post_type' => 'lejlighed'           ));      ?>                    <?php     while (have_posts()):     the_post();               $meta = get_post_meta($post->ID, 'antal_varelser');          foreach ($meta as $m) {              echo '<option value="1">' . $m . '</option>';          }     endwhile;     ?>       The result: 2 2 3 4 3 3 4 Any suggestions?


title: localhost wordpress site redirects to public site

text: On my mac, I modified virtual host:               <VirtualHost *:80>       DocumentRoot "/Users/me/Documents/github/gps_cms"      ServerName gps_cms      </VirtualHost>      That is so I can type gps_cms in url and invoke the web page on local host. However, when i type in               http://gps_cms/wp-admin      in address bar, it redirects to my main site:               http://mysite.com/wp-admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F      And the content on page is this:               No Update Required          Your WordPress database is already up-to-date!


title: get attachment title based on attachment id

text: I'm getting an image through `getMeta`. It returns me the id of the attachment. Now I want to get the titel, alternative text, description and so on. For the alternative text this works very well:               get_post_meta($logo, '_wp_attachment_image_alt', true);      Now I want to get the title. I found out I can do that with `$attachment->post_title`, but here I only have the id. How do I get the title for an attachment id?


title: custom post type category link redirects to index

text:
I'm using custom post type named "fotograf". I want to show every post's category with               <?php the_terms( $post->ID, 'fgaleri', '', ', ', '' ); ?>      But if I click category then it redirects me to index.php and shows everything in posts (not custom post type). You can test it with open my web site link ( http://www.onurunwebsitesi.com/ ) Click to Tümünü Göster (Show All) and test it! After, click to Category: Atatürk, you will redirect to index.php , not archive-fotograf.php I tried this too:               <?php the_terms( $wp_query->$post->ID, 'fgaleri', '', ', ', '' ); ?>      But after this, my loop stopped and shows nothing in results. What sould I do? Thanks for your helps, in advance. My codes: archive-fotograf               <?php      /**      * Displays the Pagination in Custom loop      *      */     ?>     <?php get_header(); ?>     <?php $aranan= $_GET['s'];      $kategorim = intval($_GET['cat']);     $myterm = get_term( $kategorim, 'fgaleri' );      $myslug = $myterm->slug;     ?>
     <?php     $temp = $wp_query; //save old query     $wp_query= null; //clear $wp_query     $rakam= 0;     //The query     $wp_query = new WP_Query();     $wp_query->query( array( 'post_type' =>'fotograf', 's' => $aranan, 'paged' => $paged, 'taxonomy' => 'fgaleri', 'fgaleri' => $myslug ) );     //The loop     ?>

Fotoğraf Galerisi      <form action="<?php echo get_bloginfo('wpurl'); ?>" id="searchformfoto" method="get" name="searchform">     <?php      $args = array(      'taxonomy' => 'fgaleri',     'show_option_none' => 'Kategori Seçin',     'hierarchical' => 1     );      wp_dropdown_categories($args);      ?>
<input name="s" id="sfoto" type="text" value=""/>     <input type="hidden" name="post_type" value="fotograf" />      <input type="hidden" name="fgaleri" value="<?php echo $myslug; ?>" />      <input id="searchsubmitfoto" type="submit" value="Ara"/>
     </form>

     <?php while ($wp_query->have_posts()): $wp_query->the_post();      $rakam++;     ?>     <div class="FGaleriItem2" style="<?php if ($rakam % 5 == 0 ) { ?>margin-right: 0px;<?php } ?>">     Category: <?php the_terms( $post->ID, 'fgaleri', '', ', ', '' ); ?>
<?php if (has_post_thumbnail()) { ?><a href="<?php the_permalink() ?>"><?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );$url2 = get_bloginfo('template_directory') . "/timthumb.php?src=" . $url . "&w=100&h=100&zc=1"; ?><img src="<?php if(get_option('of_timthumb')=="true") { echo $url2; } else { echo $url; } ?>" alt="" title="" width="100" height="100" /><?php } ?>

<a href="<?php the_permalink() ?>"><?php the_title(); ?>     <?php      ?>

<?php endwhile; ?>

     <?php if(function_exists('wp_pagenavi') ) {      wp_pagenavi(); //function call for plugin pagination( wp pagenavi plugin)     }else{ ?>
           <?php next_posts_link('« Daha Eski Fotoğraflar'); ?>       <?php previous_posts_link('Daha Yeni Fotoğraflar »'); ?>
     <?php     }//endif     ?>     <?php     wp_reset_postdata();     $wp_query = null; //Reset the normal query     $wp_query = $temp;//Restore the query          ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>      functions.php               <?php     add_action( 'init', 'register_cpt_fotograf' );      function register_cpt_fotograf() {      $labels = array(      'name' => _x( 'Fotoğraflar', 'fotograf' ),      'singular_name' => _x( 'Fotoğraf', 'fotograf' ),      'add_new' => _x( 'Yeni Ekle', 'fotograf' ),      'add_new_item' => _x( 'Yeni Fotoğraf Ekle', 'fotograf' ),      'edit_item' => _x( 'Fotoğrafı Düzenle', 'fotograf' ),      'new_item' => _x( 'Yeni Fotoğraf', 'fotograf' ),      'view_item' => _x( 'Fotoğrafı Önizle', 'fotograf' ),      'search_items' => _x( 'Fotoğraf Ara', 'fotograf' ),      'not_found' => _x( 'Fotoğraf Bulunamadı', 'fotograf' ),      'not_found_in_trash' => _x( 'Çöpte Fotoğraf Bulunamadı', 'fotograf' ),      'parent_item_colon' => _x( 'Ana Fotoğraf:', 'fotograf' ),      'menu_name' => _x( 'Fotoğraflar', 'fotograf' ),      );      $args = array(      'labels' => $labels,      'hierarchical' => false,      'supports' => array( 'title', 'author', 'thumbnail', 'custom-fields', 'comments' ),     'public' => true,      'show_ui' => true,      'show_in_menu' => true,      'show_in_nav_menus' => false,      'publicly_queryable' => true,      'exclude_from_search' => false,      'has_archive' => true,      'query_var' => true,      'can_export' => true,      'rewrite' => array('slug' => 'fotograflar'),     'capability_type' => 'post'      );      register_post_type( 'fotograf', $args );      }           register_taxonomy("fgaleri", "fotograf", array("hierarchical" => true, "label" => "Fotoğraf Kategorileri", "singular_label" => "Fotoğraf Kategorisi", 'show_ui' => true, 'show_tagcloud' => false, "rewrite" => array('slug'=>'fkat')));          function mySearchFilter_0987($query) {      $post_type = $_GET['post_type'];      if (!$post_type) {          $post_type = 'post';      }      $query->set('post_type', $post_type);     return $query;      };           add_filter('pre_get_posts','mySearchFilter_0987');          // This filter will jump into the loop and arrange our results before they're returned          function limit_posts_per_archive_page() {        if (is_post_type_archive()) { $limit = 20; } else { $limit = get_option('posts_per_page'); }             set_query_var('posts_per_archive_page', $limit);     }     add_filter('pre_get_posts', 'limit_posts_per_archive_page');          if (!term_exists( 'Fotoğraf Galerisi', 'fgaleri') ) {      wp_insert_term( 'Fotoğraf Galerisi', 'fgaleri',     array( 'description' => 'Fotoğraf Galerisi', 'slug' => 'fotogaleri' ) );      }          add_filter( 'request', 'my_request_filter' );     function my_request_filter( $query_vars ) {     if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) {         $query_vars['s'] = " ";     }     return $query_vars;     }     ?>


title: Display posts with a start OR end date later than current date

text:
I'm working with an upcoming events list. I create a custom post type, with a custom field: [event_start_date]. I also have some multiday extension events, defined by an additional custom field: [event_end_date]. Then, I have this two kinds of events (examples):   * Birthday | start date: 13/08/2012, end_date: 'empty'   * Holidays | start date: 5/08/2012, end_date: 30/08/2012 I would like to display events with a 'start' or 'end date' later than current time, but I failed. I think my date format is correct, because I had started using other 'query' that works perfect only using the [start date]. My problem is incorporating the 'OR' end_date condition. I tried with a meta_query with an 'OR relation', but doesn't work:               $args = array(                  'post_type' => 'eventos2',                  'posts_per_page' => 4,                  'meta_key' => 'event_start_date',                  'orderby' => 'meta_value',                  'order' => 'ASC',                  'meta_query' => array(                  'relation' => 'OR',                  array('key'  => 'event_start_date',                        'value' => date('Y/m/d', strtotime('-1 day')),                        'compare' => '>=')                       array('key'  => 'event_end_date',                        'value' => date('Y/m/d', strtotime('-1 day')),                        'compare' => '>=')                  )        );     $loop = new WP_Query( $args );      while ( $loop->have_posts() ) : $loop->the_post();     $end = DateTime::createFromFormat('Y/m/d', get_field('event_end_date'));      $start = DateTime::createFromFormat('Y/m/d', get_field('event_start_date'));          if ($end !='') {  /*print events with start and end_date*/          echo "
";         echo the_title(), "
";         echo $start-> format('Y/m/d'),"&nbsp". to . "&nbsp". $end-> format('Y/m/d');          echo "
";         }         else {             /*print events with only start_date*/         echo "
";         echo the_title(), "
";         echo $start-> format('Y/m/d');         echo "
";            }         endwhile;        ?>      It show this result:   * EVENT 2 | 2012/08/08 to 2012/08/15    * EVENT 4 | 2012/08/31 to 2012/09/06   * EVENT 3 | 2012/08/17    * EVENT 1 | 2012/08/01 How you can see, EVENT 1 is listed, despite of is a past event. Moreover events are in disorder. I will appreciate any orientation with the problem.


title: Split wordpress loop to multiple layouts

text: OK so I've searched a lot and couldn't find a straight forward answer to my question. I am simply trying to use one category loop that will display posts in a category page in a wordpress site. lets say 6 posts for this purpose. it's pretty simple to accomplish it by using a simple query loop like so:               <?php query_posts('showposts=6'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>     // content or anything comes here     <?php endwhile; endif; ?>      however, I am trying to "break" my loop into 2 different layouts:   1. 2 posts showing with featured image   2. the rest of the 4 in a different design which will be just showing title + excerpt + read more Here is a sample which best demonstrates what I am trying to accomplish: https://dl.dropbox.com/u/4405634/split-loop-layout.jpg There are tons of solutions in the web, however some of the are too complicated and some don't work in a category loop. I have seen it in a lot of websites and still can't find a simple way of doing it. does someone have a nice solution? Thanks a lot. Gil


title: can i run wp as root permissions

text: Im not sure if this question is about server, git or wordpress. i have wordpress set up on ubuntu VPS in /home/user its working now when all chown and group is "user". however, when i git pull (as user root) it set the files owner and group to root. then they dont work. so either wordpress should be able to run with files who have root ownership, or somehow the wordpress directory should automatically chown when i pull, possible?


title: Custom Walker for wp_list_categories

text:
I need some help with making of one Walker Class. Now I’m having a menu with categories and in the dropdown there are some subcategories. The menu is something like that:

         <?php         wp_nav_menu( array(         'theme_location' => 'header-cats',         'menu_class' => 'nav',         'menu_id' => 'cat-nav',         'fallback_cb' => '' ) );         ?>
          <?php wp_list_categories('title_li=&orderby=id&exclude=1,2,3'); ?>

      http://imageshack.us/photo/my-images/228/21946748.gif/ I want to show the title of the last article with a small pic of it in that dropdown menu. Now I’m having only subcategories there. I want to be the subcategories AND the last title with + a thumbnail in every category. The menu should be like that: http://imageshack.us/photo/my-images/339/81352218.gif/ For example there is something like my idea in www.cosmopolitan.co.uk There are showing the latest 2 articles from every category. Can you help me with that? I’ll be so grateful! Thank you!


title: Plugin to create unlimited custom shortcodes?

text: I want to be able to create unlimited shortcodes and use them anywhere on my theme, pages or posts. The idea is: A textfield for the shortcode name. A textarea for the shortcode content (html+js). I found this one: http://wordpress.org/extend/plugins/shortcode-generator/ But it's really old and outdated, I am using wp 3.2.1 with multisite. Does someone knows if a plugin like this exists and it's compatible with wp 3.2.1 and the multisite feature?


title: How to effectively handle the problem of installing WordPress locally for each new project?

text: I waste a lot of time installing WordPress then populating it with dummy stuff for each new project. I started creating a new theme for each project (instead of creating a whole new install) but it's not good either since each project has its own specifics in terms of content. Is there a time-saving, professional solution for this problem?


title: Displaying information from Custom Fields in template with Types?

text:
I am trying to understand Custom Fields and how I can use them on my posts. I have set up a Custom Field for 'author' and associated it with a template. Now, on the PHP side of things I need to designate where the custom field's out put will be. I have followed the documentation on the WP-Types site here and so have written:
Author: <?php   types_render_field( "author", array( ) ) ?>
      But it returns nothing. Im not sure what I've done wrong. Can someone point me in the right direction?


title: WordPress plugin DB upgrade

text: I am writing plugin. I have added 1 custom table in database. Suppose my plugin's current version is 1.0 After few days i am upgrading plugin and now its version 1.2. Same for after some time and now version is 1.3 and ..... 1.4 Now for every release of plugin version I have made some changes in database. Than how can i upgrade database. I know about store db version in options table. But i don't know because some user update his plugin from 1.1 -> 1.2, other is from 1.1 -> 1.4......... some is 1.2 -> 1.4..etc.. Than there is only way to add all conditions to code or any other solution is available?????


title: Send data to Editor before saving the post

text: I have created a meta field in the new post page. When I add some content in the meta field, I store it in a hidden textarea. When a post is saved, I want to clear all content of the editor and copy the data of that meta field textarea to the editor. The data can be copied with jQuery, however I'm unable to figure out that how I send it to the editor just before saving the post? The idea is build a visual shortcode, and the data being sent to the editor will be shortcode. I will really appreciate any help in this regard.


title: Still using WP Stats without Jetpack

text: The WP Stats plugin has long been deprecated in favor of Jetpack. Is there a way I can still use it on new WP installations? I know it can be downloaded and installed but no longer be configured. Can the API key from one installation be extracted from its database and inserted into the database of another installation?


title: Multisite move server giving redirect loop

text: I'm currently trying to move my site dreamdoors.co.uk to my new server. Everything is 100% working and fine on the old server but when I move it to the new server I get "This webpage has a redirect loop Error code: ERR_TOO_MANY_REDIRECTS" What it seems to be doing is going from www.dreamdoors.co.uk to dreamdoors.co.uk back to www.dreamdoors.co.uk. The current live site only redirects from dreamdoors.co.uk to www.dreamdoors.co.uk Everything is the same from htaccess to mutlisite forwarding. Is there anything I could be missing.


title: How to add a custom post type in child theme? (Wordpress > 3.0)

text: I'm using Wordpress Magazine Style Theme (http://wordpress.org/themes/magazine-style) which doesn't have any other than default post format set (no galleries, aside, etc.). I would like to create a child theme that would have custom post types added via register_post_type() function. In **childtheme** folder I created files:   * style.css with import rule   * functions.php According to Codex (http://codex.wordpress.org/Post_Types) I've added in **functions.php** :               <?php     add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'acme_product',             array(                 'labels' => array(                     'name' => __( 'Products' ),                     'singular_name' => __( 'Product' )                 ),             'public' => true,             'has_archive' => true,             )         );     }     ?>      But I can't see the new Product post type while creating a new post (there is no "Format" menu). What else I have to do to enable custom post types in child theme?


title: Convert WP Menu to a Drop Down for Mobile browser

text: I'm working on a wp project with responsive theme. I have single level nav menu at the top of the site, that I want to change to a Select Option tag for mobile browsers (small screens) with options for the nav items which is much easier to select in mobile site. So the UL LI menu will be replaced with a Selection- Option tag for mobile. However, I'm unable to figure out how to change wp menu to a select option dropdown.


I am using a plugin wordpress-simple-paypal-shopping-cart for my cart requirement. I am trying to send an email through this plugin when some payment is made by using IPN. My code :               $invoiceProducts = $_SESSION['simpleCart'];         if(isset($invoiceProducts) && !empty($invoiceProducts)){             $html = renderHTML($invoiceProducts);             generatePDF($html);             unset($invoiceProducts);         }          function renderHTML($param){         $IPN = $_POST;              $name = $IPN['first_name'];         $donationAmount = $IPN['payment_gross'];         $contributorsEmail = $IPN['payer_email'];         $contributorsPhone = $IPN['payer_email'];         $contributorsAddr = $IPN['address_name'] . ', ' . $IPN['address_city'] . ', ' . $IPN['address_country'];              //We will need to shoot email to laura of successfull payment.         $to = 'myemail@domain.com';         $subject = 'Donation made on your website';         $message = '';         $message .= '';         $message .= '
You have received a contribution from'.$name.' of '.$donationAmount.'
';         $message .= '
Contributor Information:
';         $message .= '
';         $message .= '
Name:'.$name.'
';         $message .= '
Amount:'.$donationAmount.'
';         $message .= '
Email:'.$contributorsEmail.'
';         $message .= '
Address:'.$contributorsAddr.'
';         $message .= '
';         $message .= '';              wp_mail( $to, $subject, $message, $headers, $attachments );     }      But when this function is called I am getting this error : `Fatal error: Call to undefined function wp_mail()` I know why I am getting this error, its just that my plugin is getting loaded first rather then `wp_mail()`. In my case how can I call `wp_mail()` first then my plugin?


title: What hook is used to display the admin_bar on the front end?

text: Or, how is the admin_bar displayed at all? I'm looking to display a similarly styled menu, but for all users who visit.


title: Remove a particular tag name from the tagcloud

text: How do I remove a particular tag name from the tag cloud ? I changed `wp-includes/default-widgets.php` on line 1038 from               wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) );      to               wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy, 'exclude' => "featured") ) );      But no effect.


title: set post author depending on condition via frontend post submit

text: I allow users to post from frontend. There are three kinds of users. Myself as admin, a junior ( given a role of an author) and anyone from public as non- logged-in user. Currently if any non-logged-in user posts from frontend, I am assigned as an author with this code. Currently my `wp_insert_post` array looks something like this :               'post_title'    => $final_title,     'post_content'  => $about_stuff,     'post_status'   => 'draft',     'post_author'   => '20',     'post_type' => 'post',      etc....      wherein my author id is '20'. All this works fine. Now, what I would like to achieve is when my junior logs-in and creates post in the frontend, I would like him to be the post author, and not me (as currently set). I understand that the `post_author` will need to be a variable eg. `$content_creator`. Given below is the code I have written till now, but I am confused how to put it together in order to achieve what I need. To be specific I am confused how do I make the variable `$content_creator`work with rest of the code.               if ( is_user_logged_in() ) {         $current_user = wp_get_current_user();         if ( 19 == $current_user->ID ) {         'post_author' => '19';         } else {         'post_author' => '20',         }      }       The code is pretty self-explanatory and basic which says check if the user if logged in, if yes check the user-id. If user id equals 19 set '`post_author' => '19'` (user id of my junior) otherwise set the author as admin. Two things I wanted to ask, do I also need `global $post` before my code and should I be using another wp_update_post filter instead. Please help. > Final scenario must be, when the admin or anyone else creates a post the > post-author must be set as admin (me) but when my junior creates a post he > must be set as the post-author. This would have been unnecessary if we were > creating posts in the backend but due to some reason we prefer to create > posts in frontend. * * * **UPDATE : SOLVED** Turns out it was pretty simple with wp_update_post. Although, now it works fine. Let me know if you find something funny. Here is the code I am using after wp_insert_post               if ( is_user_logged_in() ) {         $current_user = wp_get_current_user();         if ( 19 == $current_user->ID ) {              $update_creator = array(                     'ID'          => $pid, //created post ID                     'post_author' => '19'                 );              wp_update_post( $update_creator );         }     }


title: Custom Meta box only returns most recent value on page

text:
I created a custom post type and a custom meta box where I create a new post and input a Youtube URL into the meta box, and I call for it on a custom template page inside an iframe that is inside in a modal (Drublic CSS modal) window where clicking on the post title will open the modal window. The meta box will return a value on the page, however it displays the most recent URL entered for each of the posts when you open the modal. How do I get each modal box to display the video assigned to it? If this is confusing, here's the page that the error is on: http://www.josephkatool.com/Pell/media and below is the code from the post:               <?php query_posts( 'post_type=videos');?>          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>          <article class="post" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

          <iframe width="560" height="315" src="//<?php echo get_post_meta($post->ID, "pell_video_url", true); ?>" frameborder="0" allowfullscreen>

          ×

          <?php endwhile; endif; ?>      I've been trying to figure this out for a while now and I think I'm losing my mind!! Thanks! Edit: Here's the code I use to save the meta boxes:                function pell_video_save_post_class_meta( $post_id, $post ) {          if ( !isset( $_POST['pell_video_url_nonce'] ) || !wp_verify_nonce( $_POST['pell_video_url_nonce'], basename( __FILE__ ) ) )         return $post_id;          $post_type = get_post_type_object( $post->post_type );          if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )         return $post_id;          $new_meta_value = ( isset( $_POST['pell-video-url'] ) ? esc_attr( $_POST['pell-video-url'] ) : '' );          $meta_key = 'pell_video_url';          $meta_value = get_post_meta( $post_id, $meta_key, true );          if ( $new_meta_value && '' == $meta_value )         add_post_meta( $post_id, $meta_key, $new_meta_value, true );          elseif ( $new_meta_value && $new_meta_value != $meta_value )         update_post_meta( $post_id, $meta_key, $new_meta_value );          elseif ( '' == $new_meta_value && $meta_value )         delete_post_meta( $post_id, $meta_key, $meta_value );     }      Here's the js. It's the Drublic CSS js script:               (function (global) {              'use strict';              // Storage variable         var modal = {};              // Store for currently active element         modal.lastActive = undefined;         modal.activeElement = undefined;              // Polyfill addEventListener for IE8 (only very basic)         modal._addEventListener = function (element, event, callback) {             if (element.addEventListener) {                 element.addEventListener(event, callback, false);             } else {                 element.attachEvent('on' + event, callback);             }         };              // Hide overlay when ESC is pressed         modal._addEventListener(document, 'keyup', function (event) {             var hash = window.location.hash.replace('#', '');                  // If hash is not set             if (hash === '' || hash === '!') {                 return;             }                  // If key ESC is pressed             if (event.keyCode === 27) {                 window.location.hash = '!';                      if (modal.lastActive) {                     return false;                 }                      // Unfocus                 modal.removeFocus();             }         }, false);              // Convenience function to trigger event         modal._dispatchEvent = function (event, modal) {             var eventTigger;                  if (!document.createEvent) {                 return;             }                  eventTigger = document.createEvent('Event');                  eventTigger.initEvent(event, true, true);             eventTigger.customData = { 'modal': modal };                  document.dispatchEvent(eventTigger);         };                   // When showing overlay, prevent background from scrolling         modal.mainHandler = function () {             var hash = window.location.hash.replace('#', '');             var modalElement = document.getElementById(hash);             var htmlClasses = document.documentElement.className;             var modalChild;             var oldModal;                  // If the hash element exists             if (modalElement) {                      // Get first element in selected element                 modalChild = modalElement.children[0];                      // When we deal with a modal and body-class `has-overlay` is not set                 if (modalChild && modalChild.className.match(/modal-inner/)) {                     if (!htmlClasses.match(/has-overlay/)) {                              // Set an html class to prevent scrolling                         document.documentElement.className += ' has-overlay';                     }                          // Unmark previous active element                     if (modal.activeElement) {                         oldModal = modal.activeElement;                         oldModal.className = oldModal.className.replace(' is-active', '');                     }                     // Mark modal as active                     modalElement.className += ' is-active';                     modal.activeElement = modalElement;                          // Set the focus to the modal                     modal.setFocus(hash);                          // Fire an event                     modal._dispatchEvent('cssmodal:show', modal.activeElement);                 }             } else {                 document.documentElement.className =                         htmlClasses.replace(' has-overlay', '');                      // If activeElement is already defined, delete it                 if (modal.activeElement) {                     modal.activeElement.className =                             modal.activeElement.className.replace(' is-active', '');                          // Fire an event                     modal._dispatchEvent('cssmodal:hide', modal.activeElement);                          // Reset active element                     modal.activeElement = null;                          // Unfocus                     modal.removeFocus();                 }             }         };              modal._addEventListener(window, 'hashchange', modal.mainHandler);         modal._addEventListener(window, 'load', modal.mainHandler);              /*          * Accessibility          */              // Focus modal         modal.setFocus = function () {             if (modal.activeElement) {                      // Set element with last focus                 modal.lastActive = document.activeElement;                      // New focussing                 modal.activeElement.focus();             }         };              // Unfocus         modal.removeFocus = function () {             if (modal.lastActive) {                 modal.lastActive.focus();             }         };              // Export CSSModal into global space         global.CSSModal = modal;          }(window));


title: Publish post's date is set to Nov 30 -0001

text: It is very difficult for me to describe the problem and the cases when it happends. The idea is that somtimes Publish date of article in administration panel is set to "Nov 30, -0001 @ 0:00". The status is set to Published and even when press Update of given post, the date still is set to that mysterious date with year -0001. This happens with custom post type. Does anyone have any ideas how to investigate or fix the problem?


title: Wordpress listen to $_POST in functions.php

text: I currently have the following function in my `functions.php` which checks if a username exists in the DB.               function check_username() {            $username = $_POST['user'];            if ( username_exists( $username ) ) {                $return['user_exists'] = true;             }            else {                $return['user_exists'] = false;            }            echo json_encode($return);            die();     }     add_action('wp_ajax_check_username', 'check_username');      I'm using Ajax to call that function with an appropriate username:               $.ajax({         url : "http://examle.com/wp-admin/admin-ajax.php",         type : "GET",         dataType : "json",         cache : false,         data : {             action : 'check_username',             user: 'test'         },         success : function (json) {             if (json.user_exists) {                 alert(json.user_exists);             }         }     });      The problem is that `$username` returns `null` instead of `test`. I've been trying for several hours now different combinations yet they've all returned null. Assigning this makes the above php function work `$username = 'test';` so I'm pretty sure this isn't an issue with the php code. So my question is, how do I get the variable `$username` to listen and fetch the correct parameter instead of `null`?


title: Cannot get redirect working

text: I can't get wp_redirect working correctly? I thought I'd figured this out (see wp_redirect not working when going to www version of site) but apparently not; no idea what changed between last week when it was working and now. I tried simplifying the function down but using the following I get an infinite- redirect error:               add_action ('after_setup_theme','mkm_restrict_access',10);     function mkm_restrict_access() {         if (!is_user_logged_in() && !is_page('splashpage') && !is_page('login')) {             wp_redirect('http://localhost.localdomain/clientname/wp/splashpage/');              exit;          }     }      I've tried using wp_footer and almost everything up the chain in terms of calling the function but nothing seems to help. I am running Theme My Login and User Domain Whitelist, if that matters. I tried disabling them but it didn't help. I suspect I'm doing something REALLY STUPID. :( Thanks for your help!


title: How to make a page to not appear in the menu when created?

text: When one creates a page in the Dashboard (Pages -> Create new) it always appears in the menu and that is the way it should be. But now I want to create a page that does _not_ appear in the menu at all. How do I do that? I'm using a plugin called Nice navigation for animated menus and the theme I'm using is called Fiver Here is the site I'm working on. Edit: This Nice navigation plugin has an arguments box in the Nice Nav widget. All I did was add "exclude=17757" (not `<?php wp_list_pages('exclude=17757'` ); ?>) in the box and it now works fine. This post helped me. Sorry, I could'nt answer my own question.


title: Function to return true if current page has child pages

text: I'm trying to create a simple function to do a "status test". Goal is to test and see if the current page being viewed has any child pages or not. Using this to alter layout to accomodate child pages. The following code seems like it should work, but alas, no dice. Anyone see what I'm missing?               function is_subpage() {     global $post;                              // load details about this page          if ( is_page() && $post->post_parent ) {   // test to see if the page has a parent         return true;                                            // return true, confirming there is a parent          } else {                                   // there is no parent so ...         return false;                          // ... the answer to the question is false     }      }


title: How to automatically activate a plugin on install

text: I have a plugin that is an installer for my theme and several plugins that work with it. For the sake of discussion, let's call the additional plugins, the "payload". The only thing I'm missing is how to activate the payload plugins via script (rather than requiring the site owner to manually click "Activate". I'd also like to deactivate (and delete) the installer plugin once its completed its activation routines (but that's a secondary concern). Thanks in advance for your help! Here's what I have so far but its not activating any of the payload plugins:               function payload_activate(){         activate_plugin('my-first-plugin.php');         activate_plugin('my-second-plugin.php');         }          register_activation_hook(__FILE__, 'payload_activate');


title: How can I (semi) automate a database export and import to a different location?

text: I'm attempting to move toward developing WordPress sites locally, rather than on a live server, and as part of that move I'd like the ability to have a local and a remote version of a site, and easily deploy changes made locally the the remote site. That's easy enough for the filesystem changes using something like Git, but I'm not sure how to make database changes easy to transfer. I understand that it's probably possible to write a script to somewhat automate this process, but I really don't know at all where to start.


title: Using WPDB class

text: I want to use the `wpdb` class on my external page not associated with wordpress. I tried to include the following on the php file:               // include wordpress functions     include( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');     require_wp_db();     global $wpdb;      Now I made a query using `$wpdb->query`               $product_info_query = $wpdb->query("select p.products_id, p.products_type, p.img_display, p.products_sku, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_last_modified, p.products_date_available, p.manufacturers_id, gp.likes from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_GLOBAL_PRODUCTS . " gp where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and gp.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");     $product_info = mysql_fetch_array($product_info_query);      However, its not working. It returned a warning:               Warning: mysql_fetch_array() expects parameter 1 to be resource      What seems to be the problem? How to fix this and probably use `wpdb` class correctly on running queries outside wordpress?


title: PHP: How to access db the right way in plugin?

text:
I thought I would find an answer to my question on the internet but I was not able to. This is not a big question, but as it is my first plugin, I want to make sure that everything is right before submitting. What I am doing is adding a link to navigation menu depending on a value that admin selects from a settings panel in dashboard. I am accessing db in my custom javascript to add data to tables (in admin dashboard) and then fetching that data in another php script using "wp_nav_menu_items" filter. I used               wp_localize_script( 'my-ajax-request', 'accessDB', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );      to get hold of `admin-ajax.php` path. I then send my ajax calls to url referred by `accessDB.ajaxurl`. This part is working fine. And I think this is the right way to make ajax calls in Wordpress plugin. If not please correct me. The second part is where I have to get the value from db. This is the value I need in a wordpress filter hook `wp_nav_menu_items`. And this is how it goes:               function add_custom_menu_link($items, $args) {              global $wpdb;         $row = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "custom_table");              if (count($row) > 0) {             return $items . "
url . "' target='_blank'>Custom Link
";         } else {             return $items;         }     }          add_filter('wp_nav_menu_items', 'add_custom_menu_link', 10, 2);      So my question is that, am I doing it the right way, or do I have to use cURL to get the data by using `admin-ajax.php`? Or is there any other way that I am missing? Regards


title: $wpdb insert array

text: I need to insert multiple array. I get error: mysql_real_escape_string() expects parameter 1 to be string, array given My example code:                $array_info is          Array     (     [0] => Array         (             [0] => a             [1] => b             [2] => c         )          [1] => Array         (             [0] => d             [1] => e             [2] => f         )          )           $data = array(             'blog_id' => NULL,             'post_id' => $id,             'ing' => $array_info             );             $insert = $wpdb->insert($table_name, $data);


title: More gentle way to hook Wordpress custom url

text: I have written a plugin named `foo`, and I want when user typed url `/hello` and it will display the string `world` There is an existing psot[1] use the following code               if ($_SERVER["REQUEST_URI"] == '/hello') {       echo "world";       die;     }      But this is hacky as it terminate immediately, for example, it ignored the `shutdown` hook (http://codex.wordpress.org/Plugin_API/Action_Reference/shutdown) Are there any better approach allow me to print the output and follow the action lifecycle gracefully? [1] http://stackoverflow.com/questions/4365145/wordpress-plugin-hook-on- custom-url


title: Any ideas how to make unit test read the theme functions.php?

text: I have performed a unit testing for a plugin that works perfectly until the section where I need to activate the theme and check if the theme is supplying the right hooks data to the plugin. Inside the plugin that I'm testing, I have apply_filters that will implement the add_filter hooks defined inside the theme functions.php. This is my unit testing code:               function test_theme_hooks() {                 //Define required plugins for testing     $requiredplugins=array( '0' => 'myplugin1/plugin1.php','1' => 'myplugin2/plugin2.php');          //Activate plugins     update_option('active_plugins',$requiredplugins);                 //Activate theme         switch_theme('my_theme_to_test', 'my_theme_to_test');          //Get groups defined by the theme     $Class_My_Plugin = new Class_My_Plugin;              $groups_definedfrom_theme = $Class_My_Plugin->get_groups();              $correct_groups=array('0'=>'Some array');                   $this->assertEqual($correct_groups,$groups_definedfrom_theme);          }      The problem is that, it seems that the theme functions.php is not read or executed during the test. I have manually checked that the theme has been successfully switched/enabled as well as the required plugins. But the result of $groups_definedfrom_theme is NULL which is not correct. Any tips how to do this test correctly or how to make the unit test read the active theme functions.php as well as well as it's filters? Thanks for any help.


title: Confusion about how to use Custom Post Types, Custom Taxonomy or Category?

text: I've been reading about Custom Post Types, Custom Taxonomy and Category but I'm still getting some confusion. I want to build somewhat like an ecommerce site just to understand it better. Say I've a problem like this               Products         --Computer               --Operating System                     --Linux                     --Win 7               --RAM                     --less than 1 GB                     --1 GB                     --2 GB         --Car                   ---Brand                 --- BMW                 --- Ford                   ---Color                 --- Red                 --- Blue         Price From <TextBox> to <TextBox>      My Solution will be somwhat like this:   1. Product is a custom post type   2. Computer and all others are hirarchical taxonomy   3. Price is a custom field for product what do you think, am I go the right track or can you correct me??


title: Refresh problem post is duplicated when page is submitted after page reload

text:
I have a form on my website, that creates a post from front end. So every time when I refresh a page I got this message first: The page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue? If page is refreshed then previous action is done that is post with same entries as is in previous post is created. CODE is::               <form action="" method="post" name="story_form" onsubmit="return vedioform()"  enctype="multipart/form-data">         Add link to your video
         <input type="text" class="input-big" name="cntnt"/>                                                Name
         <input type="text" class="input-box" name="fname" />                         Email
         <input type="text" class="input-box" name="email"  />         Your Wix website
         <input type="text" class="input-box" name="title"/>         Excerpt::<input type="text" class="input-box" name="excerpt"/>         custom:::<input type="text" class="input-box" name="custom"/>         Your picture (Type: jpeg, jpg, png, gif)
         <input type="file" size="60" id="BrowserHidden" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" name="thumbnail"/>         <input type="text" id="FileField" name="filefield" />         <input type="submit"  class="form-submit" id="submit" value="SUBMIT" name="submit-video"/>
     </form>          <?php     $title = $_POST['title']; //from your form...     $content=$_POST['cntnt'];     $excerpt=$_POST['excerpt'];     $custom = $_POST['custom'];     //-- Set up post values     $myPost = array(         'ID' => '',         'post_title' => $excerpt,         'post_excerpt' => $excerpt,         'post_status' => 'publish',         'post_type' => 'post',         'post_author' => $authorID,         'post_content' =>$content,         'comment_status' => 'closed',         'ping_status' => 'closed',                   'post_category' => array('7'),     );          $new_post = wp_insert_post( $myPost);     add_post_meta($new_post, 'rating', $custom, true);     ?>


title: Upload images to remote server

text: I am using Wordpress media uploader to upload images and I was wondering if there is a way to make it upload to my remote server instead of my local server? Example: My wordpress blog is hosted on Server A and I want to want to use the media uploader to upload images to Server B instead of Server A. Both servers run Ubuntu 10.04 LTS with nginx as the webserver and both support ftp & sftp.


title: Search working only on default permalink structure

text: my custom theme is using a search form which works fine with default permalink structure`site-url/?p=id`. however after i changed my permalink structure to post name, the search returns NOTHING FOUND. the URL looks like this `site- url/post-slug` . what needs to be done in order to get search results with permalink-post-structure ?


title: Can wp-config be on another place and shows the fake path of itself?

text: My website hasn't any problems yet, but after editing wp-config file using a file manager plugin, it doesn't even shown and displays the below error:   > Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting > T_STRING in /home3/------/public_html/THEWEBSITE/wp-config.php on line 23   > On my host, I tried to find and fix the config file but it seems that the file which is exactly on "`/home3/------/public_html/THEWEBSITE/wp-config.php`" path, is not the original wp-config file which error occurs on that and addition to this, all of the files on the folder and sub-folders are for 5 months ago. But I can see all of the medias which I've uploaded on the site at `THEWEBSITE/wp-content/uploads/` URL. So I have two questions.   First, How can I copy all of the contents of the `Uploads` folder from URL? I can't download them one by one.   Second, How can I find the original wp-config file and then fix it? because according to that I'd search for the newest files and another wp-config and didn't get any result, files is not on the path that error said.   All I done for test the wp-config file which is shown on the error is these and the same error occurs again:     * Adding an empty line before 23   * Renaming the file   * Using wp-config sample file with my settings


title: Moving wordpress site

text: Haven't found anywhere to help with this so I'll ask here. I've built a new website for our front end on a dev server, and moved it over to the live server, and got it running on a virtual apache host at the moment. This means both websites, old and new, are on the same server, running under different apache vhosts. Would I be able to simply change the server name each vhost answers to, and update the URL in WP? So, in summary:   * New site - change the WP settings from dev.domain.com to domain.com   * New site - change apache vhost to answer to domain.com instead of dev.domain.com   * Old site - change apache vhost to answer to dev.domain.com instead of domain.com   * Old site - change the WP settings (DB search and replace script) from domain.com to dev.domain.com DNS is already in place to point both variations of the domain to the live server. I obviously don't want to disrupt anything too much, so that's the order I'm thinking of doing it, so I tell the new site to answer to domain.com, then tell it's vhost ot answer to domain.com, and at the same time, change the old site to answer to dev.domain.com, then restart apache, so both vhosts change at the same time.


title: Getting rid of menu items on a custom taxonomy

text: I have made up a custom taxonomy and it works great but in the admin menu I get the normal categories and normal tags showing up along side the custom categories and custom tags (see image) is there a way to only show the custom cats and custom tags? ![Admin menu items showing custom posts and categories](http://i.stack.imgur.com/sMteY.png) So keeping "Event Cats" and "Event Tags" but getting rid of "Categories" and "Tags" on the menu. Thanks code:                           function event_post_example() {                          register_post_type( 'event_type',                              array('labels' => array(                             'name' => __('Events Posts', 'baretheme'),                             'singular_name' => __('Event Post', 'baretheme'),                             'all_items' => __('All Event Posts', 'baretheme'),                             'add_new' => __('Add New Event Post', 'baretheme'),                             'add_new_item' => __('Add New Event Type', 'baretheme'),                             'edit' => __( 'Edit', 'baretheme' ),                             'edit_item' => __('Edit Post Types', 'baretheme'),                             'new_item' => __('New Post Type', 'baretheme'),                             'view_item' => __('View Post Type', 'baretheme'),                             'search_items' => __('Search Post Type', 'baretheme'),                             'not_found' =>  __('Nothing found in the Database.', 'baretheme'),                             'not_found_in_trash' => __('Nothing found in Trash', 'baretheme'),                             'parent_item_colon' => ''                             ), /* end of arrays */                             'description' => __( 'This is the example event post type', 'baretheme' ), /* Custom Type Description */                             'public' => true,                             'publicly_queryable' => true,                             'exclude_from_search' => false,                             'show_ui' => true,                             'query_var' => true,                             'menu_position' => 9,                             'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png',                             'rewrite'   => array( 'slug' => 'event_type', 'with_front' => false ),                             'has_archive' => 'event_type',                             'capability_type' => 'post',                             'hierarchical' => false,                                  'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')                         ) /* end of options */                     ); /* end of register post type */                               register_taxonomy_for_object_type('category', 'event_type');                          register_taxonomy_for_object_type('post_tag', 'event_type');                      }                               add_action( 'init', 'event_post_example');                          register_taxonomy( 'event_cat',                         array('event_type'),                              array('hierarchical' => true,                                 'name' => __( 'Event Categories', 'baretheme' ),                                 'singular_name' => __( 'Event Category', 'baretheme' ),                                 'search_items' =>  __( 'Search Event Categories', 'baretheme' ),                                 'all_items' => __( 'All Event Categories', 'baretheme' ),                                 'parent_item' => __( 'Parent Event Category', 'baretheme' ),                                 'parent_item_colon' => __( 'Parent Event Category:', 'baretheme' ),                                 'edit_item' => __( 'Edit Event Category', 'baretheme' ),                                 'update_item' => __( 'Update Event Category', 'baretheme' ),                                 'add_new_item' => __( 'Add New Event Category', 'baretheme' ),                                 'new_item_name' => __( 'New Event Category Name', 'baretheme' )                             ),                             'show_admin_column' => true,                             'show_ui' => true,                             'query_var' => true,                             'rewrite' => array( 'slug' => 'event-slug' ),                         )                     );                          register_taxonomy( 'event_tag',                         array('event_type'), this */                         array('hierarchical' => false,                             'labels' => array(                                 'name' => __( 'Event Tags', 'baretheme' ),                                 'singular_name' => __( 'Event Tag', 'baretheme' ),                                 'search_items' =>  __( 'Search Event Tags', 'baretheme' ),                                 'all_items' => __( 'All Event Tags', 'baretheme' ),                                 'parent_item' => __( 'Parent Event Tag', 'baretheme' ),                                 'parent_item_colon' => __( 'Parent Event Tag:', 'baretheme' ),                                 'edit_item' => __( 'Edit Event Tag', 'baretheme' ),                                 'update_item' => __( 'Update Event Tag', 'baretheme' ),                                 'add_new_item' => __( 'Add New Event Tag', 'baretheme' ),                                 'new_item_name' => __( 'New Event Tag Name', 'baretheme' )                             ),                             'show_admin_column' => true,                             'show_ui' => true,                             'query_var' => true,                         )                     );e


title: Custom SINGLE page with custom metaboxes and custom template

text: I run in this situation where I must create complex contacts page with custom template, custom meta boxes. I know how to make custom post type, add meta boxes and display all information in custom template. Problem is I don't need 200 contacts pages that custom post type allows, just one. Is there way to create this page under pages section? Similar to selecting dropdown template for page just for admin side that changes page meta box structure.


title: Add meta tag to search results

text: In the search results I use author_name=something in the url to restrict the results. The Problem is that domain.com/?s=searchterm and domain.com/?s=searchterm&author_name=something have the same meta tags. How can I add the author_name value to the meta tags?


title: tax_query dynamic search

text:
Sorry for my english, I'm french speaking I'm working on a web site. I have a taxonomy that can select a department and state for all the posts of the site for admin users and a page where there are some vouchers (postype voucher). I would like to permit a user to view vouchers per deparment. Any suggestions to make this work? Here is my header.php                                                   <?php                                             $selected = isset( $_COOKIE['filter_region'] ) ? intval( $_COOKIE['filter_region'] ) : -1;                                             wp_dropdown_categories( array(                                                 'taxonomy' => 'region',                                                 'hide_empty' => false,                                                 'hierarchical' => true,                                                 'id' => 'global-region-filter',                                                 'show_option_none' => __( '- All Departments -', 'dlp' ),                                                 'selected' => $selected                                             ) );                                             ?>                                         <?php } ?>       My `vip_voucher`               $args = array(                             'post_type' => array('place', 'event'),                                  'posts_per_page' => 48,                             'ignore_sticky_posts' => 1,                                  'meta_query' => array(                                 array(                                     'key' => 'voucher',                                 ),                                 array(                                     'key' => 'voucher_expire',                                     'value' => strtotime( date('Y-m-d', time() ) ),                                     'type' => 'NUMERIC',                                     'compare' => '>='                                 )                             ),                             'paged' => $pagenum                         );                              if ( $region != '-1' ) {                             $args['tax_query'][] = array(                                                 'taxonomy' => 'region',                                                      'hierarchical' => true,                                                 'field' => 'id',                                             'terms' => $region,                                                  );                         }                              $wp_query = new WP_Query( $args );                              if ( $wp_query->have_posts() ) {                                  echo '
';                             while ($wp_query->have_posts()) {                                 $wp_query->the_post();                                 $voucher_details = dlp_get_voucher( get_post_meta( $post->ID, 'voucher', true ) );                                 ?>

                                         <a  title="Aller à la page de l'activité" href="<?php the_permalink(); ?>"> <?php                                              dlp_post_image( $post->ID, 'preview' );                                              $summary = urlencode( sprintf( __( 'Offer at %s in %s', 'dlp' ), $post->post_title, get_post_meta( $post->ID, 'city', true ) ) );                                         ?>

                                             <a  title="Aller à la page de l'activité" href="<?php the_permalink(); ?>">
                                                     <?php the_title(); ?>                                                     à <?php echo get_post_meta( $post->ID, 'city', true ) ?>
                                                 <?php echo $voucher_details->name; ?>

                                           <?php                             }                             echo '
';                                  wedevs_content_nav( 'nav-below' );                         } else {                             get_template_part( 'no-results', 'archive' );                         }                              wp_reset_postdata();                         ?>


title: How to limit the max number of characteres in the title that are displayed

text: I am following this tutorial — "Display Your Popular Posts In WordPress Without A Plugin" and want to limit the max number of characters in the title that are displayed. Also, why is the thumbnail, at times, smaller than the number I define in the php?


title: Use child theme on certain pages and not others?

text: I have created a twenty-eleven child theme, I want to know if its possible to only load that child theme on certain pages, maybe with the custom page templates? I have looked via google and on here and have found nothing on the twenty- eleven or very outdated posts. Thanks


title: How to run WP_Query to retrieve attachments to posts only from a particular category?

text: I have a WP blog with a few pages and posts and several categories. I want to write a loop to retrieve images attached to the posts (not the pages) and only those from a specific category and it's children. The category id is 60. This is the WP_Query call:               $my_query = new WP_Query( array(       'post_type' => 'attachment',       'cat' => '60',       'post_mime_type' =>'image',       'posts_per_page' => $batch_size,       'nopaging' => false,       'post_status' => 'all',       'post_parent' => null,       'meta_key' => 'my_hash',       'orderby' => 'meta_value'     ) );      But I get nothing! What am I doing wrong?


title: Remove the category/taxonomy description field?

text: How can I remove the category/taxonomy description field? The one which shows up on the edit category/taxonomy page.


title: Wordpress email notification using address with plus sign

text: So I've managed to change `mail_from` used by WP to send e.g. new comment notifications by adding filters like that:               add_filter('wp_mail_from_name', 'get_name');     add_filter('wp_mail_from', 'get_email');      This part is working fine. My problem is that I want to use gmail address with a plus sign like this one: `example+something@gmail.com`. The plus sign is legitimate to use in email address. I know `wp_mail` is using `phpmailer` but that is not a problem as I have successfully sent mails with `phpmailer` setting from header to such address. When the filter sets mail_from to such address nothing is sent. Why would this happen?


title: WP Cron emails not working

text: _Running wp 3.5.1._ I have 2 plugins that work in part. They do everything nice. If I click to send emails, they send the emails. However the **scheduled** emails are not being sent. The plugins are:   * Wordpress file monitor plus version 2.2   * WP-db manager version 2.63 **TROUBLESHOOTING** I have tried to change the schedule to run every hour, every day, every 2 days. But none of them sends emails, but all the rest is done. WP-db manager generates the backups at the right time. Wordpress file monitor plus checks the files when it should. But after generating the backups or checking file changes, those plugins should send the email with the results. These plugins have the manual option like "send backup manually to the email" or send the file changes report manually. When I chose to do so, the emails arrive immediately. ================= I thought that there is some incompatible plugin: I have moved all the plugins but wp-dbmanager to another folder, so that wp-dbmanager is the only active one. Still didn't work. I have tried to change the theme. Still nothing ================= New installation: I have tried to create a new wordpress installation and new DB in the same server. I have copied all the plugins of the old installation to the new test installation. I have also put the same theme. It works - but it's a test installation :( ================= How can I troubleshoot this problem? Why the production installation does not send emails when they are scheduled via CRON? Please note that the CRON works, I have installed WP-Crontrol and I can run scheduled jobs manually whenever I want, but still, the cron job works, but it does everything, but sending emails. P.s. nothing in the wp-debug. Please help


title: How can I customize the wp_list_categories

text:
I have a list of categories in woo-commerce which I'm trying to customize to be displayed to look like the following image. ![List of categories](http://i.stack.imgur.com/PwUHl.png) I created the above image using normal HTML and css however I would like to now convert it to WordPress in order to have it dynamically created. Here is the HTML:

Women

                                               All

                           Accessories

                           Blouses
                              .etc...

Men

                                All

                           Accessories

                           Coats
                       ..etc..

Kids

                                All

                           Babies

                           Girls

                           Boys

      Here is the current WordPress code I'm working with (not sure if I should use the walker to customize the output to be generated like the HTML above):
     <?php $args = array(         'style'              => 'list',         'show_count'         => 0,         'use_desc_for_title' => 1,         'child_of'           => 0,         'title_li'           => __( '' ),         'show_option_none'   => __('No Menu Items'),         'number'             => null,         'echo'               => 1,         'depth'              => 2,         'taxonomy'           => 'product_cat',     ); ?>

                <?php wp_list_categories( $args ); ?>

      1) How can I use wp_list_categories filter to add an "All" link at the top of the sub categories which links to a page which displays all items. 2) How can I also use the wp_list_categories filter to remove the link from the parent parent category and wrap it in an to make it bold (like in the example image)? Any help would be appreciated


title: Load multiple Javascript scripts

text: I have three Javascript script that I need to load -   * `imagesLoaded.js`   * `lazyload-1.8.4.js`   * and `cd.js` `cd.js` contains my functions that use `imagesLoaded.js` and `lazyload-1.8.4.js`. Do load them altogether or separately?               function add_my_script() {       wp_enqueue_script(         'imagesLoaded',         get_template_directory_uri() . '/js/imagesLoaded.js',          array('jquery'),         'lazyload',         get_template_directory_uri() . '/js/lazyload-1.8.4.js',         array('jquery'),         'cd',         get_template_directory_uri() . '/js/cd.js',         array('jquery')                            );     }        add_action( 'wp_enqueue_scripts', 'add_my_script' );      * * * ## Code that Worked                           add_action( 'wp_enqueue_scripts', 'add_my_script' );                      function add_my_script() {                     wp_register_script('imagesLoaded',get_template_directory_uri() . '/js/imagesLoaded.js', array('jquery'),true);                     wp_register_script('lazyload',get_template_directory_uri() . '/js/lazyload-1.8.4.js', array('jquery'),true);                     wp_register_script('cd',get_template_directory_uri() . '/js/cd.js', array('jquery','imagesLoaded','lazyload'),true);                     wp_enqueue_script('imagesLoaded');                     wp_enqueue_script('lazyload');                     wp_enqueue_script('cd');                 }


title: how to get specific page content

text:
bellow is my code working nice but problem is don't coming with html tag.. like etc... no idea why...                 <?php $recent = new WP_Query("page_id=2"); while($recent->have_posts()) : $recent->the_post();?>         <?php          echo substr(get_the_excerpt(), 0,450);               ?>          <a href="<?php the_permalink() ?>" rel="bookmark">                  More About Us                         bellow is another code which is html tag and everything ok.. but i can't figure out how to permalink do there.. the permalink i put there i not work.               <?php     $my_id = 2;     $page_id = get_post($my_id);     $content = $page_id->post_content;     echo substr($content, 0, 450);          ?>       <a href="<?php the_permalink() ?>" >More About Us      also what is best way to get specific page content like bellow way
title

featured image

content
     <a href="<?php the_permalink() ?>" rel="bookmark">


title: Get custom taxonomy description with paragraph tags

text:
I am printing the description for a custom taxonomy of artists with the following code:               $terms = get_the_terms( $post->ID, 'artists');                                if ( $terms ) {         // loop through artists (could be multiple)         foreach ( $terms as $term ) {             $termid = 'artists_' . ($term->term_id);                  echo '
';              echo $term->description;             echo '
';                                     }     }      This works great but I would like the line breaks to show up if possible. I tried using the Rich Text Tags plugin which made the description meta_box into a WYSIWYG TinyMCE text editor, but I could not get the provided code to print anything. This is the code I tried:               if(isset($wp_taxonomies)) {         // This is getting the friendly version of a taxonomy         // - not the hyphenated get_yoast_term_title()         $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'artists' ) );         if($term) {             echo '
'.$term->name.'
';         }         // If you have a taxonomy description, let'er rip!         if(function_exists('get_yoast_term_description') && get_yoast_term_description()) {             echo wptexturize(get_yoast_term_description());         }     }


title: What causes the "Are you sure you want to do this?" error with plugins?

text: This is an odd case I've run into. A site I've had for years started throwing this "error" when i try to make certain backend changes. It seems pervasive - If i try to install, update, activate or deactivate any plugin. I can still look at the list of plugins and view their settings, generally. Any thoughts on where to start looking?


title: Storing values in Post Meta vs new tables

text: I want to store list of user IDs in the post meta who have rated a post . So, for each post I will need to check the post meta to see if the user id exists in it or not. So my question is that, is it good idea to store that information in the post meta OR should I create a table and add it in the table. Will there be any difference in the performance (table vs meta) if the number of values grow very much? I would prefer to store in the post meta as it is much simpler and cleaner way, but I have read one answer which says > never, ever, ever, use an EAV (aka the post_meta table) to store data that > you might to need to query.


title: Display custom field value as a mailto: link

text: I'm very confused with an "Email" custom field, how I can make it automatically clickable as "mailto:" link, inside a loop like this:               while ( $loop->have_posts() ) : $loop->the_post();         $mail = get_post_meta($post->ID, 'mail', true);                                                                              if  ($mail) {             echo the_title()."</br>",             echo $mail;         } /*... rest of the loop      Thanks in advance.


title: Posting From Apple Aperture?

text: When sorting through my images in Apple Aperture I regularly find myself wanting to post one, or a few dozen, of them to one of my WordPress sites. Does anyone know of an Aperture plugin or some way to create a quick post directly from the app? If Aperture was written in PHP, I'd be set! Thanks, Mark EDIT: I mistakenly referred to 'Adobe' Aperture. I really need to make a choice between Lightroom & Aperture, and stick with it.


title: How to delete Jetpack Widgets from the Widgets page in admin panel

text: **NOTE:** Please note that, it's not the Widget Visibility issue -- I'm taking about front-end. To supply a project to my customer, I need to hide/delete the Jetpack Extra Sidebar widgets from the admin panel - basically I need a control to hide them specifically or can activate them again, if necessary. As I can hide (Source^) the default widgets with code like:               // unregister default widgets      function unregister_default_widgets() {          unregister_widget('WP_Widget_Pages');          unregister_widget('WP_Widget_Calendar');          unregister_widget('WP_Widget_Archives');      }      add_action('widgets_init', 'unregister_default_widgets', 11);      I'm using JetPack for many purposes, but don't want to avail all of the JetPack Extra Sidebar Widgets to the Editor account. How can I hide/delete them from the back-end?


title: How to make the first post in the loop be styled like a "new / featured" post?

text: I hope i can explain this right , what im trying to do is use the default word press loop to show all my posts etc.. but for the first post I would like it to be styled completely different depending on what parent category it was published in, so there would be a lot going on in that first post. Right now I'm some what achieving this by using 2 loops that both pull from the default, the first loop is my "new / Featured" post area and is set to posts_per_page=1 , then the second loop is your standard loop, but the issue I'm having is obviously it shows duplicate posts, now i tried offset=1 on the second loop but then my pagination does not work, any help or direction would be awesome, I know its a lot sorry. below is my code for both loops and a link to my testing site thanks! 1st (new / featured) loop :               <?php $custom_query = new WP_Query('posts_per_page=1');      while($custom_query->have_posts()) : $custom_query->the_post(); ?>     <?php     $parent_cat = array();     $post_cats = get_the_category($post->ID);     foreach( $post_cats as $post_cat ) {     if( $post_cat->parent ) $parent_cat[] = get_category( $post_cat->parent )->slug;     }     ?>          <!--CONTENT HERE-->               <?php endwhile; ?>     <?php wp_reset_postdata(); // reset the query ?>     <?php } else { ?>      2nd (Standard) loop:               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>          <!--CONTENT HERE-->               <?php endwhile; else: ?>     <?php _e('Sorry, no posts matched your criteria.'); ?>     <?php endif; ?>      Here is a link to the dev site were you can see what im talking about http://themes.thefragilemachine.com/gone/ thanks for any help!


title: Display All Custom Post Fields and Values, Unless Empty

text:
I am looking to grab all of the custom post meta fields for a given post and display them on the page which i have accomplished with the following code. However I would like to check if( !empty() ) the custom post meta values and not print any that are empty. Other then that it should be pretty straight forward but I would appreciate the help.               <?php     $custom_fields = get_post_custom();         foreach ( $custom_fields as $field_key => $field_values ) {             if(!isset($field_values[0])) continue;             if(in_array($field_key,array("hits","_wp_trash_meta_time","SKU","sub-category-2","sub-category-1","_wp_trash_meta_status","old_price","price","qty","additional_notes","buy_link","customlist1","customlist2","featured","image","images","_edit_lock","_edit_last","_thumbnail_id","_sexybookmarks_permaHash","_sexybookmarks_shortUrl"))) continue;         foreach ( $field_values as $key => $value )                                      echo '
' . $field_key . ': ' . $value . '
';     }     ?>


title: Order Events by Category or Type, The Events Calendar

text:
So I've using the Events Calendar Plugin which is really working well for what I am trying to accomplish. However, I have run into a snag. I want to organize this query below by displaying an "multiday" event first, and then anything else after. Since I couldn't figure it out, I tried to sort alphabetically on a custom key value, but that didn't work as well. See code below:               <?php             global $post;            $current_date = date('j M Y');       $end_date = $current_date;            $get_posts = tribe_get_events(array(         'start_date'=>$current_date,         'end_date'=>$end_date,         'posts_per_page'=>3,         'meta_key'=>'promotion_type',         'orderby'=>'met_value',         'order'=>'DESC'         ));            foreach($get_posts as $post) {setup_postdata($post);          ?>

           <a href="<?php the_permalink(); ?>"> <?php echo tribe_get_start_date($post->ID, false, 'M'); ?>            <a href="<?php the_permalink(); ?>"> <?php echo date('d'); ?>

           <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
<?php echo substr(get_the_excerpt(), 0, 50); ?>...

          <?php } //endforeach ?>     <?php wp_reset_query(); ?>      While the posts are being display, they are not being organized the way I want. Is there something built in (besides the multiday conditional) where I can organize it by the type of event it is? Thanks ahead of time.


title: How to Create a Custom WordPress Navigation Menu with the Code?

text: Without using plugins, how to create a custom WordPress navigation menu with the code?   I have **Wordpress** ver **3.2.1**   and **Buddypress** ver **1.5.1** I would like to create a menu. I would like to place the buddypress menu navigation items into one item (social). when you pass the mouse over this item it appears the buddypress menu items in style **Drop-Down Menu**. Can you help me? Thank you and sorry for my bad english!


title: how to create extra post thumbnail with merge of an icon image?

text: I am searching a way to merge image of play button icon to featured image of the post. Bay be possible between add_image_size process.               if ( function_exists( 'add_image_size' ) ) {          add_image_size( 'post-play-icon', 90, 62, true ); //(cropped)     }


title: WooCommerce - filter by featured products in admin

text: WooCommerce has a simple way to pick "Featured" products by clicking a little star icon in the "Featured" column in the admin area. I need to be able to filter and show only featured products in the admin area. Does anyone know of a straightforward way to do this? I did some digging and it turns out this is done with meta key/values, where `_featured` is the key and the value is either `yes` or `no`. Unfortunately, since it's not done with taxonomies like product categories, there is no way to use the filter functionality in the admin area to show only featured products. You can sort the featured column so they are all either at the top of bottom of the product list, but that's it.


i want to use if and else statement on iframe but it's not working if and else statement not working on the iframe php page               <?php           if("p=947"){     ?>      <iframe width="820px" height="1200px" style="overflow:hidden;margin-left:-900px; margin-top:-100px" allowtransparency="true" frameborder="0" src="<?php bloginfo ("template_url")?>/gallery/karachigallery.php" ></iframe>          <?php } else if("p=953") {?>         <?php }?>


title: Page has a parent and $post->post_parent returns 0

text: I have several pages with a parent. So, $post->post_parent should be different than 0, right?               echo $post->post_parent;      Is returning 0. Thing is, this is only happening in one post category. Do I need to declare that a page has a parent elsewhere? I do it from within the edit page form of that page. Thanks!


title: Redirect user on second visit on page

text: I have a page like a welcome page which should be visited only once by each subscriber. After registration, they will redirected on my welcome page. Then I want that page not be available on same user for the second time, if the will try, I want them to be redirected. Is this possible?, should I use plugin? Thanks. :)


title: WooCommerce Checkout Error

text: Just started getting this message when trying to "Check Out" in WooCommerce: {"result":"failure","messages":"               \n\t\t\t     Action failed. Please refresh the page and retry.<\/li>\n\t\t\t     Country<\/strong> is a required field.<\/li>\n\t\t\t     First Name<\/strong> is a required field.<\/li>\n\t\t\t     Last Name<\/strong> is a required field.<\/li>\n\t\t\t     Address<\/strong> is a required field.<\/li>\n\t\t\t     Town \/ City<\/strong> is a required field.<\/li>\n\t\t\t     State<\/strong> is a required field.<\/li>\n\t\t\t     Zip<\/strong> is a required field.<\/li>\n\t\t\t     Email Address<\/strong> is a required field.<\/li>\n\t\t\t     Phone<\/strong> is a required field.<\/li>\n\t\t\t     Country<\/strong> is a required field.<\/li>\n\t\t\t     First Name<\/strong> is a required field.<\/li>\n\t\t\t     Last Name<\/strong> is a required field.<\/li>\n\t\t\t     Address<\/strong> is a required field.<\/li>\n\t\t\t     Town \/ City<\/strong> is a required field.<\/li>\n\t\t\t     State<\/strong> is a required field.<\/li>\n\t\t\t     Zip<\/strong> is a required field.<\/li>\n\t\t\t     Invalid shipping method.<\/li>\n\t\t\t     Invalid payment method.<\/li>\n\t<\/ul>","refresh":"false"}      What the hell is this and how do I make it go away?


title: Slow Scrolling on Wordpress Theme

text: I'm using the Curated theme from ThemeMaha. I have noticed and several users have echoed that scroll feels delayed to get started and slow to stop. It's almost as though it is sluggish or has some kind of elastic effect on. I've observed this on across browsers (Chrome, FF, Safari) on mac and PC. I know there are javascript and css ways to manipulate scrolling. If I were looking to find and undo any such things where would I look? Or does this appear to be a poorly optimized theme and the sluggishness is from the image heavy layout?


title: How to get a retweet button on my wordpress.com blog?

text: Is is possible to get a retweet button on a WordPress.com blog? I see that plugins are not an option, and the only widget that I found was for adding my tweets to my blog. I'm looking to add my blog to other peoples tweets, and I'm surprised that isn't built in, like the FaceBook 'like' widget. Can this be done?


title: Wordpress 3.8.3. custom theme - sliders won't load js/css files

text: I'm building custom WP theme and I have issues with sliders. None of those I've tried to install worked. When I looked into the developers console, and searched for their js/css files, they where not there. Not in the header or the footer. One of those plugins had option to include his files into header or footer - tried to change that but didn't work. Contact form and pagenavi are working just fine, but sliders not. There are no js errors, because there are no files to cause them. WP version is 3.8.3. jQuery 1.9.3 is included and working fine. Am I missing something in my functions.php ( theme is made from scratch ) maybe?


title: functions.php conditional tag only for custom post type

text: I'm using gpp slideshow, which overwrites wordpress's default gallery display. I only want to use it on my custom post type, "listings" - how would I reference it to only replace wordpress's default gallery on the "listings' page? I have this code in my functions.php, and I can't seem to get the reference right for the custom post type:               add_action('wp_head','add_gpp_gallery');     function add_gpp_gallery() {         if( ( is_single() || is_page() ) && ( !is_page_template('page-blog.php') ) ){             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }      above is the code the plugin uses, and I added it to my functions.php and tried this change:               if (is_single() && is_post_type('post_type'){      and that returns an error. thoughts & thanks


title: How do you add pages on a staging server, and then move them over to production

text: Here is just one of a couple of scenarios where this could come up. Let's say you add a plugin on your development server, which requires a wordpress page to do its magic. There are a couple of problems.   1. There is no easy way to move the page over to production. The pages and posts are intermingled.   2. Event if you do move it over, there is no guarantee that the pages ID will be the same, since likely new content was created on production in the interim. Most plugins that operate this way, store a page ID.


title: recommended practice for form submission

text: I want to create a form on a page but how do I handle the form submission. Which hook should i implement to handle my submission? Probably dirtiest would be to do it in the theme itself but I don't want it that way... probably not the right way to do it


title: How to host 2 subdomains as lookalike destinations under one master domain?

text: Due to restrictions on several required plugins, we cannot use multisite (some are not multisite compatible) at this time. So we have 2 sites with e-commerce that will look essentially the same (same theme) but be operated as separate locations: location1 and location2. Each location has separate inventory, same items, but different quantities. Similar to a JimmyJohns where you would select the location you are closest in order to place your order. So perhaps I can set a cookie determining the chosen domain? So the users going to www.shop.com would need to select location1 or location2 (ideally from a drop down or other header area button) that would move them to location1.shop.com. They could review products, purchase items, and schedule delivery with that site. If they switch over to location2 (location2.shop.com) via the header area popup, the cart would be reset because they are different locations with different inventories. Same items, but different inventories in each store. How can we configure individual sites www., location1., location2., so the user can easily switch between them, redirecting between the subdomains? Thank you.


title: Multi Taxonomies same terms

text: Is it possible to have multi taxonomies that shares the same terms ? What I would like to achieve : I have a taxonomy which contains all the languages as terms. Then I have second taxonomy called native language and a third called second language. I want all of them share the terms of taxonomy language and not to write again the languages for the others taxonomies. Is there any other way without using taxonomies ?


title: Shortcodes dont work online

text:
i created some shortcodes which i have include into functions.php This is the shortcode.php code i have used:               // alert box      function alertBox($atts, $content = null) {         extract(shortcode_atts(array(             "bgcolor" => '#ffffff'         ), $atts));         return '
'.$content.'
';     }          add_shortcode("alertbox", "alertBox");          /*** info box ***/     function infoBox($atts, $content = null) {         extract(shortcode_atts(array(             "bgcolor" => '#ffffff'         ), $atts));         return '
'.$content.'
';     }          add_shortcode("infobox", "infoBox");      All this was included into the functions.php using this line:               include TEMPLATEPATH . '/extras/shortcodes.php';      When working on wamp (offline) shortcodes work beautifly but online wordpress only spew out the actuall tags like this `[alertbox]Sometext[/alertbox]` I have created many shortcodes tough mostly with copy/paste/refine.. Anyone got an idea as to why this might happen ?


title: separate posts to have (kind of) 2 blogs?

text: Before putting a lot of effort in this, just to find out it's not possible: Let's say I have two different categories and I want the user to be locked in one of them after choosing it from a menu-point. If someone has choosen, e.g. 'announcements', I want Wordpress to do like there are only posts of this category and ignore the rest. Or even better, is there a way to divide categories into different blocks and use them separately? Would this be a job for link-categories?


title: Why is my table background image not showing in wordpress?

text:
Why is my table row background image not appearing in Wordpress. Is the stylesheet for the theme suppressing it in some way and if so, how can one override that to make the image show, or is there some other fault causing it not to appear? Note the other image in the table does display properly so the path to the files seems to work ok.

      Any suggestions?


title: File included into functions.php via require_once() won't echo?

text: I'm trying to load a file via require_once() to handle some enhanced functionality in my theme. I could place all the code directly inside functions.php, but I'm trying to isolate this code into its own script. The file is widget_context.php (see code below) and right now I'm just trying to echo some text back to each widget. It works fine when I do the echo directly from the function that calls the file. However, I can't get the echo or return (from the widget_context.php file) to show up in the widget. What am I missing? This function is inside functions.php               add_filter('in_widget_form', 'widget_context');          function widget_context(){         //echo works here:         //echo 'in widget form';          $widgets_context_file = TEMPLATEPATH . "/widget_context.php";         require_once($widgets_context_file);     }      Here is the contents of widget_context.php               <?php         echo 'place the checkboxes here';         return 'place the checkboxes here';     ?>


title: WYSIWYG – Getting the "link" button from HTML mode in Visual mode

text: Pretty much as the title says, I want to use the "link" button from the HTML mode in the Visual Mode in the WYSIWYG editor (the link/unlink in visual is to "advanced" for my liking). Is this possible without too much of a hassle?


title: Wordpress Custom Menus Issue

text: In my template I'm using calls like this to output some custom menus:               <?php wp_nav_menu(array('container_class' => 'secondary-navigation', 'theme_location' => 'secondary')); ?>      Ever since upgrading to WordPress 3.1.4 I get the full list of pages output on instead of the custom menu I've seen fixes (via google) saying I should add the following to fix this:               'fallback_cb' => false,      While I understand why this might fix things for some people, when I do the menu doesn't output at all (not just unstyled content, no html is echoed). My theme is heavily based on the twentyten default theme (from a code point of view), so I guess my question is does anyone have a fix which doesn't involve setting the fallback callback to false... And/or does anyone know if this issue also exists in the latest RC for the new version?


title: ajax front-end increment views on click

text: I'm using a redirect plugin that adds rewrites to the permalink. I want to count views on the front-end since I can't hook into the single.php as a result. This seems to be close, but it isn't incrementing the views meta value. I'm not sure where to debug, or tr Here's my code so far: I'm copying most of this from the codex and another question here. Here's the javascript snippet:               jQuery(document).ready(function($) {     $('.external').click(function(event) {           // had to add the post id to the permalink in loop as url to postid didn't work           var postID = $(this).attr('id');           var data = {              action: 'inc_views',             post_id: postID         };         // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php         jQuery.post(ajaxurl, data, function(response) {                //update the custom field value without a page refresh         });         });     });      Here's the snippet in functions.php:               function increment_post_views() {              global $wpdb; // is this needed?         $post_id = intval( $_POST['post_id'] );         $meta_key = 'views-' . $post_id;         // increment the views         $views = get_post_meta( $post_id, $meta_key, true );         update_post_meta( $post_id, $meta_key, intval( $views ) + 1 );         die();     }     add_action('wp_ajax_inc_views', 'increment_post_views');      **update** : some progress the following code update does increment the post view count, but does not continue on to the actual post. if I uncomment the window.location, it does redirect but the view count is not incremented.               jQuery(document).ready(function($){         $('.external').click(function(e){             e.preventDefault();             var redirect = $(this).attr('href');             $.post(ajax_object.ajaxurl, {action:'inc_views',post_id:$(this).attr('id')});             //window.location = redirect;         });     });      **final** : this works               jQuery(document).ready(function($){         $('.external').click(function(e){             e.preventDefault();             var redirect = $(this).attr('href');             $.post(ajax_object.ajaxurl, {action:'inc_views',post_id:$(this).attr('id')}, function() {                 window.location = redirect;             });             return false;         });     });


title: Background audio player

text: There are a lot of audio/music players that are either WP plugins or work with WP, but I don't see that they do exactly what I'm looking for. I want to be able to play an audio file automatically when the site loads, as a sort of background music, with the only control a "turn this off" button - no play/pause, no track info etc. (I'm vehemently against this sort of online Muzak, but my client is insistent.) Is there a good way to do this?


title: Radom post image/link based on custom taxonomy

text: How would I make a widget to display a random post's image and permalink? I would like it to pull from a specific custom content type and only posts have set the custom field of "featured" to "yes".


title: Creating Custom Query

text: I've hit some sort of stumbling bock here, and I can't find my way over it. I'm trying to craft a custom WP query that searches for posts by country of origin, selecting multiple countries at once. I have a table that maps countries to regions, so the initial query will search for the selected region, and return all of the countries in that region as an array. For example, if you select Africa, it will return an array of countries within Africa.               if(!empty($_REQUEST['region'])){          $region = $_REQUEST['region'];              $regionresult = mysql_query("SELECT * FROM gallery_regions WHERE region='$region'") or die(mysql_error());         $num_rows = mysql_num_rows($regionresult);              if (!$regionresult) {             $message  = 'Invalid query: ' . mysql_error() . "\n";             $message .= 'Whole query: ' . $query;             die($message);         }     } else {          $region = NULL;     }      That part works. Now, I want to use the returning array to search my WP posts for any that originated from any of the countries in the array. This is the part I can't get to work:               $country_search = array(mysql_fetch_array($regionresult));     $args = array(         'posts_per_page' => -1,         'meta_query' => array(             array(                 'key' => 'Country',                 'value' => '$country_search',                 'compare' => 'IN'             )         )     );     $query = new WP_Query( $args );      I get no results back. In fact, if include `echo "$args";`, what I get back is simply the word "Array." I also only want it to return results from a specific category. I'm sure that I'm overlooking something simple. Can anyone help? Thanks! ty