Getting soft 404 errors (200 status) when caching plugins are enabled

I have a blog running the latest stable version of WordPress on a dedicated virtual server with the following situation. (Replace _[caching plugin]_ with W3 Total Cache, Hyper Cache, or Quick Cache, as I've tried all three with the same results.)   1. [caching plugin] is disabled. I visit a known bad link on my site (http://example.com/xyzz/) and receive a 404 error page. I can verify in Chrome's Inspector and/or Firebug that the "404 Not Found" status is being properly served in the HTTP headers.   2. I turn [caching plugin] on and visit the same URL. On the initial visit I am served a cached page (verified by the debugging comments inserted by the plugin at the bottom of the HTML source) with the proper "404 Not Found" status in the HTTP header.    3. If I visit the page again (http://example.com/xyzz/), I'm served the same cached page from #2 above displaying the "404 - Page Not Found" error to the user, but with a "200 OK" status in the HTTP header.    4. If I turn [caching plugin] off and visit the page again, I am again being served an uncached page with the correct "404 Not Found" status in the HTTP header.  Any idea what might be going on here? This is seems to be causing some an issue where Google Bot is attempting to index some non-existent pages because its seeing the "200 OK" HTTP header instead of the proper 404.


How does uninstalling WordPress plugins work?

I'm trying to drop a database table when the user uninstalls the plugin. But what does uninstalling a WordPress plugin really mean? There's the deactivation hook and there's also the uninstall hook. And then there's the `uninstall.php` file. On the constructor of the plugin class I have the uninstall hook:               register_uninstall_hook(__FILE__, array($this, 'uninstall_housekeeping'));      Then the `uninstall_housekeeping` method has the following code:               public function uninstall_housekeeping(){          global $wpdb;     $tweets_table = $wpdb->prefix . 'zam_tweets';          require_once ABSPATH . 'wp-admin/includes/upgrade.php';     dbDelta("DROP TABLE $tweets_table");     }      According to the wordpress codex you need to have an `uninstall.php` file which contains the code that will execute when the plugin is uninstalled so I also put this code:               if (!defined('WP_UNINSTALL_PLUGIN'))     exit();     global $wpdb;     $tweets_table = $wpdb->prefix . 'zam_tweets';          require_once ABSPATH . 'wp-admin/includes/upgrade.php';     dbDelta("DROP TABLE $tweets_table");      But all I can see on the WordPress plugin page is the `activate` and `delete` links when the plugin is currently deactivated. And then the `deactivate` and `edit` link if its currently active. **Where's`uninstall`?** I already tried the delete link but it doesn't seem like its doing anything except to delete the whole plugin folder, the database table is still intact.


How Can I limit the visible part of the short-description on the Category page?

How Can I limit the visible part of the 'short description' in the Category Page? I found the code in theme/woocommerce/content-product.php, but whatever I try doesn't do a thing.               <?php             $len = strlen(strip_tags($post->post_excerpt));             if($len>get_option('shop_dec_len', '180')) {                 $len = "...";             } else {                 $len = "";             }         ?>         <?php if ($post->post_excerpt && $post->post_excerpt != "") echo '<div     itemprop="description" class="desc">' . mb_substr ( strip_tags($post->post_excerpt), 0, get_option('shop_dec_len', '180')) . $len . '</div>'; ?>


How to create multisite roles with predefined themes

I am using the multisite feature to allow users to have there own mini-blog within the main install. I have managed to get the register user/site page working, but I was wondering if there is a way to setup different roles for the user to choose from when signing up (Artist, Producer, Designer...for example) and assign each account type its own theme.


Wordpress sync with phpbb

How can i sync the wordpress database users with phpbb database users so i can log on each one with the same user at any time and if there`s no user created for the wordpress to log in with the phpbb one and vice versa?


wp query with dynamic taxonomies and terms?

I need wp_query with more than one taxonomies and terms which are dynamic. Multiple terms to one taxonomies each. Like If one taxonomy is **Color** it has terms **blue,green,red** Second taxonomy is **Size** and terms **7,8,9** this taxonomy is **Price** and its terms are **500$,600$** and so on. I need to filter results based on checkboxes like happens on any e-commerce websites.Let's say first I select **blue** color then products are those which belong to **blue** then if I select **green** then products are those which belong to both **blue** and **green** but now if I select **7** then product will be those which belong to **blue,green having size 7** . Hope you are getting what I need.I saw on codex for multiple taxonomy but it is having only 2 taxonomies which are static but in my case it is dynamic and can be more than 5. In codex it is the code..               $args = array(         'post_type' => 'post',         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'movie_genre',                 'field' => 'slug',                 'terms' => array( 'action', 'comedy' )             ),             array(                 'taxonomy' => 'actor',                 'field' => 'id',                 'terms' => array( 103, 115, 206 ),                 'operator' => 'NOT IN'             )         )     );     $query = new WP_Query( $args );$args = array(         'post_type' => 'post',         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'movie_genre',                 'field' => 'slug',                 'terms' => array( 'action', 'comedy' )             ),             array(                 'taxonomy' => 'actor',                 'field' => 'id',                 'terms' => array( 103, 115, 206 ),                 'operator' => 'NOT IN'             )         )     );     $query = new WP_Query( $args );      but what if i have more than 2 e.g 5(dynamic). Please give me any solution. I also write query intead of Wp-Query but not working it is adding result of blue,green with size 7 instead of filtering. Here is query.               $taxonomy_name = "'" . implode("','", $taxonomy_name_ar) . "'";     $term_name = "'" . implode("','", $term_name_ar) . "'";          $querystr = "         SELECT *          FROM $wpdb->posts         LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)         LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)         WHERE $wpdb->posts.post_type = 'product'          AND $wpdb->posts.post_status = 'publish'         AND $wpdb->term_taxonomy.taxonomy in (".$taxonomy_name.")         AND $wpdb->terms.slug in (".$term_name.")         ORDER BY $wpdb->posts.post_date DESC         LIMIT 10         ";     echo $querystr;     $pageposts = $wpdb->get_results($querystr, OBJECT);       **Note** $tanomy_name is having the number of taxonomies like color,size,price and terms having number of terms like 7,8,blue,green **UPDATE : AFTER ANSWER**               $tax_query = array( 'relation' => 'AND' );               foreach($taxonomy_array as $taxonomy_array_value){          $term_value_array = array();          foreach($term_array[$taxonomy_array_value] as $term_value){                  array_push($term_value_array,$term_value);         }          $term_name = "'" . implode("','", $term_value_array) . "'";                  $tax_query[] = array(             'taxonomy' => $taxonomy_array_value,             'field'    => 'slug',             'terms'    => array($term_name)              );               }         $args = array(         'post_type' => 'product',         'tax_query' => $tax_query         );


Moving database from WP 2.6 to 3.5 problem

I recently moved my database from a wp 2.6 blog to a wp 3.5 form using this posts advice. (Alex Miller's answer). Everything looked good on the home page; however, when I click on an individual article, I get an error message that says: > "The requested URL /index.php was not found on this server. Additionally, a > 404 Not Found error was encountered while trying to use an ErrorDocument to > handle the request." Because I was also switching to a new URL, I also added the following code to the wp-config.php file.               define('WP_HOME','http://example.com');     define('WP_SITEURL','http://example.com');      Any suggestions why I'm getting this error?


Checking if meta_value exists for any user

I'm using gravity forms for a sign-up form and I set up a hidden field that is automatically filled with a random string generated and passed to the form by               add_filter("gform_field_value_random_number", "generate_random_number");     function generate_random_number($value){        $value =     substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"     ,5)), 0, 7);      }      This is to use as a unique coupon code/user.This field also appears in their user profile. Up to here all is well. Where I'm having trouble is checking the database that no user already has that coupon code. At first, I wanted to use get_user_meta, but that only works for one user_id at a time. I need it to check ALL users. So the second thing I thought of was to do a wpdb query somewhat like this:               $wpdb->get_results(         "         SELECT meta_value         FROM $wpdb->usermeta         WHERE meta_key = 'Referral'             ")      My final function would basically be the following:   1. Generate random number and return the variable with it (ex: $value)   2. Do a while loop to check if $value already exists in the database   3. End loop when $value does not match anything in the database. I'm not sure how to make this happen. If anyone can give me a hand or point me in the right direction if this is wrong, it'd be much appreciated! :) edit: Sorry, here's the site: http://colorplan.ca


Reset postmeta entries every month

I have this currently running on my site, which counts how many times each 'post' has been viewed, adds one view to the count and then saves it in postmeta:               function getPostViews($postID){     $count_key = 'post_views_count';     $count = get_post_meta($postID, $count_key, true);     if($count==''){         delete_post_meta($postID, $count_key);         add_post_meta($postID, $count_key, '0');         return "0 View";     }     return $count.' Views';     }          function setPostViews($postID) {     $count_key = 'post_views_count';     $count = get_post_meta($postID, $count_key, true);     if($count==''){         $count = 0;         delete_post_meta($postID, $count_key);         add_post_meta($postID, $count_key, '0');     } else {         $count++;         update_post_meta($postID, $count_key, $count);     }     }      Everything works fine, postmeta saves, and I can echo it as and when I need to. My question is, how can I get this data to reset every month? E.g, the 1st of every month? I've Googled my arse off, and can't seem to find anything. I don't really want to use a plugin, as they tend to have more features than I really need Does anyone have any ideas? Thanks Mark


custom naming of search permalink /search/

I found this snippet online …               function search_url_rewrite_rule() {         if ( is_search() && !empty($_GET['s'])) {             wp_redirect(home_url("/search/") . urlencode(get_query_var('s')));             exit();         }        }          add_action('template_redirect', 'search_url_rewrite_rule');      This transforms my `?/s=term` into `/search/term` which is almost what I want. I'd like to use the german word "suche" instead of "search" inside my permalinks. I thought of changing `home_url("/search/")` to simply `home_url("/suche/")` but that doesn't work. How can I make that happen?


Show two different sized featured images on homepage

I would like to have **two different sized featured images** on my homepage. I currently have all featured images set to 280x200. I would like to have SOME posts on the home page display a larger 620x200 image and others the 280x200. I'm not sure how to accomplish this. I realize I can specify a custom image size in my functions file like `add_image_size( 'large-image', 620, 200, true );`. However, I'm not sure how to get my homepage to know which image to display? I have no idea if this is an optimal approach or not but I was thinking of making a custom field called 'large-featured' and having the homepage check to see if `large-featured` custom field value is set to true. Upon true use `large-image` custom size and upon no custom field value set use wordpress default featured size. I'm not good at php coding so a little help here would be awesome. I'm pretty good and figuring things out with a little direction. Thanks for your assistance. Much appreciated. My site in question is: http://www.fighterstyle.com


Query for menus in backend (BE)

I want to create a simple plugin (already started) to have in one place recurring tasks (for me as webdesigner) e.g. take site offline, set backend icon, don't show updates and so on... Now I want to hide some menus for my clients in BE and I am asking if someone knows a query to get all existing menus? Thanks in advance.


Taxonomies exists - but not showing up

In the functions.php of my child-theme I created some CPT with taxonomies.               add_action('init', 'register_ap_jobverzeichnis');     function register_ap_jobverzeichnis() {       global $jobdata;            $ap_jobver_rewrite = $jobdata['ap_jobver_rewrite'];       if(empty($ap_jobver_rewrite)) {          $ap_jobver_rewrite = 'jobboerse';        }            $joblabels = array(         'name'               => __('Jobverzeichnis','frameworkjob'),         'singular_name'      => __('Jobverzeichnis','frameworkjob'),         'add_new'            => __('Neuer Job','frameworkjob'),         'add_new_item'       => __('Neuen Job hinzufügen','frameworkjob'),         'edit_item'          => __('Job bearbeiten','frameworkjob'),         'new_item'           => __('Neuer Job','frameworkjob'),         'view_item'          => __('Job ansehen','frameworkjob'),         'search_items'       => __('Job suchen','frameworkjob'),         'not_found'          =>  __('Keine Jobs gefunden','frameworkjob'),         'not_found_in_trash' => __('Keine Jobs im Papierkorb','frameworkjob'),         'parent_item_colon'  => '',         'menu_name'          => 'Jobverzeichnis'       );            $jobargs = array(         'labels' => $joblabels,         'hierarchical' => false,         'description' => 'Stellenangebote',         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'exclude_from_search' => false,         'publicly_queryable' => true,         'rewrite' => array('slug' => $ap_jobver_rewrite),         'menu_icon' => get_template_directory_uri() . '/jobverzeichnis/job.png',         'query_var' => true,         'capability_type' => 'post',         'menu_position' => 12,         'taxonomies' => array('jobfelder'),         'supports' => array(           'title',           'editor',           'excerpt',           'thumbnail',           'page-attributes'         )       );            $jobtaxlabels = array(         'name'                       => __('Tätigkeitsfelder', 'frameworkjob'),         'singular_name'              => __('Tätigkeitsfelder', 'frameworkjob'),         'search_items'               => __('Tätigkeitsfelder suchen', 'frameworkjob'),         'popular_items'              => __('Häufige Tätigkeitsfelder', 'frameworkjob'),         'all_items'                  => __('Alle Tätigkeitsfelder', 'frameworkjob'),         'parent_item'                => __('Eltern-Tätigkeitsfeld', 'frameworkjob'),         'parent_item_colon'          => __('Eltern-Tätigkeitsfeld:', 'frameworkjob'),         'edit_item'                  => __('Tätigkeitsfeld bearbeiten', 'frameworkjob'),         'update_item'                => __('Tätigkeitsfeld aktualisieren', 'frameworkjob'),         'add_new_item'               => __('Tätigkeitsfeld hinzufügen', 'frameworkjob'),         'new_item_name'              => __('Neue Tätigkeitsfeld', 'frameworkjob'),         'separate_items_with_commas' => __('Tätigkeitsfelder mit Kommas trennen', 'frameworkjob'),         'add_or_remove_items'        => __('Tätigkeitsfeld hinzu/ entfernen', 'frameworkjob'),         'choose_from_most_used'      => __('Choose from the most used Project types', 'frameworkjob'),         'menu_name'                  => __('Tätigkeitsfelder', 'frameworkjob')       );                 register_post_type('jobboerse',$jobargs);            register_taxonomy('jobfelder', array('jobboerse'),         array(           'hierarchical' => true,           'labels' => $jobtaxlabels,           'show_ui' => true,           'query_var' => true,           'rewrite' => array(             'slug' => 'jobfelder',             'hierarchical' => true           )         )       );     }      Then in a page with own template I want to output the taxonomies with               $customPostTaxonomies = get_object_taxonomies('jobfelder');     if(count($customPostTaxonomies) > 0) {       foreach($customPostTaxonomies as $tax) {         $args = array('orderby' => 'name', 'show_count' => 1, 'pad_counts' => 0, 'hierarchical' => 1, 'taxonomy' => $tax, 'title_li' => '');         wp_list_categories($args);       }     }      But I get no output. Thanks for any help.


Main blog page works but title says Page not found

Here's a strange one. I've been developing a site, including a custom template that I originally worked up from the functionality of the Naked theme. The site has no public blog at the moment; the use of WordPress here was for the sake of content management of pages as well as the use of numerous plugins. Nonetheless, I wnat to "plan in" the flexibility of being able to add a blog down the road, so have been prepping the template and admin for that. Along the way, however, I've run into strangeness. I've got the look pretty much how I want it, and the individual posts and even monthly archives display fine. Actually, the main blog archive displays okay too, with one exception: It generates a Page not found title (and I do mean HTML title, displayed in your browser tab, not a heading) even though the page obviously is working. The permalink structure is `example.com/blog/%postname%/` but note of course that the actual site home page is not the blog, but a so-called WordPress "static" page. The problem I'm talking about concerns the page that collates all the posts in order, which is located at `example.com/blog/`. Anyone encountered anything like this? I'm wondering if it's a leftover from the fact that I changed the permalink structure, since the actual WordPress installation has been around awhile. However, I deleted all the old posts.... In the General Settings, both the WordPress address and the Site Address are set simply to the domain name. Does one of these need to be altered, and if so, will it mess up my page addresses? I want them to remain `example/pagename/` as they currently are. Is there something else I need to do to properly generate the main blog archive page so that it has the proper title? I wouldn't think so, since the monthly archive page doesn't have the issue ... I'm grasping at straws a bit, and frankly the issue is such that I hardly know what keywords to use to search for an answer.


WP 3.9 - default Media Manager

I need that in the admin edit page, when the user clicks on “ **add Media** ”, the default in the new frame will be “ **Create Gallery** ” and not “Insert Media”. I think, that the script for it is in the media-editor.js in wp/inclodes/js. There, if I change line 1009 - “ **state: 'insert’,** ” into “ **state: ‘gallery,** ”, and do the same in the media-editor.min.js, it works, and the frame is opened with “Create Galley”. Well, the question is: how can I do the same using actions or filters in the function.php?


Automatically assign taxonomy term if custom meta value exists

I currently have a custom meta field for adding a video url to the post. I'd like for the existing taxonomy term "video" to be automatically assigned to the post upon saving if the meta field has any value.


how to write short code in word press

I am new in WordPress, I want to write short code with parameters in function. That is in               add_shortcode('short code name','function name','parameter1,parameter2');      In `add_shortcode()`, I want to pass parameters and this must get in function used for creating short code. Here is the function               function function name('parameter1','parameter2') {          }      how is it possible?


Migrate posts into a different category

I have about 1500 posts I want to change category for. Is there a quick way to do this in Wordpress Admin?


XOR functionality for meta_query

I'm trying to resolve the problem with event displaying. An event has its start and end dates, written in meta. For example, event starts on (dmY) 03.04.2013 and ends up on 08.04.2013. Using `WP_query` and `meta_query` I can exclude this event if I am trying to get data by 09.04.2013. At the same time this event will show up each day in the interval, that is cool too. But, I can't really exclude this event if I'm trying to get data by 02.04.2013.   The interval I use is this month, I mean, for example from 01.04.2013 to 30.04.2013. Here is the code.   In my particular situation I need XOR functionality for `meta_relation`. The best way is to create a custom `$wpdb` query, but I'm not too strong in MySQL....               //Week events     $query_date = $_GET['date'];     $month_start = date('Ym01',strtotime('this month'));     $month_end = date('Ymt',strtotime('this month'));     //IF query Day is empty     if ( empty($query_date) || ( strlen($query_date) != 8 ) || ( !is_numeric($query_date) ) ) {            //Custom query       $args = array(         'post_type' => 'post',         'orderby' => 'event_start_date',         'order' => 'ASC',         'meta_query' => array(         'relation' => 'OR',           array(             'key' => 'event_start_date',             'value' => array( $month_start, $month_end),             'compare' => 'BETWEEN',             'type' => 'DATE'           ),           array(             'key' => 'event_end_date',             'value' => array( $month_start, $month_end),             'compare' => 'BETWEEN',             'type' => 'DATE'           )         )       );          } else {            //Custom query       $args = array(         'post_type' => 'post',         'orderby' => 'event_start_date',         'order' => 'ASC',         'meta_query' => array(         'relation' => 'OR',            array(             'key' => 'event_start_date',             'value' => array( $query_date, $month_end),             'compare' => 'BETWEEN',             'type' => 'DATE'            ),            array(             'key' => 'event_end_date',             'value' => array( $query_date, $month_end),             'compare' => 'BETWEEN',             'type' => 'DATE'            )          )        );       }          $wp_query = new WP_Query( $args );     //End of custom query


ACF media fields

I'm using ACF to add galleries to a post type. In the gallery field you can click edit on an image and type Title, Alt Text, Caption and Description. These seem to be media related fields. I'm wanting to remove two of those fields from the screen so that the site manager doesn't have access to them. Would anyone with experience of ACF gallery be able to help me out, or someone point me in the right direction with where I may need to look to make this change? I believe the fields are attachment-info fields, related to media-uploader fi that helps?!


Why can't the WP-CLI installer find my php.ini?

I am trying to install WP-CLI on my Mac using the standard installation command (found here: http://wp-cli.org), yet I am receiving the following error message: > `#!/usr/bin/env php` > > Some settings on your machine make Composer unable to work properly. Make > sure that you fix the issues listed below and run this script again: > > The detect_unicode setting must be disabled. Add the following to the end of > your `php.ini`: `detect_unicode = Off` > > A `php.ini` file does not exist. You will have to create one. If you can not > modify the ini file, you can also run `php -d option=value` to modify ini > values on the fly. You can use '-d' multiple times. > > ## Installing the main WP-CLI package... > > Could not open input file: composer.phar > > ## Installing the Boris package... > > Could not open input file: composer.phar > > WP-CLI files have been succesfully installed. > > To test, run: > > `/Users/[username]/.composer/bin/wp --info` When I run the test it reports `no such file or directory`. I have not installed the bundled PHP that ships with OS X, nor am I using any kind of package. I use MAMP for my local development environment, so my php.ini file is located here:               `/Applications/MAMP/conf/php5.4.4/php.ini`      Can anyone please advise on the best way to get around this error message? Thanks.


A garbled copy of MY blog on this site?

I stumbled upon a website that had a garbled copy of a post I wrote a while ago and posted somewhere else. This site has no contact, no way to get in touch with admin, just brings me to wordpress.org....which is why I'm asking here. I have no idea what to do...obviously this site is not legit..it seems all the posts (blogs) are stolen from other bloggers. And why is it so garbled, as if translated from another language?? Can anybody help me? I need to remove my post from there and have no way to do it. Here is the website and the link to my original post and the link to the garbled one I found. http://activerain.com/blogsview/2078742/the-art-of-hanging-art http://cgcaf.com/tag/hanging-art-on-the-wall CGCAF.com is the website. Thanks!


$wpdb->get_var next var?

This is giving the same views value for each post how would I grab the next var for each post?               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <a href="<?php the_permalink(); ?>"><?php the_title(); ?>              <?php         // set the meta_key to the appropriate custom field meta key         $meta_key = 'views';         $views = $wpdb->get_var( $wpdb->prepare(              "                 SELECT meta_value                 FROM $wpdb->postmeta                  WHERE meta_key = %s             ",              $meta_key         ) );         echo "
Total views {$views}
";         ?>               <?php endwhile; ?>


Can I pass two roles to the function get_users?

I want to get the users of role academic and student. I have tried using the code below (passing an array of roles, but all users are being displayed, so clearly it's not working.               $roles=array('academic','student');     $args =array('role'=>$roles);     $users=get_users( $args );          foreach ($users as $user) {         echo '<li>' . $user->user_email . '</li>';     }


Images in upload folder with hexadecimal names

I'm using Wordpress 3.4.1 with the Suffusion theme 4.3.0. I've noticed that there are a large number of images with hexadecimal names, like 54f96e1d5f478186f66bde9d6aeda625.jpeg. I'm wondering how these images are being created, and what I can do to prevent their generation, as they don't seem to be used by any post.


Hook when new CPT published AND postmeta inserted

I would like to know if there is a hook that fires when a new CPT is published and its postmeta has been inserted. I was using publish_mycpt but found that the postmeta wasn't being saved at that point. I would like my hook to run only for this custom post type, not for all posts. The function I will be calling via the action hook is also used by a scheduled cron job, so it's not only called when a new post is published via the administration interface, not sure if this is important or not.


Change hyphen/dash for vertical line in menu

I have the theme Blaskan installed. I have a child theme installed also, but I cannot seem to change the hyphens/dashes to vertical lines `|` in my menu for this theme. Any suggestion would be appreciated?


echo post-permalink without http and www

I have this line …
<?php the_permalink(); ?>
      and the result on my page looks like this …               http://mysite.com/whatever/post-or-so      I guess it could also look like this …               http://www.mysite.com/whatever/post-or-so      However I'd like to have just `mysite.com/whatever/post-or-so` without the `http://` or `www` in front of it. What is the best and easiest way to do so? Don't get me wrong, this has nothing todo with rewriting permalinks or whatsoever. Just a simple echo of `the_permalink()` on my page that is not handled as link but as normal text. And in this case I would like to get rid of the http or www.


Redefine function arguments before rendering

How to change args values before function output (filter default values before call)               wp_function($arg1,$arg2 = false){code}      change to               wp_function($arg1,$arg2 = true){code}      without php runkit!


Add function to custom menu

I am am trying to add a function to my custom menu. The menu works, but I have no idea on how to get the `custom_execute_shortcode()` function to work inside the `add_profile_link_to_nav()` function. Any help appreciated.               //--Nav Menu     function add_profile_link_to_nav(){      if ( is_user_logged_in() ) { ?>

 All  Members
           function custom_execute_shortcode() {     $myfunction= '[Shortcode]';     $myfunction_parsed = do_shortcode($myfunction);     echo $myfunction_parsed;     }

          <?php      }      }     add_action( "wp_nav_items","add_profile_link_to_nav" );      Thanks, Tim .


Custom fields / meta box output

I have some custom fields added via a meta box, and I'd like to output them into a dl on the post itself, with the field being the term and the data it contains being the term. Currently, calling `<?php the_meta(); ?>` outputs an unordered list. Example:

Date

Monday 26 March 2012

Time

11pm

      I have the meta box fully implemented, it's just the output that I'm clueless with. The relevant part of the meta box code, should it help:               function admin_init(){       add_meta_box("events_meta", "Event Details", "event_details", "post", "normal", "default");     }          function event_details() {       global $post;       $custom = get_post_custom($post->ID);       $date = $custom["date"][0];       $time = $custom["time"][0];       $location = $custom["location"][0];       $tickets = $custom["tickets"][0];       ?>
Date:
       <textarea cols="34" rows="2" name="date"><?php echo $date; ?></textarea>

Time:
       <textarea cols="34" rows="2" name="time"><?php echo $time; ?></textarea>

Location:
       <textarea cols="34" rows="2" name="location"><?php echo $location; ?></textarea>

Ticket Price(s):
       <textarea cols="34" rows="2" name="tickets"><?php echo $tickets; ?></textarea>
       <?php     }      Thanks in advance for any help! :)


