Ajax response is always 0

I am trying to figure out why my Ajax response is always 0. I am trying to load in meta data into a Jquery UI Dialog box based on the ID of the link clicked. All of this is in a single.php template file - not sure if that is the cause or not. Here is my code(edited for space):                           jQuery( '#meta-dialog-box' ).dialog({                 width: "500px",                 autoOpen: false,                 show: "blind",                 hide: "explode",                 resizeable: false,                 draggable: false,                 modal: true,                 position: "center",                 closeText: "X",                 dialogClass: "co-meta-dialog-wrapper"             });                  jQuery('a.co-meta-dialog').click(function(){                 var id = $(this).attr('id');                 var taxonomy = id.replace("co-","");                 taxonomy = taxonomy.replace("-dialog","");                 var title = $(this).text();                 jQuery( "#meta-dialog-box" ).dialog( "option", "title", title );                 jQuery( "#meta-dialog-box" ).dialog( "open" );                 jQuery( "#meta-dialog-box" ).html( '<img width="62px" height="62px" style="margin:0 auto;" src="<?php bloginfo('template_directory');?>/images/loading.gif" alt="loading..." />' );                                   //$( "#meta-dialog-box" ).html('Meta Dialog Box For: ' + id);                      switch( id ){                     case 'co-location-dialog':                         dialog_action = 'show_co_location_dialog';                     break;                          case 'co-contact-dialog':                         dialog_action = 'show_co_contact_dialog';                     break;                          //and so on....                          default:                     break;                 }//end switch                      jQuery.post(                                 UiAjax.ajaxurl,                     {                         action : dialog_action,                         postid: '<?php echo $postid; ?>',                         tax: taxonomy                     },                               function( response, data, status ) {                         jQuery('#meta-dialog-box').html(response);                         //alert(data + ' ' + status);                     }                 );                 return false;                        });      I have check Firebug and my action is getting through correctly. So it seems my PHP call back is not being fired correctly. All my call back PHP functions have die(); at the end of them. And are set to print the meta data. I tried echo and return but still no luck. I have all my ajax actions in my functions.php file like so:               //location|address     add_action('wp_ajax_show_co_location_dialog', array('DS_Lingerie','get_dialog_address') );     //contact info      add_action('wp_ajax_show_co_contact_dialog', array('DS_Lingerie','get_dialog_contact_info') );      Do I need to set up a plugin to do this? Or am I missing something else entirely? I have been banging my head against the wall for about 6 hours now and cannot figure out what I am doing wrong here. Any and all help is greatly appreciated! I may need to rethink how I have this set up, perhaps use a different modal/dialog function or something like that. Suggestions and insights are 100% welcome! Thanks in advance.


Will activating a different theme preserve custom settings to current theme?

I have theme A currently active, and theme A has custom settings (like header image, custom CSS, etc). I am having issues with theme A, and want to activate theme B while I troubleshoot these issues. If I activate theme B, and go to activate theme A later, will my custom settings be preserved?


Custom post type capabilities

I've got a somewhat unique scenario that I would appreciate some assistance with. I have a custom post type, coin, for content that is automatically created by an custom import process. I would like to restrict all users from performing certain actions on any coin posts. Specifically, I want to prevent any user from deleting a coin, changing the published status, or changing the visibility. I have registered a post type:               function my_post_type() {         register_post_type('coin',                 array(                     'labels' => array(                         'name' => __( 'Coins' ),                         'singular_name' => __( 'Coin' ),                         'view_item' => __( 'View Coin' ),                         'edit_item' => __( 'Edit Coin' ),                         ),                     'public' => true,                     'menu_position' => 5,                     'capability_type' => 'coin',                     )                 );     }     add_action('init', 'my_post_type');      I have specified how to handle the capabilities:               function my_map_meta_cap( $caps, $cap, $user_id, $args ) {         if (preg_match('/_coins?$/', $cap) == 1){             $post = get_post( $args[0] );             $post_type = get_post_type_object( $post->post_type );             $caps = array();             $disallowed = array(                     'delete_coin',                     'publish_coins',                     );             if (in_array($cap, $disallowed)){                 $caps[] = 'do_not_allow';             }         }          return $caps;     }     add_filter( 'map_meta_cap', 'my_map_meta_cap', 10, 4 );      This does prevent the deletion of coin posts. This does prevent the adjustment of the visibility of a coin post. This does prevent users from publishing a coin post. However, it does not prevent users from changing a coin post status to draft or pending review. Additionally, I would like to prevent users from being able to add new coin posts as coin posts should only be created by the import routine. I have not found any information about how I could do this. Can anyone help me or am I asking too much of wordpress?


How to customize a plugin whilst maintaining ability to upgrade

I am currently working on a major update to one of my WordPress plugins. The plugin lets the user choose from several available skins. Quite often I get asked to create a custom skin. To prevent this skin from being deleted on upgrade I have to use a WordPress hook to disable automatic updates for the plugin. This is obviously not ideal as I would want them to still be able to update the plugin. The problem is the way WordPress handles updates - it simply deletes the plugin folder and installs the new version. Thus removing files which were not actually part of the old version. Currently the only way I can get around it is having two skins folders - one in the plugin folder and one in the uploads folder - is this really the only way I can offer this to my users?


Echo a numerical value in query_posts

I am creating an option page for one of my wordpress themes and I am trying to ask user to enter "Number of posts to show" - I am using "query_posts" to show posts This is the code I modified but it is not working `<?php query_posts("posts_per_page='".of_get_option('numberofposts', '3' )."'&cat='".of_get_option('postcategory', 'no entry' )."'"); while(have_posts()) : the_post();?>` the correct method to echo the option used is : `<?php echo of_get_option('numberofposts', 'no entry' ); ?>` which returns a value the user entered - ex : 5 the category section works , I can output the category ID but not the number of posts . thanks in advanced


css file status 403

I am importing some css files in another css document like so, however the foundation.css file is getting a 403 for the stylesheet when I visit the location, my ftp says it is there and it all works locally. The site is live here username:anders pass:reading61 I am not sure what is going on.               /*     Theme Name: git.Austin.Kitson.org     Theme URI: http://austin.kitson.org     Description: A Wordpress version of Austin.kitson.org     Author: springmethod     Author URI: http://springmethod.com     Version: 1.0     */     /*import styles for zurbs foundation*/     @import url("stylesheets/foundation.css");     @import url("stylesheets/app.css");     [if lt IE 9] @import url("stylesheets/ie.css");      here is my functions.php css register and enqueue if that helps               //LOAD CSS     function load_css_styles(){     if (!is_admin()){     wp_register_style('css_main', get_template_directory_uri() . '/style.css');     wp_enqueue_style('css_main');     }// if not admin ends     }// css_styles ends     add_action('wp_enqueue_scripts', 'load_css_styles');


Is there any way to not require email address or disable notification upon setting up a member?

I'm setting up a website which will track the users by their role in relationship to the company. I want to use the built-in WP user functionality, but I don't want to send out notifications to all these people that I'm mucking around with the backend, when I have no intention of giving them edit access at all. I just want their information in there for the company's use. Specific Problems: Regardless of whether I use a plugin to extend WP's functionality or not,   1. Setting up a user requires an email address   2. The email address is required to be unique (I can't make my own test email address primary)   3. Setting up a user WILL generate an email notification I need to be able to either not require an email address, set up the users with the same corporate email address, or disable email notifications. Any help is appreciated.


$wpdb->get_results not returning an array

I haven't really messed with $wpdb before, but I'm stuck hard on one part. I'm trying to get the values returned in an associative array. I've tried both of these               $datarow = $wpdb->get_results("SELECT class_name FROM wp_wcs2_class WHERE id=$classnumber");     $datarow = $wpdb->get_results("SELECT class_name FROM wp_wcs2_class WHERE id=$classnumber",ARRAY_A);      but `print_r $datarow;` just errors out with `Parse error: syntax error, unexpected T_VARIABLE` Any idea what's going wrong? I know the data is there because this returns the correct value:               $nameresult = $wpdb->get_var($wpdb->prepare("SELECT class_name FROM wp_wcs2_class WHERE id=$classnumber",ARRAY_A));


Redirect once on first visit

I would like to find a way to have visitors who visit my site every 24 hours to be redirected to a different page where they click a link that takes them back to the main page. I've found a few ways to almost accomplish this but every time they land on the homepage it keeps redirecting them back to the other page. I've looked at a large number of plugins but I have yet to find anything. Is there a way to accomplish this?


Pass url part as argument to shortcode

I have a page /most-commented which lists all articles which have most number of comments. The list is generated by a shortcode. I want to add year-wise top commented articles so URL should look something like: /most-commented/2013, /most-commented/2014 etc. The simplest solution is to just create child pages and have each of them their own separate shortcode. However, I'd like to have a more dynamic approach. Another solution is to use template_redirect and wp rewrite rules to redirect the page to appropriate page. Is there another simpler way to do this?


How can I understand what is the cause of WP death (white screen)?

I have some problems on a admin side:   when i try to filter posts according to any category, or when I publish a post, I see a white screen of WP death...   The content of `debug.log` is:                     [17-Jun-2012 11:49:55 UTC] PHP Warning:  include(/home/dinorg/public_html/wp-content/advanced-cache.php) [function.include]: failed to open stream: No such file or directory in /home/dinorg/public_html/wp-settings.php on line 62         [17-Jun-2012 11:49:55 UTC] PHP Warning:  include() [function.include]: Failed opening '/home/dinorg/public_html/wp-content/advanced-cache.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/dinorg/public_html/wp-settings.php on line 62         [17-Jun-2012 11:49:55 UTC] PHP Notice:  Constant BLOGUPLOADDIR already defined in /home/dinorg/public_html/wp-includes/ms-default-constants.php on line 28         [17-Jun-2012 11:49:55 UTC] PHP Notice:  wp_enqueue_script נקרא בצורה לא תקינה. סקריפטים וסגנונות לא צריכים להרשם או להיטען לפני ווים wp_enqueue_scripts,admin_enqueue_scripts, או init. כנסו ל-Debugging in WordPress למידע נוסך. (הודעה זו נוספה בגרסה 3.3.) in /home/dinorg/public_html/wp-includes/functions.php on line 3587         [17-Jun-2012 11:49:55 UTC] PHP Notice:  define() was called with an argument that is deprecated since version 3.0. The constant VHOST is deprecated. Use the boolean constant SUBDOMAIN_INSTALL in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0. Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/dinorg/public_html/wp-includes/functions.php on line 3551         [17-Jun-2012 11:49:55 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/dinorg/public_html/wp-content/themes/din/admin/qa_db.php:1) in /home/dinorg/public_html/wp-includes/pluggable.php on line 866      It is reasonable that the last row (`Cannot modify header information - headers already sent`) points to the critical problemm, however it's unclear for me, what does it mean. And is it realy the critical problem?   Thank you for any help with it!


documentation for wordpress 3.7 keyword

Is there a place in the Codex (or anywhere else) where the new search features are documented in detail? For example, what are considered 'keywords'? How exactly are post sorted by relevancy?


jQuery conflict on EDIT POST page - Getting blank White Screen

I have made a button to show up on ADD/EDIT POST page with onClick function to import values and insert to custom fields. My button/script looks like:               <script type="text/javascript">         $(document).ready(function() {             $('.button').click(function() {                 var val = $('#file').val();                 $.get('import-values.php', {file: val}, function(data) {                                 result = $.parseJSON(data);                     $("input[name='nick_name']").val(result.avaname);                     $("input[name='phone']").val(result.avaphone);                 });             });         });         </script>     <input id="button" name="button" type="button" class="button" value="IMPORT PROFILE">      **The problem is** : This button/script will NOT work if I dont use this script:               <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">     </script>      I thought WordPress was already including `jquery.min.js` ? Anyway the result is if I include this second script then I will be able to **Add A NEW POST** and use my button so every thing works fine except now the EDIT POST page show BLANK!! So I cant edit any POSTS!! If I use this script!! Finally I found a way around while testing and debugging!! Its NOT preferred or a good idea to edit WP CORE files but this WORKS for me: I opened /wp-admin/admin-header.php and inserted this code in beginning of `LINE 59`:               <?php if ( is_admin() && $parent_file == 'edit.php') { ?>     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>     <?php } ?>      After doing this now Im able to use my button on both **ADD NEW** and **EDIT POST** pages. **My question is** : Now as I know how to solve my problem. Can someone please advice me how I can get the same results using functions.php instead of editing WP CORE files? How can I put this script on TOOOP of Admin Header? Thanks a million


Group posts by weekly or monthly

Is there an easy way to group all WordPress blog posts by Weekly or Monthly grouping. Ideally I do not want the posts to be displayed by grouping in Front Page but would like to add it as an element or attribute so I can call it using the JSON API plugin. My intention is to use the following JQ code to group the posts based on week post was posted:               $('#postlist').listview({         autodividers: true,         autodividersSelector: function (li) {         var out = li.attr("Enter the attribute that defines week for each posts");     return out;     }      Or is there a plugin that appends some weekly attributes for each posts


Malware/Permission bug removal?

I'm facing a hell of a problem on a client's WP theme. Whenever I try to 'Activate' it, it gives me the following errors on a blank page: > Warning: include(/homepages/32/d207857955/htdocs/wp- > content/themes/kvinterior/functions.php): failed to open stream: Permission > denied in /homepages/32/d207857955/htdocs/wp-settings.php on line 316 > > Warning: include(): Failed opening '/homepages/32/d207857955/htdocs/wp- > content/themes/kvinterior/functions.php' for inclusion > (include_path='.:/usr/lib/php6') in /homepages/32/d207857955/htdocs/wp- > settings.php on line 316 > > Warning: include(/homepages/32/d207857955/htdocs/wp- > content/themes/kvinterior/home.php): failed to open stream: Permission > denied in /homepages/32/d207857955/htdocs/wp-includes/template-loader.php on > line 74 > > Warning: include(): Failed opening '/homepages/32/d207857955/htdocs/wp- > content/themes/kvinterior/home.php' for inclusion > (include_path='.:/usr/lib/php6') in /homepages/32/d207857955/htdocs/wp- > includes/template-loader.php on line 74 I think, the wp-config is changing the file permissions automatically which causes the problem. The hosting provider tells me that these four files are malware infected. If either or even if neither of the two cases prevail, please provide me a solution. P.S. - All the other themes work perfectly fine.


post_type_link function giving 404 errors

I have searched google and WordPress support, but nowhere I found any info about it. I am trying to remove the custom post type slug from the single post url and include the taxonomy base urls there. Here is the code which I used               function post_type_permalink($link, $post) {     if ($post->post_type == 'products') {         $cats = get_the_terms($post->ID, 'product_cats');         foreach ( $cats as $cat ) {             $cats_slug = $cat->slug;             $parent = get_term_by('id', $cat->parent, 'product_cats');             $parent_slug = $parent->slug;         }         $link = str_replace('products/', $parent_slug . '/' . $cats_slug . '/',   $link);              return $link;     }     }          add_filter('post_type_link', 'post_type_permalink', 10, 2);      The URLs are fine and I am getting what I wanted, however the pages are showing a 404 error. At some point of time it did work but then the other pages were giving a 404 error. Any ideas what should I do to make it work. Here is the custom post type register code.               function products_post() {     $labels = array(         'name'               => _x( 'Products', 'post type general name' ),         'singular_name'      => _x( 'Product', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'product' ),         'add_new_item'       => __( 'Add New Product' ),         'edit_item'          => __( 'Edit Product' ),         'new_item'           => __( 'New Product' ),         'all_items'          => __( 'All Products' ),         'view_item'          => __( 'View Product' ),         'search_items'       => __( 'Search Products' ),         'not_found'          => __( 'No Products found' ),         'not_found_in_trash' => __( 'No Products found in the Trash' ),          'parent_item_colon'  => '',         'menu_name'          => 'Products'     );     $args = array(         'labels'        => $labels,         'public'        => true,         'menu_position' => 5,         'supports'      => array( 'title', 'editor', 'thumbnail' ),         'has_archive'   => true,         'query_var'     => true,         'rewrite'       => array('with_front' => true),         'taxonomies'    => array( 'product_cats' ),     );     register_post_type( 'products', $args );     }     add_action( 'init', 'products_post' );      Edit: I fixed that issue (using the 404 page as product pages by grabbing url slug), now they are opening, however the other post types are getting affected, their permalinks are not working. The "View" in admin panel is actually showing the link to editing that post rather than the actual post link in the frontend.


Tags or categories referenced (accessed) via subdomains

Is there an easy way to add subdomain pointing to a particular tag or category in WordPress? So:   * accessing `http://www.blog.com/` or `http://blog.com/` would display **all** posts,   * `http://tag.blog.com/` would display all posts tagged by (or in category) `tag`. Since accessing category (or tag) is as easy as calling `http://blog.com/category/artykuly/`, I understand, that this could be fairly easily to solve in server configuration, completely outside WordPress, by defining some redirection, virtual host etc. The thing is, that I have a blog network, based on subdomains and serverd via separate top level domains through `WordPress MU Domain Mapping` plugin. So actual redirection would have to be througs something like: `http://tagsubsubdomain.blogsubdomain.networkdomain.com`. MU plugin is handling all the server configuration and redirection stuff, so I'm concerned, if above would not interfere with it?


Change class-name on "current_ancestor" in wp_nav_menu

Im working with a project where i want the wp_nav_menu to output other css classes for current_page, current_ancestor and remove other stuff like page-id and menu-id. I have get some stuff working like remove the unessesary classes and id:s using a custom Walker. But i cant get the current_ancestor to change to another class. here is what i have come up with until now:               class Clean_Walker extends Walker_Nav_Menu      {              /**          * @see Walker::start_el()          * @since 3.0.0          *          * @param string $output Passed by reference. Used to append additional content.          * @param object $item Menu item data object.          * @param int $depth Depth of menu item. Used for padding.          * @param int $current_page Menu item ID.          * @param object $args          */              function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 )          {             global $wp_query;                  $class_names = $value = '';                  $classes[] = ( $item->current ) ? 'sel' : '';                       // $current_classes = array(             //     'current-menu-item',             //     'current-menu-parent',             //     'current-menu-ancestor',             //     'current_page_item',             //     'current_page_parent',             //     'current_page_ancestor'             // );                  // foreach ($current_classes as $current_class )             //  {             //     if ( in_array( $current_class, $classes ) )              //     {             //         $classes[] = "active";             //         break;             //     }             // }                       $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );                  $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';                       $output .= '
';                  $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->title .' '. $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                       $attribute  = ! empty( $item->attr_title ) ? '' . esc_attr( $item->attr_title ) . '' : '';                  $item_output = '';                 $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID );                 $item_output .= $attribute . $args->link_after;             $item_output .= '';                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }      I also needed the attribute-field to be inside a span for some styling. So the poblem is that i need to change "current_ancestor" to the class `sel`. The class sel are working on a "single-page" so the only problem comes when im one lvl deeper. I have search WPSE but no luck. Thanks!


Pods CMS: How to add custom column to Adnvanced Content Type

I'm using **Pods plugin** _(ver 2.2)_ to create some **'Pods'** or **Advanced Content Types** , as they would refer to it, which are like _custom post types_ but are actually separate from WP, blank slate, in their own tables. Each content type has at least two fields. What I wanted to know is **how do I display those field inputs in the manage page columns of those _Advanced Content Types_** (created with the **Pods** interface)? By default it is only showing one column, ie. the default field. Using **manage_${post_type}_posts_columns** doesn't seem to work since they're **not** really post types. Further research lead me to **pods_ui()** , but the result is undesirable: the list is blank _(pic #1)_ and there seems to be another Pod item(?) at the bottom _(pic #2)_. ## Effort #1 This was the code:               function pods_ui_test() {         $object = pods('cities');         $object->ui = array(                 'columns' => array(                         'cities'    => 'Cities',                         'regions'   => 'Regions'                     ),             );              pods_ui($object, true);     }          add_filter( 'pods_admin_ui_cities', 'pods_ui_test' );      _**Pic #1:_** > ![Blank list](http://i.stack.imgur.com/RwXeu.jpg) _**Pic #2:_** > ![Bottom part](http://i.stack.imgur.com/qzzHB.jpg) Anybody familiar with how **Pods** work? * * * ## Effort #2 @ScottKingsleyClark... I think I understand what you mean, so I gave it another shot. Here's the code:               function pods_ui_test($object) {         $pod = $object[pod];              // Test on TITLE         $pod->pod_data[label] = 'XXXXX';              // Test on UI Column         $pod->ui = array(                 'columns' => array(                         'city'      => 'City',                         'region'    => 'Region'                     )                 );              return $object;     }          add_filter( 'pods_admin_ui_cities', 'pods_ui_test' );      I tested by changing the **title** and the **column UI** to see if it has any effects at all. The former works, _ie.the TITLE changed_ , but the column remains the same, ie. _only one is showing_ which is the default field.


How to display only top level posts in loop via WP_Query?

How do I set my custom loop to only show top-level posts? I have a hierarchical custom post type and the archive page shows both the parent and child posts.


Can I set up wordpress to deliver a survey?

My wife (and her co-author) are publishing a business book on cultural fluency, and they want a website to help promote the book. Since I'm the techie, I'm working on the website. Business books are really vehicles (i.e. glorified calling cards) to promote the authors and their ideas. So the website is intended to promote the book and more. Initially, I'm thinking Wordpress is the simplest platform to use, since it can do simple CMS. And they already have a domain set aside on Go Daddy. One of the add-ons that the website should promote is an assessment to measure the cultural fluency of website visitors. Essentially it will be a question & answer survey that proceeds through a wizard. The beginning of the wizard collects visitor information in a lead generation form, and the end of the wizard should report the test-taker's score. Of course, collecting the data and filtering it is necessary for marketing contact purposes. Would Wordpress be able to do this? I'm not sure about using a plugin and I'd be happy to hack around in PHP to get this feature going. If Wordpress can't handle this, are there alternative platforms like Drupal? OTHER REQUIREMENTS: the site needs the following pages: author pages, blog pages, recent events where they spoke, etc. MY BACKGROUND: I'm a JEE developer working on enterprisey eCommerce sites, and I've developed sites in Ruby on Rails and Scala on Play. So it shouldn't be difficult for me to leap into Wordpress/PHP. The main difference for me is that I need to tone done some of my enterprise instincts, since this is more of a small-business kind of site.


Custom Taxonomy List with Children

I am trying to display a list of terms for a custom taxonomy and am having a bit of trouble. The custom tax is for a Custom Post Type called `project`. What I want to do is list a Parent term and it's children, such as:   * Painting      * 2013     * 2012     * 2011 When you get to an archive of a child term, the same list would appear, showing the parent term. I have attempted to use `wp_list_categories()` and it has potential but I am not sure how to manipulate it for these purposes, meaning that when the archive is for a child term, the parent term and all other child terms are not displayed. The code I have in the template isn't working at all, and it comes from a WP Codex example. Here is the template code:                 global $wp_query;       $term = $wp_query->get_queried_object();       $title = $term->name;                            $termID = $term->term_id;       $taxonomy_name = $term->taxonomy;       $termChildren = get_term_children( $termID, $taxonomy_name );            echo $title;       echo $termChildren;            echo '
';            foreach ( $termChildren as $termChild ) {         $term2 = get_term_by( 'id', $termChild, $taxonomy_name );         echo '
name, $taxonomy_name ) . '">' . $term2->name . '
';       }            echo '
';      This does not render a list, and breaks everything underneath the `foreach` statement. Just for good measure, here is the Custom Tax code in case I did anything stupid there:               add_action( 'init', 'register_taxonomy_mediums' );          function register_taxonomy_mediums() {              $labels = array(              'name' => _x( 'Mediums', 'mediums' ),             'singular_name' => _x( 'Medium', 'mediums' ),             'search_items' => _x( 'Search Mediums', 'mediums' ),             'popular_items' => _x( 'Popular Mediums', 'mediums' ),             'all_items' => _x( 'All Mediums', 'mediums' ),             'parent_item' => _x( 'Parent Medium', 'mediums' ),             'parent_item_colon' => _x( 'Parent Medium:', 'mediums' ),             'edit_item' => _x( 'Edit Medium', 'mediums' ),             'update_item' => _x( 'Update Medium', 'mediums' ),             'add_new_item' => _x( 'Add New Medium', 'mediums' ),             'new_item_name' => _x( 'New Medium', 'mediums' ),             'separate_items_with_commas' => _x( 'Separate mediums with commas', 'mediums' ),             'add_or_remove_items' => _x( 'Add or remove mediums', 'mediums' ),             'choose_from_most_used' => _x( 'Choose from the most used mediums', 'mediums' ),             'menu_name' => _x( 'Mediums', 'mediums' ),         );              $args = array(              'labels' => $labels,             'public' => true,             'show_in_nav_menus' => true,             'show_ui' => true,             'show_tagcloud' => true,             'show_admin_column' => true,             'hierarchical' => true,             'has_archive' => true,             'rewrite' => true,             'query_var' => true         );              register_taxonomy( 'mediums', array('project'), $args );     }      Any help would be great. Thanks!


Uploading images from post editor fails with "An error occurred in the upload. Please try again later."

Also when i want to upload from the media library the progress bar gets stuck at crunching. but with the browser upload it works just fine but the images don't appear in the insert media pop up. also even if the upload "fails" the images are actually uploaded but they still don't appear in the insert media pop up


Custom Meta Field - Youtube embed

I created a custom meta field and I want to use it to embed a youtube video into the post. It works but when I post a code like this: `<iframe width="640" height="360" src="//www.youtube.com/embed/5Krz-dyD- UQ?feature=player_detailpage" frameborder="0" allowfullscreen></iframe>` It doesn't save. If I put a link or any other plain text it does save. Any tips to make it work with `iframe` codes? CODE:               <?php          add_action( 'add_meta_boxes', 'url_meta_box' );     function url_meta_box()     {         add_meta_box( 'url-box', 'Additional Resources', 'url_meta_box_func', 'post', 'normal', 'high' );     }          function url_meta_box_func( $post )     {         $values = get_post_custom( $post->ID );         $video1 = isset( $values['video_1'] ) ? esc_attr( $values['video_1'][0] ) : '';              wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>         <p>             <input type="text" name="video_1" placeholder="Youtube Embed Code" size="75" id="video_1" value="<?php echo $video1; ?>" />         </p>         <?php        }               add_action( 'save_post', 'cd_meta_box_save' );     function cd_meta_box_save( $post_id )     {         // Bail if we're doing an auto save         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              // if our nonce isn't there, or we can't verify it, bail         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;              // if our current user can't edit this post, bail         if( !current_user_can( 'edit_post' ) ) return;              // now we can actually save the data         $allowed = array(              'a' => array( // on allow a tags                 'href' => array() // and those anchords can only have href attribute             )         );              // Probably a good idea to make sure your data is set              if( isset( $_POST['video_1'] ) )             update_post_meta( $post_id, 'video_1', wp_kses( $_POST['video_1'], $allowed ) );          }     ?>


WordPress Boldy theme new created page - Page Not Found

I'm using Boldy Theme and having problems with creating new pages: every page I have published showing "Page Not Found" page in preview. I'm new to WordPress and not 100% whether I'm following the right way of creating new pages. Also when I'm trying to create a new menu link item it doesn't show on top bar but when I created Home menu link item it's appeared where it should be. I feel like I'm missing something silly and would appreciate your help. Thanks in advance! * * * I have no Plugins active. As I said I'm new to WordPress and do not want to break something by changing to one of the bundled themes as this is a live site. Can I just activate one of the default themes for test purposes and then go back to Boldy again? One thing to note: when I change page status from Published to Pending Review - page is appearing on the websites without problems.


Custom taxonomy template loop

I know that this question is asked numerous but i din't find an answer that suits to me. Well i'm made some custom post types and some custom taxonomies. I have the custom post type **Products** and linked to it the taxonomy **Product Categories**. When the user is at the _Products_ page and clicks on a _Product Category_ , i want to show him all the products from this specific category. The problem is that the product categories will be about 50. Right now the only thing that i found is to put to the wordpress loop this               <?php $loop = new WP_Query( array( 'post_type' => 'all_products', 'posts_per_page' => 12, 'products' => 'advance' ) ); ?>      But this shows the posts only for the advance category. I need a way to automatically takes the category that the user clicked. The dirty way is to make 50 **taxonomy-{slug}.php** files. But i want the clean way. And i can't seem to find it. I read all the codex about the template hierarchy and specific for the custom taxonomies, and search the half stackexchange but nothing (maybe i've missed something :P ). I tried to describe my question as clear as i can. If you cant understand something just tell me and i'll try to update the question with more info. Thank you


WooCommerce product search titles only

I had asked this earlier and solved it using the Relevanssi plugin, however that plugin is now breaking things so I can't use it anymore. How is something so freaking simple made so impossible by woocommerce?? AAARG! I tried using this solution, but it didn't seem to work for me. I've also tried searching out the woocommerce `product_search` function and adding a filter to that, but didn't get anywhere with it, either. Here's the last thing I tried, which still returned search results from all content, not just titles: _MarkUp_               <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">         <input type="hidden" name="post_type" value="product" />         <input type="text" value="" name="s" />         <input type="submit" value="Search" />     </form>       _Search-SQL filter callback_               // Search product titles only.     function __search_by_title_only( $search, &$wp_query ) {         global $wpdb;         if($_GET['post_type'] = 'product' )             return $search;         $q = $wp_query->query_vars;         $n = ! empty( $q['exact'] ) ? '' : '%';         $search =         $searchand = '';         foreach ( (array) $q['search_terms'] as $term ) {             $term = esc_sql( like_escape( $term ) );             $search .= "{$searchand}($wpdb->posts.post_title LIKE '{$n}{$term}{$n}')";             $searchand = ' AND ';         }         if ( ! empty( $search ) ) {             $search = " AND ({$search}) ";             if ( ! is_user_logged_in() )                 $search .= " AND ($wpdb->posts.post_password = '') ";         }         return $search;     }     add_filter( 'posts_search', '__search_by_title_only', 500, 2 );      Anyone? I imagine it has something to do with the woocommerce post type itself... they like to put in a lot of custom hooks and such.


Prevent Data Resubmission On Page refresh

**UPDATED FOR CLARIFICATION** I've got this rating plugin that keeps submitting & duplicating the rating data on page refresh. When a user wants to add a rating, they have to click a button that takes them to "mysite.com/?review=true" After they submit their review, the browser stays on "mysite.com/?review=true" Upon refreshing the browser, the review is resubmitted, causing duplicate entries. How can I check against duplicates in the database and stop this? http://pastebin.com/c6wPGRD5 - class.php http://pastebin.com/tz4PvWtS - form submit.php http://pastebin.com/9ebCxpMZ - plugin.php


How can I put a custom field value that needs to be inside the loop, in a custom menu via functions.php?? I'm working on a bilingual website and I'm using the Bilingual Linker plugin. I was able to add the language switcher in a sidebar using the Enhanced Text plugins using this code:               <a href="<?php     global $wp_query;     $postid = $wp_query->post->ID;     echo get_post_meta($postid, 'bilingual-linker-other-lang-url-1', true);     wp_reset_query();     ?>">English      but what I really want is to make the language switcher appear in the top nav menu of my theme. Thanks!


Is there any way I can put google ads on wordpress.com?

I know they do not allow plugins on wordpress.com and hence no ads. I know I can put adds on own wordpress site hosted on my own domain. But I really like wordpress.com and the ease you can create blogs there. Is there any decent way that I can put my ads on google? Weren't they allowed the ads before? Or would anyone encourage me to go with my own site instead of wordpress.com ?


Foreach loop returning more than one item when querying taxonomy

I am querying the taxonomy terms and then listing the posts that are under those terms. The taxonomy is basically a category for a custom post type, and the terms in it are the categories. I didn't think this was possible, but I have a foreach loop that is supposed to loop through each term(category) from the query and then list the terms(categories) on the page and then list the posts in those terms(categories) underneath them, and the issue is that it is listing the posts from all categories(terms) under every category. So I am getting multiples of each post. The posts are only added under one category. I couldn't figure out why it was duplicating the posts until I accidently tried getting a variables value for the category description before it was even declared, when I seen that it did not get the descriptions value for the first category but it did the second one, I knew it was getting multiple categories posts at once for the single foreach loop. Is this even possible? Can someone tell me what my issue is and help me rectify the problem?               <?php                 $myterms = get_terms('menu-category', 'orderby=none&hide_empty');               foreach ($myterms as $term) : ?>
<?php echo $term->name; ?>
 <?php                     $term_name = $term->slug;                     $term_desc = $term->description;                 if( $term_desc )                   { ?>

<?php echo $term_desc; ?>

           <?php } else { ?>

           <?php }                           $args = array(                     'post_type' => 'restaurant-menu',                     'taxonomy' => $term_name,                     );                     //  assigning variables to the loop                global $wp_query;                $wp_query = new WP_Query($args);                     // starting loop posting only                while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

<?php the_title(); ?>

<?php the_content(); ?>
                                  <?php $price_value = get_field( "show_price" );                              if( $price_value == "Yes")                             { ?>                              $ <?php $price_value ?>                       <?php } ?>
                   <?php  endwhile;              endforeach;           ?>


How to show animal lineage/pedigree in WordPress?

I need to show the pedigree or lineage of an animal in my wordpress site. Currently I have the animals set up as custom post types, with data inserted using the amazing Advanced Custom Fields plugin. I can't really find any good plugins for this that do it well, especially those that can output standards compliant HTML and usable CSS without tables. Even if it's a list item, that's cool, I can work out the CSS. But what would be the best way of inputting an animal's lineage / pedigree, up to 4 levels deep (eg: 1)Parents 2)Grand parents 3)Great Grand Parents 4) Great Great Grand parents Really appreciate your help on this one! Rick


