How to Make a Custom Dashboard Widget to Display Custom Notification from Admin?

I am looking for a way to achieve the following:   1. A group of users 'students'    2. They login to the site   3. Each student can see a 'Custom Dashboard Widget(s)'   4. Each widget will carry a personal message wrote by Admin for that logged-in student. Such as A] Total Days in the course B] Total attendance C] paid & due fees. Is it possible with WP or should we look for another CMS to achieve these?


Show specific page on main index instead of latest

There are 3 latest pages displaying on my WP. Here's the code.
     <?php         $temp = $wp_query;         $wp_query= null;         $wp_query = new WP_Query();         $wp_query->query('showposts=3'.'&paged='.$paged . '&post_type=page' );     ?>     <?php //query_posts('showposts=3'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
         <?php $image = get_post_meta($post->ID, 'Image', true); ?>             <a href="<?php the_permalink(); ?>">                 <img class="post_image" width="251" height="292" src="<?php echo $image; ?>" alt="" />
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

      I want to put 3 specific pages that I want on the main index page. How do I make it so?


Set featured image size for a custom post type

I have a custom post type, and I'm adding support for thumbnails (featured image)                       register_post_type('cp_companies', array(                 'labels' => array(                     'name' => __('Companies'),                     'singular_name' => __('Company')                 ),                 'public' => true,                 'has_archive' => true,                 'supports' => array('thumbnail', 'title', 'editor')                     )             );      This is not a theme. This is a plug-in. What I want to do is simply limit (120x120) the size of the featured image.


HTTP Error when uploading images

I am getting an 'HTTP Error' when uploading images to posts. What could be the reason for this? It doesn't happen all the time, sometimes I get the error, try again, and the file uploads. Actually the file always seems to upload, however it doesn't generate the different sized images or anything.


How do you create a custom template to display a category with an image and related posts below?

I am trying to create a custom template that can give the following effect...   * Category Name A (with image)     * post with category name A     * post 2 with category name A     * post 3 with category name A   * Category Name B (with image)     * post with category name B     * post 2 with category name B     * post 3 with category name B Should I do this with custom post types? If so, do I have create two, or can I manage this with one custom post type?


Rewrite rules for using the same base slug for multiple content types

I'm not sure if this is possible or not, but here is what I'm trying to achieve. I'm using WooCommerce, and I have it setup to prepend a base slug and the product category to my product permalinks. So, my product permalinks look like this: `example.com/shop/%product_category%/%product_slug%` Now, I want to create another post type called "gemstone" that uses the `shop` base page in its permalinks, so they would look like this: `example.com/shop/gemstone/%gemstone_slug%` The problem is that all of the gemstone pages 404. This is because their URLs are rewritten so that "gemstone" is assumed to be the `%product_category%` and the `%gemstone_slug%` is assumed to be the `%product_slug%`. I'm having trouble thinking of a way around this, but URL rewriting is pretty new to me. Anyone have any thoughts? As a bonus, another problem with the product permalinks is that their attachment pages (e.g. `example.com/shop/%product_category%/%product_slug%/%attachment%`) all 404 as well. For reference, I have opened a bug ticket for the attachment page issue on the WooCommerce github.


How can I modify wp_nav_menu with walker?

I would like my wp_nav_menu to output in the format for jquery ui:
Section 1

     Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer     ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit     amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut     odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

Section 2

     Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet     purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor     velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In     suscipit faucibus urna.

      The list has two levels. I've successfully changed the top level, but I'm having trouble with the second level. How can I do this? Is there an easier way than extending the walker class?


After activating a Plugin, /wp-admin is no longer accessible

After installing/activating AWPCP (Another Wordpress Classified Plugin), when I type wp-admin/ I get a blank page but with /wp-login.php the login appears. I this there's a problem with redirection or .htaccess with that plugin but I can't find out what it is.


Force image rename based on post title for the following script

I am looking to have this upload rename image titles to match the post title. So instead of 0182012018228_sometitle.jpg it would be like daves-and- busters.jpg and the next file call daves-and-busters-1.jpg. Possible?                   <?php /*     Template Name: Uploading Page          */?>          <?php get_header();     ?>

         <form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
         upload         <input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">

         <input type="hidden" name="post_id" id="post_id" value="<?php echo '212';?>" />         <?php wp_nonce_field('client-file-upload'); ?>         <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

         <input type="submit" value="Save all changes" name="save" style="display: none;">
         </form>          <?php     if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {         require_once(ABSPATH . 'wp-admin/includes/admin.php');         $id = media_handle_upload('async-upload', 1199); //post id of Client Files page         unset($_FILES);         if ( is_wp_error($id) ) {             $errors['upload_error'] = $id;             $id = false;         }              if ($errors) {             echo "
There was an error uploading your file.
";         } else {             echo "
Your file has been uploaded.
";         }     }          get_sidebar();     get_footer();?>


Author url rewrite

The default author permalink is:               http://domain.com/author/{username}      How can I do something like this ?               http://domain.com/author/{username}/songs      http://domain.com/author/{username}/books     http://domain.com/author/{username}/movies      If someone visit songs permalink, wp should display songs of the respective author. If someone visit books permalink, wp should display books of the respective author, and so on! Any idea about how can I do this !? **Later edit** mySQL table: favs   * id   * post_id   * author_id   * fav_type (song, book, movie)


Wordpress as template engine

i would like to use Wordpress as template engine in my custom bootstrap/zurb foundation sites. I found there's lot of custom styles included in wordpress articles by default. Are there any ways how to get 'pure'(not formatted) content from wordpress ? Would be cool to use lightweight customized,mobile friednly website powered by wordpress in 'backend'.


Admin plugin, how can I output a different content-type?

I'm creating a plugin with an admin page that needs to:   * stream a file for download (set content-type & other headers)   * display HTML without the admin menu etc In both of these cases the 'pages' **must** be accessible only to logged in administrators. So far I've found one way to accomplish both of these, by including wp-blog-header.php in a php file, checking the user is an admin and doing things myself from then on, as below.               require('../../../wp-blog-header.php');          if (!current_user_can('administrator'))     {         wp_die( __('You do not have sufficient permissions to access this page.') );     }           ...set headers & stream file      Is there a better way of doing this? Is there any reason I shouldn't do it this way? Thanks :)


See which user installed a plugin?

Are there any DB entries made when a plugin is installed, and if so does this indicate which user did so?


WordPress on WP7

Is there an app for the Windows Phone (7) that allows submission to WordPress? Having used the WordPress app on the Blackberry, I'm looking for one that is similar to that, but for the WP7. I've had a look and not found anything, though there are rumours (potentially unsubstantiated) that one is being created..


is there import_id parameter for wp_insert_term to create custom id for category

is there option to create category with custom id like custom post id is created using parameter import_id ? `$post = array( 'post_title'=>'whatever', 'post_content'=>'whatever', 'import_id'=>123 ); wp_insert_post($post); ` what i want to do is create custom post type ( will import data from table which have category id attached ) using wp_insert_post so i want to create categories with custom id that are attached to products table right now i'm using custom field added to categories as OLD_CATEGORY_ID and get posts against this custom field id categories are also imported to wordpress or is there another better way ? or this is the ONLY way ? :)


wpdb->insert adds too many rows

I have the following code in my `functions.php`               $ar = array(         'price_content' => 'hello'         );          $result = $wpdb->insert('hs_prices', $ar); // insert 'hello' into 'price_content'      This should just create one row, but it creates 12 in the database. I am on the homepage of the website when I run this (by refreshing the page). Could this be because the code is in `functions.php`, and it's being included 12 or so times throughout the site? **edit:** It shouldn't be because it's in `functions.php`, as it also does it when on `index.php`. Must be the query. What could be the cause of this?


Custom menu breaks down

This code : http://icodesnip.com/snippet/php/wordpress-show-custom-types-in- categories .. achieves its purpose which is to make category page work with a custom post type, but in my case it also destroys my custom menu, that is, my custom menu is empty. I want my custom menu AND my category page to work.


Adding elements to wp_list_pages (within <li>, but before <a>)

I'm working on my first wordpress theme and I'm running into some trouble. I'd like to add an extra div (which I'll style in css) within each `<li>`, but _before_ the actual `<a ... >` element In my theme, I'm using `wp_list_pages('&sort_column=menu_order&link_before=<div></div>&title_li=');`, which results in _almost_ what I want, but not quite. The out put I get from the method call above results in this:

Page Name A

Page Name B
      as you can see, this places the `<div>` within the `<a>` and not before it. I've tried using the CSS :before selector to do what I want, but it won't work in this instance because I am adding some styles to the `<li>`and `<a>` elements (some light skews) that I don't want to actually affect the new area that this makeshift div will use. (I've already tried reversing the skews and it didn't work for the :before selector) I've also tried using a hacky regex to get this done: `echo preg_replace("/>\s*<a/i", "><div></div><a", (string)wp_list_pages('&sort_column=menu_order&title_li='));` but that still didn't work (which really puzzled me). I know this is kind'of odd, so any help is greatly appreciated!


Dynamic filtering of posts with custom taxonomies

I am currently trying to make a business directory where the users can filter the results by:   1. Type of service   2. County I am using a custom post type for the business directory, and I have created 2 custom taxonomies:   1. Type of service - works like a category   2. County - works like tags I need a dynamic query that will let my users first choose a type of service, then choose a county and then get a list of results - or the other way around; they choose a county first and then a type of service. Is this possible? Or do I have to do this with categories and sub-categories?


Loop through widgets in sidebar

I have a sidebar called footer, I know I can use dynamic_sidebar() but I need to be able to split that into individual widgets. I have the following so far which gives me the widget name e.g. text-1, category-2 etc but I am after the content for each of those.               $widget_list= get_option('sidebars_widgets');     if($widget_list)      foreach($widget_list["footer"] as $widget){       var_dump($widget);      }      Is this possible to get the widget content from the widget name?