Problem with Language translation

I working with a theme that supports langauge settings. I've changed the setting in WP-Config to:               define('WPLANG', 'es_ES');      The theme I'm using did not provide the es_ES.po or es_ES.mo files so I created my own es_ES.po and took the es_ES.mo from es.wordpress.org (after I downloaded the Spanish version). The translation is working but its not picking up the entries I specify in es_ES.po, for example:               #. Text in function     #: daydream/comments.php:78     msgid "Be nice!"     msgstr "Escribe!"      This still displays in English on my site. _UPDATE_ Just to clear something up, I'm not actually editing the core language files, the theme has its own language folder, this is where I created my es_ES.mo and es_ES.po. Any help would be appreciated. Regards, Stephen


Recommend an open source, template driven website builder UI that produces a working WordPress site

I'm a programmer at a domain registrar and web hosting company. In the past year or so we have branched into custom web design for individuals and small businesses. Currently all our solutions are WordPress-based. We find that we have a small but vocal group of clients that are not ready for custom web design, and are not prepared to learn WordPress to build themselves a site either. Currently these clients are using our legacy templated website builder solution based on a classic ASP framework that we purchased and customized. While the platform is a complete dead-end, it does have several good features, including sub-page support, galleries, contact forms, product catalogs, and Paypal integration. It is also easier for a non-technical user than Wordpress -- better at holding their hand with wizard interfaces and big buttons, etc. Some within the company are suggesting what essentially amounts to an updated version of the same solution, based on Plesk's SiteBuilder platform. I believe this will simply lead to another dead-end a few years from now. What I would really love to adopt instead is an open source, template driven website builder UI that produces a working WordPress site. (Note that it can be commercial and paid, as long as we have access to the source to customize/maintain it.) My thinking is that the future of the WordPress platform is bright and stable, and any clients that build small templated sites on it will be able to easily upgrade them as their needs grow in the future. In addition, should they later require custom development, we will be in a position to leverage our WordPress know-how, including any plugins and themes that we have customized, to get their job done faster and cheaper. I'm surprised that after five minutes of Googling, I haven't found something that matches my description. Maybe I'm using the wrong search terms. I would have thought that such a huge and mature platform as WordPress would already have spawned something like this. Does anyone have any suggestions? Another way to put it is that we want to offer a service competitive with GoDaddy's WebSite Tonight, but that produces a working WordPress site. We want a completely non-technical user with no knowledge of HTML to be able to build their site without human assistance. In other words, **a nice colourful wizard with big buttons and 3 steps** :   1. **Pick a theme.**   2. **Setup page names and paste in your content.**   3. **Optionally install some common free plugins: contact forms, photo/media album, Google Analytics, product catalog, PayPal integration, etc.** It's OK if the wizard can't edit the site once it's generated. At that point it will be better for the user to learn how to edit within Wordpress proper. But the "kickoff" has to be through the super-simple friendly UI. If nothing like this exists, I would love to help build it, but I doubt our management team could allocate the time :-) Maybe as a side project.


