Error uploading files bigger than 58 MB

For uploading files bigger than 58meg I get HTTP error. or IO error when using media uploader or 500 Internal Server Error when using browser uploader in WordPress v3.5.1 Multisite . It seems to get almost all the way thru the upload before it stops and comes back with the error message. Hosting is LINUX thru Godaddy, they tested a php script to load a 130meg file successfully they can not find anything wrong, I get the error in IE9 or Firefox with or without flash plugin, cache cleared or not, only with files larger than 58megs, mod security fix does not seem to work for this issue either. FTP works fine to upload larger files and uploading files smaller than 58megs works fine, This is a multisite configuration and the errors happen for every site, I do not have any plugins loaded yet, Does anyone have any ideas about how to fix this?               my php5.ini file is this:     max_execution_time = 1800     max_file_uploads = 2000     memory_limit = 256M     post_max_size = 192M     file_uploads = On     upload_max_filesize = 192M      my .htaccess file now is:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]          </IfModule>          # END WordPress      part of my wp-config.php file is:               /* Multisite */     define('WP_ALLOW_MULTISITE', true);          define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'youmightry.com');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);          define('WP_MEMORY_LIMIT', '256MB');      thank you for your editing and your comments! :) great ideas! I forgot to mention that my hosting is Linux hosting.. and I am looking into my settings.php file   here is the upload settings section

<?php _e( 'Upload Settings' ); ?>

                 <?php _e( 'Site upload space' ) ?>	                                  <input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '<input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?>

                 <?php _e( 'Upload file types' ) ?>	                 <input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option('upload_filetypes', 'jpg jpeg png gif') ) ?>" size="45" />

                 <?php _e( 'Max upload file size' ) ?>	                 <?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?>


why breadcrumb has wrong orders?

Here is my code:               function the_breadcrumb() {     if (!is_home()) {         echo '';         bloginfo('name');         echo " / ";         if (is_category() || is_single()) {             the_category();             if (is_single()) {                 echo " / ";                 the_title();             }         } elseif (is_page()) {             echo the_title();         }     }     }      It gives a wrong result:               website name > cat1 > cat1 sub1 > cat1 sub2 > cat1 sub3 > your location      The order I try to get:               home >cat1 > cart1 sub1 >your location      Can someone tell me what I have to change?


Post being scheduled that shouldnt be schedulded

Theres something strange in the neighborhood.. Seriously.. I think my wordpress is haunted. I've been working on a plugin that creates a post from a form and its been working fine for several weeks, submit the form, the post is published. Now, bear in mind that Ive made no changes to the function that creates the post, everytime I submit the form the post is automatically scheduled. Whats going on and what can I do to get it working normal again? Its super annoying. Thanks! -- UPDATE -- As requested te code that creates the post: ## INSERT POST                       $new_post = array(                     'comment_status' => 'open',                     'ping_status' => 'open',                     'post_title' => $productName,                     'post_content' => $productDesc,                     'post_status' => 'publish',                     'post_date' => date('Y-m-d H:i:s'),                     'post_author' => $currentUser,                     'post_type' => 'products',                     'post_category' => array(0)                     );                  $post_id = wp_insert_post($new_post);


"MySQL server has gone away" since update to 3.8