How to force a query conditional?

There is a long-standing WordPress core bug (#16373) in which, if custom query variables are registered and present in the query string, the query will not set `is_front_page()` true, even if `'page' == get_option( 'show_on_front' )`. Full details are in the trac ticket, but the end result is that the front page returns an invalid page instead of `get_option( 'page_on_front' )`. I have a certain use case in which I need to pass custom query variables to the query string on the front page (using a form to pass registered query variables, which are in turn used to filter Theme options - a front-end Theme options demo). The above-mentioned trac ticket was closed as invalid, so I need a work-around. I can force the front page template easily enough, like so:               function themeslug_force_front_page_template( $template ) {         if ( '' != get_query_var( 'foobar' ) ) { // Registered custom query var             return get_front_page_template();         }         return $template;     }     add_filter( 'template_include', 'themeslug_force_front_page_template' );      However, the underlying query conditionals are not impacted. So any code dependent on `is_front_page()` being `true` (such as, say, a slider that only displays on the site front page) will still not render properly. I have attempted to modify `$query` at `pre_get_posts`, but this does not appear to be working:               function themeslug_force_static_front_page( $query ) {         if ( $query->is_main_query() ) {             if ( 'page' == get_option( 'show_on_front' ) ) {                 if ( '' != get_query_var( 'foobar' ) ) { // Registered custom query var                     $query->set( 'page_id', get_option( 'page_on_front' ) );                     $query->set( 'is_home', false );                     $query->set( 'is_page', true );                     $query->set( 'is_front_page', true );                 }             }         }     }     add_action( 'pre_get_posts', 'themeslug_force_static_front_page' );      The query conditionals are not modified. Am I attempting incorrectly inside my callback? Is there a different/better way to force the query conditionals, in particular `is_front_page()`? ## Edit Note that setting the `page_id` **does** work in the `pre_get_posts` callback:               $query->set( 'page_id', get_option( 'page_on_front' ) );      If I omit the `template_include` filter, the displayed page is, indeed, the page assigned to the front page; however, `get_page_template()` is used, rather than `get_front_page_template()`. So, setting `page_id` at `pre_get_posts` does cause `is_page()` to be true. But the aforementioned bug prevents `is_front_page()` from being set to `true`. ## Edit 2 Per @toscho's request, here's some query var code, for context. Register query variables:               /**      * Add options-related query variables      */     function themslug_add_theme_demo_query_vars( $qvars ) {         $qvars[] = 'demo_foo';         $qvars[] = 'demo_bar';         $qvars[] = 'demo_baz';         return $qvars;     }     add_filter( 'query_vars', 'themeslug_add_theme_demo_query_vars' );      (Where `foo`, `bar`, and `baz` are Theme options - background, various colors, etc.) How they are used is simply to add a filter to a Theme option - that part is out of the scope of the question, so I'll omit it here. They are output on the front end via custom Widget. The Widget output is just a form. Here's an example of one of the form fields:
Foo
     <input name="demo_foo" id="demo_foo" class="pickcolor"  type="text" value="<?php echo $foo_setting; ?>" data-default-color="<?php echo $foo_setting; ?>" />      Generated query string on-submit:               www.example.com/?foo=some_value


Get posts from taxonomy URL

How can I get the posts from a custom taxonomy using the URL to determine which taxonomy term id is being shown? I tried to get posts via a category using `get_category_by_path` which returned false when passing the URL because the custom taxonomy isn't the same. Is there an equivalent function which will do this for taxonomies? I've google and scanned the Wordpress codex and found nothing. Many Thanks


Combining Post Thumbnails With Nivo Slider

I am wanting to use the post thumbnail with the nivo slider and for it to generate the image from a custom image size (already declared in my functions file) I wrote this (for generating the images)               <img src="<?php the_post_thumbnail(); ?>" data-thumb=""<?php the_post_thumbnail('sliderimage')> title="" />      It doesnt seem to load the images, however if i take away the image tags etc it works. Can the above be achieved this way so that it auto generates the thumbnails and loads the images?


Minimalistic schedular

I've been looking at schedulers and appointment maker plugins the last few days, but so far haven't found anything suitable. So thought I'd ask, Basically I just want to be able to list a loads of dates for scheduling games and practices in the admin section and then to display say the next 5 - 10 games and practices on the home page in their own little discreet section/sidebar/widget. Something like this is what I'm after at this site hcusoccer.ca/ at the bottom on the right. Does anyone know of anything that may be good? Everything i've come across so far is probably a bit to big and advanced. Does anybody have any good ideas? Thank you


Successful or Error Message after running mysql code in functions.php

Just for this article, suppose there is a code that I want to run on my WordPress' functions.php file. It's a code to delete mysql table on my database. For example, here's the code:               $wpdb->query( "     DELETE FROM $wpdb->posts     WHERE anything = 'whocares'     " );      The code works, but I want to show a Successful or Failed message after running the code. I also have a code which shows the success message after running, which is here:               function remove_contributors() {         global $wpdb;         $args = array( 'role' => 'Contributor' );         $contributors = get_users( $args );         if( !empty($contributors) ) {             require_once( ABSPATH.'wp-admin/includes/user.php' );             $i = 0;             foreach( $contributors as $contributor ) {                 if( wp_delete_user( $contributor->ID ) ) {                     $i++;                 }             }             echo $i.' Contributors deleted';         } else {             echo 'No Contributors deleted';         }     }     remove_contributors();      Tell me how I can do it in my simple code. Thanks for the time!


Advanced Custom Fields Plugin - not displaying images

I installed the plugin and assigned it to the relevant page but the problem is that the custom fields display 'no image selected' after I have uploaded them and do not appear on the relevant page. Any ideas? For reference, I have set 'Page Template' as equal to 'Home' (the relevant page) on the custom fields rules. This is the code I am using to call the image on the template:               <img src="<? the_field ('image_2'); ?>" class="middle" alt="image2"/>


Advanced Search by minimum/maximum values

I'm building an advanced search form which allows me to search by different parameters. Currently, searching by taxonomies work fine. My issue occurs with trying to set a minimum price to search by. Here's the code in my functions.php file:               function advanced_search_query($query) {         if ($query->is_search) {             $query->set('post_type', array( 'properties' ));                  if (isset($_GET['propertyfor'])) {                 $query->set('taxonomy', 'propertyfor');                 $query->set('terms', $_GET['propertyfor']);             }                  if (isset($_GET['propertytype'])) {                 $query->set('taxonomy', 'propertytype');                 $query->set('terms', $_GET['propertytype']);             }                  if (isset($_GET['minPrice'])) {                 $query->set('meta_query', array(                     'key' => 'shru_price',                     'value' => $_GET['minPrice'],                     'compare' => '>=',                     'type' => 'NUMERIC'                 ));             }         };         return $query;     };     add_filter('pre_get_posts', 'advanced_search_query', 1000);      As you can see, I'm trying to use a meta query to handle it but nothing is happening. The minimum price is completely ignored when displaying results. Anyone know how to fix? Edit: FYI, the numeric values are stored in the database without any special characters. UPDATE: It works for the following, where i set a min and max value and use BETWEEN:                   if (isset($_GET['minPrice']) && isset($_GET['maxPrice'])) {             $query->set('meta_query', array(                 array(                     'key' => 'shru_price',                     'value' => array($_GET['minPrice'], $_GET['maxPrice']),                     'compare' => 'BETWEEN',                     'type' => 'NUMERIC'                 )             ));         }      but not for what I originally posted where only one is set and i use `>=` or `<=`. I used elseif statements between each but still no results were being produced.


Private replies for comments

Currently in the Comments section, if you (the admin) wants to reply to a pending comment, perhaps to warn them or whatever, the only way to send the reply is by clicking 'Approve and Reply'. Is there a way to send a private message to the submitted email address (besides manually writing an email) before approving the comment?


Problem with custom function from jQuery slider tutorial

I found the perfect slider for my needs, the only issue now that is that I cannot get it to work correctly. Problem that occur is that the function created doesn't work like it should. It ought to display three posts from a specific category but it ends up pushing more posts, presumedly via the loop in the function. And the slider effect won't work at all - probably because of this. Check the url below. It's step 2, at the bottom. The code for slideshow_featured_posts. I have a feeling something is missing in the code, because I already see that we're missing php-tags in it. But I can't see what. Can anyone who knows this better than me help out? http://www.paddsolutions.com/how-to-integrate-jquery-cycle-plugin-to- wordpress-theme/


Passing JSON-encoded HTML from Wordpress to JavaScript

I'm trying to pass a post's content (which may contain HTML) to JavaScript via wp_localize_script(). wp_localize_script() can't handle multi-dimensional arrays, so I'm encoding it in JSON and then decoding it with jQuery. That works fine as long as you it's only text and you replace the `"` entity with a regular `"` before you call `$.parseJSON()`. If you try to parse a post with HTML in it, though, you get errors like, > JSON.parse: expected property name or '}' http://redacted.local/wp/wp- > includes/js/jquery/jquery.js?ver=1.6.1 Line 16 So, I'm guessing I need to do some more string manipulation before trying to parse it, to convert more entities back to the regular characters, but I don't want to just pick the few characters I'm having errors with because I'm sure there are dozens more that I might miss. Is there a comprehensive or standard way of doing this? I've done a lot of searching and having found any answers, so it makes me think I'm missing something obvious. Here's the PHP side:               public function loadResources()     {         // ...               wp_register_script(             'bgmp',             plugins_url( 'functions.js', __FILE__ ),             array( 'googleMapsAPI', 'jquery' ),             self::BGMP_VERSION,             true         );              // ...              if( !is_admin() && $this->mapShortcodeCalled )         {             // ...                  wp_enqueue_script('bgmp');                  $bgmpData = array(                 'options'   => $this->getMapOptions(),                 'markers'   => $this->getPlacemarks()             );             wp_localize_script( 'bgmp', 'bgmpData', $bgmpData );         }              // ...     }          public function getPlacemarks()     {         // ...                  foreach( $publishedPlacemarks as $pp )             {                 // ...                      $placemarks[] = array(                     // ...                     'details'   => $pp->post_content,                     // ...                 );             }              return json_encode( $placemarks );     }      And here's the JavaScript side               // ...          init : function()     {         // ...              bgmpData.markers        = $.parseJSON( bgmpData.markers.replace(/"/g, '"') );              // ...     },          // ...


Get wp-load.php PATH with wp_localize_script and JavaScript for plugin

I just learned about wp_localize_script() and it's very cool. I read Otto's post and Gary Cao's post, but I'm learning Ajax so I'm trying to wrap my head around getting the path to wp-load.php this way. I have array like this in my test env:               $data = array(     'test' => 'test2',     'wp_get_site_url' => get_site_url(),     'wp_abspath' => ABSPATH,     'wp_load' => get_site_url() . '/wp-load.php',       'foo' => 'bar',     'setting' => 123 );      Inside my plugin, how to declare data.wp_load (dynamic) path?               <script>How_Do_I_Declare data.wpload; alert('thanks'); </script>      If I'm doing things wrong, I'd love your help. I'm currently reading Ajax_In_Plugins as I type this. Thanks.


Mystery URL http://#/ Listed in XML Sitemap Created by WordPress SEO by Yoast Plugin

I'm using the Wordpress SEO by Yoast plugin. I'm having problems getting the Sitemaps XML section to work properly. Google gives me the dreaded red X for the status of the sitemap. The error message Google gives is: 208 "Invalid URL This is not a valid URL. Please correct it and resubmit." The incorrect Google XML lists is: http://#/ . In the XML sitempap created by the plugin, I can see that that URL is listed. I'm not sure where the XML Sitemap generator came up with this URL. In order to get my dropdown menus to work, I set the URL to # on some blank pages that only have a title. For example, the first child in my navigation is a blank page with a URL set to # and a title of "A-C". The "A-C" page's children are the pages of all of the areas starting with A thru C. I set the "A-C" page's robot meta to noindex, nofollow. Does that have something to do with the problem? I don't have a page named http://#/. As I don't have a page with this URL listed in my WordPress Pages section, I can't set it to noindex, nofollow. Any suggestions on how to solve this problem? Thank you.


Standard API for rendering a date form

I'm hoping to enhance an existing plugin's setting page by adding an 'end date' form. I know how to add text and other form fields but was wondering if there is standard function that will render a year/data/time form. No sense in re-inventing the wheel. Thanks for all tips.


Overriding the default WP Multisite notification e-mail

Is it possible to hook in and override the default notification message for WP MS? I know the message being sent out is in /wp-admin/user-new.php               if ( is_multisite() ) {         function admin_created_user_email( $text ) {             /* translators: 1: Site name, 2: site URL, 3: role */             return sprintf( __( 'Hi,     You\'ve been invited to join \'%1$s\' at     %2$s as a %3$s.     If you do not want to join this site please ignore     this email. This invitation will expire in a few days.          Please click the following link to activate your user account:     %%s' ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) );         }         add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );              function admin_created_user_subject( $text ) {             return "[" . get_bloginfo('name') . "] Your site invite";         }     }      I believe I can do it if I can find the right hook in so that I can remove_filter() and then add my own in. I had been toying with the following (admin_created_user_email2 is my new function):               function reset_admin_email(){         remove_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );         add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email2', 1 );     }      I was reading this page that lists the actions/hooks I can tie into, but I can't figure out which one to use (if any of them will even work) Does anyone have experience with this to point me in the right direction? Thanks   Levi