How to use the full page

I'm trying to figure out how to get rid of the whitespace on this page: http://www.seccbiblebowl.org/calendar/ I need the calendar to be full page. On the edit page screen, there's an option to set the template as "full page, no sidebar" but it doesn't expand my content area. Is there a setting I'm missing?


how to replace get_template_part('loop','tag') with explicit styled version?

So my theme has a tag.php, that contains this line: `get_template_part('loop','tag');` that runs the loop and spits out the tag entries. I'm modifying it to include post thumbnails (using if(has_post_thumbnail()) { the_post_thumbnail() }), but have run into a need to add more styling. to do this I need to get access to the code that `get_template_part()` is spitting out. i know i should be able to do this somehow by creating my own loop in loop- tag.php or some such thing, but can't find an example. can someone give me a simple example of a loop-tag.php that would break the functions of `get_template_part('loop','tag')` into it's components?


Simple webshop-plugin?

Im looking for a simple plugin to make a site from which i can make orders for products. The whole shop should be under an own "tab" in the menu. It should be possible to use nested categories. Each product have an "Add to cart" button, and a textfield to enter the quantity. When the user is finished, they fill out their name and address and such, and an email is sent to the store keeper with all of the information about added items and information about the buyer. Is there such a plugin?


Minimum Dimensions Requirement for Featured Image?