I have a WordPress install on a dedicated server with decent memory (upwards of 8GB). The WordPress install includes many plugins - 50 active plugins. Most important to note is the WPML plugin to make WordPress multilingual. The theme is Weaver II Pro. The stack is LAMP - CentOS 6.3, Apache 2.4.4, Percona MySQL, PHP-FPM. I have been quite stupid, and didn't set up a test or staging server. Everything was running fine till I updated to WordPress 3.8, and also updated several plugins at the same time. I didn't pay attention at the time, but all my widgets got messed up, and so did any sort of navigation etc. I enabled error_log for a bit, i.e.               ini_set('log_errors',TRUE);     ini_set('error_reporting', E_ALL);     ini_set('error_log', dirname(__FILE__) . '/error_log.txt');      This resulted in an immense file - basically the error_log grows by about a GB every 4 minutes or so. The primary error I found in the error log was database server disconnect, better known as > MySQL server has gone away The first priority was to patch the problem. So I installed Database Ping plugin. This **mostly** , though not completely solved the issue. Many of the widgets came back. However, the special (non-English) characters are all messed up (converted to question marks). I tried to fix this by opening wp-mysql-ping.php and commenting out               if ( !DB_CHARSET && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>='))                                         {                                             $this->query("SET NAMES '" . DB_CHARSET . "'");                                         }      Didn't help. Besides, the plugin is not a permanent or complete solution. So leaving the site in this messed up state, I started working on other possibilities: As suggested at Rackspace, I edited my.cnf to add               wait_timeout = 60      Didn't help. Also added caching to my.cnf               query_cache_type = 1     query_cache_limit = 8M     query_cache_size = 512M      Didn't help. (and yes, I restarted mysql every time I edited my.cnf) Also tried the method suggested here: In wp-db.php before               $this->select( $this->dbname, $this->dbh );      I added               $this->query("set session wait_timeout=600" );      Didn't help. I'm at my wit's end. Please help!


wordpress add image size crop function not working in version 3.8

I am using twenty fourteen theme to make another theme most of the files are same including the functions.php file, but the problem I am having is , When I add image size ( with true crop, hard crop mode). The images are not getting cropped on the front-end, only getting resized, but I want them to get cropped also. I will appreciate any help.


Create another TAG widget for posts

Currently, Posts have "tags" and in the post edit page you can add and remove tags using the widget. I would like to add another such tag-system (say, keywords) and I would like for it to use the tag interface to add and remove tags. Suggestion on how I should go about this ?


query post based on comparison

Each post in my site can be rated as 'good' , 'ok' , 'bad'. The values are stored in custom fields. I now need to show top 10 posts with maximum 'good' and it should not display posts with greater 'ok' or 'bad' values. I currently do this by the following code               <?php     $orig_post = $post;     global $post;     $args=array(     'post__not_in' => array(get_the_ID()),     'posts_per_page'=>10, // Number of related posts to display.     'meta_key'=>'good',     'orderby'=>'meta_value_num',     'caller_get_posts'=>1     );          $my_query = new wp_query( $args );          while( $my_query->have_posts() ) {     $my_query->the_post();          //code for filtering posts based on max good           $good_val = get_post_meta(get_the_ID(),'good',true);     $ok_val = get_post_meta(get_the_ID(),'ok',true);     $bad_val = get_post_meta(get_the_ID(),'bad',true);          $maxValue=max($good_val,$ok_val,$bad_val);               if ($maxValue == $good_val)     {the_title();}}          $post = $orig_post;     wp_reset_query();     ?>      The above code filters posts after it has been queried, which results in improper results at times. Is their anyway we can do the filtering (i.e comparing 3 values) in `wp_query` itself?


How to handle is_user_logged_in() with w3 total cache

I have a site that allows user registration and login but not via the standard wp-login.php etc - it's all done within the theme and a bit of s2member as well. I've been encountering problems where, with page caching enabled my code to show either a login button or a 'your account' button shows cached material. I use the below do decide which button is shown depending on whether the right user level member is logged in.               <?php if (current_user_is("s2member_level1")) : ?>         <?php             $current_user = wp_get_current_user();             $redirect = '&redirect_to='.urlencode(wp_make_link_relative(get_option('siteurl')));             $uri = wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' );         ?>
             My Account

<a href="<?= $uri; ?>">Logout

<a href="<?= get_permalink(x); ?>">Edit Account

     <?php else : ?>
             <a class="btn-lg" href="<?= get_permalink(x); ?>">Member Login
     <?php endif; ?>      However with page caching enabled this has all sorts of problems. I was looking at the Fragment Caching notes in W3TC's FAQ section but it looks like it has a major failing - it says: > Be aware that WordPress functions will not be available. So, if I understand it correctly, that pretty much stops me from being able to use fragment caching. As the member login/my account button is ever-present in the site main nav I've just disabled page caching entirely for the time being. Is the only option for me to integrate some form of AJAX approach for handling dynamic sections dependent on auth/guest status?


How to delete post thumbnails in index page? (twenty fourteen theme)

i want to delete post thumbnails in index page. but online top of the posts. i don't want to delete "featured-content" part. how can i do this? i tried replace the main loop with this:               while (have_posts()) :              the_post();              echo "".the_title()."";              the_content();        endwhile;      but now, my css doesn't work with that code. _sorry about my english._ here is my new content.php               <?php     /**      * The default template for displaying content      *      * Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Fourteen      * @since Twenty Fourteen 1.0      */     ?>          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>     <?php if ( ! is_home() ) twentyfourteen_post_thumbnail(); ?>                          <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
                 <?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?>
             <?php                 endif;                      if ( is_single() ) :                     the_title( '
', '
' );                 else :                     the_title( '
', '
' );                 endif;             ?>
                 <?php                     if ( 'post' == get_post_type() )                         twentyfourteen_posted_on();                          if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :                 ?>                 <?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?>                 <?php                     endif;                          edit_post_link( __( 'Edit', 'twentyfourteen' ), '', '' );                 ?>
                       <?php if ( is_search() ) : ?>
             <?php the_excerpt(); ?>
         <?php else : ?>
             <?php                 the_content( __( 'Continue reading →', 'twentyfourteen' ) );                 wp_link_pages( array(                     'before'      => '
' . __( 'Pages:', 'twentyfourteen' ) . '',                     'after'       => '
',                     'link_before' => '',                     'link_after'  => '',                 ) );             ?>
         <?php endif; ?>              <?php the_tags( '', '', '' ); ?>
      still doesn't work


how to assign more permission to wordpress author

I have installed jw player plugin so that users of my site could upload their videos. Right now, admin can only see jw player menu on the admin panel and he can only upload videos and use this plugin. I have created an author as author is able to add/edit/delete his posts. My problem is author cannot see and use this jw player plugin as he does not see that admin menu of this plugin. anybody tell me please how to assign more permissions to Wordpress Author so that he could see this plugin Menu and use it, thanks


How do I add a video to a custom field instead of a post body using Automatic Youtube Video Posts plugin?

I'm using the theme called wptube2 and using a plugin with it called Automatic Youtube Video Posts so it can import every video I upload on youtube. It does import every video (which is PERFECT for me) but it puts it in the post, not where I want it to be. Here is an example: http://awesomescreenshot.com/0af11r5b24 I can add the video manually with their quick video publish tool that came with the theme, but I will be uploading a lot of videos and this plugin fits PERFECTLY. I would really appreciate if someone can help Thanks.


Will my Wordpress site become vulnerable after adding this functions which allows more HTML tags for subscribers?

I was thinking of adding the following lines of code to my `functions.php` file:               /**      * Change the default list of allowed html tags      */     add_action('init', 'edittag', 10);          function edittag() {       define('CUSTOM_TAGS', true);       global $allowedposttags, $allowedtags;       $allowedposttags = array(           'strong' => array(),           'em' => array(),           'ol' => array(),           'li' => array(),           'u' => array(),           'ul' => array(),           'blockquote' => array(),           'code' => array(),           'pre' => array(),           'a' => array(             'href' => array (),             'title' => array ()),           'img' => array(             'src' => array ()),       );            $allowedtags = array(           'strong' => array(),           'em' => array(),           'ol' => array(),           'li' => array(),           'u' => array(),           'ul' => array(),           'blockquote' => array(),           'code' => array(),           'pre' => array(),           'a' => array(             'href' => array (),             'title' => array ()),           'img' => array(             'src' => array ()),       );     }      The user will be able to add stuff using the CLEditor (WYSIWYG editor, so the user can't see the code), and the form belongs to the bbPress plugin: ![enter image description here](http://i.stack.imgur.com/OIUkb.png) I was wondering if my site will become vulnerable to spam, hackers, cracker, etc? If that's the case, what's an easy way of making this stuff more secure? **EDIT:** If I use Firebug I can see the actual HTML code: For instance, this is what you see if you inspect a bold text (in Firefox):               <b _moz_dirty="">sd</b>      (Not sure if this is dangerous).


Displaying Posts of a Custom Type

I currently have a new custom post type-- "Books." I have a custom rewrite url that I set when registering my post type:               'rewrite' => array( 'slug' => 'books', 'with_front' => false )      It works great when I visit a specific post, but how do I take control of the /books url for displaying a list of ALL of the books by date posted?


How to create a linked tag list in my sidebar

I'm looking for a solution to display a tag list that shows how many times the tag has been used in posts as well as link to a list of results. I found a php code snippet you posted on the Wordpress forum here http://wordpress.org/support/topic/how-to-display-the-number-of-posts-under- each-tag?replies=30               <?php     // Select all the post tag IDs     $the_tags = $wpdb->get_col("SELECT term_id     FROM $wpdb->term_taxonomy WHERE taxonomy = 'post_tag'" );          // Loop over each ID, and grab associated data     foreach($the_tags as $tag_id) {         // Get information on the post tag         $post_tag = get_term( $tag_id, 'post_tag' );         // Print the tag name and count (how many posts have this tag)         echo $post_tag->name.' ( '.$post_tag->count.' )
';         // Unset the data when it's not needed         unset($post_tag);     }     ?>      It's almost perfect for what I need however I'd like to wrap it in a list item and link along with a span over the number. I took the echo line and did this:               echo '
<a href=\"<?php echo get_tag_link($tag_id); ?>\">'.$post_tag->name.' ('.$post_tag->count.')
 ';      I gave it my best guess but know it's not right. I know very little about PHP and am not sure if it's just a case of concatenating it correctly or if the get_tag_links part is even correct. Would you be able to help me out? Thanks so much for your time.


Why is google telling me to upate wordpress

Today I got a bunch of messages for many of my sites in Google Webmaster Tools telling me I dont have the latest version of Wordpress and should update. However I have 3.13 up, I dont see any updates on the wordpress page or within my site and 3.2 is there but its still in BETA. Whats the deal?


Error of "Call a member function on non object" while var_dump get correct result

I got error of "Call a member function embed() on a non-object", but I can see the result of var_dump is an object. Please help evaluate the following code: This is the Class to create a picture:               Class Picture{     //....     function embed() {...}     //....     }      This is the Class for template:               Class Picture_Template{     $obj_id = $post->ID;     $pic = New Picture( $obj_id );     $this->obj = $pic;     }      This is a function to test the code:               function test_picture(){     global $pic_template;     $pic_template = new Picture_Template();     $obj =$pic_template->obj;     $obj_func =$obj->embed();     echo '<pre>';     var_dump( $obj ); // I can see it is an object     var_dump( $obj_func ); // I can see the embed() function output correct result     }      This is the function that get the error message:               function play_button(){     echo get_play_button();     }          function get_play_button(){     global $pic_template;     if (!$obj )      $obj =& $pic_template->obj;     if ( $obj->embed(){     //do something     }     }


WordPress Stats keeps showing non-existent post as a top post?

For some reason, one of my top posts as reported by WordPress Stats is actually non-existent... What I see is: > #2147483647 (loading title) and it links to "...?p=2147483647" which returns a 404. Now a bit of background info:   * I'm actually using the following permalink settings: **/%category%/%postname%/**   * Stats for other posts seem to be fine   * I migrated from tumblr to WordPress The odd thing is looking into the database where the posts are stored I can not find any reference to that particular ID. Also, I appear to have several 'duplicates' of posts in the database - the difference being in a couple of fields (I'm guessing versioning or something?) I've googled a bit, and the closest I've seem to come is: http://wordpress.org/support/topic/solution-for-id-loading-title-coming-back- from-stats_get_csv-function However, that seems to assume that the ID actually exists, but WordPress/WordPressStats is just for some reason unable to get the title. So does anyone know why WordPress Stats is listing this non-existent page? (It comes #2 in all time top posts!) Thanks!


Using post title as term in query, only working with single word titles

I am using get_the_title to set up the taxonomy term for my query, which has worked fine in testing up until I had a title with more than one word, title of "catalogs" works, title of "new catalogs" does not work. When I say doesn't work I mean that, the_post_thumbnail and get_post_meta don't return anything.               <?php         $supplier = get_the_title();              global $post;         $args = array(             'numberposts' => 1,             'post_type' => 'suppliers',             'taxonomy' => 'suppliersTax',             'term' => $supplier,             'post_status' => 'publish'         );         wp_list_categories( $args );         $homeSOTMHeader = get_posts( $args );         foreach( $homeSOTMHeader as $post ) :   setup_postdata($post);     ?>

                 <?php if ( has_post_thumbnail() ) {the_post_thumbnail();} ?>

                 <?php                     $meta = get_post_meta(get_the_ID(), 'sp_homeHeaderCompanyLink', true);                      '' != $meta and print "
Company Site
";                          $meta = get_post_meta(get_the_ID(), 'sp_homeHeaderProductsLink', true);                      '' != $meta and print "
Browse Products
";                          $meta = get_post_meta(get_the_ID(), 'sp_homeHeaderContactsBox', true);                     '0' != $meta and print "
Contacts
";                 ?>
                  <?php endforeach; ?>             <?php // Reset Post Data             wp_reset_postdata(); ?>


Fix : Custom Taxonomy Duplicating in each call

I have created Custom Post type called "places" For that I created Custom Taxonomy Category called "Music". Here is the code:               add_action( 'init', 'register_taxonomy_music' );          function register_taxonomy_music() {          $labels = array(          'name' => _x( 'Music', 'music' ),         'singular_name' => _x( 'Music', 'music' ),         'search_items' => _x( 'Search Music', 'music' ),         'popular_items' => _x( 'Popular Music', 'music' ),         'all_items' => _x( 'All Music', 'music' ),         'parent_item' => _x( 'Parent Music', 'music' ),         'parent_item_colon' => _x( 'Parent Music:', 'music' ),         'edit_item' => _x( 'Edit Music', 'music' ),         'update_item' => _x( 'Update Music', 'music' ),         'add_new_item' => _x( 'Add New Music', 'music' ),         'new_item_name' => _x( 'New Music', 'music' ),         'separate_items_with_commas' => _x( 'Separate music with commas', 'music' ),         'add_or_remove_items' => _x( 'Add or remove music', 'music' ),         'choose_from_most_used' => _x( 'Choose from the most used music', 'music' ),         'menu_name' => _x( 'Music', 'music' ),     );          $args = array(          'labels' => $labels,         'public' => true,         'show_in_nav_menus' => true,         'show_ui' => true,         'show_tagcloud' => true,         'show_admin_column' => false,         'hierarchical' => true,              'rewrite' => true,         'query_var' => true     );          register_taxonomy( 'music', array('places'), $args );     }      Now, To display the categories in `single-places.php`. I am calling this               <?php $terms = wp_get_post_terms($post->ID, 'music');     if ($terms) {         foreach ($terms as $term) {             $out[] = 'slug .'" href="' .get_term_link( $term->slug, 'music') .'">' .$term->name .'';         }         echo join( ', ', $out );     } ?>      It is showing the results perfectly. and with this if i am calling additional categories like music, genre, pub, location etc by the above code. First Category is proper, Second Category shows First plus Second third Category is showing First+second+Third Please Help


How do I troubleshoot responses with WP HTTP API?

I make a GET call to API, call is supposed to return no data:   * browser (and sniffer) give me 200-OK response with `null` text as body;   * `wp_remote_get()` gives me 200-OK response with string of **binary garbage** as body. Other API requests (that are supposed to and do return non-empty data) work perfectly fine. Where to start poking HTTP API to figure out why it ends up with garbage? Here is dump of full response data:               array       'headers' =>          array           'date' => string 'Tue, 22 Feb 2011 16:51:03 GMT' (length=29)           'server' => string 'Apache/2.2.3 (Red Hat)' (length=22)           'x-powered-by' => string 'PHP/5.2.16' (length=10)           'content-encoding' => string 'deflate' (length=7)           'vary' => string 'Accept-Encoding' (length=15)           'content-length' => string '17' (length=2)           'connection' => string 'close' (length=5)           'content-type' => string 'application/json; charset=utf-8' (length=31)       'body' => string 'x��+��������_' (length=17)       'response' =>          array           'code' => int 200           'message' => string 'OK' (length=2)       'cookies' =>          array           empty


Dynamic widgets

In wordpress is it possible to have different widgets on different pages, I mean, I am having a form widget which has to be just displayed on posts page, it should just display on single.php Is this possible? Is their any plugin for this?


Post with no tag permalink problem

Firstly my problem was the `%tag%` in the permalink, but I resolved it with this patch:   %tag% in permalink not working So my custom structure now looks like this:               /%category%/%tag%/%postname%/      And the url is like:               /category_name/tag_name/post_name`      However, now I have something else that I can't resolve. When post doesn't have any tag the url becomes:               /category_name//post_name      .. which is undesired. If post does'nt have tags, i would like the url to be..               /category_name/post_name      and if it does..               /category_name/tag_name/post_name      Anyone have an idea how to solve this?


Include related posts on a page

i've got several posts which are tagged with "design", but also a page called "design". my question: i put some text into the design-page and would then display all posts which are tagged by "design". how is that possible? can i put a placeholder directly into the text or do i have to code it by myself in php? thx


Allowing non-latin characters in registration

I am from Turkey and we have "şŞçÇğĞüÜöÖıİ" characters in our alphabet. I want to use those characters in permalinks/slugs/usernames. I found temporary solution for permalinks/slugs with core-hacking. There is no other option for it except core-hacking seems. You can find solution here: http://core.trac.wordpress.org/ticket/15248 My problem is, user registration need a little fix after this one too. Fortunately there is filter i can use but couldnt handle it: in wordpress includes/formatting.php :               function sanitize_user( $username, $strict = false ) {      $raw_username = $username;      $username = wp_strip_all_tags( $username );      $username = remove_accents( $username );      // Kill octets      $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );      $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities           // If strict, reduce to ASCII for max portability.      if ( $strict )       $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );           $username = trim( $username );      // Consolidate contiguous whitespace      $username = preg_replace( '|\s+|', ' ', $username );           return apply_filters( 'sanitize_user', $username, $raw_username, $strict );     }      This section of code is producing error:                if ( $strict )       $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );      Somehow i need to disable this section. But i am not sure how to do it.


Add custom fields from different posts

I am trying to add up custom fields from different posts. The array I created is not working. Here is the code.               <?php $totalpricearray = query_posts('post_type=items&author='.$thisauthorID.'&tag='.$thispostID); while (have_posts()) : the_post();               $productprice = get_post_meta($post->ID, "productprice", true);         $productquantity = get_post_meta($post->ID, "productquantity", true);         $totalproductprice = ($productprice * $productquantity);         echo $totalproductprice, ',';              endwhile;                   $totalprice = array($totalpricearray);              echo array_sum($totalprice); ?>      Any ideas, Marvellous (ps just noticed array is working but equals 0)


Are custom page templates being used to get this permalink structure

There's a website which has page URL's such as `http://www.example.com/states/new-york/` If I go to `http://www.example.com/states/` I get a 404 error. The site also has `http://www.example.com/category/some-category-name/` and `http://www.example.com/tag/a-tag/` So clearly they haven't modified their permalink category and tag bases. Or customized them. I'm thinking they created custom page templates and pages who's parent is a a page called `states` to get the permalink `/states/new- york/` but then why would going to `/states/` throw a 404? Can a link structure like this be created any other way?


Echo get_option displays as text

I am trying to use some code that is stored as a settings option in WordPress. When I try to use the following code below however, it show up as plain text instead of executing. The option I have created contains the following PHP code:               echo get_option('profiles_templates_html'. $template .'');


How to redirect search result page to post

I'd like to redirect a search result page URL to a specific post. I've tried doing a 301 redirect in the .htaccess but it is not working. As an example: I want to redirect permanently the URL http://www.domain.com/?s=keyword to http://www.domain.com/name-of-the-post.html Is possible to do this in the .htaccess file' Best Carles


What are some best practices for switching the child theme for a production site?

I have a couple questions related to the best strategy for changing a site's theme. I'll do my best to set the stage apologies ahead of time for the verbosity. I setup a Genesis/Zigzag Press - Megalithe child theme based site at plancooltrips.com. I like the theme and have taken sometime to learn how it's put together. I really like that it's responsive but I've had a difficult time customizing it (mostly the home page) given that the home page is custom vs. a generic Genesis based loop that I can hook into. Rather than continue to try and customize this theme I thought perhaps I would be better served switching to a new theme now that I understand child themes a little better. I purchased and installed a different theme from Zigzag press that seemed to have most of what I was looking for called Mindfulness. This theme has some interesting custom post types (e.g. Portfolio) that I think will work nicely for some of the things we're wanting to do with the site. So here's where things get interesting. I host the site with Bluehost. I downloaded a backup from Bluehost of my WP directory, and a backup of the MySQL DB. On my local PC I have XAMPP for Windows, WP, Genesis, and both of these child themes. I recreated the site locally, and I use the same domain name but leverage my \etc\hosts file to point my browser at either "production" at bluehost or "local development" on my PC. I've been tweaking, testing, etc. Mindfulness is pretty cool but not as responsive in design (different issue). So now for the questions. After I installed and activated the new theme I had to do quite a bit of work just to get back to a quasi similar site. The work was mostly related to pictures in the media library, setup of slide shows, replacing "Lorum ipsum" text with our site's content, etc. This literally took me hours. We have very little traffic at this point (insert tireless plug from some SEO expert...) so performing this type of maintenance on the production site isn't a big concern but it seems to me there's got to be a better way to migrate in the following fashion: production -> local dev/config/test -> production. I came across the following post that gave me some good ideas - link. Before I sink some more money into tools like WP Migrate DB Pro, I was wondering 1.) What's this site's perspective is on the WP Migrate DB Pro Tool, worth $90.00? and 2.) If there are some alternative best practices to minimizing disruption for the production site. PS - As I was installing, tweaking, etc. I screwed some things up and got the white screen of death which rattled me a little. I was cool with blowing away local directories and starting over from the backups locally but I'd hate to get into that situation on the production server. Thanks guys! -Scott


How can I link to the most recent post in a category?

How can I create a link to a category--to it's most current/recent post? I want to display the actual post. I do not want to display the category with one post listing in it.I'm going to be really silly here... :) But in my sometimes wild and limitless imagination something like this should already be available: > domain.com/category-name/index.php?newest or > domain.com/category/category-name/index.php?latest&wpusers=happier-now I've searched and there are many PHP level solutions. And this site won't let me post more than two links here so sorry about the limitation feature ...and for reference here are the best of the related links I looked into (some are 100% in context but dated so I don't know if they're still effective with WordPress): **Resolved** Link to most recent post in one category? Link to latest post in category I had about ten more relevant links... But again, it really seems like there doesn't need to be a PHP, function or template level way ONLY to do this. There are so many cool little ?this and &that elements added to the URL that there should be one that gets the latest post. A good example is a YouTube playlist link. It loads the latest video and allows all kinds of &height &width &rel=0 abilities. I'm kinda surprised this isn't a core WordPress feature. Right now I've got several widget variations which can display a recent or featured post on the front page with an excerpt and a featured image. When someone clicks on the title, featured image, or Read More, they're taken to that post. So I can see widgets can create the links--I'm just out of my depth figuring out how to leverage the same concept to create a link without displaying everything.


How to create a menu item which is not a page

I have a few pages that contains technical tips. I would like to group these pages under the title "tips" in the menu bar, but I don't want to make the item "tips" clickable because it does not contain any data. How do I create a menu item which is not a page, whose sole purpose is to server as a menu parent?


how to run loop in function.php that sends email based on specific conditions?

So far this code works if I run it as a page in WordPress. I am trying to send my user email updates when I publish a post with with a specific tag. The users can choose if they want to receive the updates in their settings page.   1. Every time a post is published it checks if the post has the specific tag. Only one tag will be added to the post.   2. then is checks if the tag match the users settings (first user setting)   3. then is check if the users have updates turned on. (Second user setting)   4. if everything is good it should send the email.  But it does not send the email if the code is in the function file. I do not get an error, so I'm kinda stuck.               // check is new post is published      add_action( 'transition_post_status', 'a_new_post', 10, 3 );     function a_new_post( $new_status, $old_status, $post ) {       if ( 'publish' !== $new_status or 'publish' === $old_status ) {       return;       global $post;  global $wp_query;      // get all the users meta       $blogusers = get_users();              // get users facility updates setting from settings page      $arg = array(       'posts_per_page' => '1'      );       // start the loop the get only the last post      $wp_query = new WP_Query($arg);       query_posts( 'posts_per_page=1 ');        if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();       // get the post tags     $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) {            foreach ($blogusers as $user) {        // get the users settings and check if they match       $savedsetting = $user->facilityupdates;        $current_facility = $user->current_facility;            if($savedsetting === 'ON' && $tag->name == $current_facility )  {      // get the users emails         $users_emails = $user->user_email . ',';                       // send email            $to = $users_emails;                   $subject = "New update from PrisonPulse";                   $message = "a caller who phone number is was sent to  wanting to go to  (second request) ";                    $from = "example@gmail.com";                     $headers = "From:" . $from;                     mail($to,$subject,$message,$headers);             }}} }         endwhile; endif; // end the loop       }}


How to insert PHP code in a WordPress Post

I need to insert into post a simple form handler, but WordPress' engine deleted my code after saving. how can I fix it?


How to set up an entity (post-type?) with many dependent entities (more post-types?)

I want the wordpress CMS to manage a new type of content called Athletes. The data structure for Athlete would be as follows:               Athlete.name     Athlete.date_of_birth     Athlete.profile     etc...      An athlete will also have a photo gallery. So in a typical relational database design, you will have something like               Athlete_Gallery.id     Athlete_Gallery.athlete_id     Athlete_Gallery.file_name      An athlete will have also participated in many tournaments. So in a typical relational database design, you will have something like:               Athlete_Tournament.id     Athlete_Tournament.athlete_id     Athlete_Tournament.tournament_name     Athlete_Tournament.win_or_loss     Athlete_Tournament.score     Athlete_Tournament.weight_class     etc...      An athlete will also have list coaches he has trained under, following a db schema similar to Athlete_Tournament. What is the best way to set up a CMS that will manage such a data structure? Which plugins will I need? **ADDITIONAL NOTES** I looked at Pods but the steps for creating dependent records is not optimal. If I want to record the fact that John won the 2001 City Tournament, I currently need to:   * go to a tournament page   * create 2001 City Tournament   * go to John page   * relate John to the 2001 City Tournament record   * save This is not ideal. Instead, I want to:   * go to John page and see a section called tournaments   * add the 2001 City Tournament   * save Pods doesn't seem to do this out of hte box....please correct if i'm wrong. Thanks


How to add images to a post without inserting them into the content area of the post editor?

I'm building a site where I need to be able to add multiple images to a post, but not have them in the regular content of the post. These images will be used in a gallery above the post. My client might want to add images to the post itself too, so I can't just set img to display:none in the content div and use a loop to get the image attachments for the post to use. The wp-e-commerce plugin has an area below it's custom product post type where you can only add images, which is exactly what I'm looking for, but I can't seem to find something similar. Does anyone know of a plugin, or code snipet to add this type of functionality to a template?


If custom category search then page 2 not found

I'm using a custom post type named fotograf. If it shows all photos in archive page, no problem. It finds photos in every page. But if I'm search a custom category in fotograf custom post type, then nothing found if paged>=2. Just finds the page 1. You can test it in my web site. http://www.onurunwebsitesi.com Click to Tümünü Göster (Show All), and click Diğer (Other) category and click pagination links at bottom. 2nd page and others not found. My code: archive-fotograf.php               <?php /** * Displays the Pagination in Custom loop * */?>     <?php get_header(); ?>     <?php      $temp = $wp_query; //save old query     $wp_query= null; //clear $wp_query     $aranan= $_GET['s'];      $kategorim = intval($_GET['cat']);     $myterm = get_term( $kategorim, 'fgaleri' );      $myslug = $myterm->slug; ?>
     <?php      $rakam= 0;     //The query     $wp_query = new WP_Query();          // HERE IS MY WP_QUERY. WHERE IS MY FAULT? IF CUSTOM CATEGORY SEARCH, THEN PAGE 2 NOT FOUND. PLEASE, HELP ME. THANKS IN ADVANCE.           $wp_query->query( array( 'post_type' =>'fotograf', 's' => $aranan, 'paged' => $paged, 'taxonomy' => 'fgaleri', 'fgaleri' => $myslug ) );     //The loop     ?>

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

<?php while ($wp_query->have_posts()): $wp_query->the_post(); $rakam++; ?>     <div class="FGaleriItem2" style="<?php if ($rakam % 5 == 0 ) { ?>margin-right: 0px;<?php } ?>">     <?php     $termargs=array('orderby' => 'count', 'order' => 'desc');     $terms = wp_get_post_terms( $post->ID , 'fgaleri', $termargs );     $t = count($terms);     if ($t>0) { ?>
     <?php      $c = 0;     foreach($terms as $term) {     $c++;     if ($c==$t)      {      echo 'term_id . '&post_type=fotograf&fgaleri=' . $term->slug . '" title="' . $term->name . '" ' . '>' . $term->name.' ';     }     } ?>
     <?php } ?>
     <?php if (has_post_thumbnail()) { ?>     <a href="<?php the_permalink() ?>">     <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );     $url2 = get_bloginfo('template_directory') . "/timthumb.php?src=" . $url . "&w=100&h=100&zc=1"; ?>     <img src="<?php if(get_option('of_timthumb')=="true") { echo $url2; } else { echo $url; } ?>" alt="" title="" width="100" height="100" />          <?php } ?>

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

     <?php endwhile; ?>

     <?php if(function_exists('wp_pagenavi') ) {          wp_pagenavi(); //function call for plugin pagination( wp pagenavi plugin)     }else{ ?>
          <?php next_posts_link('« Daha Eski Fotoğraflar'); ?>     <?php previous_posts_link('Daha Yeni Fotoğraflar »'); ?    >
<?php } //endif     ?><?php     $wp_query = null; //Reset the normal query     $wp_query = $temp; //Restore the query     ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>


Do WordPress Permalinks Refer to a Lookup Table in the Database?

I'm trying to figure out how to rewrite URLs while dropping the original parameter (whether it's a number or text); basically exactly what WP does with it's clean permalinks Does a database lookup table exist that matches the post ID# to the permalink string as set in the post editor?


Cron firing my function everytime wp-admin is visited

This is a MU-plugin I'm developing, and I want it to run hourly. Unfortunately, it's running every time I visit any site's wp-admin page. I've used the Debug Bar plugin with the Cron plugin, and it consistently says that the next event is in the past. Any ideas?               add_action('admin_menu', 'dhg_cron_menu');     function dhg_cron_menu()     {         add_options_page('NEW WPMS Stats', 'NEW WPMS Stats', 'manage-options', 'dhg-cron', 'dhg_cron_settings');     }          function dhg_cron_settings()     {         if(!wp_next_scheduled('dhg_cron_hook'))         {             wp_schedule_event(time(), 'hourly', 'dhg_cron_hook');         }     }          add_action('dhg_cron_hook', 'dhg_cron_get_stats');     function dhg_cron_get_stats()     {         //  this is a custom function I use to log to a file for testing...         log_wpms_stats("testing!");     }


Show only post titles in archives?

I'm using the Twenty Fourteen theme and think it's stupid to show full posts in the Archives section. I want just the titles to be displayed for easier navigation. Even removing the dates would be nice. (I've already done so for individual posts but the Archives section still says May 2014.) This is minor though. The main thing I'd like to know is how to only display the title. I've looked at the archive.php file (included below) but don't know php and have no idea what to do. The advice I've found through googling is outdated and the code samples don't match mine. Please o' gracious lords of the internet, tell me what needs to be changed so my site can suck a little less.               get_header(); ?>

                      <?php if ( have_posts() ) : ?>
                         <?php                             if ( is_day() ) :                                 printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() );                                  elseif ( is_month() ) :                                 printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyfourteen' ) ) );                                  elseif ( is_year() ) :                                 printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfourteen' ) ) );                                  else :                                 _e( 'Archives', 'twentyfourteen' );                                  endif;                         ?>
                                       <?php                         // Start the Loop.                         while ( have_posts() ) : the_post();                                  /*                              * Include the post format-specific template for the content. If you want to                              * use this in a child theme, then include a file called called content-___.php                              * (where ___ is the post format) and that will be used instead.                              */                             get_template_part( 'content', get_post_format() );                              endwhile;                         // Previous/next page navigation.                         twentyfourteen_paging_nav();                          else :                         // If no content, include the "No posts found" template.                         get_template_part( 'content', 'none' );                          endif;                 ?>

          <?php     get_sidebar( 'content' );     get_sidebar();     get_footer();


How to create thumbnails for PDF uploads?

I'm developing a website that needs to allow users, within Gravity Forms, to submit a PDF file and have a JPG thumbnail created of the first page of the PDF that is then displayed in the created post. My plan was to have a function that would allow for this, and add the JPG link to a custom field, so it can then be displayed on the post page. Unfortunately, while I understand the concept, and have a script I used to use to convert PDFs to JPG format in a non-Wordpress site, I'm not sure how to implement this in Wordpress, or if it's better to create this as a plugin instead of a function. Can someone provide some direction either where I can start with this concept? **CODE:** For reference, here is the specific part of the code I had from the previous scripting, but it's about 6 years old:               function make_thumbs($uploadedFpId,$issueFileprefix) {         $issuePathprefix = $_SERVER['DOCUMENT_ROOT'].'/fp/'.$issueFileprefix;         exec('convert -colorspace RGB -density 100x100 '.$issuePathprefix.'.pdf[0] -quality 90 '.$issuePathprefix.'.jpg');         exec('convert '.$issuePathprefix.'.jpg  -resize 100x146 '.$issuePathprefix.'_sm.jpg'); // make thumbnail         exec('convert '.$issuePathprefix.'.jpg  -resize 500x1000 '.$issuePathprefix.'.jpg'); // make correct size of preview     }      **UPDATE:** I found the following code (right here) , which seems to point further into the right direction. The catch is that I still don't see how to handle this right after upload, and also pull in the uploaded file path, and then I still need to save it to the post custom field:               $img = wp_get_image_editor( ‘my/temp/uploads/path/mypdf.pdf’ );     $img->resize( 50, 50, true );     $filename = $img->generate_filename( ‘thumb’, ‘wp/wp-content/uploads/thumbs/’, ‘jpg’ );     $img->save($filename, ‘image/jpeg’);


Is there a better, more efficient way to get the post id outside the loop?

Right now I am using:               $wp_query->post->ID;      I want to know if there is a better way for getting the post id that consumes less resources?


Wordpress pages not working out correctly with HTML

Hey all i am having some problems with finding out where wordpress saves my pages. I have a default theme selected and have added a few pages. However, the links to them seem to show up all the same (page.com/about, page.com/contact, etc etc). They all have the same content no matter what page i view (even though each page i set up has been published (saved) with different HTML in the box). Where can i go to find out where its saving my HTML for each of these pages? I don't see a about.php, contact.php, etc in the theme directory so where is it getting that information (and better yet, where is it storing my HTML i add and publish for each of those pages?) Thanks for your time! David


Editing the nav menu?

I want to add | (vertical lines) between the page links in the nav menu. What's the easiest way to do this?


Can not call .php files after switching to %postname%

This               $('#content').load("submenu.php");      works just fine with default permalinks When I switch to %postname% it does not work any more But, I can still go though to mysite.com/submenu.php and it loads just fine Did I miss something here?


Latest comment post should be the first post in the blog

If someone put a comment to post, that post should be the first post of blog. ( Forums works like this). I don't want to use forum plugin also. I need only, when a user submit a comment, that post goes to up as the first post of my blog. Is it possible?


Reinstalling WordPress

I have WordPress installed on my server. now I was using it almost as a testing install but i put up many posts on it. I added and removed many plugins and themes and tweaked with all the settings. So now I want to do a fresh install of WordPress. I want a new database and the core. Also I want to install all the plugins and the theme again. I want to keep my existing posts, with the images. There are just 30 of them, with no comments, and comments are handled by DISQUS. Also, the export file from WordPress, gives me an xml file, but i will put it on the same domain, so i think I wouldn't be able to get those images. It's ok if the downtime is long, no problem... but I want a fresh install... So can anyone guide me on how to do this without any errors... Thanks and just for info, my hosting is on GoDaddy...


Sliders with buttons

I'm looking for a slider plugin that allow me to insert additional buttons in a slider, not the next and prev neither numbers, I mean buttons to redirect users to a different page, etc... I would appreciate your info! Regards


Reducing image size in RSS only

Is it possible to reduce the image size of WordPress rss feeds parse to feedburner? Meaning to say I still want to retain the large image size on the original post page but only display the thumbnail or medium sized image when subscribers are reading it via feedburner.


Tagging users in Wordpress

I have a community blog at thelazy.info . I want to tag users based on their colleges and assign a role known as "College Owner" which will have permissions to edit users belonging to his colleges. How can I go about it?


WP insert post PHP function dynamically generated Custom Fields

Further to my previous question WP insert post PHP function and Custom Fields We have a working insert post function that can also send over custom fields without yet knowing the ID. Please see the previous question for the answer. What we are trying to do now is have some of those custom fields dynamically load in. A session at the top of the page has loaded in all information from a post type called services. This is the code that then picks it up and inserts it into a new post.                   <?php      $my_post = array(         'post_title' => $_SESSION['booking-form-title'],         'post_date' => $_SESSION['cal_startdate'],         'post_content' => 'This is my post.',         'post_status' => 'publish',         'post_type' => 'booking',     );     $the_post_id = wp_insert_post( $my_post );               __update_post_meta( $the_post_id, 'duration', $_SESSION['booking-form-actual-duration'] );     __update_post_meta( $the_post_id, 'picture', $_SESSION['booking-form-picture'] );     __update_post_meta( $the_post_id, 'totalprice', $_SESSION['booking-form-total-price'] );     __update_post_meta( $the_post_id, 'activityduration', $_SESSION['booking-form-total-duration'] );     __update_post_meta( $the_post_id, 'totaldives', $_SESSION['booking-form-total-dives'] );          query_posts('post_type=services'); while (have_posts()) : the_post();     __update_post_meta( $the_post_id, 'producttitle'.get_the_ID(), $_SESSION['products-form-title'.get_the_ID()]);      __update_post_meta( $the_post_id, 'productprice'.get_the_ID(), $_SESSION['products-form-price'.get_the_ID()]);      __update_post_meta( $the_post_id, 'productduration'.get_the_ID(), $_SESSION['products-form-duration'.get_the_ID()]);     __update_post_meta( $the_post_id, 'productdives'.get_the_ID(), $_SESSION['products-form-dives'.get_the_ID()]);       __update_post_meta( $the_post_id, 'productquantity'.get_the_ID(), $_SESSION['products-form-quantity'.get_the_ID()]);            endwhile; ?>      Notice the query posts and use of get_the_ID() to differentiate. The same thing occurred with the session at the top of the page to load in the data. The code that then receives it is as follows. Notice that the reason for the IF statement is to only display the data of items that had quantity. Other php codes on the page retrieve the other custom posts.               <?php query_posts('post_type=services'); while (have_posts()) : the_post();              $SPtitle = get_post_meta($post->ID, 'producttitle'.get_the_ID(), true);             $SPprice = get_post_meta($post->ID, 'productprice'.get_the_ID(), true);              $SPduration = get_post_meta($post->ID, 'productduration'.get_the_ID(), true);             $SPdives = get_post_meta($post->ID, 'productdives'.get_the_ID(), true);             $SPquantity = get_post_meta($post->ID, 'productquantity'.get_the_ID(), true);             if ( $SPquantity ) {              echo '

',the_post_thumbnail(array(50, 50, true)),'

',$SPquantity,' ', $SPtitle,'

',the_excerpt(),'<input name="product_price_PRI_',get_the_ID(),'" id="product_price_PRI_',get_the_ID(),'" type="hidden" value="',$SPprice,'">     <input name="product_price_total_PRI_',get_the_ID(),'" id="product_price_total_PRI_',get_the_ID(),'" type="hidden" value="">     <input name="product_duration_PRI_',get_the_ID(),'" id="product_duration_PRI_',get_the_ID(),'" type="hidden" value="',$SPduration,'">     <input name="product_duration_total_PRI_',get_the_ID(),'" id="product_duration_total_PRI_',get_the_ID(),'" type="hidden" value="">     <input name="product_dives_PRI_',get_the_ID(),'" id="product_dives_PRI_',get_the_ID(),'" type="hidden" value="',$SPdives,'">     <input name="product_dives_total_PRI_',get_the_ID(),'" id="product_dives_total_PRI_',get_the_ID(),'" type="hidden" value="">          <input name="product_quantity_PRI_',get_the_ID(),'" id="product_quantity_PRI_',get_the_ID(),'" type="hidden" title="" value="',$SPquantity,'"/>

';     }     else {     echo '';     };?>                     <?php endwhile; ?>      Right so I hope that explains what I am trying to do. And may I point out that it is all functional with the exception of the query area services. Hence why I have provided you with that segment of code. Does anybody know why that bit isn't working. Marvellous, Thanks.


Getting Wordpress image gallery to output image title as well as caption

I'm looking to do a small tweak to the way Wordpress shows gallery images. I use a 1 column gallery with full width images and would like to output the title as a header and the caption as the main caption copy. I'm putting in the following code:               if ($attachment->post_title)     {     $output .= "<h2>{$attachment->post_title}</h2>";     }      before this line in media.php:               if ( $captiontag && trim($attachment->post_excerpt) ) {             $output .= "                 <{$captiontag} class='wp-caption-text gallery-caption'>                 " . wptexturize($attachment->post_excerpt) . "                 </{$captiontag}>";         }      So I'm simply trying to put the image title in h2 tags if one has been filled out and print it out in the document before the caption tag. Would anyone be able to point me in the right direction on how to do this? Thanks!


Test if key is in user_meta array

I want to associate certain users by means of a custom key stored in the user_meta for both users. There may be more than one-one relationships, so it'll be in an array. If 2 users have the same key in this _mm_group_membership array, they're part of the group. Now since meta_value queries are restricted to simple comparisons (=, <, >, etc.) here's what I'm proposing, searching for users related to $user_id on the basis of group membership $key:               function linked_users_array ($user_id, $key) {         $group = '_mm_group_membership';         $users = get_users('meta_key='.$group.'&fields=all_with_meta');         $linked_user_ids = array();         foreach ($users as $u) {             if (in_array($key, $u->$group)) {                 $linked_user_ids[] = $u->ID;             }         }         return $linked_user_ids;     }          2 questions on this: 1) Is $u->$group possible? Or do I need to use something along the lines of `var_dump( $u->get( $group ) );`? 2) I want to minimise hitting the database, so I don't really want an extra get_user_meta() call on each user in the loop. Is this possible? Thanks in advance.


wp_list_pages change <ul> of children and anchor of parent

I am getting the list of Pages and Subpages by `wp_list_pages()`. I want to change the parent `<a>` and `<ul>` child. I found a solution here in this WPSE thread. But It only changes the `<ul>`. How can I add classes/attributes to the both (`<a>` and `<ul>`) at once.


Different wp_mail_from and wp_mail_from_name for specific situations

I'm wondering how to create differents `wp_mail_from` and `wp_mail_from_name` for specific actions that use the built-in mail system in Wordpress. For example, when a new comment comes, notify the user using this:               function comments_new_mail_from($old) {return 'comments@example.com';}     function comments_new_mail_from_name($old) {return 'Comments at Example.com';}     add_filter('wp_mail_from', 'comments_new_mail_from');     add_filter('wp_mail_from_name', 'comments_new_mail_from_name');      But when a new user registers, use:               function users_new_mail_from($old) {return 'users@example.com';}     function users_new_mail_from_name($old) {return 'Users at Example.com';}     add_filter('wp_mail_from', 'users_new_mail_from');     add_filter('wp_mail_from_name', 'users_new_mail_from_name');      I want to do this to figure out the way to do this properly and avoid any problems with plugins using the built-in mail system that Wordpress have.


Http error when upload some images

I'm using Wordpress 3.5.1 on Debian Wheezy with PHP 5.4.4. I have increased memory in php.ini to 512M. It is a new Wordpress with no plugins. When i try to upload images, some images won't upload : image.jpg 960x540 44.0KB => upload OK image2.jpg 700x400 152KB => HTTP error


get data with shortcode

i have a wp db. and i added a table "wp_mapmus" now i want to show these datas on post page with shortcode. But there is an error. and i dont know php very well. i only use same plugins. what is the correct code ? my code:               function veri_cek($atts, $content = null) { extract( shortcode_atts( array( 'id' => '0', ), $atts ) );              global $wpdb;         $table = $wpdb->prefix . 'mapmus';         $sql = 'SELECT point FROM '.$table.' WHERE id = '.$id.'';         $results = $wpdb->get_results($sql);         foreach ( $results as $result )     {         return ' Point: '.$result.' ';     }     }     add_shortcode( 'veri', 'veri_cek' );


Disable comments for a user?

Is there a way I could ban a registered user from posting comments, thus converting them to a read-only mode temporarily? Ideally I'd like this to be a set-it-and-forget-it solution (ban user for 2 days, then they are unbanned automatically 2 days later). I have comments open to registered users only, sitewide. I have searched thoroughly for a plugin to help me achieve this, but failed to find anything.


Removing the "on/off" white rectangle from my homepage (WPtouch)

I use the WPtouch plugin (here: r-bloggers.com), and some of my visitors are getting a white rectangle on the homepage, with a "on/off" option for the theme. The problem is that it only appears to some of the users, and clears after a little bit. I read online it might be a conflict with another plugin, or a theme, but I don't wish to change any of these (they are all important for the function of the site), instead, I'd like to remove this box completely - is that possible? Any other suggestions? (I have the plugin on "restricted mode" already - that doesn't help)


Page not found when trying to link to files in child theme directory

I'm trying to create a child theme based on Toolbox 1.4 by Automattic. I have my scripts file saved as `child_theme/js/scripts.js` on my server and I enqueue it by using               wp_enqueue_script( 'scripts', get_stylesheet_directory_uri() . '/js/scripts.js', array('jquery') );      in the `header.php`. When I view source in Firefox, I see the href to the stylesheet as               http://example.com/wordpress/wp-content/themes/child_theme/style.css      and the href to the scripts as               http://example.com/wordpress/wp-content/themes/child_theme/js/scripts.js?ver=3.3.2      When I click on both, I can see the source of my `style.css`, but it says "Page not found" for my `scripts.js`. I've never created a child theme before. I used to just copy a theme and modify it. What am I doing wrong? **EDIT** It works when I move `scripts.js` out of the `/js/` subdirectory into the child theme's root directory and change the `wp_enequeue_script`. So what is wrong?


How to show a dynamic_sidebar if main content content's height is > a set amount?

I'm looking to add a second dynamic_sidebar to a theme's sidebar.php that will only be displayed if the height of my main content area is greater than a certain amount. If I had some magic hybrid of jQuery and php, and I wanted this to happen if the main content area (#content) was taller than 700px I'd do something like:                if ( jQuery('#header-wrap').height() > 700 ) {          dynamic_sidebar( 'sidebar-extra' );      }      Is this possible using real phg? I know I could use jQuery hide() inside that conditional, but I'd rather not load the sidebar and mess with my layout if I didn't have to.


How change the header color?

I want to change the balck color in the header and also the font color in the same place? **Update:** I am using the Twenty Ten 1.3 theme ![enter image description here](http://i.stack.imgur.com/FpRuJ.png)


How can I let users to access plugin functions based on roles?

I use a plugin called "Live Edit" to let authors and editors edit the content front-end. But the issue is that the plugin lets any logged in users to edit the content. I want the edit(specified by plugin. Not the WP's default edit button) button be accessed based on their roles. I don't know how to make it accessible based on roles. So trying to make it appear only for the authors and higher roles to that. I want to do something like this in loop.php:               <?php     global $current_user;      get_currentuserinfo();      if ( user_can( $current_user, "author" ) ){      // Show Role     // Show Subscriber Image     }       Here is the code:                <?php post_class( 'post clearfix ' . $themify->get_categories_as_classes(get_the_ID()) . ' ' . $themify->get_post_color_class(get_the_ID()) ); if(function_exists("live_edit")){ live_edit('post_title, field1'); } ?>      and               <div <?php if(function_exists("live_edit")){ live_edit('post_content, myfield2'); }?>>             <?php if( function_exists('the_field') ) the_field('myfield1'); ?> </div>             <?php if( function_exists('the_field') ) the_field('myfield2');  ?>     </div>      I am unsure how to do it in the template or through functions.php. Could any one help me or guide through that to achieve what I want? Here is the loop.php at pastebin - http://pastebin.com/9MVY64LJ The live edit class is used in line 8 and line 57. ![enter image description here](http://i.stack.imgur.com/0J44x.png)


List Categories of the Parent Category of the Current Category

So, let's say I have this structure of categories   * I. Super Cat A      * i. mini cat a     * ii. mini cat b     * iii. mini cat c   * I. Super Cat B      * i. mini cat a     * ii. mini cat b     * iii. mini cat c This code:               <?php if (get_categories('child_of='.$cat.'&hide_empty=0')) { ?>

                         <?php wp_list_categories('show_count=0&child_of='.$cat.'&hide_empty=0&title_li='); ?>

     <?php   } ?>      enables if I am in **Super Cat A** it would list all mini cat a-c, what I want to add, is if I go to **mini cat a** or **mini cat b** or **mini cat c** , it would list other subcategories of its parent category, say: current location: **mini cat b** will list: **mini cat a** & **mini cat c** Anyone? Thanks in advance and more power.


Is template name always same as directory name?

When creating child theme, I must write like this.               /*     Theme Name: 2012 Child     Template: twentytwelve     */      Is that `Template` name is always same as directory name? Or is it defined somewhere else?


Custom PHP script within WordPress sub-directory

I've a page with a section called `/catalog/` within WordPress. I have a custom php script and I want this script to be accessible via `/catalog/script.php`. Is there any trick that will allow me to do this? Creating `/catalog/` directory will break WordPress.


Ajax page load without reload

I am working on a script to load my page without refreshing. It is working as I want it except for one thing. The test site I have up is http://dev.dog- company.com . Only home About us and FAQ will work with the script right now. The issue is on the homepage there is a slider loaded via a plugin(click on home while on home). When I load it via AJAX my script does not load it the proper way it is supposed to. I am not sure why. Could someone explain why it is not working?               $('document').ready(function() {     $('a[rel="load"]').click(function(e){         e.preventDefault();         var link = $(this).attr("href");         if(link!=window.location){                     window.history.pushState({path:link},'',link);         }         $('#slider-wrapper').slideUp().empty();         $('#content').wrap('

');         $.ajax({         //ajax setting             type: 'POST',             url: link,             dataType: 'html',             success : function(data, text, xhr){                 //parse data                 var response = $("
").html(data);                      var parser = new DOMParser();                 var preParse = data.match(/]*>[\s\S]*<\/head>/gi);                 var headHTML = parser.parseFromString(preParse, "text/html");                 var head = $(headHTML).find('head').html();                 var slider = response.find('#slider-wrapper').html();                 var content = response.find('#content').html();                 var footer = response.find('#wp-footer').html();                      //Post data                 $('#content').empty().append(content);                 $('head').empty().append(head);                 if(slider != null){                     if($("#slider-wrapper").length == 0){                         $('#content').insertBefore('

');                     }                     $("#slider-wrapper").empty().append(slider);                 }                 $("#content").empty().append(content);                 return false;             }})             if($('#slider-wrapper').length > 0){                 $('#slider-wrapper').slideDown();             }         });     });      Any help would be appreciated,


Can I edit the database to change a login?

I have WP installed on a server with a couple of other things. Naturally, phpMyAdmin is installed so I can edit my databases easily. Anyway, is it possible to, using phpMyAdmin to edit a row and change the username? AFAIK everything is based off an ID, so why does this matter that you can't change it? Will it bork anything if I change it?


how to put the logo in the center of other items in the navigation bar

I'm developing a website in wordpress and I have to create a navigation bar in which the logo of the website has to be put between items like this:               item1 item2 LOGO item3 item4      I'm thinking to use the `Walker` class but I don't know where to start. Do you have other/better suggestions? Thanks!


How to customize login process

I want to create a new way to Login. What I got to do now:   1. Edit the user form, adding a new field that is saved in user_meta   2. Edit the Login form, adding a new input;   3. Build a (safe) query that selects the user_id in usermeta table; What I still need:   1. Catch the post to login, run my query (3) and accept this as a valid user.  I could do this if I could overwrite the `wp_signon` function, but this is not possible. Any other alternative?


How to do an URL rewrite

I'm trying to rewrite my URL structure. I want to delete the parents in my URL. So for example www.test.com/parent1/child should become www.test.com / child and www.test.com/parent1/parent2/ should be rewritten to www.test.com / child. My idea was to do this by alter the .htaccess file. But I haven't work with URL rewrite yet so I'm a little bit lost. Hope someone can explain me how to do it. Thanks


Template from scratch: Sidebars not showing widget

I have an issue wherein i have a plugin (newsletter) which has a widget whereby users can (usually) subscribe to a newsletter and other functionality. But i digress. I have been trying to create my own wordpress template solely for personal- use. The following is the code I've accumulated in progression to having a functional sidebar, but so far, un-successful. Any help is much appreciated. Thanks **index.php**
           <?php if (have_posts()) : while (have_posts()) : the_post(); ?>           <?php the_content(); ?>           <?php endwhile; endif; ?>
            <?php get_sidebar(); ?>      **functions.php**               <?php /**  * Register our sidebars and widgetized areas.  *  */      function arphabet_widgets_init() {              register_sidebar( array(        'name' => 'Home right sidebar',         'id' =>      'home_right_1',              'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ) );         }         add_action( 'widgets_init', 'arphabet_widgets_init' );         ?>      **Sidebar.php (taken from twentyfourtine theme )**               <?php     /**      * The Sidebar containing the main widget area      *      * @package WordPress      * @subpackage Twenty_Fourteen      * @since Twenty Fourteen 1.0      */     ?>
         <?php             $description = get_bloginfo( 'description', 'display' );             if ( ! empty ( $description ) ) :         ?>
<?php echo esc_html( $description ); ?>
         <?php endif; ?>              <?php if ( has_nav_menu( 'secondary' ) ) : ?>                      <?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?>                  <?php endif; ?>              <?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
             <?php dynamic_sidebar( 'sidebar-1' ); ?>
         <?php endif; ?>


wp_list_categories Display Output in dynamics Columns

I use wp_list_categories on my site but they show list of categories in one column. I found chow to create 2 or 3 columns in 2/3 columns but i woundering it is possible to creat colums dynamic sorted by "li" record. For example: I have 24 categories and I wana create wp_list_categories displayed by 6 "li" in each column (then script creat 4 columns with 6 rows each) and when I add 25 categories then script create 5 columns where first 4 have 6 rows and the last have 1 row etc. Thx for help :)


Using standard backend elements in Plugin

I'm currently writing a plugin for a company. I created a custom backend page where the admin can change settings used by the plugin. Currently it looks very messy because there is just too much information on one single site. To clean it a little bit up, I'd like to separate it in sections. It would be ideal if I could just use the same elements that WordPress uses, for example : ![enter image description here](http://i.stack.imgur.com/M27zm.jpg) It would be great if the whole collapsing / extending functionality would come automatically with it too. Unfortunately I found no resources how to do that. Is it possible to integrate these elements? How to do that?


Absolute paths in backend for plugins after moving wordpress

I wanted to move my wordpress from `www.domain.com/old-name` to `www.domain.com/new-name`. I thought that this is no problem and I missed backing up... Now if your are logged in into the dashboard the plugins are not working as expected. The problem is that the css and js files have an **old absolute path** in it. Example:               http://domain.com/new-name/wp-content/plugins/var/www/web/mag/old-name/wp-content/plugins/tinymce-advanced/css/tadv-styles.css?ver=3.4.2      Why does Wordpress takes here an absolute path and where is it stored? There is no entry in the database... **EDIT:** Perhaps it is because I created a symlink with the old-name. I created the symlink to get the page running ... If I remove it I get the following error:               Warning: require_once(/var/www/web/mag/old-name/wp-includes/pomo/translations.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/web/mag/old-name/wp-includes/pomo/mo.php on line 10          Fatal error: require_once() [function.require]: Failed opening required '/var/www/web/mag/old-name/wp-includes/pomo/translations.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/web/mag/old-name/wp-includes/pomo/mo.php on line 10      Why does he takes the old name? Is it a server setting/caching?


Display custom post taxonomies

This should be fairly simple and Im not sure what I'm doing wrong. I am trying to display the tags associated with my custom post. I have registered it like so               // Initialize Taxonomy Labels         $labels = array(             'name' => _x( 'Tags', 'taxonomy general name' ),             'singular_name' => _x( 'Tag', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Types' ),             'all_items' => __( 'All Tags' ),             'parent_item' => __( 'Parent Tag' ),             'parent_item_colon' => __( 'Parent Tag:' ),             'edit_item' => __( 'Edit Tags' ),             'update_item' => __( 'Update Tag' ),             'add_new_item' => __( 'Add New Tag' ),             'new_item_name' => __( 'New Tag Name' ),         );              // Register Custom Taxonomy         register_taxonomy('tagevents',array('events'), array(             'hierarchical' => true, // define whether to use a system like tags or categories             'labels' => $labels,             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'tag-events' ),         ));      but I cannot display the tags associated with the single page. I have tried (among other things) `<?php the_tags('<span class="tags- button">Tags : ',' ','</span><br />'); ?>` which I use in my posts single page.


Allow authors to use their own Google Analytics code

Is it possible to allow multiple Google Analytics tracking code on one page? One for the website admin, and one for the author. The purpose is to maintain website's main tracking code while allowing authors to insert their on tracking code to get stats of their own posts. How can I do that?


Debug Performance Issues

I've had a WordPress blog I've hosted on Dream Host for several years now. Recently (the past year) my site is going down often. Via Dream Host I found that I'm using up my CPU limit and they are killing my process. This used to happen twice a day, but I was able to get it down to maybe once a week. I did that by swapping my caching plugin from W3 Total Cache to another and removed some plug-ins. I'm still sometime getting my issue. To be honest, I'm an ASP.NET developer, so I'm used to debugging tools in my IDE and CMS applications. How can I get to the bottom of what is causing the CPU issues? Are there any WordPress tools? Also, my site is configured for the URL pattern `http://hostname.com/{article slug here}` so you'll notice I don't sub-folder by year, month, or category. Could this be contributing to the problem?


Pagination with Custom Post Type not working on index.php: I get a 404

I've read many posts about the same problem but none seems to work for me. I have a query for a custom post into the index.php. When I go to page 2 I get a 404 error. The same code works like a charm in any static page.               <?php get_header(); ?>

Latest Works Added
                             <?php wp_reset_query();?>                              <?php                              // the query                             $args = array('post_type' => 'work', 'posts_per_page' => 2, 'paged' => $paged);                             $the_query = new WP_Query( $args );                              ?>                                  <?php if ( $the_query->have_posts() ) : ?>                                                                                <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                                 <article id="post-<?php the_ID(); ?>" class="fourcol home-article" role="article">                                     <a href="<?php echo the_permalink();?>">

Title

<?php the_title(); ?>

Author
	                                                     <?php                                                     require_once'wp-content/themes/p-dpa/rdfa/lib/arc2/ARC2.php';                                                     include_once('wp-content/themes/p-dpa/rdfa/connect_to_store.php');                                                          // All Artists                                                                           $query = '                                                         PREFIX dcterms: <http://purl.org/dc/terms/>                                                          PREFIX foaf: <http://xmlns.com/foaf/0.1/>                                                         SELECT distinct ?url ?name                                                          WHERE   {                                                             <'.get_permalink().'> dcterms:creator ?url .                                                             ?url foaf:name ?name                                                         }                                                     ';                                                     $result = $store->query($query, 'rows');                                                     if (!empty($result)) {                                                         echo '
';                                                         $names = array();                                                         foreach ($result as $row) {                                                             array_push($names, $row['name']);                                                         }                                                         echo implode(', ', $names);                                                     }                                                     echo '
	';                                                     ?>
                                                 <?php                                                 $first_image = catch_that_image();                                                 if ($first_image != '') { ?>
                                                                                <img src="<?php echo $first_image;?>" alt="<?php the_title(); ?>" />
                                                 <?php } ?>

                             <?php endwhile; ?>                                                   <?php else:  ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
                             <?php endif; ?>
                                                  <?php                         $big = 999999999; // need an unlikely integer                          echo paginate_links( array(                             'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),                             'current' => max( 1, get_query_var('paged') ),                             'prev_text'    => __('« Previous'),                             'next_text'    => __('Next »'),                             'total' => $the_query->max_num_pages                         ) );                         ?>

     <?php get_footer(); ?>


Confusion about how a URL is being parsed

I have a permalink that leads to some custom content like:               http://mysite.com/extra-deal/91103/      That will take you to a page that is handled by the file:               category-extra-deals.php      On that page I grab the last portion of the URL (91103 in the above example) and use that to do a custom database request for the info I need. I want to quit using the id number (91103) and start using the title. However changing that to:               http://mysite.com/extra-deal/title-of-that-entry/      Results in a 404 and the template `category-extra-deals.php` is never touched. I figured that the template would be hit, at least, even if that title can't be found but this is not the case. Another example... if I visit:               http://mysite.com/extra-deal/9/      I will get the `category-extra-deals.php` template but with no content because 9 doesn't exist. However using:               http://mysite.com/extra-deal/a/      I will get the 404 page. Why do I get the desired template when the URL has a number and a 404 when that same portion of the URL has text? * * * **Solution** I needed to add my own rewrite rules to accommodate the new url structure. So the following url:               http://mysite.com/extra-deal/the-title-of-the-posting      Would be handled by the following rule:               function add_rewrite_rules($aRules) {     $aNewRules = array('extra-deal/([^/]+)/?$' => 'index.php?pagename=extra-deal&extradeal_title=$matches[1]');     $aRules = $aNewRules + $aRules;     return $aRules;     }          add_filter('rewrite_rules_array', 'add_rewrite_rules');      One other thing, if you notice, the url expects a param named "extra deal_title". That needs to be added as well and it done with:               function add_query_vars($aVars) {     $aVars[] = "extradeal_title";     return $aVars;     }


Merge 2 args in one WP_Query and order it by date

I'm trying to merge 2 WP_Query in a new WP_Query and then order all posts in this new merged query by date descending. I can merge 2 WP_Query and work fine, but I can't order the new query                   $args1 = array(                  'posts_per_page' => '10',                  'post_status' => 'publish',                  'post_type' => array('news','partners'),                  'orderby' => 'date',                  'order' => 'DESC'                  );         $queried_post1 = new WP_Query($args1);              $args2 = array(                  'posts_per_page' => '10',                  'post_status' => 'publish',                  'post_type' => array('post'),                  'orderby' => 'date',                  'order' => 'DESC',                  'tax_query' => array(array(                                 'taxonomy' => 'tax',                                 'field' => 'id',                                 'terms' => '5'                                 ))                  );                  $queried_post2 = new WP_Query($args2);                       $merged_queried_post = new WP_Query();                  $merged_queried_post->posts = array_merge($queried_post1->posts,$queried_post2->posts);                  $merged_queried_post->post_count = $queried_post1->post_count + $queried_post2->post_count;      In this point, I need to order all posts in $merged_queried_post by date. Thanks for help


How to load parent_theme functions.php before child_theme?

I got the problem that i have to load my parent theme's `functions.php` file before my child theme's `functions.php` file loads. This is needed for the setup & init procedure. I looked at the hooks inside /wp_core_root/wp- settings.php (named: `do_action('setup_theme');`). The problem is that i don't know how to hook into there, because the first file i get is the child theme's `functions.php`, so no `add_action( 'setup_theme', 'my_init_function' );` will work. _Edit:_   a) I know that plugins load earlier than theme and therefore can access even the initial Query, but i don't want to rely on a Plugin.   b) Here's the code (shortened) from wp-settings.php file               // happens a lot earlier:       do_action( 'plugins_loaded' );          // localize stuff happening here         do_action( 'setup_theme' );                  // Load the functions for the active theme, for both parent and child theme if applicable.             if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )                 include( STYLESHEETPATH . '/functions.php' );             if ( file_exists( TEMPLATEPATH . '/functions.php' ) )                 include( TEMPLATEPATH . '/functions.php' );         // first available hook, *after* functions.php was loaded         do_action( 'after_setup_theme' );      I want to avoid two things: First a lot of explanation to users. Second the chance that someone breaks anything if the cuts the rope with accidently deleting the parents init procedure. People shall just play inside the functions.php without risking to break anything without knowing it. In other words: How do i keep my child themes functions.php file clean, but have the the parent themes bootstrap done? Any ideas? Thanks a lot!


Previous Posts Link and Next Posts Link Show All The Same Articles?

I just fixed the problem of my featured posts section displaying on every index page instead of just the first one. This, of course, created a brand new problem. The first page looks fine; my featured posts are all where they should be and the loop below doesn't include any repeat posts. But then I click on "older entries" at the bottom of the page and page two contains the first eight posts from the loop. Page three contains the same eight posts, as do pages four, five, six, and presumably all of them. Here's page two, where the problem starts. What do I need to add or take out in order to fix it? Thanks in advance. EDIT: I think I have an idea of where the problem is, but not how to fix it. Everything seems to work fine until I add in the query_posts to offset the main loop by 4, since those posts are displayed up in the feature area. It seems that when I go to page two and beyond, every page is starting from that offset of four instead of continuing on to display the next batch of posts. If I take out the query, it works fine, except for the fact that I have duplicate posts in the loop.


How to display admin error notice if settings saved succesfully?

Title sounds counter-intuitive but bear with me. :) I have options page, made with Settings API. When user enters invalid data I want to display error notice with `add_settings_error()` call. But! To determine that data is invalid I need to make an remote API call. That call relies on saved data. So I can't do this in sanitization callback (which is recommended place to throw such notices) because my data is not saved yet. Instead I had tried to hooking my check into `admin_notices`. It works fine most of the time except one (and most important) case - when settings are saved they are always followed by **native _Settings saved._ notice and my custom notices are completely ignored** for some reason. So how do I throw that error notice even if WP thinks everything is fine? **Edit** More focused question - why exactly _Settings saved._ trumps any other notices? PS I could try to make API call optionally take data as argument instead of reading it from saved option, but so far I think it will make arguments overly bulky.


Combine internal search with Google custom search?

I currently have a search box in my sites header, (on every page), which sends the search query to a page called 'Search', which uses a template called `searchpage`. The page/template uses Google custom search to display the results. Now this all works great, but I would like to use the built-in WordPress search to also return search results on the same page, above the Google results. Effectively using 1 search box to return 2 sets of results on the same page; 1 for WordPress and 1 for Google custom search. Is this possible and how would I go about doing it?


Custom Taxonomy-specific JavaScript

I'm looking to add some scripts and styles to particular taxonomy page. For example, I want to have a banner rotator only appear for posts that fall under the "issue" custom taxonomy. I've tried using the is_tax('issue') to control when the scripts and styles are enqueued but that doesn't seem to be working. Here's a sample of my functions.php file:               function init_customizations() {       if (is_tax('issue')) {         wp_register_script('rotator_scripts',get_bloginfo('template_directory').'/includes/issue-rotator.js', array(), '1.0.0' );         wp_enqueue_script('rotator_scripts');         wp_register_style('rotator_styles',get_bloginfo('template_directory').'/includes/issue-rotator.css', array(), '1.0.0', 'screen');         wp_enqueue_style('rotator_styles');       }     }     add_action( 'init', 'init_customizations', 0 );      This doesn't actually write anything to the header so I suspect I may be calling it incorrectly. **Update** Here is the final code with the correct answer applied to it:               function init_customizations() {       if (is_tax('issue')) {         wp_register_script('rotator_scripts',get_bloginfo('template_directory').'/includes/issue-rotator.js', array(), '1.0.0' );         wp_enqueue_script('rotator_scripts');         wp_register_style('rotator_styles',get_bloginfo('template_directory').'/includes/issue-rotator.css', array(), '1.0.0', 'screen');         wp_enqueue_style('rotator_styles');       }     }     add_action( 'wp_enqueue_scripts', 'init_customizations', 0 );


Turn a snippet of HTML and PHP into a shortcode

the code is
                         <a href="<?php echo get_post_meta($post->ID,"taobao_value",true);?>" hidefocus="true" target="_blank" class="btn-buy js-log " data-log="page=p-huihui-discount-detail&type=buy">                             ￥<?php echo get_post_meta($post->ID,"price_value",true);?>                             buy
      the has two Custom Fields is `taobao_value` `and price_value` now I want become a shortcode Please help me


Displaying wp post categories into my custom metabox

Is there a way to display custom select box containing list of WordPress posts categories in my metabox? (also my metabox in custom post) Here are the illustrations: > This are categories from built-in WordPress post type ![enter image description here](http://i.stack.imgur.com/PRW9e.jpg) > And this one is metabox from my cutom post type, how to display WordPress > categories into this dropdown list ? ![enter image description here](http://i.stack.imgur.com/Iq3Hi.jpg)


restricting custom rewrite to just one custom post type

I am using the following code to create a short permalink for one of my custom post types. I have another cpt that I wish to just use the default permalink structure, so what would be the best way to restrict this filtering to just cpt1? to be honest I thought one of the functions here would already handle this (add_permastruct?) but the same permalink rewrite is applied to other cpts. the documentation in the codex is a little thin on this… thanks Rhys               function cpt1_rewrite() {     global $wp_rewrite;     $queryarg = 'post_type=cpt1name&p=';     $wp_rewrite->add_rewrite_tag('%cpt1_id%', '([^/]+)', $queryarg);     $wp_rewrite->add_permastruct('cpt1name', '/cpt1/%cpt1_id%', false);}          function cpt1_permalink($post_link, $id = 0, $leavename) {     global $wp_rewrite;     $post = &get_post($id);     if ( is_wp_error( $post ) )         return $post;        $newlink = $wp_rewrite->get_extra_permastruct('cpt1name');     $newlink = str_replace("%cpt1_id%", $post->ID, $newlink);     $newlink = home_url(user_trailingslashit($newlink));     return $newlink;}          add_action('init', 'cpt1_rewrite');     add_filter('post_type_link', 'cpt1_permalink', 1, 3);


Customizing wordpress to match your site theme

I have been wondering about how I could customize a Wordpress theme to look like that of my site, which is basically made of simple html and css. Alternatively, do you think there is a customizable simpler blogging solution that can be used for the same purpose?


WP_LOCALIZE_SCRIPT doesn't work

I am creating AJAX loading and need to use WP_LOCALIZE_SCRIPT but cannot make it work. Here is my code. I place it in functions.php               wp_enqueue_script( 'page_data');     $gallery_js_data_array = array(                 'maxPages' => '$gallery_max_load = $gallery->max_num_pages;',                 'curPage' => '1'     );     wp_localize_script( 'script', 'glr_dt', $gallery_js_data_array);


How can I include the parent menu item label in page title?

I want to customize the header title of a page to include the menu label of the parent page. I have this code that does essentially the same thing - but using the parent page title instead. Any ideas?
<?php         // If child page , also include the parent title:         if ($post->post_parent) {             $parent_title = get_the_title($post->post_parent);             echo ''.$parent_title.' —
';         }         the_title(); ?>
      ![enter image description here](http://i.stack.imgur.com/bLGOO.png)


How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field

I have searched high and low for a solution and couldn't find anything; hopefully someone here more skilled than myself can lend a hand. I have two testimonial videos (from a video custom post type) displayed randomly every time the page loads. There are different clients that have testimonials and in some cases, there are multiple testimonials from the same client. I have the query working that randomly displays two videos from the custom post type (while filtering out a category completely). What I'm trying to avoid is loading two testimonial videos from the same client (looks odd to have two of the same thumbnails show) but I'm not sure how to do this. Here the working code that I have so far:                 <?php  $loop = new WP_Query(array(                 'post_type' => 'video',                 'posts_per_page' => 2,                 'orderby' => 'rand',                 'tax_query' => array(                     array(                     'taxonomy' => 'video_category',                     'field' => 'slug',                     'terms' => 'assess-core-certification',                     'operator' => 'NOT IN')                    )                   )                                 );                            ?>                                <?php if ( $loop ) : while ( $loop->have_posts() ) : $loop->the_post(); ?>

<?php the_content(); ?>

                         <?php echo get_post_meta( get_the_ID(), 'video_clientName', true ) ?>
                         <?php echo get_post_meta( get_the_ID(), 'video_clientCompany', true ) ?>

                         "<?php echo get_post_meta( get_the_ID(), 'video_shortQuote', true ) ?>"

                     <?php endwhile; else: ?>
Sorry, no testimonials found.
                        <?php  endif; wp_reset_postdata();?>


How put links in wordpress dynamic sidebar?

i would like put link after each widget in dynamic sidebar. I thinks is possible if i use static sidebar, but i don't found any tutorial for this. Thanks you