how to remove the word "blog" from custom post type urls

my portfolio is at for example – `http://example.com/blog/portfolio/regali- preciozo/` but instead of it I want the URL like `http://example.com/portfolio/regali-preciozo/`. I want to remove the `blog` word from portfolio URLs. How to do that? My code in `stylish-custom-post.php` is following               <?php     /**      * Plugin Name: Stylish Custom Post Types      * Plugin URI:      * Version: 1.1.0      */          require_once('stylish-custom-taxonomies.php');          add_action('init', 'stylish_register_portfolio');          /**      *  Registers the Portfolio custom post type      */     function stylish_register_portfolio() {              $labels = array(             'name'               => _x( 'Portfolio', 'post type general name' ),             'singular_name'      => _x( 'Portfolio', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'new portfolio item' ),             'add_new_item'       => __( 'Add New Portfolio Item' ),             'edit_item'          => __( 'Edit Portfolio Item' ),             'new_item'           => __( 'New Portfolio Item' ),             'all_items'          => __( 'All Portfolio Items' ),             'view_item'          => __( 'View Portfolio Item' ),             'search_items'       => __( 'Search Portfolio Items' ),             'not_found'          => __( 'No Portfolio Items found' ),             'not_found_in_trash' => __( 'No Portfolio Items found in the Trash' ),             'parent_item_colon'  => '',             'menu_name'          => 'Portfolio'         );              $args = array(             'labels' => $labels,             'description' => 'Holds portfolio specific data',             'show_ui' => true,             'public' => true,             'menu_position' => 5,             'supports' => array('title', 'editor', 'thumbnail', 'comments'),             'has_archive' => true,              'rewrite'    => array (                             'slug'       => 'portfolio',                             'with_front' => false                         ),              );              register_post_type('portfolio', $args);               }      when i use rewrite rule in this then it give following error "404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable."