I am creating a baseball website with multiple Authors. From past experience, no matter how well you know someone personally, it doesn't mean they will follow or even read your instructions. That being said, I would like to require that any image an Author decides to "Use as featured image" be at minimum of 640px wide and a minimum of 360px tall. I have required that each post have a Featured Image using the WyPiekacz plugin; the post will not publish without a Featured Image. I have blocked the ability for an Author to hotlink to another site by removing the "From URL" tab in Add Media using Bainternet's code. Now I need to require that any image used as the featured image is at least 640px by 360px. I am no means a coder, but I have been playing around with and trying to use Maor Barazany's code as a starting point, but to no avail. His code forces minimum dimensions for any image that is uploaded.


Does not show comment list

I can not see comments on my post. There is the code I use:               <?php if($comments) : ?>
       <?php foreach($comments as $comment) : ?>           <li id="comment-<?php comment_ID(); ?>" class="clearfix">               <?php if ($comment->comment_approved == '0') : ?>
תגובה שלך מחכה לאישור
               <?php endif; ?>             <?php echo get_avatar( $comment, 50 ); ?>
                 <?php comment_text(); ?>
נשלח יל ידי: <?php comment_author_link(); ?>
                 <?php edit_comment_link(); ?>

       <?php endforeach; ?>
        I admin I see 2 comments for this post, but on the page 0. How can I fix it? Thanks


How to add checkbox and radio button in Profile Page

I liked to customize my profile page by adding new fields to get more info from the user like "Gender" or "Speaking Languages". I managed to get the text input form to work, the problem I having now is on the radio and checkbox type of input. Here is my code:               function my_user_field( $user ) {                 ?>
<?php _e('More About You'); ?>

                                                              <?php _e('Gender'); ?>                             	                             <?php _e('Gender?'); ?>
                             <input type="radio" name="dealing" value="Male">Male
                             <input type="radio" name="dealing" value="Female">Female

                                                              <?php _e('Company'); ?>                             	                                                  <?php _e('Insert Your Company name'); ?>
                                 <input type="text" name="company" id="company" value="<?php echo esc_attr( get_the_author_meta( 'company', $user->ID ) ); ?>" class="regular-text" />

                                                              <?php _e('Language'); ?>                             	                             <input type="checkbox" name="Engilsh" value="Malay" /> English
                                 <input type="checkbox" name="language" value="Mandarin" /> Mandarin

                      <?php }                           function my_save_custom_user_profile_fields( $user_id ) {                     if ( !current_user_can( 'edit_user', $user_id ) )                         return FALSE;                     update_usermeta( $user_id, 'gender', $_POST['gender'] );                     update_usermeta( $user_id, 'company', $_POST['company'] );                     update_usermeta( $user_id, 'language', $_POST['language'] );                      }                 add_action( 'show_user_profile', 'my_user_field' );                 add_action( 'edit_user_profile', 'my_user_field' );                 add_action( 'personal_options_update', 'my_save_custom_user_profile_fields' );                 add_action( 'edit_user_profile_update', 'my_save_custom_user_profile_fields' );      The "Gender" and "Languages" are not passing through the $_post[]. I am new to coding, hope you guys can help.


How to get current user ID in array meta_value?