How to append to menu items selectively

I'm making this wordpress theme, and I need to create a menu that is vertical but its submenus are horizontal, like this:               MenuItem      SubmenuItem | SubmenuItem      AnotherMenuItem      SubmenuItem | SubmenuItem      Now using wp_nav_menu() and CSS I can get this effect, but I don't have any idea on how to add the pipe symbol to separate the submenu items.               wp_nav_menu(array(                 'container'=>false,                 'after'=> ' | ',                 'theme_location'=>'home-menu',                 'menu_id'=>'main_nav_left',                 'menu_class'=>'main_link',             ));      is no good as it will turn out as               MenuItem |      SubmenuItem | SubmenuItem |      (adding a | after every item, which is the documented behavior) I was wondering if there was a way to selectively add the pipe symbol so that it is added only between the submenuitems and not after anything else. According to WP documentation, there doesn't seem to be a built-in method to support this. So what is the best way to accomplish this effect (without editing wp core code)?


Timed post and tweet?

I'm new to wordpress. Is it possible to say i would like to make this article public on this day and time AND have wordpress tweet it? Possibly tweeting the subject+link or a twitter msg i add in + link on that said time/date?


How can I change the title of the Home link in the navigation bar?

I use Bones theme with a static front page. The header.php calls the `bones_main_nav()` function without parameters, while `bones_main_nav()` only calls the `wp_nav_menu()` function.


How to get an array of post data from wp_query result?

When run a query with WP_Query method, I got an object. I understand that I can then do the loop to display stuffs. But, my goal is not to display anything, instead, I want to get some post data by doing something like "foreach...". How can I get an array of post data that I can loop through and get data?


how to store wordpress loop in array?