How to change transitions on Wordpress slider?

I am using the Plixus Wordpress theme on a website at www.LenhamSportsCars.com. You can see that there are different transitions for each slide, however I want them all to have the same transition which should be the one that slides the box across from side to side. I have looked through all of the settings and there seems to be no settings that allow you to amend this so I am guessing I would need to play with the code, but do not know what to change. Here is the index.php code that has the slider info on:               <?php     /**      * @package WordPress      * @subpackage Granit      */          get_header(); ?>               <link rel="stylesheet" href="/css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />                         <?php $s_check = of_get_option('slide_check', '' );      if($s_check != "1") : ?>

     <?php $image1 = of_get_option('image_1', '' );      if($image1 != "") : ?>     <a href="<?php echo of_get_option('image_1_url', '' ); ?>"><img src="<?php echo $image1 ?>" alt="" />     <?php endif; ?>     <?php $image2 = of_get_option('image_2', '' );      if($image2 != "") : ?>     <a href="<?php echo of_get_option('image_2_url', '' ); ?>"><img src="<?php echo $image2 ?>" alt="" />     <?php endif; ?>     <?php $image3 = of_get_option('image_3', '' );      if($image3 != "") : ?>     <a href="<?php echo of_get_option('image_3_url', '' ); ?>"><img src="<?php echo $image3 ?>" alt="" />     <?php endif; ?>     <?php $image4 = of_get_option('image_4', '' );      if($image4 != "") : ?>     <a href="<?php echo of_get_option('image_4_url', '' ); ?>"><img src="<?php echo $image4 ?>" alt="" />     <?php endif; ?>     <?php $image5 = of_get_option('image_5', '' );      if($image5 != "") : ?>     <a href="<?php echo of_get_option('image_5_url', '' ); ?>"><img src="<?php echo $image5 ?>" alt="" />     <?php endif; ?>

      <?php endif; ?>               <?php $hd = of_get_option('home_desc', '' );      if($hd != "") : ?>