Here is example:               $args=array(        'meta_key'       => 'Something',        'meta_value'      => '',//here goes current used ID by default.        'meta_compare'   => '=',           );          $user_query = new WP_User_Query( $args );     // User Loop     if ( ! empty( $user_query->results ) ) {         foreach ( $user_query->results as $user ) {             echo '<p>' . $user->user_login . '</p>';         }     } else {         echo 'No users found.';     }      This results all users user name, But I need to echo only those users name whose `meta_key=` something but `meta _value` is equal to current user ID. How can I get the current user(log in user) ID in the `meta_value` by default?


Nonce keeps failing

I have a plugin that works for 99% of the users, but one user is having problems. The plugin opens a thickbox modal window and pushes content via the `load-edit.php` hook. The links are displayed in a metabox like this:               add_action( 'add_meta_boxes_shop_order', 'add_box' );     function add_box() {         add_meta_box( 'myparcel', __( 'MyParcel', 'wcmyparcel' ), 'create_box_content', 'shop_order', 'side', 'default' );     }               function create_box_content() {         global $post_id;         $export_link = wp_nonce_url( admin_url( 'edit.php?&action=wcmyparcel&order_ids=' . $post_id ), 'wcmyparcel' );         ?>         <a href="<?php echo $export_link; ?>" class="button myparcel one-myparcel" alt="Exporteer naar MyParcel">Exporteer naar MyParcel         <?php                }      then I hook into load-edit.php:               add_action( 'load-edit.php', 'wcmyparcel_action' );     function wcmyparcel_action() {         if ( isset($_REQUEST['action']) && $_REQUEST['action'] == 'wcmyparcel' ) {             // do stuff         }     }      When this particular user tries to access that page, he gets the 'Are you sure you want to do this?' message. This indicates that the nonce fails (correct?), but I can't figure out why it's failing, especially since it's working for everybody else. As you can see I am not performing any nonce checks myself at this stage, so it fails before the action is even fired. What can I do to diagnose the cause of this error? those interested in the complete code, the plugin can be found here.


How to remove shortcode(s) from WYSIWYG Page editor for Non Admins

Title says it all. We have a front end form on our site where users submit content via front end (also they are logged in while doing this) Because these short codes add them self to the content box of the page editor so in turn they are adding themselves to the front end form page editor. My question is, how can I best remove these short code buttons from showing on the page editor for anyone else's role who is not an admin? I don't know if I could use a conditional to check the current users role and if it is anything other than admin then use the remove_shortcode() function? Does that sound right or is there a better way?


logged_in user outside of wordpress loop

I have a member site which maintains a collection of books. I want to have a page on a folder outside of my loop that can see if the user is logged in to the main site, and then display the book viewer. If the user is not logged in to the main site, display a different page. I think I am having some trouble with cookies. I installed the Root Cookie Plugin, to help This is the code I've put together, what needs to be done better:               <?php     define('WP_USE_THEMES', false);      if (file_exists('../books/wp-blog-header.php')) {         require_once('../books/wp-blog-header.php');     } else {         echo 'ERROR: blog header does not exist';     }     global $current_user;     get_currentuserinfo();     // Start Site     $sitetitle = 'Book Viewer';     include 'head.php';          if ($current_user->ID == 0)     {         include ('guest.php');         exit;     }     else     {         include ('viewer.php');     }     include 'foot.php';     ?>      Should I be using `wp-load.php` instead of `wp-blog-header` or do I need to do something with wp_signon


Hide hour from displaying when using user_registered

`$user->user_registered` displays "Registered since: 2014-08-18 07:25:22" I just want to show the date, not the hour. How can I hide the hour and just show the date? thank you


Automaticaly bulk update all posts of an certain post type

How can I save all records of a particular post type in bulk with php code. I would like to save daily (automated) all records (without changes). With updating a post a particular function is already implemented. However, we now need to manually update the posts. How can this be done? (daily automated) How does such a bulk update code in php look like?


Categories and Tags not working!

I'm at the final debugging stages for a major web design project I've been working on for the last 6 months. The site itself is based on the has become a bit of a behemoth (merging 4 existing sites into 1 massive one!) with various custom post types etc... Getting to the point - my Category and Tag archives are no longer working, if you click on a category/tag in the sidebar while in any of the blogs, rather than take you to a list of blog posts within the same category/tag, it just goes to a list of nothing: Example blogs: http://whitewatergroup.eu/leadership-blog/ Example category/tag archive: http://whitewatergroup.eu/category/100-lessons- on-happiness/ I've based the site on this template; Carbon Light: I've been wracking my brain for the last few weeks as how to get this working - but it's beyond me - could someone be helpful and point me in the right direction as to how I've screwed this up somehow! I beginning to wonder if I didn't register the custom posts correctly, here's an example oh the code I used:               add_action( 'init', 'register_cpt_womens_blog' );     function register_cpt_womens_blog() {         $labels = array(             'name' => _x( 'Women in Business Blog', 'womens_blog' ),             'singular_name' => _x( 'Womens Blog', 'womens_blog' ),             'add_new' => _x( 'Add New', 'womens_blog' ),             'add_new_item' => _x( 'Add New Womens Blog', 'womens_blog' ),             'edit_item' => _x( 'Edit Womens Blog', 'womens_blog' ),             'new_item' => _x( 'New Womens Blog', 'womens_blog' ),             'view_item' => _x( 'View Womens Blog', 'womens_blog' ),             'search_items' => _x( 'Search Women in Business Blog', 'womens_blog' ),             'not_found' => _x( 'No women in business blog found', 'womens_blog' ),             'not_found_in_trash' => _x( 'No women in business blog found in Trash', 'womens_blog' ),             'parent_item_colon' => _x( 'Parent Womens Blog:', 'womens_blog' ),             'menu_name' => _x( 'Women in Business Blog', 'womens_blog' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => false,             'description' => 'Women in Business Blog',             'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),             'taxonomies' => array( 'category', 'post_tag', 'page-category' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,              'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post',         'yarpp_support' => true         );         register_post_type( 'womens_blog', $args );     }       Hope someone out there can help me! Cheers


Archive page of filtered posts

I'm sorry if my question may seem strange, but I've only recently started fiddling with WordPress development, as I was given a project already largely developed (I'm not saying it was well developed ;-) ). The previous developer registered several post types, and assigned custom fields to each post type. For instance, there is a "news" post type, whose "section" custom field can be "updates" or "press review". However, this was left behind, and only a archive-news.php and a single-news.php scripts have been written to present the list of "updates" and the single "update". Now I need to keep the current contents of the existing pages, but I have to make a new page listing the "news" posts with section set to "press review". I think I've got how to query and how to present the posts, but what I'm missing is how can I point to the new "archive-pressreview.php" page. From what I got, it would be easy to do if "press review" was a post type, but it's not, and I cannot change it. How could I get a permalink to my custom archive page? Thanks in advance!


Superfish Menu is incompatible with the latest jQuery version (1.11.0)

I tried to convert an HTML template into a WordPress theme, and it seems like the Superfish Menu v1.7.4 is not compatible with the WordPress' default jQuery version (which is v1.11.0). I've tried to deregister that default 1.11.0 version and use instead the 1.10.2 (which works with Superfish) and everything worked fine, which proves that the problem is definitely the jQuery version, not something else. But deregistering the default version is not a good practice, so what else can I do to make the Superfish Menu work?


Multiple pages to show posts

I don't have any code or pages to show yet so I'll just have to describe my question. I have group of posts, no categories or taxnomoy yet. On my home page I have a 'View all posts' link that is linked to a view_all_post.php page. On the view_all_posts.php page I have a simple loop that shows all the posts. I only want to show 10 posts on the view_all_posts.php page and have the rest of the posts on the next page that will be linked on the view_all_posts page. So the view_all_posts will show 10 post and then have links to show the next page with the rest of the links on, that will have links to the next page if there are more posts to show. I know how to limit the number of post - post_per_page My problem is how to create the extra pages with the rest of the posts. I'm sure I don't create another view_all_post page because I don't know how many post there will be and so it won't be dynamic. Is there a template page I should be using like single.php to show actual posts. If it helps here is the view-all-post.php
View all Posts

              <?php             $allposts_args  = array(                 'post_type' => 'post',                 'order' => 'ASC',                 'orderby' => 'date',                 'posts_per_page' => 10,             );                  $allposts_loop = new WP_Query($allposts_args);                  if($allposts_loop->have_posts()):                 while($allposts_loop->have_posts()):                     $allposts_loop->the_post();              ?>
                  <a href="<?php echo get_permalink($post->ID); ?>">
<?php echo the_title(); ?>

by

<?php echo the_content(); ?>

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


Disable qTranslate by post type in admin + disable per page / post ID on front-end

I'm trying to find a way to selectively disable qTranslate - I would like to be able to show certain static content on my site in 4 languages, but to then only have a single language (and a simplified editor) for posts and also custom post types. I would also need to disable the output on selective pages in the front-end, so that I can show all the language content on the same page, at the same time. Is there a way to have the plugin load on demand?


plugins_url() incorrectly returns a url with www subdomain

I'm working on a plugin which we'll call "my-plugin" for the purposes of this question. The my-plugin directory looks like this:               my-plugin/      |- image.jpg      |- script.js      |- script.php      |- plugin.php      |- ajax.php      In script.php I have a section of code that specifies some JS. In it, I need a URL for ajax.php. e.g.:               <script type="text/javascript">       foo = jQuery.getJSON("<?= plugins_url('ajax.php', __FILE__); ?>", function (data)         { /* ... */ });     </script>      My wordpress domain is configured with a subdomain-less base url e.g.: http://example.com/ however the URL returned from `plugins_url` is: http://www.example.com/wp-content/plugins/my-plugin/ajax.php. Unfortunately this has the side effect of preventing the script from being loaded as jQuery's getJSON is consistently "canceling" the request when the HTTP 301 response is returned for the malformed address. Why is `plugins_url` (in WordPress 3.3.1) returning a URL with 'www' when WordPress's 'Site Address' setting doesn't have it?


wp_list_pages, links only for pages with no children

Is this possible to do, and what is a best practice solution? The things I can think of is parsing the page structure myself, or do it with JQuery to convert `<a>` to `<span>` or similar. Is there a CSS solution? This is for a left-hand indented menu a la the ones in legacy windows help files or PDF table of content panes. A sidebar tree menu, if you will, where only the 'leaves' of the tree are clickable (the 'end nodes'). I have the `wp_list_pages` menu working, but I want to make the links that have children unclickable. Menu is here The only links that should be clickable are: Hjalp Intro Policy Om Att Ringa Att Ringa Aut-telefonist Hanvisning Trio Trio Web


How to query posts that have certain post meta keys, and sort by meta key and/or value

I'm using this structure to make album lists. I'm using a key so I correspond lists to albums but I don't know how to reverse the output so the items start at the top with lowest key value. Any ideas?                 <?php      $album = get_post_meta($post->ID, "album", false);      $album_list = get_post_meta($post->ID, "album_list", false);       foreach ($album_list as $album_list) {          list($key, $value) = explode(',',$album_list);          $indexed_album_list[$key] = $value;      }      foreach ( $album as $each_album) {          list($key,$album) = explode(',',$each_album);          echo '
'.$album.'
';          echo '
';          if ($album_list = $indexed_album_list[$key]) {              echo $album_list;          }            else {              echo '&nbsp';          }          echo '
';      }     ?>


Single Image Gallery Post

I'm trying to edit my new theme and I got the following comments:   1. Single image gallery post: image shifted in left side with footer   2. Need next and previous image gallery link on single image gallery post. I know how to create a gallery post with many thumbnails, but how do I create a single gallery post in order to simulate the above to comments?


Exclude category from category archive

I've included the code I'm working with below. I had some custom work done on a wordpress site of mine. This is a page that shows an list of the categories along with images and a short description. I'm not quite sure how to go about exclude a single category from showing up on this page. This is a media site, so all of the categories correspond to productions. I'd like to create a blog, but am unable to until I can find a way to exclude the category from showing up on our production page. Any help would be appreciated, can typically work my way through WP, this one has me stumped at the moment.               <?php include( TEMPLATEPATH . '/admin/admin-init.php' ); ?>
              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <div class="post" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

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

                            <?php                          $categories = get_categories('hide_empty=0');                     $imgs = get_option('ciii_image_names');                     $upl = wp_upload_dir();                          foreach ($categories as $c): ?>                         <?php                         $img = isset($imgs[$c->term_id]) ? $upl['baseurl'].'/category-images-ii/'.$imgs[$c->term_id]['original'] : $upl['baseurl'].'/dummy-285x175.png';                         ?>

                                 <a href="<?php echo get_category_link($c->term_id) ?>" rel="bookmark" title="<?php echo $c->cat_name ?>"><img src="<?php echo $img ?>" width="285" />

<a href="<?php echo get_category_link($c->term_id) ?>" rel="bookmark" title="<?php echo $c->cat_name ?>"><?php echo $c->cat_name ?>

<?php echo $c->description ?>

                     <?php endforeach; ?>


Tag template not returning posts

I have the following code which SHOULD print out the title of all posts with the associated tag (in this case the tag is 'icon'):               <?php         $tagname = get_query_var('tag');     ?>           <?php          if( is_tag()  ){         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         query_posts( array('post_type'=>array( 'photo', 'post'),'paged'=>$paged, 'tag'=>$tagname ) );         }     ?>          <?php while ( have_posts() ) : the_post(); ?>          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

          <?php endwhile; // End the loop. Whew. ?>              <?php wp_reset_query(); ?>      I can confirm that $tagname contains the value of 'icon' when echoed. The problem is, no posts are being returned when I know there are 8 posts with the tag 'icon'! Why is that?


Find out Requires WP tag for a plugin when submitting it

I am going to submit my first plugin to the repository. How do I find out the Requires tag value for which my plugin would work? I know its somewhat vague, but how do you guys figure out? Like my plugin just add some info in the head section. The only thing required for its functionality is `wp_head` hook. So I just did a grep and checked the inline documentation that it was introduced in WP v1.2 So am I right? This is how I should be doing it? Any tips?


wp_posts - guid update

Hello and please excuse if this has been answered before but we really need to make sure. We have developed a website under a domain of ours and then moved it to the live site of the client. We have run a few sql queries in the db in order to update to the new url but when we search our domain name in the database, we get: 600+ matches inside table wp_posts (mostly revisions, but there are attachments and posts also). We read in the codex of WP that we should NOT update that column but we are not quite sure how it would affect the site if we did. The files are still in our domain and we need to delete them, but we are thinking that since there are still instances in the database that call our domain, something might break if we did. If someone can provide more info on the guid use and any suggestions in the above situation, we would be reaaally grateful. thanks in advance


How can I add more code to this?

<?php $my_query = new WP_Query( "cat=11&posts_per_page=1" );        if ( $my_query->have_posts() ) {             while ( $my_query->have_posts() ) {                 $my_query->the_post();                the_excerpt();            }        }        wp_reset_postdata(); ?>      Where it says the_excerpt, how come I am unable to add other code alongside this? I'm guessing it's because it's still within the PHP tag, but I am unsure of how to seperate the two. Is there a way to make a section where the_excerpt is so that I may add additional code? I'm trying to add:
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

     Written by <?php the_author(); ?>     <?php the_time ('j F, Y'); ?>     Posted in: <?php the_category(', '); ?>     <?php the_tags(); ?>
      and THEN the excerpt Thank you


Navigation link to specific user page

I asked this question and got a great reply - Associate Page with User - so I can now associate a post with a specific user as required. What I want to do is include in the main site navigation a link to 'View Your Page' that displays the post that has been linked to the logged in user. If the user is not logged in or does not have a page associated to them then a simple message to say so. Any idea of how to do this? Thanks.


my checkbox is not saving it's value

Processing the following form in the admin area, but the database constantly returning an empty cell where the info should be. Help!!               <form action="options.php" method="post">                      <input type="hidden" value="admin_bar" name="option_page"><input type="hidden" value="update" name="action"><input type="hidden" value="fd5754f034" name="_wpnonce" id="_wpnonce"><input type="hidden" value="/accessibilitysite/wp-admin/options-general.php?page=admin_bar&settings-updated=true" name="_wp_http_referer">

Admin Toggle	                                     <input type="checkbox" value="admin_bar_toggle" name="admin_bar_[admin_bar_toggle]">
Turn Admin Bar On ?

                      <input type="submit" value="Save Changes" class="button-primary">
                  </form>


Validate emails in array using foreach

How do I validate an array of emails from a textbox before sending them to the `wp_mail` function?               $emails = 'test@test.com;test2@test2.com     email3@email3.com,email4@email4.com, email5.com';          $emails = preg_split('/[;,\n]/', $emails);     $validEmails = array();     $subject = 'Hey Subject';     $message = 'I am a message';          foreach($emails as $key=>$value){       if (is_email($value)) {         array_push($validEmails, $value);       }     }          wp_mail($validEmails, $subject, $message, $headers);      The kinda sample code above stops on the `if (is_email())` condition. Was wondering how I can validate each email in the array whichever way before sending to the mail function.


My custom write panels won't save data. What am I missing?

So far I've been reading some tutorials about ways to create Custom Write Panels. It seems that none of them will really work without some bug. I'd like to discuss one of those tuts here: http://www.sitepoint.com/guide-to- wordpress-custom-write-panels/#.T_iokY7olaQ I copied this code snippets to my theme and also followed the hints in the comments which adivsed me to correct the syntax of line               if ( !wp_verify_nonce($_POST['my_meta_noncename'], __FILE__) ) return $post_id;      Having done that, my panel works fine exept one thing: It won't save the fields data. But if I comment out this line, the fields will get saved but if I then want to delete one of the related posts or create a new one, my backend triggers quirk mode and outputs:               Warning: Invalid argument supplied for foreach() in ...      ... my next line which looks like this:               foreach($accepted_fields[$post_type_id] as $key){         $custom_field = $_POST[$key];         //If no data is entered         if      (is_null($custom_field)) { delete_post_meta($post_id, $key); }         elseif  (isset($custom_field) && !is_null($custom_field))                 { update_post_meta($post_id,$key,$custom_field); }          else    { add_post_meta($post_id, $key, $custom_field, TRUE); }     }     return $post_id;     {      How can I fix this? Your help would be very appreciated. Thanks in advance! Best Frank


Wordpress theme: Add page content to the bottom of the Contact form

I am using the following wordpress theme, which is pretty cool btw.: http://demo.s5themes.com/?theme=simplecorp Now the site has a custom Theme Options build in, where you can specify all the content inside the Dashboard(eg. For the contact page, you fill in your details on the dashboard theme editor. Now my issue is the following: When I add any additional content to the contact page inside the Contact Page itself, under Pages>contact page, whatever content I add there gets added to the TOP of the contact form template content. i would like to add it below. What do I need to change? Below is the code form my contact page template:               <?php     /*      * Template Name: Contact Form Page     */     if(isset($_POST['submitted'])) {             //Check to make sure that the name field is not empty             if(trim($_POST['contactName']) === '') {                 $nameError = __("You forgot to enter your name.", "site5framework");                 $hasError = true;             } else {                 $name = trim($_POST['contactName']);             }                  //Check to make sure sure that a valid email address is submitted             if(trim($_POST['email']) === '')  {                 $emailError = __("You forgot to enter your email address.", "site5framework");                 $hasError = true;             } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {                 $emailError = __("You entered an invalid email address.", "site5framework");                 $hasError = true;             } else {                 $email = trim($_POST['email']);             }                  //Check to make sure comments were entered             if(trim($_POST['comments']) === '') {                 $commentError = __("You forgot to enter your comments.", "site5framework");                 $hasError = true;             } else {                 if(function_exists('stripslashes')) {                     $comments = stripslashes(trim($_POST['comments']));                 } else {                     $comments = trim($_POST['comments']);                 }             }                  //If there is no error, send the email             if(!isset($hasError)) {                 $msg .= "------------User Info------------ \r\n"; //Title                 $msg .= "User IP: ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP                 $msg .= "Browser Info: ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent                 $msg .= "Referrer: ".$_SERVER["HTTP_REFERER"]; //Referrer                      $emailTo = ''.of_get_option('sc_contact_email').'';                 $subject = 'Contact Form Submission From '.$name;                 $body = "Name: $name \n\nEmail: $email \n\nMessage: $comments \n\n $msg";                 $headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;                      if(mail($emailTo, $subject, $body, $headers)) $emailSent = true;              }          }     get_header();     ?>

                                        <?php if(of_get_option('sc_contact_map') != '') { ?>
                             <?php echo of_get_option('sc_contact_map') ?>
                                                      <?php } else if(of_get_option('sc_showpageheader') == '1' &&  get_post_meta($post->ID, 'snbpd_ph_disabled', true) != 'on' ) : ?>                                  <?php if(get_post_meta($post->ID, 'snbpd_phitemlink', true)!= '') : ?>                                  <?php                             $thumbId = get_image_id_by_link ( get_post_meta($post->ID, 'snbpd_phitemlink', true) );                             $thumb = wp_get_attachment_image_src($thumbId, 'page-header', false);                             ?>                             <img class="intro-img" alt=" " src="<?php echo $thumb[0] ?>" alt="<?php the_title(); ?>"  />                                  <?php elseif (of_get_option('sc_pageheaderurl') !='' ): ?>                                      <?php                                 $thumbId = get_image_id_by_link ( of_get_option('sc_pageheaderurl') );                                 $thumb = wp_get_attachment_image_src($thumbId, 'page-header', false);                                 ?>                                 <img class="intro-img" alt=" " src="<?php echo $thumb[0] ?>" alt="<?php the_title(); ?>"  />                                  <?php else: ?>                                      <img class="intro-img" alt=" " src="<?php echo get_template_directory_uri(); ?>/library/images/inner-page-bg.jpg" />                                  <?php endif ?>                         <?php endif ?>

<?php the_title(); ?> <?php if ( !get_post_meta($post->ID, 'snbpd_pagedesc', true)== '') { ?>/<?php }?> <?php echo get_post_meta($post->ID, 'snbpd_pagedesc', true); ?>
                              <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">                                  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                                     <?php the_content(); ?>

<?php _e('Address:', 'site5framework') ?> <?php echo of_get_option('sc_contact_address') ?>

<?php _e('Phone:', 'site5framework') ?> <?php echo of_get_option('sc_contact_phone') ?>

<?php _e('Fax:', 'site5framework') ?> <?php echo of_get_option('sc_contact_fax') ?>

<?php _e('E-mail:', 'site5framework') ?> <a href="mailto:<?php echo of_get_option('sc_contact_email') ?>"><?php echo of_get_option('sc_contact_email') ?>

                                         <p class="simple-error error" <?php if($hasError != '') echo 'style="display:block;"'; ?>><?php _e('There was an error submitting the form.', 'site5framework'); ?>

<?php _e('Thanks! Your email was successfully sent. We should be in touch soon.', 'site5framework'); ?>

                                          <form id="contactForm" method="POST">
                                             <?php _e("Your name", "site5framework"); ?>                                             <input type="text" id="nameinput" name="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="requiredField"/>                                             <span class="error" <?php if($nameError != '') echo 'style="display:block;"'; ?>><?php _e("You forgot to enter your name.", "site5framework");?>

                                             <?php _e("Your email", "site5framework"); ?>                                                 <input type="text" id="emailinput" name="email" value="<?php if(isset($_POST['email']))  echo $_POST['email'];?>" class="requiredField email"/>                                               <span class="error" <?php if($emailError != '') echo 'style="display:block;"'; ?>><?php _e("You forgot to enter your email address.", "site5framework");?>

                                             <?php _e("Area/Rep", "site5framework"); ?>                                             <select>                                                 <option>Area 1 - Engela</option>                                                 <option>Area 2 - Francois</option>                                                 <option>Area 3 - Johan</option>                                             </select>

                                         <?php _e("Your message", "site5framework"); ?>                                             <textarea cols="20" rows="20" id="Mymessage" name="comments" class="requiredField"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>                                               <span class="error" <?php if($commentError != '') echo 'style="display:block;"'; ?>><?php _e("You forgot to enter your comments.", "site5framework");?>

                                         <input type="hidden" name="submitted" id="submitted" value="true" />                                         <button type="submit" id="submitbutton" class="button small round orange"><?php _e('  SEND MESSAGE  ', 'site5framework'); ?></button>                                          </form>
                                            <?php endwhile; ?>
                              <?php else : ?>

<?php _e("Not Found", "site5framework"); ?>

<?php _e("Sorry, but the requested resource was not found on this site.", "site5framework"); ?>

                              <?php endif; ?>

                       <?php get_footer(); ?>


Sensible location for IPN Callback script

I'm working on a plugin which will involve accepting PayPal Instant Payment Notifications. IPNs are a web-hook which gets called when a payment is processed. Currently I have a script to handle the IPNs within the plugin e.g. http://mywordpressinstall.com/wp-content/plugins/paypalplugin/IPNHandler.php I then paste this URL into the PayPal developer settings area. I'd like to use a more customizable location for the IPN handler (with a friendlier URL). I was thinking maybe a shortcode could be used to give 'handler' functionality to any page it's inserted in. Is this a sensible idea? Does anyone have any suggestion on how I can make the URL of the handler shorter? Thanks!


WYSIWYG editor not in a post editor?

It is possible to use the WYSIWYG editor in theme settings (not in a post editor)?


rewrite rules hierarchical

I want that my WordPress follow this rules:   1. `/productes/` a page with all products   2. `/productes/[category]/` a taxonomy-page with all products of the category   3. `/productes/[category]/[subcategory]/` a taxonomy-page with all products of the category (the same as 2)   4. `/[productes]/[category]/[product]/` a `single-productes.php` that will show the category product   5. `/[productes]/[category]/[subcategory]/[product]/` a `single-productes.php` that will show the subcategory product (same as 4) `[category]/[subcategory]` is an hierarchical taxonomy is equivalent to `%categories_productes%` I have these two rules:               add_filter('rewrite_rules_array', 'tatanet_rewrite_rules');     function tatanet_rewrite_rules($rules) {       $newRules  = array();       $newRules['(.+)/?$']                                  = 'index.php?pagename=$matches[1]';       $newRules['productes/(.+?)/([^/]+)(/[0-9]+)?/?$']     = 'index.php?productes=$matches[3]';       return array_merge($newRules, $rules);     }      I have registered this taxonomy:               $labels = array(     'name'                          => 'Categories',     'singular_name'                 => 'Categoria',     'search_items'                  => 'Buscar Categories',     'all_items'                     => 'Totes les Categories',     'parent_item'                   => 'Categoria superior',     'edit_item'                     => 'Editar Categoria',     'update_item'                   => 'Actualitzar Categoria',     'add_new_item'                  => 'Afegir nova Categoria',     'new_item_name'                 => 'Nova Categoria',     'separate_items_with_commas'    => 'Separar Categories amb comes',     'add_or_remove_items'           => 'Afegir o treure Categoria',     );     $args = array(     'label'                         => 'Categories',     'labels'                        => $labels,     'public'                        => true,     'hierarchical'                  => true,     'show_ui'                       => true,     'show_in_nav_menus'             => true,     'query_var'                     => true,     'args'                          => array( 'orderby' => 'term_order' ),     'rewrite'                       => array( 'slug' => 'productes', 'with_front' => false, 'hierarchical' => true )     );     register_taxonomy( 'categories_productes', 'productes', $args );      I have registered this post type:               $labels = array(       'name' => _x('Productes', 'post type general name'),       'singular_name' => _x('Producte', 'post type singular name'),       'add_new' => _x('Afegir nou', 'productes'),       'add_new_item' => __('Afegir nou producte'),       'edit_item' => __('Editar producte'),       'new_item' => __('Nou producte'),       'all_items' => __('Tots els productes'),       'view_item' => __('Veure producte'),       'search_items' => __('Cercar productes'),       'not_found' =>  __('No s\'han trobat productes'),       'not_found_in_trash' => __('No s\'han trobat productes a la Paperera'),        'parent_item_colon' => '',       'menu_name' => 'Productes'     );     $args = array(       'labels' => $labels,       'public' => true,       'publicly_queryable' => true,       'show_ui' => true,        'show_in_menu' => true,        'query_var' => true,       'capability_type' => 'post',       'has_archive' => 'productes',        'hierarchical' => false,       'menu_position' => -4,       'rewrite' => array( 'slug' => 'productes/%categories_productes%', 'with_front' => false, 'hierarchical' => true ),       'supports' => array( 'title' )     );      register_post_type( 'productes', $args );     }      This is the URL and the page load result:   1. `/productes/` OK => load the page products that runs `template-productes.php`   2. `/productes/[category]/` OK => load `taxonomy-categories_productes.php`   3. `/productes/[category]/[subcategory]/` ?? => 404 error not found   4. `/[productes]/[category]/[product]/` OK => load `single-productes.php` of the `[product]`   5. `/[productes]/[category]/[subcategory]/[product]/` OK => load `single-productes.php` of the `[product]` Why the 3 point isn't working? I have got a page named productes (maybe it is causing the conflict?) I have got this permalink rewriter of the posts:               add_filter('post_link', 'categories_productes_permalink', 10, 3);     add_filter('post_type_link', 'categories_productes_permalink', 10, 3);          function categories_productes_permalink($permalink, $post_id, $leavename) {       if (strpos($permalink, '%categories_productes%') === FALSE) return $permalink;       $post = get_post($post_id);       if (!$post) return $permalink;       // get taxonomy terms       $terms = wp_get_object_terms($post->ID, 'categories_productes');         if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;       else $taxonomy_slug = 'uncategorized';       return str_replace('%categories_productes%', $taxonomy_slug, $permalink);     }


change widget to display excerpt instead of content

For the life of me I can not figure out how to get this widget (built into the theme) to show the excerpt instead of the post content. Can you guys take a look at it for me please. Any help would be greatly appreciated.               // =============================== Latest news posts Widget (particular category) ======================================          class latest_post1 extends WP_Widget {         function latest_post1() {         //Constructor             $widget_ops = array('classname' => 'widget Latest News', 'description' => 'List of latest posts in particular category' );             $this->WP_Widget('latest_post1', 'PT → Latest News', $widget_ops);         }              function widget($args, $instance) {         // prints the widget                  extract($args, EXTR_SKIP);             echo $before_widget;             $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);             $category = empty($instance['category']) ? ' ' : apply_filters('widget_category', $instance['category']);             $post_number = empty($instance['post_number']) ? ' ' : apply_filters('widget_post_number', $instance['post_number']);             $post_link = empty($instance['post_link']) ? ' ' : apply_filters('widget_post_link', $instance['post_link']);                  // if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };             echo '';              ?>                    <?php if($title){?>
<?php echo $title; ?>
                               <?php }  ?>
                     <?php                          global $post;                         $latest_menus = get_posts('numberposts='.$post_number.'postlink='.$post_link.'&category='.$category.'');                         foreach($latest_menus as $post) :                         setup_postdata($post);                     ?>                      <?php $post_images = bdw_get_images($post->ID,'large');?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     By <?php the_author_posts_link(); ?>
 <?php the_time('jS F')  ?>

                                               <?php endforeach; ?>     <?php                  echo '
';                  echo $after_widget;         }              function update($new_instance, $old_instance) {         //save the widget             $instance = $old_instance;             $instance['title'] = strip_tags($new_instance['title']);             $instance['category'] = strip_tags($new_instance['category']);             $instance['post_number'] = strip_tags($new_instance['post_number']);             $instance['post_link'] = strip_tags($new_instance['post_link']);             return $instance;              }              function form($instance) {         //widgetform in backend             $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'category' => '', 'post_number' => '' ) );             $title = strip_tags($instance['title']);             $category = strip_tags($instance['category']);             $post_number = strip_tags($instance['post_number']);             $post_link = strip_tags($instance['post_link']);          ?>
       <label for="<?php echo $this->get_field_id('title'); ?>">Title:         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />

       <label for="<?php echo $this->get_field_id('category'); ?>">Categories (IDs separated by commas):       <input class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" type="text" value="<?php echo attribute_escape($category); ?>" />

       <label for="<?php echo $this->get_field_id('post_number'); ?>">Number of posts:       <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" name="<?php echo $this->get_field_name('post_number'); ?>" type="text" value="<?php echo attribute_escape($post_number); ?>" />
     <?php         }          }          register_widget('latest_post1');