I am working on a site. This site has a built in layout organize that uses a switch statement to organize data on a page. I want to use that to organize the homepage posts. Right now, there are 4 posts that I have a loop set up to return. Here is the loop I am running               query_posts( array ( 'category_name' => 'homepage', 'posts_per_page' => -1 ) );     global $more;     $more = 0;     while ( have_posts() ) : the_post();     the_excerpt();     endwhile;     wp_reset_query();      I need to be able to get the 4 posts returned into this switch               $layout = $data['homepage_layout']['enabled'];              if ( $layout ) :             foreach ( $layout as $key => $value ) {                 switch ( $key ) {                     case 'block_one' :                                          //post one would go here                         break;                     case 'block_two':                                          //post two would go here and so on....                         break;                     case 'block_three':                         break;                     case 'block_four':                         break;                   }                                 }         endif;      For the life of me, I cannot figure it out.


unsual theme / interface

Hello I’m currently developing a wordpress site for a company i’m working for. The site is basically going to be used for internal purposes and to be used as a manual for new workers. They want something with a interface on the front page to get from 1 page to the next so it flows. I’ve not came across any theme that can seem to do this that suits there needs. To describe it better, imagine the user is goes onto the website, and begins the training, they link the first link and read that first article, they can then go to to the next section. but if they want they can come out into a hub like layout where they can see the following steps. I’ve no idea if this exists but if anyone can give any suggestions I would be most grateful. Thank you for taking the time to read this.


cross-site custom menu

i have a multisite whice i want to separate because its unneccery as two of my sites are on the same DATABASE and all i need is actually the dynamic custom menus which i have built in the main site(to let them be on the other site...) i have this code from here(wordpress answers): How to duplicate custom menu settings to export to another site               $wpdb->get_results(sprintf("         select tr.object_id from wp_terms t          left join wp_term_taxonomy tt on t.term_id = tt.term_id         left join wp_term_relationships tr on tt.term_taxonomy_id =              tr.term_taxonomy_id         left join wp_posts p on p.ID=tr.object_id         left join wp_postmeta m on m.post_id=tr.object_id         where t.slug ='%s' and tt.taxonomy='nav_menu' group by(ID)         order by p.menu_order asc LIMIT 200;         ",$menus));      and it suppose to do the job, but it doesnt.... what it needs to do is to get all the menu items... im stuck at the moment... my goal is to use the main site custom menu on the other site through the database.


Wordpress Multiple Category Search

From few months I am digging into wordpress for multiple category search options, and finally came up with this. I just found that wordpress allows multiple tags, which means that if in your URL you type this               http://yourblog.com/tag/tag1+tag2      then it will return all your posts with having tags, tag1 **AND** tag2 but if you type `http://yourblog.com/tag/tag1,tag2` then it will return all the posts having tag1 **OR** tag2 Same thing now works for categories also `http://yourblog.com/category/cat1+cat2` and `http://yourblog.com/category/cat1,cat2` But this only works for category and tags, I am trying it for search option. Till now I coded where this URL is working(which means it will search HTML only in the category id 114), `http://yourblog.com/?s=html&cat=114` In this URL, the **comma separator** works very well, but not the **+** I mean to say `http://yourblog.com/?s=html&cat=114,115` works very well but `http://yourblog.com/?s=html&cat=114+115` doesn't works. Can anyone help me in this? I really want this to work Still awaiting


permalink error when modifying sanitize_title_with_dashes function

By default, wordpress remove accents and weird characters to generate `post_name` in wp_posts table. This post_name is used when we change the permalink structure to `/%postname%/` or some similar structures. In my language, i don't want to remove and replace many characters as it distorts the meaning. I have change the `sanitize_title_with_dashes` function in wp- includes/formatting to: > function sanitize_title_with_dashes($title) {               $title = strip_tags($title);`     // Preserve escaped octets.     $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);     // Remove percent signs that are not part of an octet.     $title = str_replace('%', '', $title);     // Restore octets.     $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);      /* comment out this code block               if (seems_utf8($title)) {         if (function_exists('mb_strtolower')) {             $title = mb_strtolower($title, 'UTF-8');         }         $title = utf8_uri_encode($title, 200);     }          $title = strtolower($title);      */               $title = preg_replace('/&.+?;/', '', $title); // kill entities     $title = str_replace('.', '-', $title);      // comment out $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);               $title = preg_replace('/\s+/', '-', $title);     $title = preg_replace('|-+|', '-', $title);     $title = trim($title, '-');          return $title;      } The post_name is correctly generated for all characters in my language, for example `http://1.todaytravels.info` in the latest post, the url is very good, but wordpress simply does not find the post (it says `not found`). I guess i need to change something in permalink structure so that WP query to the correct post. Anyone know how to resolve this problem? Thanks for any help!


Rewrite category wordpress

Is it possible to rewrite only one category ? I have a category "Photos" and just for this category. I just want to rewrite it from /category/photos to /photos


Creating a Freemium plugin in the WordPress Repository

I would like to create a freemium model plugin and put it in the WordPress repository. I've been going through the rules for uploading plugins into the repository, but haven't got a clear indication on whether this is allowed or not, so I am searching for clarification here. http://wordpress.org/extend/plugins/about/guidelines/ I also came across WYSIJA which is a freemium plugin, and it is hosted in the repository without any problems, so I'm assuming it's ok to do this, however I would like some definitive reply on this.


Sliding pages + wordpress

do you have any idea how to achieve such effect with wordpress? http://www.papajastudio.pl/ http://soulwire.co.uk/ I mean the navigation. i want to have simple cms to edit website content + such sliding effect. An ideas?


remove older posts link

I use these following codes to delete older posts and newer posts links in `functions.php` but it still shows them.                function remove_post_navigation() {         remove_action('thematic_navigation_below', 'thematic_nav_below', 2);             remove_action('thematic_navigation_above', 'thematic_nav_above', 2);     }     add_action('init', 'remove_post_navigation');      How to remove them?


Combile External JS files using W3 Total Cache

Is there any option or is it recommended to combine external JS files using W3 Total Cache plugin for wordpress. When I say exxternal JS files, I mean that I want to combine .JS files that on other domains/CDNs, like the .JS for facebook like button, Google+1 ,etc. I want them to be combined using w3 total cache. Is it possible?


Simple text and image slider

I've been looking for a slider that can slide whatever kind of content that I want to enter. I tried out various Wordpress plugins, but most of them only can slide Wordpress posts or images only with a small caption. I'm looking for something like the WP Photo Slider 50. Unfortunately this slider doesn't work in my theme, though as there is a jquery conflict and I have no clue how to modify the plugin so that there won't be a conflict (if possible at all). I was wondering if somebody could help me find a slider plugin similar to the one above, direct me to a "how to creat a slider yourself" website or help me figure out how to get rid of the jquery conflict with the plugin mentioned above. My website (still heavily under construction): here Thanks a lot in advance :)


duplicate sidebar

I have a problem with a sidebar. I have 4 sidebars: "Essential", "Essential+", "Premier" and "Premier+".               register_sidebar(          array(              'name'          => __('Essential Plan'),              'before_widget' => '
',              'after_widget'  => '
',              'before_title'  => '',              'after_title'   => ''         )     );     register_sidebar(         array(              'name'          => __('Premier Plan'),              'before_widget' => '
',              'after_widget'  => '
',              'before_title'  => '',              'after_title'   => ''         )     );     register_sidebar(         array(              'name'          => __('Essential+ Plan'),              'before_widget' => '
',              'after_widget'  => '
',              'before_title'  => '',              'after_title'   => ''         )     );     register_sidebar(         array(              'name'          => __('Premier+ Plan'),              'before_widget' => '
',              'after_widget'  => '
',              'before_title'  => '',              'after_title'   => ''         )     );      I have to render "Premier" and "Premier+" in the same page. When I do this WordPress renders the same content for both pages, how can i fix this?   why is this happening?


How to display posts from two taxonomies?

I have site with rankings of doctors. Medical specialization and localization where doctors live is stored as a taxonomy. For example:   `city -> New York, London, Paris`   `specialization -> surgeon, dentist, orthopaedist` If I want to display all the doctors from London, I have to navigate with my browser to: `http://my_site/city/london` but where should I navigate when I want to display all dentists from London?


Set JPEG compression for specific custom image sizes

I use various custom image sizes (by `add_image_size`) and I have set my JPEG compression to 30% with this filter:               function jpeg_quality_callback($arg) {        return (int)30;     }     add_filter('jpeg_quality', 'jpeg_quality_callback');      If I am not mistaken, the above code compresses **all** of my custom image sizes with 30%. Now, for two of my custom image sizes named `splash1` and `splash2`, I want to set the compression to 80%. How is this possible? Or alternatively, exclude those image sizes from the 30% compression filter.


Notification to author on posts bulk trashing not working

I am trying to notify the author when a post is trashed. It is working properly, but when trying to trash multiple post from bulk action (move to trash), then it's not working. Any suggestions? Here is the code I'm using               add_action('trash_post', 'sendmail');


Reordering themes in admin panel

I've been searching for a hook to change the order in which themes are displayed in the admin panel (i.e. wp-admin/themes.php) but so far haven't been successful. Is there an existing hook to do this, or another workaround so I can have a custom non-alphabetical ordering - i.e. have certain themes display before the rest?


how to insert a HTML form into a javascript popup?

I'm working on a plugin that generates a list of candidates as output. For each candidate there is a link (View Details) that once is clicked, a popup appears. I need to put a simple contact form into that popup, so when a visitor click on the candidate's link, the popup appear and the visitor can get into touch with the website owner and ask references about that candidate. As I said, all this is done by a plugin. I'm having problems in making a simple modal contact form from that plugin. Any idea in how to do that?


Unable to process php via shortcode

I've been searching around for a fix to this and while I definitely have a much better understanding of my issue (thanks to similar queries posted by others) I am still not sure of the solution. I am writing a shortcode as follows:               function cup_bc_shortcode(){          $html = file_get_contents('/html/cup_bc_layout.php', true);     return $html;     }     add_shortcode('budgetcalc', 'cup_bc_shortcode');      The file 'cup_bc_layout.php' contains html and PHP. The PHP code is being rendered as text on output rather than being processed by the browser. Is there anyway to include the PHP file in a manner similar to this? I appreciate that the shortcode must return the output in order to work but I'd prefer not to have to build this up as a single string from within this function if I can help it. Also I am quite new to PHP so even the most obvious of solutions may have eluded me. Your help greatly appreciated.


Custom taxonomy display name issue

i have created custom taxonomy named Locations , everything is working fine, but whenever i add a taxonomy, everywhere is showing the taxonomy name as Category not as Location, `Like Add New category` and so on , in wp-admin               function reg_location_taxonomy() {         register_taxonomy( 'location', array( 'product' ), array( 'hierarchical' => true, 'label' => 'Locations', 'singular_label' => 'Location', 'rewrite' => true ) );         // register_taxonomy_for_object_type( 'location', 'product' );     }     add_action( 'init', 'reg_location_taxonomy', 0 );


Ways to show multiple, separate galleries per post?

I'm working on a project that will require two separate galleries to be displayed on the same post. One gallery is specific to the product and the other is professional generic shots. The content of both galleries will change with every post. I need to figure out how to show two separate galleries on a post and repeat this process daily. The only way that I can think of is to store images in another post (post-b) and insert post-b using either @MikeSchinkel's or @Scribu's post to post connector. What would you do?


How can I allow trailing slashes on some URLs without a redirect, but not on others?

Here's the scenario. Assume I have a site, wordpress.site, which has the following Permalink structure: `/%postname%` Assume I then set up the following posts:   * /post1   * /post2   * /post3 If someone were to type in "wordpress.site/post1/" (extra slash), Wordpress will automatically 301 redirect the user to "wordpress.site/post1". So far so good. But now, let's imagine that there's an old URL "/post4/", and for SEO reasons, I want to create a post for this URL **_and_** keep the trailing slash? In other words:   * Calling wordpress.site/post4/ does not redirect to wordpress.site/post4 but   * Calling wordpress.site/post4, would redirect to wordpress.site/post4/ and   * Calling wordpress.site/post1 does not redirect, but    * Calling wordpress.site/post1/ would redirect to wordpress.site/post1 How would I go about achieving this? I attempted to do it by using add_rewrite_rule(), but couldn't seem to achieve what I was after (I was still redirected, and yes, I did flush the rewrite rules). Sample code:               add_action( 'init', 'my_rewrite_func' );     function my_rewrite_func()     {         add_rewrite_rule( 'post4/$', 'index.php?p=12', 'top' );     }      Any suggestions?


Page cache for categories not updating with W3 Total Cache

I noticed recently that the full page cache for category pages isn't getting updated. Other pages seem to work fine (home, posts, etc) but categories cache files stay untouched for days until I manually rm -rf them. What could cause this? Plugin updated to latest version.


Add Wordpress to Meteor js site

I have a Meteor app that I want to add Wordpress blogging platform to. There doesn't need to be any integration, just: http://example.com/blog/ Anything behind `blog/` belongs to WP. How would I go about doing this? Thanks in advance.


Displaying a custom field

I'm trying to display a custom field called 'my_custom_field' inside the loop:               $custom_array = get_post_custom( get_the_ID() );                         echo $custom_array['my_custom_field'];      This code display "array". Should it not display the value of the custom field instead?


Multisite use language code as subdirectory

I installed wordpress in the subdiretory "/de" and activated multisite features. The Main-Blog has the url/path: mysite.de/de Now i want to add a second site for the english language with the following url: mysite.de/en But after i added the site, the subdirectory for the english site was set as: mysite.de/de/en Any ideas how i can get these site urls: mysite.de/de mysite.de/en mysite.de/fr thx!


Is author.php a core file?

I want to change the author.php with more information. Can i edit author.php without it remove my code, after a Wordpress update? Or is there some hook for this.


Wordpress actions for plugin admin UI page

How can I make a custom edit page for my plugins admin UI page, if the requested page has a query argument of `$_GET['action'] == 'edit'`? My plugins entry url looks like               /admin.php?page=parser-top-level-handle      Than I have listed all my items per row in a table. On row hover appear "edit|delete"-links and other actions. If I'm then clicking on the `edit`-link, I get the following URl:               /edit.php?page=parser-top-level-handle&action=edit&record=55      At this point, I'd like to redirect the user to the edit form. The code what I'm trying to use to be redirected to custom edit Page                add_action( 'wp_loaded', array ( 'parserAdmin', 'init' ) );               class parserAdmin {                      private $db;                      private $add_page;                           public static function init()                 {                     new self;                 }                      //the consructor for parser admin                 function __construct(){                          global $wpdb, $posts;                     $this->db = $wpdb;                           add_action('admin_menu', array($this , 'parser_add_pages') );                          $this->get_targets();                     //Here I inspect if action exits or not                                  if($_GET['action']){                                     switch ($_GET['action']){                             case 'edit':                                    //than here should be a redirect to a custom page to edit the item passing the record query argument, do I need in this case hidden sup-page?!!!                                 break;                             case 'delete':                                 var_dump('test');                                 $this->_delete_target($_GET['record'] , $_GET['post_id']);                                       break;                                       }                                }     }


disable default widgets in Responsive theme

Theme: Resposive I have added "Widget Context" and has set it to show a widget only on the start side. This works perfectly BUT on all other sides there shows a default widget "Home Widget 1" with a default text.How do I remove the default widget? /Torbjorn


how to make a wplang for network fill automatically

I made a new network in my website its default language was ar when I add a new website it does not fill it WPLANG automatically, I made it manually but how to make it fill automatically.


options creation for plugins

I am new to wordpress and learning to create plugins. I want to know how wordpress itself create options in 'wp_options' table for plugin during plugin installation or activation? How wordpress decide about these option values, which is sometimes serialized data?


'save_post' hook not working in WP 3.5

I used to have an extra option added to the 'Edit Media' screen (using the `attachment_fields_to_edit` hook, and then saving with `attachment_fields_to_save`). However, I've updated to 3.5 today, and the Edit Media screen is now based on the Edit Post screen, so those hooks no longer work in this context. To overcome this, I've added a metabox using `add_metabox()`. The metabox is displayed, but the issue is with saving the data. As the function wasn't working as I expeced, I thought I'd output `$_POST` to see what was going on. However, it appears that the function hooked to `save_post` isn't being run when I update the media. Here is my code. Can anybody tell me if I am going about this the wrong way, or perhaps if there is a differnt hook that I am unaware of for this purpose? Thanks.               /** Register hooks for creating a metabox on the Edit Media screen and then saving the values */     if(current_user_can('manage_options')) :              /** Add the option for including the image in the slideshow on the front page */         add_action('add_meta_boxes', 'add_front_page_slideshow_option');              /** Save the '_include_on_front' data */         add_action('save_post', 'save_front_page_slideshow_option');          endif;          /**      * Saves values from the 'Include in Front Page Sideshow' meta box when the users Updates the media      */     function save_front_page_slideshow_option($post_id){              echo '<pre>'; print_r($_POST); echo '</pre>';         die();              /** Check the security nonce to ensure we have the proper authorisation  */         if(!wp_verify_nonce($_POST['slideshow_noncename'], 'include-on-front-nonce')) :             return false;         endif;              /** Ensure that the user has the correct permissions */         if(!current_user_can('edit_post', $post_id)) :             return false;         endif;              /** Check if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything */         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) :             return false;         endif;              /** Update the '_include_on_front' post meta field */         if($_POST['include_on_front']) :             update_post_meta($post_id, '_include_on_front', $_POST['include_on_front']);         else :              delete_post_meta($post_id, '_include_on_front');         endif;          }


Plugins will only be installed with 777 on folder. Solution?

I'm 100% not the first asking this question, yet I want to have this question be answered to my situation.. I got Wordpress installed on my server (I host it at Versio.nl) and configured whole Wordpress as it is recommended.. Which is default. Though.. I'm not being able to install any plugin (or theme or anything related to an 'write' action. Whenever I try to install one, I get the following message: > Downloading install package from http://downloads.wordpress.org/plugin/wp- > security-scan.zip… Unpacking the package… Installing the plugin… Could not > create directory. /home/sandexs1/domains/iscs.nl/public_html/wp- > content/plugins/wp-security-scan/ Plugin install failed. Could anyone help? Please ask if you need more information to answer my problem!


making a few sites in wordpress

I have just started to build in Wordpress, and my question is how can I build a few website in WP? After I purchase domains, do I need to install the program every time I want to create a new site?


Stop auto load wp-admin admin-ajax.php

I have a multisite. I want to stop autoload `wp-admin/admin-ajax.php`. As I have search in google. I have found out option `heartbeat`. But it reduced the request.               <?php      add_action( 'init', 'my_deregister_heartbeat', 1 );     function my_deregister_heartbeat() {     global $pagenow;          if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow )         wp_deregister_script('heartbeat');     }      ?>      But I want to completely stop autoload wp-admin admin-ajax.php. As autoload wp-admin admin-ajax.php increase my cpu usage limit to 70 to 80%. So is there any option to stop autoload wp-admin admin-ajax.php request.


Wordpress shows 404 on pages 11 and above?

Recently I noticed that every page on post list above 10 shows 404 error. My site is http://skuvajme.com/, hosted on site5 and I'm using modified "Magazine Basic" theme. http://skuvajme.com/page/10 is visible.   http://skuvajme.com/page/11 returns 404 error. I don't have much experience with wordpress and php. Can someone help me to to fix this error?


Calling Custom Taxonomy Dropdown in Form

I'm writing a plugin to allow users to submit fragments of lyrics to my site. I have the plugin working minus one aspect. When entering the lyrics I would like users to be able to select the artist whose lyrics they are from a dropdown. The artists are my custom taxonomy. Here is the function I created for the dropdown:               function suq_get_create_quote_form($suq_quote_author = '', $suq_quote_text = '', $suq_quote_category = 0){       $out .= '<form id="create_quote_form" method="post" action="">';         $out .= wp_nonce_field('suq_form_create_quote', 'suq_form_create_quote_submitted');         $out .= 'Who said it?
';         $out .= '<input type="text" id="suq_quote_author" name="suq_quote_author" value="' . $suq_quote_author . '"/>
';         $out .= 'Category
';           $out .= <CALL THE DROPDOWN HERE> . '
';           $out .= 'Quote
';                   $out .= '<textarea id="suq_quote_text" name="suq_quote_text" />' .   $suq_quote_text . '</textarea>

';                   $out .= '<input type="submit" id="suq_submit" name="suq_submit" value="Submit Quote For Publication">';       $out .= '</form>';       return $out;       }      The line that reads CALL THE DROPDOWN HERE is where I'm calling the dropdown function, which is this:               function suq_get_quote_categories_dropdown($taxonomy, $output){         $myterms = get_terms($taxonomy, $args);         $output ="<select>";         foreach($myterms as $term){             $root_url = get_bloginfo('url');             $term_taxonomy=$term->taxonomy;             $term_slug=$term->slug;             $term_name =$term->name;             $link = $root_url.'/'.$term_taxonomy.'/'.$term_slug;             $output .="<option value='".$link."'>".$term_name."</option>";         }         $output .="</select>";         return $output;     }          $taxonomy = array('hhie_artists');         $args = array('orderby'=>'count','hide_empty'=>true);         echo get_terms_dropdown($taxonomies, $args);     }      How can I call the dropdown function in my form? Or have I made a mess of the dropdown function?


How to add a download link to a movie from WP media library?

All, I'm creating a custom theme for WP and it has some pages that play videos from WP media library with an HTML5 player. I wanted to also have a link next to the player to allow the users to download the videos. But a direct link to an mp4 file opens a native player in some browsers (like Chrome and Safari) and plays the video instead of opening it. So I'd have to put a note next to the link "Right click and choose save link as..." to let the users know how to save it, and I'd like to avoid that if possible. So my question is, is there a way to maybe change the mime-type of the video (but only when accessed through the download link) to "application/octet- stream", or some other way, to make the browser save the file by default, instead of downloading it?


Worldpay Integration in Wordpress

Hi: I am working on a fast food website project, the theme is configured and all the data has been placed related to fast food, like the Order Menu, The payment method that will be used to order food is Worldpay, so I need help to integrate Worldpay in my WordPress website. Please guide me that how can I integrate Worldpay in my wordpress site.


Add Content to Content()

**The Question** ::: This is a strange question but I need to add content to `content()` in `page.php`. How do I do this? **The Why** ::: You see there's a plugin that uses the [plugin id="1337"] and I am linking this id with user ID so the ID needs to be dynamic and then added to the content of the page. This way each user will see something different from the plugin it will be cool I swear. I tried added it directly to the html but no luck it has to be added to `content()` somehow. No luck finding anything online either. **Installation** ::: I'm running wordpress version 3.2.1 and using the TwentyEleven Theme


Pagination on a custom page template

I have set up a custom post type called 'Events'. For reasons that I'm not going to get into, I chose not use `archive-events.php` as the archive template for my Events. Instead, I decided to create a custom page template, `page-upcoming-events.php`, to use as an archive. I wrote a custom query in this template to pull in events. I am also limiting posts_per_page to 4. I've successfully added pagination links using the `previous_posts_link()` and `next_posts_link()` functions. These functions are generating links to the expected urls: /upcoming- events/page/2/, etc. On page 1, I get the first 4 events and the next events link. The issue I'm having is that when I go to page 2, I get a 404 error, not events 5-8. How do I add properly add pagination to a custom page template?


How do I create a widget that only allows a single instance?

How do I create a widget that only allows a single instance of a widget to be added through the Wordpress interface? The default behaviour of widgets allows multiple instances to be added. I am using the Example code from http://codex.wordpress.org/Widgets_API I have seen a similar question where the answer was to use the old widget code, but I would like to continue to use that more modern code if possible. I have seen plugins such as Twitter for Wordpress that give exact control over the number of instances allowed. Thanks,   matt


HTML generated by WP

For example, when using `wp_nav_menu` function, WP automatically generates menus with the following structure of elements and classes

Item

Item

Item

      Is there a documentation where I can find all default HTML structure, elements and classes generated by WordPress functions, so I can instruct better the Front-End Developer about how to code better when constructing the HTML of a WordPress theme?


Standard permissions for wordpress; Plugin installation asks for FTP credentials

I'm on a server that does not have FTP installed and will not have FTP installed. I have another website that I've been able to install plugins in before, including the one I'm trying to install now (WP-PageNavi). Does anyone have a list of standard permissions for WordPress that they use themselves so that they don't run into this issue? I've read the WordPress article on the topic and looked at other questions on this website. Any help is appreciated.


add_post_meta not saved

EDIT I changed it to                           if(isset($_POST['Make']))         update_post_meta($pid,"Make", $_POST['Make']);          if(isset($_POST['Year']))         update_post_meta($pid,"Year", $_POST['Year']);          if(isset($_POST['Model']))         update_post_meta($pid,"Model", $_POST['Model']);          if(isset($_POST['Trim']))         update_post_meta($pid,"Trim", $_POST['Trim']);      And now it is working intermittently END EDIT I am updating meta boxes I created. They function flawlessly on the back-end. But on the front end I am having limited success. Firebug says the `POST` request has the values in them but they are not ending up in the database. Can anyone tell me why?               add_post_meta($pid, 'Year', $_POST['Year'], true);      is posting the meta key but not the meta value of a select box? More information available if you need just let me know what it is. EDIT TO PROVIDE MORE CODE This a condensed version of the form                   <form method="post" <?php echo $enc; ?>  action="<?php           echo post_new_with_pid_stuff_thg($pid,            $new_auction_step);?>" >

              <?php do_action('cn_before_image_upload');          if(isset($_POST['Make']))     update_post_meta($pid, 'Make', $_POST['Make'], true);          if(isset($_POST['Year']))                 update_post_meta($pid, 'Year', $_POST['Year'], true);               if(isset($_POST['Model']))         update_post_meta($pid, 'Model', $_POST['Model'], true);          if(isset($_POST['Trim']))         update_post_meta($pid, 'Trim', $_POST['Trim'], true);      ?>
      This is the before_image_upload in functions.php                       add_action('cn_before_image_upload', 'custom_nate_car');                 function custom_nate_car(){                include_once 'select.php';          global $wpdb;          ?>
Car YEAR/MAKE/MODEL/TRIM:

         <select name="Year" class="do_input" size="20" id="Year">             <?php echo $opt->getYear(); ?>         </select>         <select name="Make" class="do_input" size="20"  id="Make">           <option>Choose...</option>         </select>         <select name="Model" class="do_input" size="20" id="Model">              </select>         <select name="Trim" class="do_input" size="20" id="Trim">              </select>

      the select.php that the jquery calls is formatted like this               class selectList {          public function getModel(){         global $wpdb;         $sql = $wpdb->get_results(             "                  SELECT DISTINCT model, make                  FROM wp_car_details                   WHERE make = '$_POST[id2]'                  ORDER BY model ASC                  "             );              foreach ($sql as $res) {         echo '<option value="'.$res->model.'">'.$res->model.'</option>';         }         die();     }      one public function for each of the select boxes. is there a problem with my loop? EDIT Did var_dump($_POST); Looks like the select values are not going in into the $_POST array but showing fine in firebug.


I would like to display different text on different pages

I have at the very top of my page a line of text within a h1 tag thet I use for seo reasons. the text and html around it is written in my header.php. but I would like to write differnet txt so it appears different on each page for seo reasons. for example:   * homepage- line of text reads builders in lancaster, builders in morecambe etc   * plastereing page- line of text reads plasterers in lancaster, plasterers in morecambe etc   * roofing page - line of text reads roofing in lancaster, roofing in morecambe etc I know there is the Widget Logic Plugin but that's for widgets and not the main header.php. Is there a line of code I can write in header.php to do what the widget logic would do.


Least Number of Loops to Create Custom Homepage?

I am trying to create a custom homepage where the site content is shown as follows... See image... http://i.stack.imgur.com/ykrdf.png With separate loops this is simple... 3 individual query_posts inside a category fetch loop... But I want to reduce the number of query posts from 3 to 1 per category since they are coming from the same category... Is this possible... (since I couldn't figure out how to wrap 3 iterations with a div class block)


Set cookie for visitor

I'm writing a new plugin that will allow visitor to vote. After a visitor rated a post, I'd like to block double voting. I think the better way to do it is using cookie, but of course I can't insert the code in functions.php or in the theme header. In my case it's better to set cookie via jquery or php?


Custom Background default color not changing

I need to set several default states for a theme's background. The idea is that the background changes upon choosing a color scheme. Everything is working and changing EXCEPT the background color. The color only changes if saved from the admin screen. Am I missing something?               add_action( 'after_setup_theme', 'theme_custom_background');          function theme_custom_background(){       $theme = genesis_get_option('bf_style_selection');            switch ($theme) {         case 'bf-blue':           $bg_color = 'def1fc';           $bg_image = 'header-bg-blue.gif';           break;         case 'bf-black':           $bg_color = 'dadada';           $bg_image = 'header-bg-black.gif';           break;       }            $defaults = array(         'default-image'          => get_stylesheet_directory_uri().'/images/'.$bg_image,         'default-color'          => $bg_color,         'default-repeat'         => 'repeat-x',         'default-position-x'     => 'top',         'wp-head-callback'       => '_custom_background_cb',         'admin-head-callback'    => '',         'admin-preview-callback' => ''       );            add_theme_support( 'custom-background', $defaults);     }


how to call jQuery in admin as well as in homepage

I have this jquery code inside my wordpress admin page that checks if the input value is empty.               $j(function(){     $j('form').submit(function(){               var link = $j('#input').val();         if(link == ''){              alert('hi there');         }          });          });      Now if the form is empty it will alert ' hi there'. the plugin works fine but the alert does not show on the main page. Only in the admin section. what would be the problem? here is how I am calling jquery.               function test(){     wp_enqueue_script('jquery');     wp_enqueue_script('myscript', plugin_dir_url(__FILE__). 'js/test.js');               }     add_action('wp_enqueue_scripts','test');     add_action('admin_head','test');      I would like that if the value of input is empty, the alert show also in the wordpress homepage and not only in the admin page.


How to query post by user role?

I want to query posts by their author role. And do something with the post based on the role. I know we can get the post by get_posts or WP_query, the problem is there are no argument to sort the post based on the author role. Or, we also can combine get_users and get_posts together, like this               $users = get_users(array(role => 'author'));     foreach($users as $user){     //here we can use get_posts to query the posts by the $user->ID        } .....      this is too clumsy to doing this. I want to know if there any other way to query the posts based on the role, SQL query perhaps?


Custom Form Data save after Login User

This is form on my first page. I have to manage if user is not logged in, in that Case after submit form action is Login Page.               <?php/** Template Name: Form */      get_header(); ?>          <form id="new_post" <?php do_action('post_edit_form_tag'); ?> name="new_post" method="post" action="<?php if ( is_user_logged_in() ) { } else { echo 'http://localhost/manage/login'; } ?>">
Project Title
     <input type="text" id="title" value=""  name="title" />

Category:
     <?php wp_dropdown_categories('type=post&show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=0&show_option_none=Select Category&taxonomy=category');?>

Project Description
     <textarea id="description"  name="description" ></textarea>

submit date:
     <input type="text" value="" tabindex="5" size="16" name="post_date" id="post_date" />

<input type="submit" value="Publish" tabindex="6" id="submit" name="submit" />
     <input type="hidden" name="action" value="new_post" />     <?php wp_nonce_field( 'new-post' ); ?></form>          <?php get_footer(); ?>      After Submit this form i am sending POST value on LOGIN PAge where I want to SAVE Post With UserID after user logged In . This PAGE Code :               <?php     /**      * * Template Name: Login Page     */     get_header(); ?>          <?Php     // Values Comin From 1st Page     $title =  $_POST['title'];     $description = $_POST['description'];     $category = $_POST['cat'];     $date = $_POST['post_date'];          if (isset ($_POST['login'])) {         $new_post = array(                              'post_author'    => LOGGED IN USERID,                              'post_title'    => $title,                              'post_content'  => $description,                              'post_status'   => 'publish',                              'post_type' => 'post'                              );                              //save the new post                               $pid = wp_insert_post($new_post);                                  add_post_meta( $pid, 'category', $category , true );                             add_post_meta( $pid, 'date', $date, true );             }     ?>                  <form id="login" action="login" method="post" name="new_post">
Site Login

             Username             <input id="username" type="text" name="username">             Password             <input id="password" type="password" name="password">             <input class="submit_button" type="submit" value="Login" name="login">               <?php wp_nonce_field( 'ajax-login-nonce', 'security' ); ?>             <input type="hidden" name="action" value="new_post" />             <?php wp_nonce_field( 'new-post' ); ?>         </form>     <?php get_footer(); ?>      So This is Code which i am using.


How come `wp_options` table does not have an index on `autoload`?

In the beginning of each page served by WordPress, there is a MySQL call to fetch options:               SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';      Because there's no index on `autoload` column, MySQL has to lookup ALL rows. I also came across the comment of this answer saying there would be no performance gain even if there was an index. In my application, I used a lot of transient values to serve as a session replacement. They worked great and I have my own garbage collection routines. I noticed that in the `wp_options` table, my transient values (the ones beginning with `_transient_`) all have `autoload=no`. I expect the number of rows of my `wp_options` table to increase as the number of concurrent user increases. I'd like to know why the table is designed this way. And should I create an index for my particular case?


pasting code in wordpress blog

I am using wordpress for my blog. I disabled visual editor. I tend to use markdown for writing so I installed 'Jetpack Markdown' plugin for wordpress. Also I installed 'Auto SyntaxHighlighter' for code highlighting. However, there is a problem to deal with "#include <iostream>" or "template <typename T>" 1) cannot show code correctly 2) extra tags in the end Somebody says it is due to smart quote. I disabled it with plugin "Disabler", but it did not work. I am not sure whether it is due to 'Jetpack Markdown' plugin. I just want to use markdown and code highlighting feature. * * * I fixed it by 'SyntaxHighlighter Evolved" plugin for code highlighting. Thanks.


Custom Post Type and Taxonomy pagination permalink

I have a custom post type of galleries with pagination for the posts thumbnails. It worked great until I activated the permalinks in the WP admin panel. I saw many posts on this problem but none of them helped me solve this problem. Here is the link to my gallery: Heseg website Thanks


Multi Upload In Theme Options

I need to use the WordPress media upload on a theme options page. It needs to be able to have multiple fields on one page. I have seen a few things on the site using search but nothing recent and nothing i can get to work. Can someone please show me an easy way to do this. Would really like to use the new gallery style where you pick a picture from the media gallery, or choose to upload.


CPT in Posts tab instead of its own tab

I was wondering for CPT list and editing pages to show under Posts tab instead of creating its own tab. I really want to use CPT (over using categories) because I'd have control over capability and different templates. Any input is appreciated.


How to change the label text in default setting pages?

I've seen various tutorials on how to modify the menu items of a Wordpress Site's admin, but I'm trying to find a tutorial or way on how to modify the actual admin page labels. Here's what I mean: When you are in the back end and you hover over SETTINGS, and click GENERAL, a page comes up with, of course, the general settings for the site. The labels for each input field are as follows: SITE TITLE, TAGLINE, WORDPRESS ADDRESS(URL), SITE ADDRESS(URL), etc. I'm looking to add a function to my functions.php for a theme that will allow me to change these labels Is this even possible? Or do I just have to hard code it in?


How to check if post/page or taxonomy post is published by admin

Example :- 10 users and 2 admin in a site. If the post is published by admins than               <?php ?????() { ?>       <!-- do this -->          <?php }        else { ?>        <!-- do this if posted by user -->        <?php } ?>


How can I manage all multisite pending comments in one place?

I have a WP multisite installation with a large number of sites. Thanks to auto-approving comments from registered users and invite only registration we no longer need to receive email notifications for comments pending moderation. This is good and intended behaviour, but it has introduced a further issue. Some of the sites are accumulating large numbers of 'pending' comments, because its too much hassle for me to regularly visit each of the subsites specific admin page and manage their comments. Users could manage comments on their own sites, but most can't be bothered. I wouldn't mind doing it if I had a central interface with which to bulk approve/mark as spam/delete selected pending comments from accross the entire multisite, but I don't want to have to go into each sites admin screen. Alternatively, list of all sites on the network, with their total pending comments and links to their comment admin page would suffice. At least then I wouldn't waste time visiting the admin page of sites that don't have pending comments. Does anyone know of a plugin that can help with this? I've been searching and searching and can't find anything that gets close to what I'm looking for.


.htaccess in subdir gets ignored by Wordpress' own .htaccess in /

I have a Wordpress installation on the root of an apache (I.E. on `/`) and WP wrote this custom .htaccess:   `<IfModule mod_rewrite.c>   RewriteEngine On   RewriteBase /   RewriteRule ^index\\.php$ - [L]   RewriteCond %{REQUEST_FILENAME} !-f   RewriteCond %{REQUEST_FILENAME} !-d   RewriteRule . /index.php [L]   </IfModule>` Now I need to hide a single php script, let's say in `/scritps/hello.php`, I tried a .htaccess in `/scripts` with:   `<files hello.php>   Order allow,deny   Deny from all   </files>` But it gets overriden by WP's .htaccess, and hello.php is shown anyway. (I know this because moving the `scripts` directory out of WP to another vhost on my local environment makes it work. I want to hide this php file on the live site because it should only be called by cron from the command line, and I can't put the file outside the apache root because that's all I have FTP access to.   And no, I don't have SSH access, someone else's going to set the cron job.


Conditional tags issue for multiple is_page() conditions in sidebar.php

I've been pulling my hair out today trying to get this right. Basically I have a sidebar, which makes requests to individual files (such as sidebar-home.php, sidebar-residential.php) and different dynamic menus are supposed to be loaded depending on what page you're on. Previously this has been easy to set up when moving between: is_page, is_single, is_category, is_archive etc... But, as I have read, is_page keeps returning as true, despite any reset or endif condition. Would love to hear some feedback on what I am doing wrong here. How can I get is_page(24) and is_page(36) to see different parts of the sidebar? Code is below               <?php         if ( is_page('189') ) :             get_sidebar('home');            elseif ( is_page() && !is_page(array('189','24','36',is_tree('24'),is_tree('36'))) ) :             get_sidebar('page');         elseif ( is_page('24') && !is_page(array('36')) || is_tree('24') || is_or_descendant_tax('6','product_category') || is_or_descendant_tax('6','topic') ) :             get_sidebar('residential');         elseif ( is_page(array('36'))  && !is_page(array('24')) || is_tree('36') || is_or_descendant_tax('15','product_category') || is_or_descendant_tax('5','topic') ) :             get_sidebar('utility');         elseif ( is_post_type_archive('download_type') ) :             get_sidebar('download');         endif;     ?>


show posts only on homepage but using custom post type and taxonomy for query posts via url

I would like to do the following: I have a index.php file in which I query all posts from the existing post_types. Like the code below.                <?php if (is_home()); { ?>              <?php         global $wp_query;         query_posts( array('post_type' =>      array( 'movies',      'music', 'featured' ),'showposts' => 10, 'paged'=>$paged )         );?>               <?php }?>      I have a navigation menu e.g. "Movies" which url links to `?post_type=movies` and so on. But when I use it, everytime all posts are shown. When I delete the code above from the index.php everything works. Only the posts of a specific post_type are shown. I only want to have all posts from all custom post types, when it is really the websites home url. How could I do it? is there maybe an option to create a `customposttype.php` or so? like the `taxonomy.php`? thank you! AD * * * Hi Stephen, I have another question: I am getting the titles for each section by using this code here:´post_type; ?>´ in between h2 tags - but now on Startpage I get different names of the post type - but I'd like to have just: "Home" as Title... I tried it with is_home() and with is_front_page() but I had no luck. Do you have a hint? Thank you very much!!


Add additional metafields based on value of select box

I am faced with a particular issues dealing with metabox fields. I've added a select dropdown list to Pages post type and what I can not figure out is how to add additional metafields based on the value of the select box. I was thinking something like if (metaboxfield.value == 'value1') then display the code for the new metabox field? Here is what I am trying to accomplish...I can't figure out how to pull the value of a select box.               <?php         $page_meta_box = array(             'id'          => 'page_meta_box',             'title'       => 'Page Options',             'desc'        => '',             'pages'       => array( 'page' ),             'context'     => 'normal',             'priority'    => 'high',             'fields'      => array(                 array(                     'id'          => 'page_select',                     'type'        => 'select',                        'choices'     => array(                         array(                             'label'       => 'Value 1',                             'value'       => 'value1'                         ),                         array(                             'label'       => 'Value 2',                             'value'       => 'value2'                         ),                              // If value 2 is selected, display an additional select box                      )                      )             )         );          ?>      From the front end it would be a matter of               $getPageSelect = get_post_meta(get_the_ID(), 'page_select', true);      I've been stuck on this for a while and have yet to figure out the best way to approach this. If someone could point me in the right direction, that would be much appreciated. Thanks!


tiny_mce_before_init preventing custom shortcode icon appearing

I'm using the following to trim the TinyMCE editor               // Restrict buttons on the rich text editor     function formatTinyMCE($in)     {         $in['remove_linebreaks']            = false;         $in['gecko_spellcheck']             = false;         $in['keep_styles']                  = true;         $in['accessibility_focus']          = true;         $in['tabfocus_elements']            = 'major-publishing-actions';         $in['media_strict']                 = true;         $in['paste_remove_styles']          = true;         $in['paste_remove_spans']           = true;         $in['paste_strip_class_attributes'] = 'none';         $in['paste_text_use_dialog']        = true;         $in['wpeditimage_disable_captions'] = true;         $in['plugins']                      = 'inlinepopups,tabfocus,paste,media,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,infographic';         $in['content_css']                  = get_template_directory_uri() . "/editor-style.css";         $in['wpautop']                      = true;         $in['apply_source_formatting']      = false;         $in['theme_advanced_blockformats']  = 'p,h3';         $in['theme_advanced_buttons1']      = 'formatselect,|,bold,italic,blockquote,|,link,unlink,|,bullist,numlist,infographic|,wp_fullscreen,wp_adv';         $in['theme_advanced_buttons2']      = 'pastetext,pasteword,removeformat,|,undo,redo';         $in['theme_advanced_buttons3']      = '';         $in['theme_advanced_buttons4']      = '';         return $in;     }     add_filter('tiny_mce_before_init', 'formatTinyMCE' );      I then have a plugin to create an extra shortcode button:               function fetchInfographic() {           return 'HERE BE THE INFOGRAPHIC';       }     add_shortcode('infographic', 'fetchInfographic');          function addButton() {           if(current_user_can('edit_posts') &&  current_user_can('edit_pages'))           {               add_filter('mce_external_plugins', 'addPlugin');               add_filter('mce_buttons', 'registerButton');           }       }       add_action('init', 'addButton');          function registerButton($buttons) {           array_push($buttons, "infographic");          return $buttons;       }            function addPlugin($pluginArray) {           $pluginArray['infographic'] = plugins_url('infographic_plugin.js', __FILE__);          return $pluginArray;      }        (infographic_plugin.js)               (function() {           tinymce.create('tinymce.plugins.infographic', {               init : function(ed, url) {                   console.log('url');                 ed.addButton('infographic', {                       title : 'Add an infographic',                       image : url+'/dashboard.png',                       onclick : function() {                            ed.selection.setContent('[infographic]');                            }                   });               },               createControl : function(n, cm) {                   return null;               },           });           tinymce.PluginManager.add('infographic', tinymce.plugins.infographic);       })();        This works great if I remove the formatTinyMCE function, however with it, the button just doesn't appear. As you can see by the function I've tried adding "infographic" to $in['plugins'] and $in['theme_advanced_buttons1'] but it has no effect.


get_current_screen() inside add_action('admin_menu')

I am successfully using get_current_screen(); to get the post_type to decide whether to manipulate a meta box or not. I also need to use it in:               add_action('admin_menu', 'infographicMetaBox');          function infographicMetaBox() {         // ...         $screen = get_current_screen();         if('post' != $screen->post_type)             return;         // ...     }      however it doesn't seem to be available in that hook function (maybe being called to early?).


How to display and use all existing tags at my write-post-at-frontend-panel?

I can write and publish posts from my frontend - everything is fine. You know the backend: write-post-style, right? There it lists all existing tags. How can I display all existing tags at frontend and use it the same way, like in backend? Especially the function "click on one existing tag" and use it with the post, that I am currently writing? By the way: I want to use tags from my custom-taxonomy called "wissen"... Do you know a solution, how to use this function at frontend? This is my code: (you can see, how i do now the tags and i hope the code is everything important [my real file is a lot more code]) The code at the beginning of my form-page:               if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {              $title =  $_POST['title'];         $description = $_POST['description'];         $tags = $_POST['post_tags'];              $new_post = array(         'post_title'    =>  $title,         'post_content'  =>  $description,         'post_category' =>  array($_POST['cat']),  // Usable for custom taxonomies too         'tags_input'    =>  array($tags),         'post_status'   =>  'publish',           // Choose: publish, preview, future, draft, etc.         'post_type' =>  'wissen'  //'post',page' or use a custom post type if you want to     );              //SAVE THE POST         $pid = wp_insert_post($new_post);              //SET OUR TAGS UP PROPERLY         wp_set_post_tags($pid, $_POST['post_tags']);              //POST THE POST         do_action('wp_insert_post', 'wp_insert_post');          }      In my body:               <form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">              <?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?>         <textarea id="description"  name="description"></textarea>         <textarea id="post_tags"  name="post_tags"></textarea>         <input type="hidden" name="action" value="new_post" />         <input type="submit" value="Eintragen" id="submit" name="submit" />          </form>


Only Display Thumbnail if Larger Than

Is there a way to only display `<?php the_post_thumbnail( $size, $attr ); ?>` if it is larger/smaller than specified dimensions?


How to create a theme specific translation of buddypress?

Originally asked on the BuddyPress forums: For distribution purposes I would like to include my customized buddypress language files in my theme alongside my other language files. No matter what I try though I can only get the language files to display if I copy them over to `wp-content/languages` as described in the buddypress codex. I thought that the following would work, but it doesn’t:               function load_buddypress_language_files() {         load_theme_textdomain('buddypress', get_template_directory() . '/lang');     }     add_action('plugins_loaded', 'load_buddypress_language_files');      This is possible isn't it? WP: 3.5.1 BP: 1.7.2


Is there a filter/action to add content to WP admin metaboxes?

I want to add an instruction into a custom term meta-box. ![enter image description here](http://i.stack.imgur.com/N944O.jpg) Is there a hook to add this or is it easiest just to use JavaScript?


Single post as homepage?

I'm wanting to set a single post as my homepage. I have a photographer's site. There are a few galleries (weddings, portraits etc). Each gallery is a wordpress post with attached images. The post itself has no content apart from the attached images and I then use the wordpress [gallery] shortcode to display the attachments in a formatted manner. My main menu include links to these single post "galleries". This works well except I also want the home page to also be a gallery. I should add that the gallery posts are styled very differently to the static pages I also have (about, contact etc). Basically I want to set the home page to be a single post. Now I realise this is not possible out of the box and so I need to take extra steps. I suppose I need to create a page template that matches single.php and use that for the homepage? I was wondering what the most elegant solution here might be.


Updated multisite locally

I manually updated multisite locally with 3.5.1 but now all my subsisites in "My Sites" link to the root site even though if I type the domains directly they work.


ajax page template

I am creating a wp theme that gets all its data via ajax (using ajax- admin.php). Now, I've set a div that would have the html of the page there (in the index.php file). My index.php is a simple one, like this:               <?php get_header(); ?>

     <?php get_footer(); ?>      I also setup ajax (as I said via ajax-admin.php), and it works with simple content (for example echoing there some jquery generated text or retrieving a post/page. I have created 4 types of pages as page templates. article_1, article_2, article_3, article_4. What I want is the function that returns the page template html into a variable applied with the page data from an id. Is there a ready function on the codex or a filter/action to do that?


how to show Author information in search results

Google search result does not show author information or thumbnail images. the source code look like this `<link rel="author" href="https://plus.google.com/115911773396772351667/posts"/>` procedure followed same like what google says. unfortunately the result doesn't appear. here is the website link http://www.mohananvaidyar.org/ if anybody any body know the reason please answer. Thanks in advance


Is there a hook between clicking on "Add new" and the edit screen of a new post?

At the moment i use 3 custom post types to create "exhibitions", "guided tours" and "regular events". My idea is to combine these events to one custom post type "event" and by creating of this custom post type there should be a pop-up option page where i can choose which type of event it should be. I really do not want to do it later on the edit screen of the post because i would like to adjust the edit screen for every event type and display it prepared. So i need some kind of hook/break after clicking on the "Add New" button and displaying the edit screen. Is it possible?


Show the current post's category, without displaying parent category

I have a series of posts that all reside within a 'Main' parent category. Various posts are assigned to sub-categories. What I need to do is display the direct parent category for the currently viewed post, without showing other categories. Here is what I have:   * MainCat     * subcat1       * post a       * post b     * subcat2       * post c       * post d       * post e     * subcat3       * post f       * post g When viewing, for example, post 'a', I need to display subcat1 - not MainCat. I want to echo this in a custom template for this post type, and need to display the posts subcategory as a link. I've searched all over, and have found numerous snippets that show categories, subcats, etc.. but none that will only show a posts subcat like this.


paginate posts on admin page

I've created a plugin that calls a list of posts and grabs external API data. I am using get_posts to grab the list (because I need to feed the array of links into the API query) For whatever reason, any attempt at pagination either fails completely or loads the same posts. Since nothing I've done has worked, I've removed all the pagination at this point.               add_action('admin_menu' , 'blgs_dashboard_snap');           function blgs_dashboard_snap() {              add_dashboard_page( 'Social Metrics', 'Social Metrics', 'read', 'blgs-social-metrics-snap', 'blgs_metrics_page');     }          function blgs_metrics_page() {               echo '
';     echo '
';     echo '
';     echo '
';          echo '
Social Metrics Dashboard
';     echo '
';                  echo '

Publish Date
Post Title

Comments

Likes

Shares

                  ';                  global $post;                 $args = array(                 'post_type'         => 'post',                 'post_status'       => 'publish',                 'order'             => 'DESC',                 'orderby'           => 'date',                 'posts_per_page'    => 15,             );                       $dash_posts = get_posts( $args );             // build out table                  foreach( $dash_posts as $post ) :   setup_postdata($post);                      $link   = get_permalink();                 $grab   = urlencode($link);                      $request    = new WP_Http;                 $url        = 'http://api.sharedcount.com/?url='.$grab.'';                 $response   = wp_remote_get ( $url );                      if( is_wp_error( $response ) ) {                    echo '
There was an error getting the data. Please try again later.
';                 } else {                     $output = json_decode( $response['body'] );                  }                           $title  = get_the_title();                 $edit   = get_edit_post_link( $post->ID, $title );                 $date   = get_the_date('m/d/y');                      // get my numbers                 $stumble    = $output->StumbleUpon;                 $reddit     = $output->Reddit;                 $delicious  = $output->Delicious;                 $gplus      = $output->GooglePlusOne;                 $twitter    = $output->Twitter;                 $digg       = $output->Diggs;                 $linkedin   = $output->LinkedIn;                      // facebook sub counts                 $fb_total   = $output->Facebook->total_count;                 $fb_cmbox   = $output->Facebook->commentsbox_count;                 $fb_click   = $output->Facebook->click_count;                 $fb_comms   = $output->Facebook->comment_count;                 $fb_like    = $output->Facebook->like_count;                 $fb_share   = $output->Facebook->share_count;                      // set even odd for some fancy                      $altrows = ( ' altrow' != $altrows ) ? ' altrow' : '';                      // now output the data                 echo '

'.$date.'

'.$title.'

'.$twitter.'

'.$gplus.'

'.$stumble.'

'.$linkedin.'

'.$delicious.'

'.$reddit.'

'.$digg.'

'.$fb_total.'

'.$fb_comms.'

'.$fb_like.'

'.$fb_share.'

                     ';                  endforeach;             wp_reset_postdata();          echo '

';          }      any ideas about (a) getting it to work and (b) where it should go?


Upgrade to WP 3.2/ and Server to php5 breaks theme?

I upgraded to Wordpress 3.2 and my server from php4 to php5 and now my site outputs this error; **Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /homepages/35/d289582498/htdocs/wp- content/themes/NovatorixFullArchive_Version1.4/novatorix/index.php on line 98 Warning: getimagesize(http://itsadcoi.com/wp- content/uploads/2011/04/head1.png) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /homepages/35/d289582498/htdocs/wp- content/themes/NovatorixFullArchive_Version1.4/novatorix/index.php on line 98** This is what's on line 98 as the error is stating; **list($width, $height, $type, $attr) = getimagesize($logo_url);** How Can I fix it?