<?php echo $hd; ?>
     <?php endif; ?>

     Andrew Actman and Ian Langford have joined forces at Lenham Sports Cars Ltd.      Back at Harrietsham after a few years break we are ready to look after     your classic car and will undertake work ranging from servicing , pre MOT     checks, full restorations and preparation for racing, rallying and     touring.

     Together we have many years of experience and have achieved considerable     motor sport successes including championship wins in the Austin Healey     Championship, the Midget Challenge and international rally victories. We     have also provided mechanical assistance in trans continental events.

          <?php get_footer(); ?>


wp-admin redirects to 404

Yesterday I logged onto my site and found that when I log in as an admin I get a 404 error as seen below: ![404 Error](http://i.stack.imgur.com/6vWqC.png) I have done a bit of research and uploaded a backup, modified my `.htaccess` file to below:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      but to no avail. Trying to access anything that is `/wp-admin/` results in a 404 inclusive of the `wp-stats` image as seen in the picture. I have downloaded a new version of Wordpress and uploaded it's `wp-admin` folder. Aside from the above error, the site works fine. **EDIT** SHH Error log:               [Fri Apr 13 10:21:47 2012] [error] [client {redacted}] Premature end of script headers: index.php, referer: http://dailywealthreport.com.au/wp-login.php     [Fri Apr 13 10:21:50 2012] [error] [client {redacted}] Premature end of script headers: admin.php, referer: http://dailywealthreport.com.au/wp-admin/


Passing a variable from the archive page to the default template

I have created an archive page that will display the whole content of list of posts. The individual post content output should be managed from a specialized that I will integrate using the WP built-in get_template_part function. (I assume this is the best way to work). My challenge is that I do need to get access to some variable which scope has been defined in the archive page. How do I access to them? Should I make them "global"?


Sitewide category terms

I'm looking to implement standard category terms across a network of multisite blogs. The aim is:   * create a category on one blog (or the root blog), and it is created on all blogs   * each blog will have its own category URLs e.g. with a category called 'apples' it'd be test.example.com/categories/apples and on anothertest.example.com/categories/apples - only listing those posts on the appropriate blog. I've seen there's a concept of global_terms in the code - I'm not sure if this is related or not, as I can't find a lot of documentation on this, or whether it's deprecated in 3.0.x. If this is what I'm looking for, can anyone provide an example? Thanks, Dan


Prevent renaming of uploaded media

I would like to upload a PDF file with spaces in it, and I want to do this using the uploader in the rich text editor (really, I want other, less savvy people to be able to do it, so convoluted workarounds are not really an option). Trouble is, Wordpress (3.0.3) insists on replacing spaces with hyphens and lowercasing everything (despite the fact that it's _just not necessary_ ). Can I stop this? Turn it off? Or is there an extension to thwart this behaviour? Even a manual edit to the PHP might be okay, if there's no alternative.


WordPress as a Groupon clone

I want to create a Groupon.com clone. Do you think WordPress is the right system? If not, do you have any other recommendations? Any tips/tricks you have? What are the recommended plug-ins? If anyone has any better CMS option, I'd love a recommendation...


Media Upload Folder - how to manage

**Situation :** When uploading an image via the media uploader, WP automatically makes at least 3 additional sizes, that comes to 4 images including the original one. Most of the time, the images will be used at most 2 ( 1 thumbnail for the archive page and 1 for within the post itself. ) **Problem :** Before long, the site will be bloated with unused images, and that's ok until the time to backup site. Suppose a new WP site is up and there will be 1 post per day with 1 image per post, for a year, we will have 365 times 4 image files sitting in the upload folder ( 1460 files). Within 3 years, we will have 4,380 image files all together !!! **Solution :** So how do you handle this ?


MultiSite permalinks out of sync

I have a Multi-Site problem We have moved the site form one server to another (I think that's not a problem). Now on old blogs (meaning old sub-sites) permalinks are broken for example: On the blog's home page links to posts are linking to "main site"   https://mainsite.net/2014/03/test-post2/ instead of sub-site https://subsite1.mainsite.net/2014/03/test-post2/ also in blog's control panel link in top left corner with title"visit site" points to the main site. **But** , if we create the **new blog** then permalinks are working normally. NOTE: we are using NGINX and we have copied the .conf files from old server to new one.


Access WordPress API Outside of WordPress (command-line PHP)

I have a PHP script that I need to run as a cron job. However this script needs access to the WP API (`get_pages()`, `get_post_meta()` and `get_permalink()` specifically). I've followed the instructions at http://codex.wordpress.org/Integrating_WordPress_with_Your_Website, but to no avail. Code:               require_once('../../../wp-blog-header.php');     $args = array(         'child_of' => 2083     );     $pages = get_pages($args);      However when I run `php -q this_file.php` from the command-line I get the following output:               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />         <title>Database Error</title>
Error establishing a database connection
                Anyone have any thoughts/suggestions?


Route to custom file

I would like to create a custom file inside an existing WordPress theme. But I'm not sure how to route to it, and tell WordPress that the route named `www.mysite.com/custom` should redirect to the `custom.php` file inside my theme's directory.


Custom Query problem access the values

Below is the custom query am running on my wordpress site to get the results from postmeta table. When I `var_dump` the results then I can see the values correctly but when am trying to access a single field from the array, it doesn't work. Am I missing something?                   <?php             $key = "sc_event_year";             $value = $today_year;             global $wpdb;                    $query = new WP_Query( array( 'meta_key' => $key, 'meta_value' => $value ) );             //var_dump($query);             foreach($query as $result){                 echo $result->post_id;             }         ?>


Access post ID in "content_save_pre"

First time poster, pardon my mistakes. I am trying to use the `content_save_pre` filter to grab a URL in the first line of a post and save it into a custom meta, and also set the post format as a link. All of that works fine, for the most part.               public function save_content($content) {              // short circuit if special ignore tag is included anywhere in content         if ( stripos($content, "<!--ignore-->") != false ) {             return $content;         }              $lines = explode("\n", $content);              // added href handling so that HTML anchor-links can be handled         $regex = '/(?:href="([^\s"]+))|((?:http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,4}(?:\/\S*)?)/';              $match = preg_match($regex, $lines[0], $matches);              if ( $match ) {             $url = $matches[0];             $url = preg_replace('/&?utm_(.*?)\=[^&]+/im', '', $url);                  global $post;             if ( $post == null || !isset($post->ID) ) {                 // this is part of the problem                 return $content;             }                  $result = $this->common_save($post->ID, \LinkedList\Meta::SOURCE_URL, $url);                  // prevent save fields from overwriting a blank on top of just added value             add_filter('linked_list_save_fields', function($bool){                 return false;             });                  set_post_format($post->id, 'link');                  unset($lines[0]);             return join("\n", $lines);              }              return $content;          }      I add the filter for that method elsewhere, but like so:               add_filter('content_save_pre', array($this, 'save_content'), 9, 1);      The problem I am having is when using the Android/iOS WordPress app, which I think is using the XML-RPC interface to the self hosted WordPress, the `global $post` is not populated, and `common_save` (a method that saves custom meta fields) and `set_post_format` do not work without it. Is there anyway to the `$post->ID` while in the XML-RPC "content_save_pre" so this could work? I have been using the `add_action('all', ...)` to see if the XML-RPC saving actually works, and it is definitely being called, it just cannot continue because of the lack of `$post` being populated. Another alternative I thought would be to attach a special custom meta and then use a frequently scheduled cron handle it later, but that seems complicated and I would have to dive really deep into that. Thanks!


SQL Query inside Widget

I have a widget which contains the following code:               <? global $wpdb;     $querystr = "SELECT name FROM wp_venues WHERE name ='".the_field('venue')."' ";     $info = $wpdb->get_var($querystr);     echo $info;     ?>      What I need is to be able to use the information from the table and format it, so               Name:     Capacity:     Image:     Description:      At the moment I am only able to retrieve 1 field, I think get_rows would help but how am I able to separate the fields so I can format. Thanks


How to customize the "Insert/edit link" popup box?

is there a way to customize the "Insert/edit link" popup box in the editor so that it does something like this:   * Have a checkbox that says "Insert affiliate tag at the end of link"   * If the checkbox is checked, the affiliate code will be automatically inserted after the user hits the "Add link" button Thanks!


How to add a featured image to a existing post via php?

I'm having trouble to add a featured image to an existing post via PHP. The image resides on wp-content/upload folder. The script i'm doing, is not a plugin, theme, or something like that. It's just an automation script that runs whenever it's called. What is the best approach for this case?


Get menu names and same depth level menu names

Let's say I have a menu like this..               Home     Food      -- rice      -- apple      -- sushi     Sports      -- soccer      -- basketball      -- football     Color      -- red      -- blue      -- black      When I am on sushi page, I need to get like this.. (like breadcrumb)               Food > sushi      Current menu name and upper level menu name (if there is) And when I put mouse on sushi, it will be a dropdown menu showing same depth level menus "rice, apple, sushi" I may be able to working on the dropdown script but I don't know how to get these menu names and links. Please let me know if you have any idea.


Use an attachment in multiple posts

I have an attachment in a post and I want to attach it to another post without detaching it from the first post, using the WP API.


previous_posts_link and next_posts_link, how to return the next/previous post's title as the url

The site I am working on needs to have the returned url set a specific way. That being said, all posts are basically images that are posted, with there titles being said as the page urls. How do I go about getting the returned url from next_posts_link() and previous_posts_link to be returned as mysite.com/posttitle ? At this point I have two divs wrapped with divs and spans. located within the loop
                                                <?php previous_posts_link( '',0); ?>
      currently this is returning mysite/title/page/2.


Problem only while using require_once() within functions.php

I use `add_theme_page()` within my child theme's `functions.php` implemented something like this...               // other functions located here that create a custom options page in the Dashboard.     // THIS IS NOT A FILE PATH ISSUE ->  THE CUSTOM PAGE IS CREATED IN BOTH CASES.          function my_menu() {         ...         if ( 'save' == $_REQUEST['action'] ) {             echo '<meta http-equiv="refresh" content="0;url=themes.php?page=functions.php&saved=true">';             die;         }         add_theme_page(...)     }          add_action('admin_menu', 'my_menu');      As per the WordPress docs: > NOTE: If you're running into the _»You do not have sufficient permissions to > access this page.«_ message in a `wp_die()` screen, then you've hooked too > early. The hook you should use is `admin_menu`. This is exactly the error I'm getting right after saving my options. However, I've used the correct hook as recommended. This error only occurs if I move my function into a new file and do use a `require_once` within `funtions.php`. I was organizing my code as per this answer.               require_once('includes/functions-theme-options.php');      Why does this break simply by moving the function into an external file? I thought maybe it had to do with placement, but the `require_once()` is in the exact position where the original code was placed.   * When the code is inside of `functions.php`, it works fine.   * When the code is moved to an external file and reference with `require_once()`, it breaks ( _error messages upon save as per the referenced docs above_ ). Obviously, for now, I'm keeping it within `function.php`, but maybe somebody can explain why it's breaking when I move it. * * * **EDIT** **This is not a file path issue**. Every file referenced by `require_once()` is being found and included. The problem seems to be how it's being executed. Please read this answer: http://wordpress.stackexchange.com/a/1406/11092 * * * **EDIT 2 - revised 1/16/13** This is a stripped down version that was verified to fully demonstrate the issue. This code constructs a submenu page under "Appearance" called "Theme Options". When you click the "Save Options" button, the page is supposed to reload and show a _"your-theme settings saved"_ message. However, instead it shows the WordPress error page, _"You do not have sufficient permissions to access this page."_ Simply moving the last function into `functions.php` clears up this permissions issue. I would like to know why and how I can fix it. in `functions.php` file:               <?php          require_once('includes/functions-test.php');      in my child-theme-directory, `includes/functions-test.php` file:               <?php          $themename = wp_get_theme();          function mytheme_admin() {              global $themename;              if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

';              ?>

<?php echo $themename; ?> Options

Options specfic to this theme.
             <form method="post">
                     <input name="save" type="submit" class="button button-primary" value="Save Options" />                         <input type="hidden" name="action" value="save" />
             </form>
          <?php                    }               function wp_initialize_the_theme_load() {         if (!function_exists("wp_initialize_the_theme")) {              wp_initialize_the_theme_message();             die;         }     }          add_action('admin_menu', 'mytheme_add_admin');               /*  move only the following function to 'functions.php' and the problem is gone     __________________________________________________________________________*/           function mytheme_add_admin() {         global $themename, $shortname;           if ( $_GET['page'] == basename(__FILE__) ) {                 if ( 'save' == $_REQUEST['action'] ) {                 echo '<meta http-equiv="refresh" content="0;url=themes.php?page=functions.php&saved=true">';                 die;             }          }         add_theme_page($themename." Options", "Theme Options", 'edit_theme_options', basename(__FILE__), 'mytheme_admin');     }


Getting selection of posts based on loop variables via Ajax

For a theme I'm building I'm looking to dynamically load in a selection of posts with Ajax depending on if a user selects a category or a year ('show all posts in 2012'). I've seen many different approaches described on how to implement Ajax in WordPress but they all do one aspect (like infinite scroll for instance). I was wonder if there is one integrated solution that allows to give a variable to the loop via Ajax and a specific selection of posts is returned?


I can't change the background color of a specific page

I'm trying with no luck to change the background color of just one page. I've tried adding > and then using the selector               body.page-id-15 #content { background-color:#000000; }      This doesn't work. Seems the only way I can change the background to that page is changing the background of #content. But...that changes all pages. I know this is possible and I've done it before. But not with this theme Any ideas? The link the page in question is here http://gregtregunno.ca/news Thanks


New User Approval

I have been searching everywhere for an answer. I have two user roles set up Tutor and Student. My client wants the Tutors to require approval before their profile is displayed on the front end. I am using Buddypress to display the user profile fields. They want the Student users to be automatically approved. Everything I've found is an all or nothing solution.


Custom rewrite rules for a page with GET variables?

So basically I have a WordPress page called games. Within this page I have a list of custom post type posts. Using a form and some $_GET magic, the user is able to filter the posts based on tags, as well as, first letter in the title. The base url for the page is: localhost/gamesite/games/ The URL for the filter looks like this: localhost/gamesite/games/?genre=audio- and-video&platform=ps3&alpha=A The desired URL structure should look like this: localhost/gamesite/games/audio-and-video/ps3/?alpha=A I'm looking to use the native WordPress API to set these rules, instead of hacking the htaccess file. After reading several posts, I am unable to create any working form of the desired URL structure. More importantly than having the end code, I would like to learn how this process works. Any help would be greatly appreciated.


Remove hidden formatting when user paste text from MS Word into TinyMCE

Around a fifth of post submissions that I receive contains ridiculous amounts of hidden formatting. For example, here is some of it from a recent post:               <!--[if gte mso 9]><xml>     <w:WordDocument>     <w:View>Normal</w:View>     <w:Zoom>0</w:Zoom>     <w:TrackMoves/>     <w:TrackFormatting/>     <w:PunctuationKerning/>     <w:ValidateAgainstSchemas/>     <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>     <w:IgnoreMixedContent>false</w:IgnoreMixedContent>     <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>     <w:DoNotPromoteQF/>     <w:LidThemeOther>EN-US</w:LidThemeOther>     <w:LidThemeAsian>X-NONE</w:LidThemeAsian>     <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>     <w:Compatibility>     <w:BreakWrappedTables/>     <w:SnapToGridInCell/>     <w:WrapTextWithPunct/>     <w:UseAsianBreakRules/>     <w:DontGrowAutofit/>     <w:SplitPgBreakAndParaMark/>     <w:EnableOpenTypeKerning/>     <w:DontFlipMirrorIndents/>     <w:OverrideTableStyleHps/>     </w:Compatibility>     <m:mathPr>     <m:mathFont m:val="Cambria Math"/>     <m:brkBin m:val="before"/>     <m:brkBinSub m:val="--"/>     <m:smallFrac m:val="off"/>     <m:dispDef/>     <m:lMargin m:val="0"/>     <m:rMargin m:val="0"/>     <m:defJc m:val="centerGroup"/>     <m:wrapIndent m:val="1440"/>     <m:intLim m:val="subSup"/>     <m:naryLim m:val="undOvr"/>     </m:mathPr></w:WordDocument>     </xml><![endif]--><!--[if gte mso 9]><xml>     <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"     DefSemiHidden="true" DefQFormat="false" DefPriority="99"     LatentStyleCount="267">     <w:LsdException Locked="false" Priority="0" SemiHidden="false"     UnhideWhenUsed="false" QFormat="true" Name="Normal"/>     <w:LsdException Locked="false" Priority="9" SemiHidden="false"     UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>     <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>     <w:LsdException Locked="false" Priority="39" Name="toc 1"/>     <w:LsdException Locked="false" Priority="39" Name="toc 2"/>     <w:LsdException Locked="false" Priority="39" Name="toc 3"/>     <w:LsdException Locked="false" Priority="39" Name="toc 4"/>      It is actually 650 lines, view it all here. Also, random HTML formatting is added to tags like:               <p class="MsoNormal">      Upon further interesting research, it appears that this happens when the author paste content from MS Word directly into the TinyMCE visual editor. And as detailed: > The bad news isn’t evident until someone attempts to view that page with a > different browser and the page is totally misformatted or appears blank. > Ironically, this latter scenario happens most often when the page is viewed > in Microsoft Internet Explorer [Good!]. A way to solve it may be to use the `Paste from Word` button. However, that is not a viable solution when 20% of submissions have this issue. Is there any way to strip this nonsense formatting upon paste?


Categories Listing and Highlighting current category item

My query is on Wordpress and related to categories. I have a set of categories for my posts: All, Cat-a, Cat-b and Cat-c. a. When I click on the link to my posts page, I want to show an archive for 'All'. How do I generate a link to 'All' explicitly? Something of this kind?               <a href="<?php bloginfo('url'); ?>">All Posts      b. I would also be displaying the list of categories (shown below). I would however need to highlight the current category (by default, All).
        <?php wp_list_categories('title_li='); ?>
      c. Also I would need all categories to be displayed whether they have posts in them or not. Any help on this is greatly appreciated. Thanks!


Open NextGen gallery in same page?

When I click on the album it takes me to the gallery page and it displays the image in a lightbox. Is it possible to show to the images at the same page instead of it taking me to the gallery page?


What are the better WYSIWYG post editor replacement alternatives?

I hate the built-in WYSWIG editor for WordPress. (EDIT: Editors of the sites I support hate it, which in turn makes more work for me. Hence, I hate it.) I know there are some alternatives out there, but I'm curious what the more functional and usable ones are? Issues that I hear:   * The text auto formatting either a) adds html or b) strips html. This is annoying.   * The view within the preview section doesn't use the stylesheets of the web site itself, so it's not really WYSIWYG


Manipulate Permalink

I'm using WPML to translate a website. The only major issue I have with WPML is that you cannot have a page in different languages with the same slug. Therefore www.example.com/contact/ and www.example.com/fr/contact/ is not possible. To get around this I was thinking of saving the french version as www.example.com/fr/contact-fr/ in the database but have this transparent to the user. To do that I was thinking of manipulating the URL so the the user sees www.example.com/fr/contact/ but Wordpress handles it as if the page were www.example.com/fr/contact-fr/ Is it possible to do this with a function or rewrites?


Display a specified content on a Page and all its child pages

I have a website with 5 main pages (consider them as sections), then 3-5 sub pages for each of them. I would like to display a flash banner for each section, i.e. it should display the flash banner on that page and all its sub pages. Right now i am able to get that o the main page by using the following code.               <?php if (is_page('our-school-district')) { ?>                         <object width="664" height="217">                             <param name="movie" value="<?php bloginfo('url'); ?>/wp-content/uploads/2011/03/school_district.swf" />                             <param name="wmode" value="transparent" />                             <embed src="<?php bloginfo('url'); ?>/wp-content/uploads/2011/03/school_district.swf" width="664" height="217" wmode="transparent"></embed>                             <!-- It Is Not Just About The Seeds That Are Planted, but the Garden That Surrounds Them. -->                         </object>                                             <?php } ?>      How do I get it on all sub pages too?


Job board with custom fields (free or paid)

I'm looking for a theme or plugin (free or paid) for WordPress to create a job board site. I've read this question: Creating a job board using WordPress (for free)? But I need two (or three) features that do not appear in the suggestions from the previous question:   * custom fields to job posters, like "salary:"   * custom comment fields to use like answers from the job seekers or candidates   * a page for candidates with their portfolio or resume Thanks ;)


Getting the taxonomy

I have the following query along with a custom post type called **"Questions"** :                <ul>          <?php           $args = array(              'post_type' => 'questions',              'posts_per_page' => 50           );               $loop = new WP_Query( $args );                while ( $loop->have_posts() ) : $loop->the_post(); ?>              <li>                 <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">                     <?php the_title(); ?>                 </a>              </li>          <?php           endwhile; ?>      </ul>      I've also created a custom taxonomy called **"Type"** and linked it to this post type in order to categorize the content (like, type of questions). This query lists all the questions title but I would like to find a way to list the categories this question belongs to so it looks like:   1. How do I configure my email client? in "Technical Support"    2. How to change my themes' background image in "Wordpress Support" I've tried using but I'm not getting any results. Any ideas?


wrong php date()?

hey guys, it's weird and I've never experienced that before. I've created a new blog and a custom theme. I'm using `<?php echo date("H:i"); ?>`in my theme. The time that's put is 2h earlier. e.g. if it's actually 16:00 o'clock the date generated with date() is 14:00. I don't know why that happens? I'm using the german wordpress version with the german language pack. Also doesn't make a difference when putting               setlocale(LC_ALL, 'de_DE');     date_default_timezone_set('Europe/Berlin');      into wp-config.php. any idea how I could solve that? the time set in my wordpress settings is UTC+2 which is the correct time.


help with my wordpress website

I cannot get into my website.. i was downloading a plugin for simple tags and now everytime i try to log or look at my website i get: Fatal error: Call to undefined function register_importer() in /home/sjdenny/public_html/wp-content/plugins/simple-tagging-import/stp.php on line 198 PLEASE HELP Im not sure what to do since i cant even log in or look at my site!!! THANKS


What is full URL for a post?

What page is used for a post in Wordpress? For example, www.mysite.com/some-post-title/index.php The index.php isn't valid. What is actually after the last slash?


Post is in descendant category not working in home.php

I created a custom function in functions.php to check if post_is_in_descendant_category and I'm controlling it from a plugin which is returning true is a post is in descendant category, **it is working well** **But it's not working in my home.php** , the strange thing is that when I check if post_is_in_descendant_category for any post in home.php result stuck to true **I want to know the reason for that and how to fix it** my code for post_is_in_descendant_category               if ( ! function_exists( 'post_is_in_descendant_category' ) ) {         function post_is_in_descendant_category( $cats, $_post = null ) {             foreach ( (array) $cats as $cat ) {                 // get_term_children() accepts integer ID only                 $descendants = get_term_children( (int) $cat, 'category' );                 if ( $descendants && in_category( $descendants, $_post ) )                     return true;             }             return false;         }     }      my plugin code:               function check_category(){           global $rtlDir;         if ( $category_to_check = get_term_by( 'slug', 'category-3', 'category' )){             if(post_is_in_descendant_category($category_to_check->term_id)){                 $rtlDir = true;             }else{                 $rtlDir = false;             }         }          }     add_filter("wp","check_category");


How do I store a custom dataset in WordPress to best take advantage of API?

I'm required by my GIS Master's program to create an online portfolio of my work. As I learn new mapping technologies and software I'd like to share my knowledge through a blog. I've decided to go with WordPress, but this is my first project on the platform. I've already developed a _very_ basic php application that queries a mySQL database of my past academic coursework. When the page loads all of the data is displayed in a table, however, there's a selection box where you can filter the data (with ajax) by the College that offered the course. I'd like to integrate this functionality into a WordPress site so that it fits nicely into the main content area of a template. I think this type of functionality would be helpful to others in the future so I'd like to make this my first plug-in. There seems to be several different ways to store custom data (post meta, options, custom table) in the WordPress database, but I'm looking for some guidance for my use case. Obviously with my working prototype using custom tables would be the easiest to implement, but I might lose functionality that goes along with the core WordPress API. I only have about 150 rows of data so I can't imagine indexing would be much of a concern. Eventually I'd like to add an admin side to the plugin, which would allow uploading a file (CSV?), and adding/removing a single course.


Multiple domain names under one Wordpress Installation

This is what I'd like to accomplish, hopefully under one WP install: I would like to use one WP install for my main domain + three subdomains, where subdomains need to be somehow "masked" / add-ons of other domains. i.e. www.mymaindomain.com branch1.mymaindomain.com -> www.differentdomain.com branch2.mymaindomain.com -> www.completelydiffdomain.com branch3.mymaindomain.com -> www.anotherdomain.com More details:   * One main Wordpress Website, www.mymaindomain.com   * The homepage has links that take users to three different branches of the website.   * Client wants each branch to have it's own domain (design and everything are pretty much the same)   * So, clicking on the first branch, should take users to www.differentdomain.com (keep in mind that the design is the same, header, footer, and what not)   * Same thing for the second and third "branches", they take the user to a different domain, but the UI is the same. One idea I had is to create subdomains for each "branch" and then create an add-on domain that would point to the subdomain, but this would require installing WP in each subdomain. Is there a way to handle this (i.e. .htaccess), where subdomain.mymaindomain.com would be masked as www.differentdomain.com? Thanks!


Settings API - sanitizing urls, email addresses and text

I am asking for advice on best practices on how to write this code. Currently I have simple theme options with text fields, outputting the info in my template. I am currently using this code for the settings api and sanitization of the plain text. My questions is, an additional settings field is a website field, and also an email field. I am not sure if I have to create another entire theme option, section and field so I can directly sanitize the registered settings individually (and properly for each type), or if this can all be combined within the same `oem_theme_profile_options` sanitization. I am not the best php guy, yet. So figuring this out in terms of best practice will help educate me for the future and not lead me to create multiple options in the database.               function oem_theme_initialize_profile_options() {                  if( false == get_option('oem_theme_profile_options')) {                     add_option('oem_theme_profile_options');             }                  add_settings_section(                     'profile_settings_section',                     'Profile Options',                     'oem_profile_options_callback',                     'oem_theme_profile_options'             );                      add_settings_field(                         'personal_name',                         'Name',                          'oem_personal_name_callback',                         'oem_theme_profile_options',                         'profile_settings_section'                 );                          register_setting(                                 'oem_theme_profile_options',                                 'oem_theme_profile_options',                                 'oem_theme_sanitize_profile_options' // Here is where all these options get sanitized the same.                         );     } // end of oem_theme_initialize_profile_options          add_action('admin_init', 'oem_theme_initialize_profile_options');               function oem_profile_options_callback() {             echo '
Provide the URL to the profile networks you\'d like to display
';     } // end oem_profile_options_callback          function oem_personal_name_callback() {                  // First, we read the profile options collection             $options = get_option('oem_theme_profile_options');                  // Next, we need to make sure the elment is defined in the options. If not, we'll set an empty string.             $url = '';             if (isset( $options['personal_name'] )) {                     $url = $options['personal_name'];             }                  // Render the output             echo '<input type="text" id="personal_name" name="oem_theme_profile_options[personal_name]" value="' . $options['personal_name'] . '" />';     } // end oem_personal_name_callback      Sanitization of text               function oem_theme_sanitize_profile_options($input) {                  //Define the array for the updated options             $output = array();                  // Loop through each of the options sanitizing the data             foreach ($input as $key => $val) {                          if( isset($input[$key]) ) {                             $output[$key] = strip_tags( stripslashes($input[$key]));                     } // end if             } // end foreach                  return apply_filters( 'oem_theme_sanitize_profile_options', $output, $input );     } // end oem_theme_sanitize_profile_options


How to create an identical second loop for attachments?

I have one loop for big images, and I need the same loop with small images (thumbnails). This is where I am stuck. **Use case:** I am trying to implement the elastic image slideshow jQuery plugin with WordPress following this tutorial. So far I was able to get the _large_ images but I can't figure how to manage the thumbnail navigation. Here is the code that I used so far. Actually I don't know how to manage two thumbnail using same query one for main image and one for navigation image.

            <?php         query_posts(array('category_name' => 'featured', 'posts_per_page' => 3));         if(have_posts()) :             while(have_posts()) : the_post();         ?>
             <?php the_post_thumbnail(); ?>

 <?php the_title_attribute(); ?>

<?php the_excerpt(); ?>

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

         <?php          // I need the thumbnails here.         ?>
Current

                 Slide 1

 Slide 2

      May be I am looking for something like this? This theme implemented the slider with WordPress.


Display custom post type taxonomy and month

I have created events as custom post types and I'm storing the event start date as a custom field (`YYYY-mm-dd`). I've also assigned a taxonomy to each event. I need to display a list of events by category in a single month. The code below shows that I am currently able to display a list of events by the taxonomy `'bmx racing'` but I now need to display all the bmx racing events in any given month. I need to work out how to take the month from the event start date (custom field) and apply it to this query.               <?php     query_posts( array(     'post_type' => 'event',     'event-category' => 'bmx racing'     'posts_per_page' => '-1',          'orderby' => 'date',         'order' => 'ASC',          ) );       if ( have_posts() ) : while ( have_posts() ) : the_post();         ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
       <?php the_content(); ?>          <?php endwhile; endif; wp_reset_query(); ?>      Any help is much much appreciated. Thanks in advance


Wordpress plugin tables become corrupt

I have written a plugin that creates and uses 3 database tables. On rare occasion, all 3 database tables become corrupt but no other tables in the database exhibit similar conditions. It is pretty hard to pinpoint the precise cause because it happens infrequently but once it occurs on an installation it appears to happen more frequently there. We don't yet know what is the root cause, so we have reviewed all of the code. I make an assumption that database reads can't corrupt the database tables. This leaves us with a handful of operations that write to the various tables. But any explanation would need to account for the fact that all three tables are corrupt. No single operation writes to all three tables except the installation function which runs when the plugin is activated. This has led me to believe that perhaps the installations that see corrupt tables are reactivating plugins by rebooting the wordpress server or somehow triggering the activation code. Also of note is that since some of the data that is stored comes from user input, it may contain unicode characters. Here is our activation code:               register_activation_hook(__FILE__, 'plugin_install');     add_action('plugins_loaded', 'plugin_install');          function plugin_install() {         global $wpdb;              require_once(ABSPATH . 'wp-admin/includes/upgrade.php');              $foo_table_name = $wpdb->prefix . "plugin_foo";         $foo_sql = "CREATE TABLE $foo_table_name (             id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,             fred TEXT NOT NULL,             george TEXT NOT NULL,             tom TEXT,             bill BIGINT(20) UNSIGNED,             rick TEXT NOT NULL,             kyle TIMESTAMP DEFAULT NOW() NOT NULL,             wallace BIGINT(20) UNSIGNED,             UNIQUE KEY id (id)             );";              dbDelta($foo_sql);              $bar_table_name = $wpdb->prefix . "plugin_bar";         $bar_sql = "CREATE TABLE $bar_table_name (             id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,             sally TEXT NOT NULL,             judy TEXT NOT NULL,             UNIQUE KEY id (id)             );";              dbDelta($bar_sql);              $baz_table_name = $wpdb->prefix . "plugin_baz";         $baz_sql = "CREATE TABLE $baz_table_name (             id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,             bear BIGINT(20) NOT NULL,             deer TIMESTAMP DEFAULT NOW() NOT NULL,             UNIQUE KEY id (id)             );";              dbDelta($baz_sql);              $bar_row = $wpdb->get_row("SELECT * FROM $bar_table_name WHERE sally='qux'");         if (empty($bar_row)) {             $default_bar = '42';                  $bar_data = array(                 "sally" => "qux",                 "judy" => $default_bar                 );                  $wpdb->insert($bar_table_name, $bar_data);         }     }


Allow users to register as a higher roll than default with code

By default all new registrants for my site are assigned the roll "contributor" and then I make them request an upgrade to an "author" account through a form. I also send out invitations to join the site to certain people in which I want them to automatically register as an "author" so they can skip the application process. Now my first thought was to send out some type of key code in the email and have them enter it in on a registration page but that seems like a lot of hassle. What I'd like to do instead is send them a link to a registration page that signs them up under the "author" role. But I also have issues with that approach in that I would need the link to only work when accessed by that email address it was sent too. I know this is a vague question but I'm looking for a solid solution for what I want to do.


Plugin is not generating title tags on any pages or posts

I am using the Wordpress SEO plug in and for some reason the plug in is not longer adding title tags to any posts or pages. I just updated my theme, and something has changed between this version and the last one regarding the way it works with the Wordpress SEO plugin. I checked the header.php and as far as I can tell it has the correct code:               <title><?php wp_title(''); ?></title>      If I deactivate the plugin the titles come back. Does anyone have any ideas of what could be happening? I'll be happy to supply any code if needed.


How can i put an array as variable in shortcode_atts?

I am trying to create a shortcode with an array as input like so               function product_gallery_shortcode($atts) {          extract(shortcode_atts(array(                 'product_id' => '31',                 'prodvid' => false,                 'youtubeids'=>'',//['lbRqMddP2jo','eFAxx817rC0'],                 'thumbnr' =>2                     ), $atts));      I like to loop throught the youtube id's but i don't know how to initialize the youtubeids as an array so it reads                   'youtubeids'=> array('lbRrePOP2jo','eFAxx17rC0'),      regards


Using List Table Filters for ALL Custom Post Types

Is there a way to create sortable columns for admin tables across ALL post types? I am working on a project with 7 Custom Post Types, and wondering if there is a better approach than using multiple _manage_edit-{Post-Type- Here}_sortable_columns_ filters for each post type.


Make fonts.com font work in TinyMCE (iframe referrer issue)

I'm using custom (commercial) fonts in my project. Everything works well in the frontend. I noticed however that, when trying to add this font to the TinyMCE iframe, I get a 403 for the webfonts. The problem seems to be, that requests from the iframe do not have a referrer. And fonts.com needs to referrer to validate the request. Any thoughts?


get the url of an image on the query json

using the json plugin api, I returned data custom_field worse the value returned is an image id value, and I want to return a value to url so use with a mobile application. in the configuration of the field, I give the option to return url, but still returns me the id of the media file. "logo" is my image attribute.               "custom_fields":{     "horario":[     ""     ],     "logo":[     "4409"     ],     "layout":[     ""     ],


After changing permalink settings, everything works fine except for the two most recent posts

I've been searching for a couple of hours for a solution, but so far haven't found anything. I updated my site's permalink settings from 'post name' to 'day and name' and everything seems to be working fine except that the two most recent posts redirect back to the homepage and add the year to the url. I've tried resetting the permalinks to default and changing back to 'day and name', but this doesn't seem to work. If I insert index.php in front the custom permalink structure, the links will work, but I don't want index.php to display in my URL. I can't seem to figure out why this would be an issue for only two posts out of hundreds. The only difference between these two posts and the others is that they are the two most recent. Any help would be much appreciated, as I've been searching for a while and can't seem to find a solution. Thanks!


Big Image on Featured Post, Normal on Single Post

I have included a code which fetches any post under my category=featured. And that shows-up on the top of my content (*whenever we have any breaking news to show*)on blog-page. The problem is, The image that I can afford to show on single-post is of 750px width, whereas I have enough space to show 1100px image on the post that shows up on home page (*blog-page*). So I want to embed an option where I can upload two images (*of 750px and 1100px*). And then I should be able to use 1100px image on the post when its shown on blog-page and 750px image when user clicks and goes to single post. Is it possible, and how? Thanks.