Plugin needed to allow subscribers to post articles on the front end without admin approval

Folks, I'm working on a magazine that has two areas: a professional writer driven portion and a user submitted portion. We want the user submitted portion to be able to be formatted like the professional articles (including embedding videos and either uploading or easily linking to photos), but we don't want to give folks back end access for security purposes. We had tested out UCan Post, but it has a lot of security issues and after we added Bulletproof Security, it's upload feature ceased to work altogether. We tried out Post from Site, but it's extremely limited and buggy when it comes to categories. Essentially, the main thing we want to find is a plugin that will allow base level subscribers to post articles from the front end (without waiting on admin approval) and include: An easy way to upload pictures or embed photos/videos from sites like YouTube or Flickr Categorization Basic Formatting Support of custom post types To see what we've got so far, go to: http://www.darkestgoth.com/wp/communitygoth/submit/ Thanks, Jeremy


Categories: A Greenhorn Question on Strategy (Not Code)

Im having an issue in my category set-up logic Let's say I sell new/used (including Vintage) Drums/Drum Parts wherein a user can search by new, used or by individual part. So let's say they choose to search by individual part on Cymbals. The search results page should then display a listing of Cymbals should also be grouped by new/used? Right? So, in setting up my categories I'm coming up with this ## New   * Drum Sets   * Cymbals    * Toms ## Used   * Drum Sets   * Cymbals    * Toms But this seems redundant to me. Can I not achieve my objective WITHOUT all this duplication? So before I go hacking away at this I thought I would get a few pointers from my peers. Please advise.


displaying meta key value with wp_page_menu

I know that WP3 offers wp_nav_menu and description field but I was wondering if it is possible to alter wp_page_menu to echo desired meta key value next to the page link in format that is adjustable. Hope my question is clear. Thanks


Custom Taxonomy in Permalink from post type

I am using custom post types and custom taxonomies for that post type. This snippet currently sets the permalinks for the post type:               'rewrite' => array('slug' => 'myrewritebase'),      I am registering the taxonmy this way:               register_taxonomy(             'my_taxonomy',             'my_post_type',      What do I have to set as rewrite for my custom post type? I tried it this way:               'rewrite' => array('slug' => '%my_taxonomy%'),      This did not work. Many Thanks for your help!


Timezone UTC to PST

we are trying to figure out what's happening with our site's timezone. On general settings it shows that local time is correct while showing the UTC time next to it. The locale we have it as Los Angeles but for some reason when 5pm comes, the site changes to new day. Meaning it's counting everything, including registrations as UTC and not PST. Is there a way to make sure it's PST? Even if that means changing core files.


Inserting shortcode [stream /] into a Text widget

hi i'm trying to insert a short code into a Text widget but all its doing it showing the code and not processing it.               <?php echo do_shortcode(' [stream embed=false share=false width=500 height=560 dock=true controlbar=bottom bandwidth=high autostart=false playlistfile=http://www.xxx.com/wp-content/uploads/videos/playlist.xml config=http://www.xxx.com/wp-content/uploads/videos/config_for_playlist.xml playlist=bottom repeat=none /] '); ?>


Under What Conditions Can I name my CPT the same as my CPT Page?

The story goes that you cannot have by default the same CPT slug as the page you need to create for your CPT. On a few occasions I've been able to do just that though and have it work just fine. For example: I create my CPT               register_post_type('schedule', array(             'labels'            =>  array(                 'name'          =>      __('Events'),                 'singular_name' =>      __('Event'),                 'all_items'     =>      __('View Events'),                 'add_new'       =>      __('New Event'),                 'add_new_item'  =>      __('New Event'),                 'edit_item'     =>      __('Edit Event'),                 'view_item'     =>      __('View Event'),                 'search_items'  =>      __('Search Events'),                 'no_found'      =>      __('No Eventss Found'),                 'not_found_in_trash' => __('No Events in Trash')                                     ),             'public'            =>  true,             'publicly_queryable'=>  true,             'show_ui'           =>  true,              'query_var'         =>  true,             'show_in_nav_menus' =>  false,             'rewrite'           =>  array('slug' => 'schedule', 'with_front' => false),             'capability_type'   =>  'post',             'hierarchical'      =>  false,             'menu_position'     =>  21,             'supports'          =>  array('title','editor', 'thumbnail'),             'has_archive'       =>  false         ));      I have my CPT Page: ![Custom Post Type Page - With Same Slug](http://i.stack.imgur.com/C3o9H.jpg) My permalink structure is: `/press- releases/%year%/%monthnum%/%day%/%postname%/` Finally I have a page template called "page-schedule.php" where I then query my CPT and display it just fine, even paged. I'm not the only one who's been able to do this as I have seen a few posts on wordpress.org forums claiming to also have been able to do this. My question is, what exactly causes this to happen and how can it be reproduced so I can achieve nice CPT permalink structures without plugins?


Changing permalinks back to default ( ?p=123 )

I have a site with about 900 pages that I was using custom permalinks `/%year%/%monthnum%/%postname%/` for. I have a custom nav menu with tons of items in it. This combination seems to be simply too much for the server and they keep suspending my account for CPU usage. (I'm pretty sure this is what's causing the problem; I've already ruled out plugin issues). I've decided to change the permalink structure back to default, but it doesn't automatically change the nav menu. So I'm looking at hours of extra work rebuilding the menu after the permalink change. (I originally attempted to make the fix with sql queries, but I can't figure out the nav_menus are put together by WP). Does anyone have a fix for this, a plugin that does it, or a method to do it quickly, or any help at all? The site is http://cumberlandmaine.com


How to link 'Private page' to 'Login' button in login screen

I want to link a private page to the 'Login' button can any one guide me how to link this. Full description: 1) I opened my website 2) Click on 'login' link 3) A new screen opens with username & Password and login button 4) I entered valid credentials and click on 'Login' button Expected result: I want the private page which I am linked to 'Login' button.


Query add html after set amount of posts?

Is it possible to add some html after a set amount of posts? For the purposes of a slider after 6 posts i need it to enclose in a div/li or whatever then start a new div/li for the next 6 and so on. Here is my custom query which just prints the post name in a list.
          <?php $args=array('post_type' => 'courses','post_status' => 'publish','posts_per_page' => -1);$my_query = null;$my_query = new WP_Query($args);if( $my_query->have_posts() ) {while ($my_query->have_posts()) : $my_query->the_post(); ?>

<?php the_title(); ?>

           <?php endwhile;} wp_reset_query();?>
      After at the start and end of 6 posts i need to open a div then close it after the 6th post. Is this possible with WordPress PHP? Many thanks for any help :)


can you call the alt tag for an image dynamically?

I need to call the alt tag for images on my site dynamically. The only thing I can find online is to use the post title function but that doesn't really help me out.


Different post views for different category views

In my blog, my "pages" are really just posts sorted by categories. What's the best way to change the way the posts look for one of my category pages?


Change the sidebar from left to right twentyfourteen theme

I am creating a site using 2014 theme. I would like to remain with the theme but however, I am interested in shifting the side bar from left to right as it is more ideal for my site. Is it possible to customise the theme in this way.


Confused. Writing a plugin with which I have other callbacks working similarly fine. But when adding a meta box its failing on the callback with error: > PHP Warning: call_user_func() expects parameter 1 to be a valid callback, > first array member is not a valid class name or object Fairly standard error but I can't work out why im receiving it. I have the following (stripped down) in a class.               function __construct(){             add_action( 'init', array( &$this, 'init' ) );     }          function init() {        add_action('add_meta_boxes', function() { add_meta_box('model', 'Parent', array(&$this,'parent_meta_box'), 'model', 'side', 'high');});     }          function parent_meta_box( $post ) {        // whatever happens here...     }      As far as I am aware I am doing the callback correctly with &this but nothing renders inside the metabox though it appears and I receive the above standard PHP error. Ive stripped it right back in my code down to this and its creating the meta box just won't put anything inside it. I have put debug logging in and it doesnt reach it but gets before and after. Not sure what I am doing wrong. Any help greatly appreciated.


How to update the widget form when the image is selected?

I have created a custom widget. There are 2 things that I can't do:   1. I need to open the new media uploader window when the button "Select The Image" is clicked.   2. When the image is selected from the media uploader I need to show the image in widget form. Only when I click on "Save" button, the image appears.              <?php     /*     Plugin Name: Basic Image Widget     */          class pippin_simple_authors_widget extends WP_Widget {              /** constructor */         function pippin_simple_authors_widget() {             parent::WP_Widget(false, $name = 'Basic Image Widget');         }              /** @see WP_Widget::widget */         function widget($args, $instance) {             extract( $args );                  $title = apply_filters('widget_title', $instance['title']);             $description = $instance['description'];                      if(!$size)                 $size = 40;             ?>

                     <img src="<?php echo esc_url($instance['image_uri']); ?>" />

<?php echo $title; ?>
                     <?php                                             echo $description;                      ?>

                          <?php         }              /** @see WP_Widget::update */         function update($new_instance, $old_instance) {             $instance = $old_instance;             $instance['title'] = strip_tags($new_instance['title']);             $instance['description'] = strip_tags($new_instance['description']);                 $instance['image_uri'] = strip_tags($new_instance['image_uri']);                     return $instance;         }              /** @see WP_Widget::form */         function form($instance) {                    $title = esc_attr($instance['title']);             $description =  esc_attr($instance['description']);                       ?>
               <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>               <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />

               <label for="<?php echo $this->get_field_id('description'); ?>"><?php _e('Description:'); ?>               <textarea class="widefat" id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>"><?php echo $description; ?></textarea>

             <?php if($instance['image_uri']): ?>             <img src="<?php echo esc_url($instance['image_uri']); ?>" />             <?php endif; ?>                 <input type="text" class="img" name="<?php echo $this->get_field_name('image_uri'); ?>" id="<?php echo $this->get_field_id('image_uri'); ?>" value="<?php echo $instance['image_uri']; ?>" style="display:none;" />           <input type="button" class="select-img" value="Select The Image" />
                       <?php         }          } // class utopian_recent_posts     add_action('widgets_init', create_function('', 'return register_widget("pippin_simple_authors_widget");'));               function hrw_enqueue()     {       wp_enqueue_style('thickbox');       wp_enqueue_script('media-upload');       wp_enqueue_script('thickbox');       // moved the js to an external file, you may want to change the path       wp_enqueue_script('hrw', '/wp-content/plugins/basic-image-widget/script.js', null, null, true);     }     add_action('admin_enqueue_scripts', 'hrw_enqueue');      ### script.js               var image_field;     jQuery(function($){       $(document).on('click', 'input.select-img', function(evt){         image_field = $(this).siblings('.img');         tb_show('', 'media-upload.php?type=image&TB_iframe=true');         return false;       });       window.send_to_editor = function(html) {         imgurl = $('img', html).attr('src');         image_field.val(imgurl);         tb_remove();       }     });


Clear custom field when new tag is added

When adding a new tag in the admin interface, WordPress doesn't reload the page. It appears to send the data with an ajax call, clear the fields and add the tag to the list on the right. I am working with a custom taxonomy that operates like tags. I have added a custom field to that taxonomy. When the user adds a new term, the data in my custom field is not cleared. I have tried using jQuery to clear the fields when the submit button is clicked, but of course this clears the fields even if the tag is not added (if, for instance, the name field hasn't been filled out). Does WordPress offer any callback or hook-like system on the Javascript/jQuery side of things which I could use to execute a function when a new tag is added? I believe I can hack a solution by searching for any fields with the class 'form-invalid' and not clearing my data. But I thought I would check first to see if there is a more stable and future-proof solution. Thanks.


Javascript Loading Effect to URLs

I have found the youtube loading effect which I want to use in my wordpress theme. As this demo shows the effect triggering with button event. I want to add this to my wordpress theme by triggering URL event onclick. So how to call this effect in our theme, when any URL on page is clicked? Any pointers or suggestions to achieve this would be helpful. :)


Looking for a plugins for organization portal (Staff, Units, Departments)?

I am looking for a plugin for internal organization portal that will display all the member of   the organization also the hierarchy between the differents units and departments. Also I will be able to move one person from one departments to another. if someone know of such a plugin or could guide me to how to solve it will be great.


Regarding plugin security

Is there any guarantee that the plugins I find on the wordpress site are legitimate and don't have any malicious code in them? Or is it up to me to check them? If so, what would be the best way to do that, given that I have little knowledge of php