Removing Parent Page URL While Keeping the Navigation Intact

So here is the current format: site.com/parent-page/child-page/ - example 0 Child-page is ranking higher than parent-page, which is not what I want. So, I have a solution. site.com/parent-page/ - example 1 site.com/child-page/ - example 2 In the child-page I will have a breadcrumb on the top, like this: Home -> Parent Page -> Child Page The parent page already has a virtual SILO, so we are building another virtual SILO for child page. My question is this: Q1. How can I remove the parent page URL from example 0 to make it look like example 2? Q2. How can I make sure child-page still points to parent-page after implementing Q1?


How to retrieve the post_id of a tag page?

Thought this would be straight forward... given a tag page such as `http://domain.com/blog/tag/tag-1/` how can I retrieve the `post_id` while on that page? The usual suspects such as `url_to_postid` and `$post->ID` or `$wp_query->post->ID` do not return anything. The hook that calls the function is running during `init`. Thanks!


Version control with a team of non-developers

At work we have decided to redo our website from scratch since over the years it has been plagued with no version control or dev site, plugin inconsistencies, etc. The team who created the current site were a bunch of designers and a few others with basic wordpress editing skills. Needless to say the site is an awful hack job. I am currently the only developer, but some of the designers & others are still in place. I'm in charge of creating a new workflow that works for everyone. I'm really not keen on teaching git to everyone that will edit this site nor do I trust any of the rest of the team to have control like that. All that being said, since I am the only developer but we NEED to version the new workflow, what are some suggestions? I suppose I will be the only one creating and editing plugins, etc., but my designers do know how to create their own templates, etc. so they will be editing and adding code. So the question is: Is there any happy medium that will allow my designers to edit the theme files and push them live without having to teach them version control?


wordpress forms submit

I am new to wordpress. I am trying to develop a website where I want user registration form. But I am not sure how should I code in wordpress. I heard about some contact form plugins. Can someone direct me to some good tutorial or post about how to work with form submits in wordpress?


Could be a namespace conflict (?) with login form and register form on the same page

I have created a "My Account" page template for WP 3.5.2 that displays certain custom data if a user is logged on. If not, the page displays a login form and a link that opens the register form in a fancybox, plus some other info for the app. The mechanics of the display work fine, and the rendered page passes the HTML syntax check with the typical exceptions in the head section. **The problem:** I can get only one form to work at a time. If the login form is working, then the register form will not, and vice versa. That is, if I disable one the other works. When both are enabled and share the same value for input element attribute "name", e.g. "user_login", one will fail. Both cases result in the same error message: > undefined index user_login at line 530 in wp_login.php I have tried creating unique ids on the input elements named 'user_login' but that did not cure the problem. Sample of my code: http://pastebin.com/fevRMjHi I would be most grateful if someone can suggest how to improve the code so the cause of the problem is revealed. Of course a resolution outright would be very nice too.


Using AJAX in wordpress theme

all In my theme there is a notification at top. After user login he can see the notification update. when click on notification i want to make change in database alert field value 0 to 1. My ajax call in theme                $("#notifications-button").click(function() {                  $.ajax({             type : 'POST',             url: "http://localhost/rupp/wp-admin/admin-ajax.php",             data:{action:'MyAjaxFunction'},             success : function(data){                 $('.message-count').hide();             },                  });               });      and in function.php file               add_action('wp_ajax_MyAjaxFunction','MyAjaxFunction');     function MyAjaxFunction()     {         global $wpdb;       echo (int)$user_ID;       $wpdb->update( $wpdb->wp_frm_items,                  array( 'alerts' =>  1)                 );     }      but it not make any changes in alert fields in db. is that right way to call theme function using ajax?


Overwrite WP's default search rule to redirect to my own template

As usual, rewrite stumped me! I've built a custom search for searching through comments and comment meta, using a flat table. I'm using a rewrite rule as follows:               ..../search/reviews/<parameters>      I'm sending a query var 'args' which is group of key/val pairs to search against, to my custom template which has the sql and stuff. This works fine. My problem is, when I search as follows,               .../search/reviews/      Here I'm sending no params, hence I want to either redirect to 404 or just redirect to that same template with args as blank, where I'd see that args is blank and hence show all the results directly. I wrote the rule:               add_rewrite_rule('^search/reviews/','index.php?pagename=search-results','top');      But it still works as default search, searches for the keyword 'reviews' (like WP does for 'hello'.... `/search/hello`) and doesn't redirect to my template. Any help on how to avoid this behavior?


Restricting access to a single MultiSite site based on IP -- possible?

I have need to restrict not just admin access but also access to the content stored on a single site in a MultiSite network based upon a user's IP address.   1. Is this even possible?   2. Is there an easily admin-able plugin? (I _could_ restrict access using something like Justin Tadlock's "Members" plugin, but the requirement in this case is based on IP.)


Sending WP posts to external API

What's the best method for sending all new Wordpress Posts to an external script on another server? It needs to include the full post information including the post content, so a simple ping is not sufficient. I've looked at how Wordpress Plugins work (without having any past experience) and the publish_post and edit_post actions seemed to be along the right lines, but i've had a few issues with the data being sent not being up to date e.g. edit_post sends a post_id I use get_post() and the data provided is the old data. The other rather large issue with this is that it would probably require using CURL to send the post to the external server, which not all sites will have access to. The only other solution I can think of is to attach a function to wp_init() to intercept any requests coming from my server. To clarify this would involve my server requesting the WP index with a custom user agent such as "mysite/1.0". If this custom user agent is detected the plugin would output something itself and then exit preventing the standard WP output. That way I could use the built in ping service to ping my server from wordpress, get the permalink from this ping and then send a request back to WP which will be intercepted by my plugin and output the post as json. Does this sound feasible? Is there another commonly used method to send an entire post to an external script that i'm not aware of? I'm very new to Wordpress and don't actually use it myself, but i've been asked by people who do use Wordpress how they can get their content automatically imported to my site, so I said i'd look at creating a plugin to do so :)


Need to return shortcode text instead of the output

Is there a way I can return the shortcode text instead of the output. My code function is hooked into 'the_content' and I know if my function contain shortcode it will automatically generate the output. I just want to output shortcode text e.g [gallery]               add_filter( 'the_content', 'show_on_front', 10 );     function show_on_front( $content ) {        $content .= 'this is example of shortcode : [gallery]';        return $content;     }      Regards,


Wordpress triggers 404 on page 2 for custom search query

I modified my index.php to check if the search query is an author and if yes, display articles of that author. That is working fine but as soon as you go to page 2 of the results, wordpress triggers a 404 error. So I guess Wordpress is not calling the index.php on http://www.test.com/page/2/?s=my+search+query and I also need to put the code I got in my index.php somewhere else, but where? Edit: My code for the custom query               $author_res = $wpdb->query("SELECT ID FROM $wpdb->users WHERE display_name LIKE '%".get_search_query()."%' LIMIT 1");         if($author_res > 0) {             $author_info = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE display_name LIKE '%".get_search_query()."%' LIMIT 1");             $article_query = new WP_Query('posts_per_page=7&paged=' . $paged.'&author='.$author_info->ID.'&offset='. $offset);             if($article_query->have_posts()){     ...      $paged and $offset get calculated sitewide but that works fine. I guess the problem is somewhere else, I'd like to debug this but I don't know where wordpress decides if it triggers the 404 and I don't know which php file gets triggered on /page/2 because it seems like it's not index.php


Home page for a category / taxonomy

I don't know why WP themes do not support taxonomy homepages. I mean there should be a separate template for `example.com/location/` (this may show a list of available taxonomy terms etc.) in addition to `example.com/location/newyork/` where location is a taxonomy. What is the best way to have a taxonomy home? A page with slug=location and custom template?


Getting (Invalid) when adding custom taxonomy of custom post type link in menu

I am getting this message when I am trying to add a link to my menu: ![screenshot](http://i.stack.imgur.com/1IDME.png) I have created a custom post type and a custom taxonomy               <?php        /*        Plugin Name: Portfolio - Custom Post Type        Plugin URI:         Description:         Version: 1.0        Author:        Author URI:         License:        */     ?>     <?php          // ----- Register custom post type ------ //          add_action( 'init', 'create_post_type_portfolio' );          function create_post_type_portfolio() {         $labels = array(             'name'               => _x( 'Portfolios', 'post type general name' ),             'singular_name'      => _x( 'Portfolio', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'job' ),             'add_new_item'       => __( 'Add New Portfolio item' ),             'edit_item'          => __( 'Edit Portfolio Item' ),             'new_item'           => __( 'New Portfolio Item' ),             'all_items'          => __( 'All Portfolio Items' ),             'view_item'          => __( 'View Portfolio Item' ),             'search_items'       => __( 'Search Portfolio Items' ),             'not_found'          => __( 'No Portfolio Items found' ),             'not_found_in_trash' => __( 'No Portfolio Items found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Portfolio Items'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our Portfolio Items and Portfolio Item specific data',             'public'        => true,             'menu_position' => 5,             'menu_icon'     => plugins_url( 'portfolio.png', __FILE__ ),             'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,             'show_in_nav_menus' => true,             'rewrite'       => true,             'show_ui'       => true,              );         register_post_type( 'portfolio', $args );        }          // ------------- register taxonomy ----------------- //          // hook into the init action and call create_portfolio_taxonomies when it fires     add_action( 'init', 'create_portfolio_taxonomies', 0 );          // create Work for the post type "portfolio"     function create_portfolio_taxonomies() {         // Add new taxonomy, make it hierarchical (like categories)         $labels = array(             'name'              => _x( 'Work', 'taxonomy general name' ),             'singular_name'     => _x( 'Work', 'taxonomy singular name' ),             'search_items'      => __( 'Search Work' ),             'all_items'         => __( 'All Work' ),             'parent_item'       => __( 'Parent Work' ),             'parent_item_colon' => __( 'Parent Work:' ),             'edit_item'         => __( 'Edit Work' ),             'update_item'       => __( 'Update Work' ),             'add_new_item'      => __( 'Add New Work' ),             'new_item_name'     => __( 'New Work Name' ),             'menu_name'         => __( 'Work' ),         );              $args = array(             'hierarchical'      => true,             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'show_in_nav_menus' => true,             'rewrite'           => array( 'slug' => 'work' )         );              register_taxonomy( 'Work', array( 'portfolio' ), $args );     }                    ?>      Why ?


Returning Variables back into a template

If I put a function that I want to use in a template I can put it into functions.php               function myfunction(){     echo 'My String';     }      `add_action('myfunction','myfunction');` and in a template file put:               do_action('myfunction');      This appears to only work if writing something out to the screen. If I wanted to return a variable instead to the page. E.g.               function myfunction(){     return 'My String';     }          $string = do_action('myfunction');      and capture it instead of print it. How would I do it?


How can I display the total number of favorites for any particular buddypress activity stream post?

I like to show the total number of favorites for each individual activity post next to the favorite button just like it shows the number of comments right next to the comment button. Is this possible to implement?


Featured image size per post type

Hi I have several featured image sizes I need to use throughout the site, some of them pertaining to custom post types. Could I set them in some way so that the image sizes are not created for the featured images of all posts/pages but only to the custom post types where they will actually be used? I want this in order not to bloat the installation with a lot of different sized images. Thanks


Unable to find API Key for my blog

I have the blog http://kracekumar.wordpress.com, I need to find the API KEY of my blog,I clicked on Global Dashboard->My profile,it was mentioned in wordpress site that it will be found in top left side,but I can't find it.


Disable image attachment links

Is there a way to disable image attachment links trought a filter in functions.php or something ? I know it's possible to do it manually when you add an image to a post but I want to disable this functionality by default. **UPDATE** What I want to do is set the "Link URL" option to "none" and remove / hide it from the upload attachement screen. ![enter image description here](http://i.stack.imgur.com/NiIar.png) Is there a solution to hook into the "media-upload" "pop-in" ? Thanks by advance.


Best way to programatically add "rel" attributes to page and post images

For single posts and pages, I would like to add certain `rel` attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be `rel="lightbox[post id]"` What function would I filter to accomplish this most effectively?


How do i put a sidebar on my post permalink page?

I am using the twenty-eleven theme and every page (except the 404) has a sidebar. However the post permalink page (/2011/11/post-name/) does not. How do i put the sidebar onto it? I tried looking for its php file on codex but it is very unclear which file is the correct one.


How to exclude parent category but show child categories?

I figured out how to exclude the current post from displaying in my single- post view sidebar, but now I want to exclude parent categories and display only children. Any ideas how to do this? Much obliged!!

Similar Items
     <?php         if ( is_single() ) {         $cats = wp_get_post_categories($post->ID);         if ($cats) {         $first_cat = $cats[0];         $args=array(           'cat' => $first_cat, //cat__not_in wouldn't work           'post__not_in' => array($post->ID),              'showposts'=>8,           'caller_get_posts'=>1     );         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {           echo '';           while ($my_query->have_posts()) : $my_query->the_post(); ?>          <?php if (in_category('15')) continue; ?>

<?php get_the_image( array( 'custom_key' => array( 'thumbnail' ), 'default_size' => 'thumbnail', 'width' => '119', 'height' => '75', 'link_to_post' => true ) ); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?>

            <?php           endwhile;         } //if ($my_query)       } //if ($cats)       wp_reset_query();  // Restore global post data stomped by the_post().     } //if (is_single())     ?>


Related sub category posts with thumbanils

I want to show sub sub category posts and title Like   * Parent Cat   * Sub Cat   * **Sub Sub Cat** <--- I use the following code but shows me all posts from Parent cat , sub cat and sub sub cat posts.               function related_posts(){         global $post;         $categories = get_the_category($post->ID);         if ($categories) {         $category_ids = array();         foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;              $args=array(         'category__in' => $category_ids,         'post__not_in' => array($post->ID),         'posts_per_page'=> 5, // Number of related posts that will be shown.         'ignore_sticky_posts' => 1         );              $my_query = new wp_query( $args );         if( $my_query->have_posts() ) {         $categories = get_the_category();         echo '

 cat_ID). '"> '. $categories[0]->cat_name .'

';         while( $my_query->have_posts() ) {         $my_query->the_post();?>

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

          <a href="<?php the_permalink()?>" title="<?php the_title(); ?>"><?php the_title(); ?>
                <?php         }         echo '

';         }         }         wp_reset_query(); }


Need to check if user is on a particular page

Here I hope is a simple question for a php newbie. I have a textbox on my blog's home page that contains a link to another page. Should the visitor click the link and go to that page, I want to be able to check to see if the user is there so I can change the text and CSS. I know how to use the ishome() function, but what function do I use to check if the user is on the page in question? It's not a post, just the mysite.com/what-we-do page. Thanks.


How do I change the default admin color scheme in MP6

How do I set a different default admin color scheme for all users? For example, it's set to MP6 as default now, but I want to make it MP6 light by default. The users may or may not change it later! What I've learnt so far is that it could be done by hooking into `get_user_option_admin_color` Here's the code from the plugin author:               <?php          add_filter( 'get_user_option_admin_color', function( $color_scheme ) {     global $_wp_admin_css_colors;          if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) {         $color_scheme = 'ectoplasm';     }          return $color_scheme;          }, 5 );      But as a non-savvy I couldn't figure out where to put this code to make it work. Can anyone help me?


Is there a naming convention for database tables created by a plugin?

I have setup my plugin's table to use $wpdb->prefix but aside from that are there any conventions that you should name them; Maybe `$wpdb->prefix.'plugin_'.$tablename` or something. I can't find any documentation and the examples of plugins I have used in the past don't seem to adhere to anything in particular.


get_the_tags Conditional display of a custom taxonomy

I'm currently using the below code for displaying standard post tags in a sidebar, given the current post has one associated with it. If not, no tag & accompanying headline, etc., should be displayed. Also, the usual /tags slug should be removed in the URLs, respectively. Again, my below code does that, which is exactly what I want. However, how can I accomplish the same thing with a custom taxonomy of, say, "rivers"? Your guidance is much appreciated as I've tried several things already, to no avail. The current code (in use for standard post tags):               <?php         $tags = get_the_tags();         if ($tags) {             echo '
Holiday Regions

';                 foreach ($tags as $tag) {                     echo 'slug . '" title="' . sprintf( __( "Learn more about the %s" ), $tag->name ) . '"' . '>' . $tag->name.'
             ';                     }             echo '
';             }         ?>      * * * For those who are in a similar situation, here's what did the trick—thanks to the hint from @Michael:               <?php         $terms = get_the_terms( $post->ID, 'rivers' );         if ($terms) {             echo '
Rivers

';                 foreach ($terms as $term) {                     echo 'slug . '" title="' . sprintf( __( "Learn more about the %s" ), $term->name ) . '"' . '>' . $term->name.'
             ';                     }             echo '
';             }         ?>


Is there a way to define the $post var outside the loop?

I am trying to speed up a wordpress site by condensing three wp_queries into one. I have a need to seperate categories, so I am making the call and defining 3 arrays to hold the post using a switch, like so:                $new_query = new WP_Query();                     $new_query->query('post_type=post&paged='.$paged);                     if ( $new_query->have_posts() ) : while ( $new_query->have_posts() ) : $new_query->the_post();                                   $category = choose_one_category(get_the_category());                          switch ($category){                         case "Category 1":                             $cat1[] = $post;                             break;                         case "Category 2":                             $cat2[] = $post;                             break;                         case "Category 3":                             $cat3[] = $post;                             break;                     }                               endwhile; endif;      which leaves me with 3 arrays which with the posts nicely sorted. Now I wish to define the variable $post OUTSIDE the loop so that I can use methods like `the_date()` & `comments_number()` without having to rewrite those functions, can anyone help? I have tried:                                   foreach ($centre as $new_post){                             $post = $new_post;                                                       include('front_page_loop.php');                         }       Where `front_page_loop.php` is my loop code, but I just get the same post, albeit with different dates


Which core file(s) handle $_POST and $_REQUEST?

I have a wordpress site with a subdirectory which should be excluded from the wordpress environment. I have tried to exclude it via .htaccess, and I have tried to make sure my form element names don't match any of the reserved words. However, some form submissions in this directory still result in a wordpress 404 error. These errors come from the values of the form fields rather than the names, as the names work fine for other values. For instance, a user tried to use the name "pokerstars", and that hit a 404. It's repeatable with that particular name every time, but other names go through without issue. This is just one of the instances that result in a wordpress 404 that wordpress shouldn't be messing with in the first place. That being said, I want to modify the wordpress core to not execute whatever block(s) of code deal with $_POST and $_REQUEST variables. Where can I find them?


Cannot add / edit categories to a post anymore

I had to modify a published post and for some unknown reason, it removed the categories the post was in. I tried reassigning them, but it does not work: WordPress does not save the categories, so the post ends in the default "unclassified" category. I've checked and it happens also if I create a new post. So it's a quite strange issue. I deactivated my caching plugin, to no avail. Any idea what provokes this bug?


What are options are there to implement a multi language site

**What is the best way to have multiple languages on a site?** I was thinking of using WP3.0 and then having each language of the site being a seperate blog in a sub directory. I.E.   * `example.com`   * `example.com/fr/`   * `example.com/de/` And then just being able to have one theme that all the sites share. Is there a better way to do this? What do you think?


How to use query_posts() with a date filter on a custom field?

I have defined a custom post type that uses a meta field to store dates. In my functions.php I have the following code which saves the start date. The format of the date that is sent in the `startdate` form parameter is `2010/12/01 9:00 AM`               add_action('save_post', 'save_details');          function save_details(){         global $post;         update_post_meta($post->ID, "startdate", $_POST["startdate"]);     }      I am trying to output a list of all the events with a `startdate` later than the current time.               query_posts(array(         'post_type' => array('seminar'),         'meta_key=startdate',         'meta_value='.date("Y/m/d h:i A"),         'meta_compare=>'     ));      This lists out all the events regardless of their start date. What am I doing wrong? ## SOLVED: For some reason after I changed my code to the following, it just works.               $args = array(         'post_type' => array('seminar'),         'showposts' => 3,         'meta_key' => 'startdate',         'meta_value' => date("Y/m/d h:i A"),         'meta_compare' => '>',         'orderby' => 'meta_value',         'order' => 'ASC'     );          $seminars = get_posts($args);      I am going to select the answer from @Rarst as the accepted one, because I think I actually had multiple issues going on here, but his addressed the issue related to the title best. @sorich87 had a good point about how I should have been storing the dates as timestamps, but in the end, @Rarst was correct that if I specified a format argument to the `date()` function which matches the format I used when storing the data into the database, then I should be able to compare the data. Thanks for all the help.


Checking current language in a function

I am running WordPress with "WPML Multilingual CMS", so that it has multiple language versions. In a function used with `add_action('template_redirect',<functionname>)`, I need to find out what the current language is. What should I call?


Orders being sent to wrong admin email in WooCommerce

I set up an admin User for myself to create the site, then another for my client to use. I changed the emails in WooCommerce to her address wherever I can find them, but the orders are still coming to me. I don't want to remove my admin account (see: clients touching stuff). Where do I set this to make sure those orders come to her and not me? Thanks!


Custom size for image uploaded to custom field in user profile?

I'm using advanced custom fields and set an image upload field in user profiles. I'm using this image a few places on the website and need to set a custom size for it on some pages. If I set `add_image_size( 'homepage-thumb', 190, 259, true );` in my functions file how can I use this image size with the uploaded image since it's not a featured post or page image? From my home page this is how I get the image `$author_logo = get_field('author_logo' , 'user_' . $author_id ); // image field, return type = "Image Object"` then `<img src="<?php echo $author_logo;?>" />` Thanks


using nav menu id's

I am trying to make a WP_Query that gets all pages / posts from the navigation id. I have the id's. I have a variable that holds the numbers and when I echo it out, this is exactly what I get 7,43,20,22,16,1051,18,26,9,24,28,10523 Reading in the codex, I should be able to use page_id. When I refresh the page, I do not get any posts or pages. Having tried many different versions of this query, this is where I am at right now.                $page_query = new WP_Query( array('post_type' => array( 'post', 'page'), 'page_id' => array($number)));


language theme and multisite

i have a problem i can't solve, i made a theme with two languages support, italian as standard and english using the .po and .mo files (located in the /lang/ folder inside the theme), everything works smooth in a single website, if i change `define('WPLANG', 'it_IT');` to `en_EN` in the `config.php` the website switch with no problem. The problem is when i use it in a multisite network, even if change the language for the single website in the `site language` option, the theme doesn't change the language, what am i doing wrong? I can't find a solution, i did all wordpress say in the internationalization page i named the text domain as the "slug" of the theme               /*        Theme Name: translate test     Theme URI:      Description:      Author: Fab     Author URI:      Version: 1     Text Domain: translate-test     */      i loaded the theme textdomain correctly               <?php     add_action('after_setup_theme', 'my_theme_setup');     function my_theme_setup(){         load_theme_textdomain('translate-test', get_template_directory().'/lang');     }     ?>      and this is the index.php (for example)               <!DOCTYPE html>               <meta charset=utf-8 />     <title>translate test</title>     <link href="<?php bloginfo('stylesheet_url');?>" type="text/css" rel="stylesheet" media="all">
<?php _e('questo è un test','translate-test')?>
                What am I doing wrong?


Change the file path on get_template_part via plugin

I'm trying to make a plugin that will change the behavior of a theme. In the theme file I have a `get_template_part('libs/templates/user_menu');`. I want to make my plugin "force" the `get_template_part` to return another slug file (a path to a file in the plugin's folder). So far this is my code inside the plugin:               function wpse21352_template_part_cb( $slug )     {         if(slug == 'user_menu') {              return WP_PLUGIN_URL.'/'.$slug;         } else {              return $slug;         }     }          do_action( "get_template_part_user_menu", 'user_menu' );     add_action( 'wpse21352_template_part_cb', 'get_template_part_user_menu', 10, 1 );


Using query_posts inside single.php loop

Inside of my loop in single.php, I used a custom query using `get_posts` to return posts belonging to a certain category.               <?php                                                   global $post;                                                             $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;                                                             $myposts = get_posts("paged=$paged&category=5");?>          <?php foreach($myposts as $post) :?>          <?php the_title();?>          <?php endforeach; ?>      The problem is that the original loop, which is the single.php loop, seem to do not work after the execution of the query. For instance, the navigation links (next and previous) dont work. Have you ever faced this issue? your help is appreciated.


Can't find where to modify <html> attrbitutes

I am trying to create a simple function that adds or edits data in the `<html>`. Basically, before the server response is sent, I want to find where this piece of html is written at the top level of the page               <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">      And based on certain criteria, add a new property & value that tag.               <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US" myprop1="val1" myprop2="val2">      Is there an action or filter I can hook into, at it's earliest to modify this? Most likely using regex? Side note, I understand how it break validation, but I need this for my purposes. **Update** To answer couple questions:   * I know I can insert variables inside of html tags with just PHP. The problem is I can't find where in the WP core the actual starting `html` tag is being generated so I can replace or modify what's being generated.   * This will be in a plugin, theme independent, where the html tag is unknown, but 99% of the time it will be the standard output from Wordpress   * I can't use the header.php in a theme, as I would like this to work on whatever theme is installed. Is this specific tag always generated from the theme? Any way to override theme generated tag (if user specifies this) within a plugin?


How to redirect users to their profile after they successfully edit their profile

I am using the buddypress plugin for wordpress and would like to make a little change... I was wondering, if there was a way I could redirect users to their profile page after they save the edits to their profile page? Basically, when a user edits their profile page it just shows a message that says something like “changes saved” but stays on the edit page. I would like it to redirect to the user’s profile page so they can see the changes after they click the save changes button and it was successful. I am thinking of using something like this:               function EditsSaved()     {     global $bp;     wp_redirect( $bp->loggedin_user->domain );     }     add_filter( 'SomethingHere', 'EditsSaved' );      I am a little unsure how to do this... what would I need to put in the 'SomethingHere' part that will fire when someone successfully saves the edits they make to their profile? I have tried some code I found online but it did not work. I am using wordpress 3.8 and buddypress 1.9.1 **Update:** Alright, I figured it out! It was just an issue off trying to use outdated code... Here the function that works:               add_action( 'xprofile_updated_profile', 'SaveEditsRedirect', 12 );     function SaveEditsRedirect() {     global $bp;     wp_redirect( $bp->loggedin_user->domain );     exit;     }


Javascript block in Twenty Twelve theme

I am authoring a WP plugin, and I have to generate some JS (jQuery) code in "realtime". It is working fine in general, though I've stuck with one problem with the WP 3.5.1 and its default Twenty Twelve theme: there the scripts are inserted in the footer of the page, not in the header, causing my code to throw errors. I've looked through all the theme's files (header, footer, functions), and I can't seem to find the reason for that. Looks like the `wp_footer()` is inserting the block, but I can't find any hook or anything else that tells WordPress to insert scripts there. So, my question is: how to make jQuery and other scripts go in the header by default, not in the footer? What does make the theme work this way (maybe the default WP behavior changed?)


TinyMCE Advanced list type drop-down

I want to be able to change the list-style-type, for example:               list-style-type: circle;     list-style-type: square;     list-style-type: lower-roman;     list-style-type: lower-alpha;     ...      In the plugin directory for TinyMCE Advanced There is a screenshot that shows what appears to be a drop-down menu to do just that. ![enter image description here](http://i.stack.imgur.com/KXN8Z.png) My installation doesn't seem to have that feature. Is there something I need to do to enable it? ![enter image description here](http://i.stack.imgur.com/rTgBH.png)


check first time login only wordpress

i want to display welcome message or redirect the user to my custom template when the user login for the first time only. After the user can visit the regular page of the site.


Disable gallery in 3.5 media iframe

I'm creating a setting to set a logo. It works but there is a problem.   I only need one image to be set so the gallery item should be disabled / hidden. Of course this should only effect this page, of even better this setting.               <?php     // above this I do a simple settings api     ?>     <input id="set_logo" type="text" size="100" name="set_logo" value="<?php echo esc_attr( $value ); ?>" />     <?php     do_action( 'media_buttons', 'set_logo' );      I've looked in multiple places in code but I can't find any clues how to do this. **EDIT**   I've solved it in a different way that is not related to this. The solution is now implemented in my first plugin: http://wordpress.org/extend/plugins/default-featured-image/   _shameless plug._


Filter pictures in the media library

I have some issues with duplicated pictures in my media library and I would like to know if there is any option to show or automatically filter only certain images in the library. For instance, let's say that I have 20 pictures in the library: A.jpg (original), B.jpg (original), C.jpg (original), A1.jpg (duplicate), A2.jpg (duplicate), B1.jpg (duplicate), C1.jpg (duplicate), etc. I would like to see or to let see to other users only the first three pictures in the media library. Any idea how to do it with a plugin or modifying some files? Thank you


Best way to create a page outside of the pages list

Currently, to add a single page that should not be part of the CMS, I add a new Page entry in the WP admin panel and then markup the page in page-{page- slug}.php. This however causes the Pages list to contain pages that are not meant to be edited by the client/editor (title, content are irrelevant). How should I create these custom PHP pages without using the Pages system?   * The slug should still work and not be overwritable by new pages   * A php file should be linked dynamically like page-{slug}.php or /inc/{slug}.php


Add trailing slash to URLs not found

So I noticed that Wordpress automatically adds a trailing slash to URLs. I also noted that it doesn't do this for URLs that aren't found on the server. Why this probably is logical. Is there someway to make it rewrite not found URLs to add trailing slash?


How to insert image from link in TinyMCE

In the TinyMCE editor that comes with WordPress there is no button to insert image from link. I know that you can do this using the upload/insert section. But let us say that I don't want to allow users to upload images but want them to be able to insert images by linking them. If I remove the upload capabilities, the upload/insert section disappears altogether.   Is there already a method to do this on WordPress?


add new input field like category?

I want to create another input field like the categories. Whenever user posts a new question I want to have another drop down of locations associated with that particular question, like categories drop down in the the 'Submit Question' form. And how I can add a UI for managing it in the admin section like the one there exists for categories in Questions?


jQuery UI Tools (Flowplayer) Issues

As great as the jQuery Tools might be they're giving me a headache. I want something like this for my website. I have the necessary script included (and Scrollable works just fine btw.):               <script src="http://cdn.jquerytools.org/1.2.5/tiny/jquery.tools.min.js"></script>      I followed the minimal setup and also copied and pasted the source code from the standalone version. For some reason the content doesn't show up! If I get rid of the "display:none" command in the CSS the content shows up but overlayed. I'm not sure why it's not working. Please see here. EDIT: So, many days later I'm trying to get all the script calls out of my header and put them into my function.php instead. I also want to try and use no conflict wrappers. As far as I understand I should use               jQuery(document).ready(function($) {      instead of               $(document).ready(function(){      I found the latter in the contact.php of my parent theme. I replaced it with the first code and it stopped working!! Here's the whole script of the contact.php:                <script type="text/javascript">     $(document).ready(function(){                   $('#contact').ajaxForm(function(data) {                      if (data==1){                          $('#success').fadeIn("slow");                          $('#bademail').fadeOut("slow");                          $('#badserver').fadeOut("slow");                          $('#contact').resetForm();                          }                      else if (data==2){                              $('#badserver').fadeIn("slow");                           }                      else if (data==3)                         {                          $('#bademail').fadeIn("slow");                         }                         });                      });             </script>      Any idea why it doesn't work? I checked the jquery.form.js that it's based on and could it have to do something with that?               jQuery Form Plugin      * version: 2.07 (03/04/2008)      * @requires jQuery v1.2.2 or later      *      * Examples at: http://malsup.com/jquery/form/      * Dual licensed under the MIT and GPL licenses:      *   http://www.opensource.org/licenses/mit-license.php      *   http://www.gnu.org/licenses/gpl.html      *      * Revision: $Id$      */      (function($) {     /**      * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.      *      I need to fix all of this step by step, so I hope you'll help me out a bit here, thanks :) I really appreciate any hint you can give me. I tried to implement the scripts in the function.php instead of the header, but for some reason the scripts stop working then, so it's not an option.


Replace full content with an excerpt

My theme shows full posts on the main page and I want it to show only the summary, I tried searching for the_content tag in my theme's index.php file but it is not even there!   I don't have a home.php or category.php. I tried searching my whole wordpress installation for the_content and the only places i could find it is in page.php and even when changing it there it doesn't really work. The other places I found it in my theme formats (image.php, audio.php...) but changing it there makes the post shows the summary even when you click on it and go inside the post. My index.php file has this :               <?php if (have_posts()) : while (have_posts()) : the_post(); $format = get_post_format();  ?>            <?php if($format == ''): ?>              <?php get_template_part('library/functions/theme/formats/standar'); ?>                 <?php else: ?>              <?php get_template_part('library/functions/theme/formats/'.$format); ?>            <?php endif; ?>          <?php endwhile ?>      Do I need to do something specific there to make this work?


Trying to get property of non-object “ wordpress ”

My WP theme got these notice on description menu function my code : http://www49.zippyshare.com/v/89513423/file.html               /* Discription Navigation Menu, Credit to Christian Kriesi  */          class description_walker extends Walker_Nav_Menu          {                function start_el(&$output, $item, $depth, $args)           {                global $wp_query;                $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                     $class_names = $value = '';                     $classes = empty( $item->classes ) ? array() : (array) $item->classes;                     $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );                $class_names = ' class="'. esc_attr( $class_names ) . '"';                     $output .= $indent . '
ID . '"' . $value . $class_names .'>';                     $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';                $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';                $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';                $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                     $prepend = '';                $append = '';                $description  = ! empty( $item->description ) ? ''.esc_attr( $item->description ).'' : '';                     if($depth != 0)                {                     $description = $append = $prepend = "";                }                      $item_output = $args->before;                 $item_output .= '';                 $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;                 $item_output .= $description.$args->link_after;                 $item_output .= '';                 $item_output .= $args->after;                      $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                 }     }      my wp_nav_menu :                 $header_menu_args = array(               'theme_location' => 'main_menu',                                           'container_class' => 'menu',           'container_id' => 'dropdown',           'menu_id' => '',            'menu_class' => 'sf-menu',           'echo' => true,           'before' => '',           'after' => '',           'link_before' => '',           'link_after' => '',           'depth' => 0,           'walker' => new description_walker()                                       );       wp_nav_menu( $header_menu_args );       dropdown_menu( $header_menu_args );      the problem is in the line 44, 46, 47, 49 for the property of non object. http://multipixels.net/files/theme_function_debug.png please help me to figure it out please. Best regards, Decneo


Add new user and site per front end form

Do you know any multisite plugin which allows users to create a user account and a site after a form submission. After the form submission, the form will automatically add a site in the network admin and create a new user. Is this possible? Some say that it needs hardcoding for it to work. But I have no idea how to. Hope you guys can help.


Should I use the standard wp_mail() function for a premium theme?

I am creating a premium theme that includes a Contact page template. Currently, I am using the `wp_mail()` function to send the contact email to the administrator-specified email address. Basically, I am wondering if the `wp_mail()` function is the best/expected choice for implementing email functionality in a premium WordPress theme? If it is not, what would be the better option?


Get parent page/menu id of current post

Basically, after setting up the initial "page for post" on the Reading Options, and then add that page to the menu I get the posts when I click on that menu item as expected. On there I know the post ID (which is the actual page created before setting it as the page for posts) and all the information regarding that same page. Trouble is, when I click on a specific post, not only the menu item looses its active status, but I can't get hold of that parent page ID. Is there a way to get that parent page ID, when on a post !? **Edit:** For reference, I managed to get it with `get_option('page_for_posts');` but that's very ugly. Is not possible that the post associates with it's parent page index ?


Troll the hackers by redirecting them

My website is getting somewhat popular, and with the it's increasing popularity there's an increase in the hackers. Last night I visited my security logs and found that everyday approximately 10 people try to access                /?author=1      /?author=2      /?author=3      /?author=4      but I don't have any of these user IDs, so a 404 is generated to them. they also run a guessing bots on usernames:                admin      administrator      wordpress      Now, I want to troll them... so each time they try to access any of these two:                1. visiting /?author=1..etc      2. trying to login with admin username      I want their IP blocked off my site, and redirected to a youtube video. I know the first one can be done with .htaccess trick, but can't quietly get this trick. the second one I guess is done by php, but I have no experience with Wordpress although I'm pretty good with PHP.


Share buttons in some specific posts in WordPress

I want to put the option to share (with share buttons in post footer) but just in some specifics posts, and I want to control this in the admin panel. I know a plugin, but I want do this "without plugin". How can I do this?


Date not appearing in custom query

I'm having a weird issue with Wordpress which I cannot solve by myself, and for which I couldn't find an aswer over this and other websites. Basically, I have a custom loop.               while ( $the_query->have_posts() ) : $the_query->the_post(); ?>     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to    <?php the_title_attribute(); ?>">     <?php the_post_thumbnail('featured'); ?>

<?php the_date('d.m.Y'); ?>

<?php    the_title(); ?>

     <?php endwhile; ?>     <? wp_reset_postdata(); ?>      If I then create another custom query similar to this one, or even if i just duplicate this query further down my page, I don't get the php the_date to return any value! this is the strangest thing... what am I doing wrong?


2 custom post type paging in 1 custom taxonomy

I have 1 important taxonomy that contains 2 different custom post type content. I want somehow show them in same taxonomy page with both paging. Well.. i am not sure i can do that or not. Is it possible to paging 2 different CPT in same taxonomy?


Add filter 'wpautop' to meta box textarea

I'm using -this tutorial- to add simple meta boxes to a custom post type. But the textarea meta boxes are spitting out content all as one big paragraph, with no `<p>` formatting applied. What code would add the -wpautop filter- to the meta box textarea? Thanks for any help.


Creating on-page options for Custom Post Type

I'm creating a plugin for creating Landing Pages. I use custom post type and custom fields for the landing pages, but i need to add some on-page options for each entry. For example i need to have a an option(check box) for hiding the header(header is edited through a WYSIWYG custom field) on a specific landing page. I searched for different option "frameworks" and i found Redux ( https://github.com/ghost1227/Redux-Framework ) that works for plugins and also uses WordPress Settings API. The examples of Redux and any other framework i found as well as any tutorials i found online about creating settings/options pages are for general options but i need to have those options in the editing screen of my specific custom post type. I'm not a PHP guru but i'm trying and willing to learn, any help will be appreciated or at least if someone can point me to the right direction it would be nice. Cheers, Stelios


Replace the attribute_escape to esc_attr()

I opened a similar topic, but since it is a little confusing, I decided to create a new topic to clarify more. i run the website and i found the errors seems like: `Notice: attribute_escape is deprecated since version 2.8! Use esc_attr() instead. in C:\xampp\htdocs\website\wp-includes\functions.php on line 2638` I search and i found some useful information like : When do I need to use esc_attr when using WordPress internal functions , but sorry i am not undearstand.. The errors are in the post title. for example, this is my code of the `index.php`. Where exactly are the errors?               <?php get_header(); ?>

                                  <?php query_posts( 'posts_per_page=6' );?>                       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                          <div class="post" id="post-<?php the_ID();?>">
<a href="<?php the_permalink() ?>" <?php the_title_attribute(); ?>">                          <?php the_title(); ?>
                                  <?php if(is_sticky()):?>

Welocome

                          <?php endif;?>                                                                                <?php if( in_array( $post->ID, array(354) ) )                                            {echo get_the_content();}                                                else                          {echo get_excerpt();}?>

 <img src="<?php echo get_bloginfo('template_directory'); ?>/images/dots.png" border="0" />

                                        <?php endwhile; ?>                                       <?php else : ?>
 Not found

 Sorry but you are looking for something that isn't here.

                             <?php endif; ?>
     <?php get_sidebar(); ?>     <?php get_footer(); ?>


Removing Submenu from Menu

Thesis appears to automatically add the sub-menus (sub-menu ul) to menu parents if childs exists. I have a specific need to remove this html from a particular menu. The menu name is: second_level Not sure if there a hook to do this. I'm trying to remove these from the menu name above.
...
      I'm not trying to remove the class but the UL's.


Add plugin by SVN. Current version problem

i need add new version of plugin. And i have one problem! On my plugin link http://wordpress.org/plugins/simple- facebook-comments/ i steel see current version 0.7.6 but i add 0.7.7 Look on this skrin http://szymoon.nazwa.pl/images/verssionscrin.jpg I don't now why but version 0.7.7 is not current version why?


Transfer comments from one domain to another

We have two domains with separate WP installs, it's not a multisite network. We would like to send or transfer comments from domain A to domain B so domain B handles all moderation because we'd like to minimize maintenance as much as possible and domain B is the main site that receives the most traffic within our network. Is it possible to send or transfer comments to the admin backend for moderation between two domains? Thanks in advance!


How to add meta slider lite or other slider to main page header in pinboard theme

Slider is created using Meta Slider Lite v2.2.1. Meta Slider shows it usage as               Shortcode           [metaslider id=449]          Template Include           <?php echo do_shortcode("[metaslider id=449]"); ?>      Pinboard theme is used. Text module is added to its header element. Text element contains               [metaslider id=449]     <?php echo do_shortcode("[metaslider id=449]"); ?>      slider does not appear. View source shows that               [metaslider id=449]     <?php echo do_shortcode("[metaslider id=449]"); ?>      are rendered literally. How to show slider in header ?


Loop through child images of a parent for a Nivo Slider

I want to use a Nivo slider to cycle through the children of a parent page one by one, how can I do that? I have the following piece of code that grabs **ALL** the children of a parent page and displays them:               <?php $pages = get_pages(array('child_of' => $post->ID));     foreach($pages as $post)     {     setup_postdata($post);     $fields = get_fields(); ?>         <?php echo $fields->title; ?>     <?php } wp_reset_query(); ?>      Is there a way to show 1 child image and upon clicking the next arrow on the Nivo it shows the next child image?


Display posts of custom type in hierarchical order

I has custom field 'People' and I have parent pages(post types) and child pages (post types). This is my code:               <?php       $args = array(      'post_type'=> 'people',     'posts_per_page' => -1,     );     $loop = new WP_Query( $args );         while ( $loop->have_posts() ) { ?>         <?php $loop->the_post();?>
                  <a href="<?php the_permalink();?>" title="<?php the_title(); ?>"><?php the_title(); ?>
     <?php } ?>      I need display this custom post types in hierarchical order. For example:               First parent post type        - first child of first parent post type        -second child of first parent post type     Second parent post type        -first child of second parent post type      But by default this posts displayed in other by time of publish. Any ideas, how resolved this problem? Thanks all.


design and development workflow

We're developing a set of websites, complex ones with a lot in common, and the company have decided to use WP as a base CMS. As in every site, there is a design process, followed by HTML, then development/CMS integration. However, I'm wondering how would that work with WP? Do companies design all templates, then HTML, and then theme and CMS development, or do they finish the CMS development (which in this case a layer of custom plugins extending WP), then create individual themes that works on it? As time is crucial and many people are involved -which raises the cost- , I would want to raise efficiency of the team and make design and dev teams work in parallel. Any idea of what the sequence should be are appreciated. By the way, we have common features amongst the sites and then we have site- specific features, which you can think of as theme specific features


Photography Based Design - Multiple Images Per Post

I'm thinking of using WordPress for my new website.   It's a photography based website and the client will be uploading groups of photographs primarily. They'll want to give it a title and upload up to 20 photographs. Is this possible through WordPress?   To get rid of content in the form of text and instead, opt to upload a series of Photographs? I'm capable in WordPress, but I've not modified it much beyond vanilla previously, has anyone been able to achieve something similar?


Automattic's eCommerce Plugin

## Question Does anyone know what plugin Automattic uses for their eCommerce functionality in the MU installation of WordPress located on the free sub-domains at wordpress.com? Please share where it is available, or if it even is available. I suspect that it might be proprietary, but if not, I like to try and follow Automattics lead when developing my own WP sites to ensure better long-term stability. * * * ## More Plugin Details If you have a wordpress.com account, you'll find the admin panel for the plugin here: `{YOUR_USER_NAME}.wordpress.com/wp-admin/paid-upgrades.php`. These two related resources are pulled from the wordpress.com source code:   1. /wp-admin/css/store-bundles.css   2. /wp-content/admin-plugins/wpcom-billing/images/WPCOM-Billing-Paypal-Direct.png There are also multiple references to the plugin in this .pot file... open the link in your browser and do an on-page find for: `wpcom-billing`. Based on the above evidence, it appears that this eCommerce plugin resides in a directory called: **wp-content/admin-plugins/wpcom-billing** , but I'm also wondering if this could just be a modified version of the wp-ecommerce plugin.


One WordPress and database but multiple subdomains

I want to create a multiple subdomains, but using only one wordpress and database installation. The difference of those subdomain sites are the colors and the blogs, but in terms of functionalities, layout, plugins, they are just the same. Is this possible, or can I only go with the ratio 1 is to 1 (1 wordpress for 1 subdomain)?


Form request to page in admin panel

I'm current creating a small WordPress plugin for personal use and i have a problem with making forms working. Since i found some problems using the same page with refresh i created another php page where will be execute the code then i use `admin_url` to go back to the previous admin page with the result of the action. My problem is that i'm unable to send the request to the page since my form code will look for the file `submitedit.php` in `wp-admin` and not in the plugin directory. If i try to use my constant `PLUGIN_DIR` i get the full path to the plugin but Chrome will report an error               Not allowed to load local resource: file:///D:/xampp/htdocs/wordpress/wp-content/plugins/post-manager/submitedit.php      I noticed some plugins uses my same code `action="url"` but they work fine Except that they some hidden fields               <input type="hidden" name="_wp_http_referer" value="/wp-admin/options-general.php?page=crayon_settings&settings-updated=true">     <input type="hidden" id="_wpnonce" name="_wpnonce" value="6cbd343800">      My form html is:               <form action="submitedit.php" method="POST">      but when i submit it give 404 error since, as i said, it search the file in `wp-admin`.               http://localhost:90/wordpress/wp-admin/submitedit.php      How can i fix it? I don't find any thing online and i'm very new with WordPress plugins so i don't know if i'm doing something wrong.


Looking for Functions File that doesn't Exist

My WordPress site seems to be running fine, except that trying to go to the plugins page gives the following error:               Fatal error: Cannot redeclare _verifyactivate_widgets() (previously declared in .../public_html/wp-content/themes/news-child/functions.php:75) in .../public_html/wp-content/themes/news/functions.php on line 452      Deleting the theme so that WP reverts to the orignal does not help, it keeps trying to go to that functions.php. I cannot deactivate the plugins either (since the page is inaccessible). Ideas on what the cause/fix is?


Changing WP_CONTENT_DIR and WP_CONTENT_URL in wp-config.php does not register?

I tried to add this to the end of my wp-config.php               define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/somedir');     define('WP_CONTENT_URL', 'http://example.com/somedir');      however, echo immediately after that shows the old values (with wp-content value). I tried echo because in wp admin I couldn't see the theme from new location, of course. I have installed wp in example.com/wp subdirectory and site itself is example.com - I copied over .htaccess and index.php over to the root and everything is working fine, I just need to move wp-content into another folder over at root also with a different name.


Custom Wordpress Taxonomy problems

I have a problem on my site which is www.sultnedyr.dk . There in the menus there are links like HUndefodder , kattefoddr and kattegorier. Under Hundefodder when you click on cateogory ,it doesnt show the subcategory else the other two menus show. Hundefodder is the custom taxonomy i created. Any help will be appreciated. Thanks


Get only the top level categories using get_categories() without foreach loop

Very simple Question: Here is my `get_categories()` code:               <?php $args = array(                             'show_option_all'   => '',                             'show_option_none'  => '',                             'orderby'           => 'ID',                             'order'             => 'ASC',                             'show_count'        => 0,                             'hide_empty'        => 0,                             'exclude'           => '1',                             'hierarchical'      => 0,                             'depth'             => 1,                             'number'            => 12                             );                         ?>          <?php $categories = get_categories( $args ); ?>

                                 <?php for( $i=0; $i<4; $i++ ) {                                     echo "
" . $categories[$i]->{'name'} . "
";                                 } ?>

                                 <?php for( $i=4; $i<8; $i++ ) {                                     echo "
" . $categories[$i]->{'name'} . "
";                                 } ?>

                                 <?php for( $i=8; $i<12; $i++ ) {                                     echo "
" . $categories[$i]->{'name'} . "
";                                 } ?>

      After a long search I got the way how to get into the stdClass object without foreach loop and I want to proceed with this way. But I want only the top level categories, no subcats. How can I modify the argument here?


Different image and background color depending on page type

Here is the HTML/PHP and CSS code for a part of my page **HTML/PHP**               <?php     $product_pages_args = array(         'meta_key' => '_wp_page_template',         'meta_value' => 'page_library_html_content.php',         'hierarchical' => '0'     );     $product_pages = get_pages( $product_pages_args );     ?>          <?php     foreach ( $product_pages as $product_page ) {         $author_id =  get_post_field('post_author', $product_page->ID );         $author_details = get_user_by( 'id', $author_id );         $author_name = $author_details->first_name . ' ' . $author_details->last_name;                echo '

';         echo '
ID ) . '">' . $product_page->post_title  . '
';         echo '
' . get_post_field('post_content', $product_page->ID ) . '
';          echo '
Tutorial Instructor:  ' . $author_name . '
';         echo '
' . get_avatar( $author_id , 32 ) . '

';;      **CSS**               #posts {     float: left;     width: 48%;     background-color: #FFF;     height: 300px;     margin-left: 20px;     margin-top:20px;     -webkit-border-radius: 5px;     -moz-border-radius: 5px;     border-radius: 5px;     }     #posts:before {     content: "";     position: absolute;     z-index: 2;     top: 0;     right: 0;     bottom: 0px;     left: 60%;     background-image: url(http://localhost/wordpress/wp-content/themes/Techyoucation%202014%20Wordpress%20Theme/images/html.png);     background-repeat: no-repeat;     background-position: center;     background-color: #39ADD1;     -webkit-border-top-right-radius: 5px;     -webkit-border-bottom-right-radius: 5px;     -moz-border-radius-topright: 5px;     -moz-border-radius-bottomright: 5px;     border-top-right-radius: 5px;     border-bottom-right-radius: 5px;     }      Now with this code you can see that there is a box with the post tile and content (only post's with page type (page_library_html_content.php)) What I would like to do is show only the posts with the page type: page_library_html_content.php page_library_css_content.php page_library_wordpress_content.php and the background image in               #posts:before      will change depending on the page type of the page and the background color will change too. Is this possible and how. Thanks


How to add a class to the comment submit button?

How do I add a class to the comment submit button? The simplified function `comment_form(array('id_submit'=>'buttonPro'));` obviously only changes the id and `class_submit` does not seem to exist. I have read through both Otto's and Beau's writeups but to no avail.


Custom Permalinks for Custom post Type Archives?

I know that WP 3.1 has added support for archives for custom post types but is there any way to customize the permalinks for them?


bbpress Not Showing: How to troubleshoot?

BBPress isn't showing on the front-end in a custom theme I've built and I can't figure it out. I activated TwentyTwelve and it shows, so I know it's not a plugin. I also cleared out functions.php and that didn't have any impact. How do I begin troubleshooting from here?


Breaking up the results of a loop

In my query, I'm gathering 6 posts and displaying them into an unordered list. Here's the code I'm using:               $args = array(         'post_parent' => $page_id->ID,         'showposts' => 6,         'post_type' => 'page',         'orderby' => 'menu_order',         'order' => 'ASC'     );     $subpages = new WP_query($args);          if ($subpages->have_posts()) :         while ($subpages->have_posts()) : $subpages->the_post();             $output .= '
post_name.'-link">
post_name.'-info">
post_name.'-img">'.get_the_post_thumbnail($page->ID,'icons').'

'.get_the_title().'

post_name.'-excerpt">'.get_the_excerpt().'

';         endwhile;     endif;      I'd like to breakup the and show three posts, then insert a different div, then continue the loop. The html outcome would look similar to:

Post1

Post2

Post3

Some text goes here

Post4

Post5

Post6

      **EDIT** I got this working with the suggestions from @Rarst. Here's my updated code:                   $args = array(             'post_parent' => $page_id->ID,             'showposts' => 6,             'post_type' => 'page',             'orderby' => 'menu_order',             'order' => 'ASC'         );         $subpages = new WP_query($args);              if ($subpages->have_posts()) :             while ($subpages->have_posts()) : $subpages->the_post();                 $output .= '
post_name.'-link">
post_name.'-info">
post_name.'-img">'.get_the_post_thumbnail($page->ID,'icons').'

'.get_the_title().'

post_name.'-excerpt">'.get_the_excerpt().'

';                 if (2 == $subpages->current_post):                         $output .= '
';                         $output .= 'test';                         $output .= '
post_name.'">';                 endif;             endwhile;         endif;


Main timeline in a different path

I have a home.php file which I am using as my home page and it is showing a specific page. In my index.php I have my main timeline. But when I access this page I get redirected to home.php. How can I do that? To show my main timeline in a differente path then home. Something like mysite.com/blog


User profiles and object associations

I'm coming over from Drupal and I'm very used to the way Drupal handles users and objects (called nodes over there.) I have to learn how WordPress handles these same situations. Since we're going to be confused with the same words that mean different things, I will define some of them here:   * **Node** - In Drupal, everything is a node. A post is a node. A page is a node. A product is a node.   * **Author** - In Drupal, every node has an author. Think of the WordPress post author.   * **Product** - In Drupal, a product is a node. On my site, I sell books. So a book is a product which is a node.   * **Book Author** - In the normal sense, a book's author is the person who wrote it. I'm going to refer to this as book-author from now on to avoid confusion with node author. Every book-author is a user on the site. On my site, since every node needs an author, when I create the products I associate the author of the node with the book-author. Imagine creating a post on WordPress and saying the post author is someone other than yourself. Same thing. On the user's profile page (the book-author's profile) I can list the books they have written (with links to the actual product node) on their profile page. I simply have a section where I render each product where they are the node author. Now I need to learn the way WordPress handles this situation whether via a plugin or code in the `functions.php`. So far I've been reading up on the user profiles and they aren't near the same as Drupal.   1. How do I associate a user as a book-author? I assume this will be some kind of custom role in WordPress; however, I've been reading up on that and it seems the roles in WordPress are related only to posting permissions and the like.   2. How do I associate a user (book-author) to a product? I'm using the WooCommerce plugin. I know I can create a custom field on the product, call it Author, and then put a name in there but this will just render as simple text. I need to associate this field as a link to the user (book-author) profile and be able to associate this product on the user's profile.   3. Is the user profile even the appropriate way to handle this in WordPress? Or should I be looking into some other kind of template? Perhaps a custom post type that has a block of code in the template that will render a listing of products based on the post's title (used here as the author name) or something like that? If that's a good way to do it, how then do I associate links back to this custom post page? i.e. when clicking a user's name in a comment it should now go to that associated custom post instead of the user profile. Sorry if all of this is confusing. It's out of the box behavior in Drupal and since this is literally my second week using WordPress it's all a bit confusing to me as well. **NOTE:** an admin should create a Drupal tag. Doing a quick search I find many posts in relation to Drupal here and it may better assist users who are familiar with both platforms find questions they can expertly answer. ;-)


Custom options page, add_options_page deprecated?

I'm trying to create a page in my theme to allow users to add generic info (phone numbers etc) I followed a tutorial and thought I had something good but it turns out part of it is deprecated. So what's the best way?               function site_options_menu() {         add_options_page( 'Company Info', 'Company Info', 'manage_options', 'company-info-options', 'site_options_options' );               function site_options_options() {...}      Here is my full function which included all the fields I am trying to store (14 fields in total) http://pastebin.com/dV9bfsXh The page and fields show OK but trying to save the page settings results in: > Notice: options.php was called with an argument that is deprecated since > version 2.7! > > Warning: Cannot modify header information - headers already sent by ...


Insert dynamic content into posts

I'm currently using this plugin http://wordpress.org/extend/plugins/automatic- featured-image-posts/ which creates batches of posts from uploaded images I'm also using this code here to generate the default content for every new post               add_filter( 'afip_new_post_content', 'diww_default_post_content' );     function diww_default_post_content() {       $content = "<iframe src=></iframe>";       return $content;     }      Now I have a php array of URL's which I want to insert into the src for each post. Is it possible via some loop or sequential manner insert each URL into each post sequentially? e.g.   * URL[0] -> Post[0]   * URL[1] -> Post[1]   * URL[2] -> Post[2] and so on.


Display Child Term if it exists

I have a page that lists all the members of my band. The members are categorized into 'sections'. There are a few child sections, and I'd like to display the child section (if it exists) for each member. For example: Trumpets Trombones Drumline   * Snare   * Tenors I'd like each member that is a "snare" or "Tenors" to list this sub-section. This is the code I'm using:                <?php           // grab terms of current post, replace taxonomy name     $terms = get_the_terms($post->ID, 'section', $args);     // define arguments of following listing function     $args = array (         'child_of' => 5, // current post's (first) category          'title_li' => '', // disable display of outer list item          'taxonomy' => 'section' // replace as well     );     // list child categories     foreach ($terms as $term) {         echo $term->name;     };                           ?>      If there is a child section, it lists the parent AND child section, instead of only the child section. Also, it lists the parent section if no child exists. Any ideas on how to only list a child section, if it exists?


Create a comments template for custom post types

Is it possible to create a comment template for custom post types? I want the wording for comments on a custom post type to be different for wording on a regular wordpress post. I tried comments-posttype.php but that didn't seem to work.


Display custom taxonomy for product

I have to display custom taxonomy for every product which is i have selected for every product from back end. I have created custom taxonomy `city` in that custom taxonomy i have added the `Nashik ,Mumbai` city. In product page i have assigned custom taxonomy city `Nashik` to that product that assigned city `Nashik` i have to display at product page. i have tried out with bellow code but it's displaying the all city list like `Mumbai` `Nashik` here i have to display specific city name for product.               wp_tag_cloud( array( 'taxonomy' => 'city', format => 'list' ) );


Rewrite Custom Fields url

I use custom fields named 'url' to add another website url (like `http://www.youtube.com`), I want to rewrite the 'url' as `http://www.mysite.com/go/123`. I tried all rewrite plugins, no one could do this. Can I set post id as 123? Or can I set a random number as it?


Query Custom Post Type by Taxonomy

I've created a query working fine pulling posts from a specific taxonomy—but before I had only 7 taxonomies that were permanent, now I have sub taxonomies under that main taxonomy and they will be dynamic. Any ideas of how I might be able to write this but have a for-each loop going through this query for any taxonomy that is a child of the main taxonomy (in this example the parent taxonomy is 'Cameras') So again: I have 7 parent taxonomies ('Cameras' is one) and each one has a dynamic amount of sub taxonomies, i'm trying to create a for each loop that will allow me to do the following without writing the query for each specific sub-taxonomy. Thanks
Cameras

     <?  $args = array(                                     'post_type'=> 'rental_gear',                                     'type'    => 'cameras',                                     'order'    => 'ASC',                                     'posts_per_page' => '-1'                                     );                                                    $the_query = new WP_Query( $args );                                 if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();                                       ?>
<a href="<? the_permalink(); ?>">› <? the_title(); ?>
                                   <?php endwhile; endif; wp_reset_postdata(); ?>


Querying multiple meta_keys in Wordpress SQL query

Here's my Query... I'm looking to narrow this query down to users of one specific role ("meta_key = 'wp_capabilities' AND meta_value = 'employee'")...how do I add that additional conditional to this string?               $get_users = "SELECT * FROM $wpdb->users     WHERE ID = ANY (     SELECT user_id FROM $wpdb->usermeta     WHERE meta_key = '$meta_key'     AND meta_value LIKE '%$search%'     ) ORDER BY user_nicename ASC LIMIT 10000";      Thanks in advance...


delete a photo tag in rtmedia

I am using rtmedia photo tag in my website. When deleting a user I am also trying to delete all the photo tags added by him on the albums of other users. How can I do that?. Is there any functions available or should I write a custom one for that?


What's a good way to put authors into groups

I have 7 companies contributing to one blog, and each company has 3 authors. I'd like to show all posts by all authors of one company. Is that possible?


Plugin SVN & update API - how are plugins identified?

One thing that's never been clear to me (especially since I haven't submitted a plugin to the repository) is how a plugin's unique "ID" (slug) is generated (i.e. this list).   1. Is it a choice by the author at the point of SVN submission, or by a moderator?    2. Is it the sanitized plugin name (title)?   3. Is it the `plugin_basename`?   4. Is it the main plugin file (without the directory name)?   5. Something else? I'm curious as to which attribute(s) of a plugin **link it to it's SVN counterpart** (if it has one) for the plugin update API? I ask, partly out of my nature to want to know, but also how to ensure (to some degree), my own one-off plugins won't clash with one in the SVN. For example, if it was only **3)** , I could use a highly unique directory name, but keep my plugin name (title) short 'n sweet. * * * **N.B.** Whilst the "standard" file naming convention seems to be `[my-plugin- name]/[my-plugin-name].php`, I've become fond of `[my-plugin- name]/plugin.php`. It gives all my plugins some consistency, it's clear that it's the "bootloader" (main) file, and from a petty standpoint I hate the repetition of the directory name. This is another reason I ask the question, since **4)** would screw me over. Plus I'd like to hear your thoughts on this "standard" too :)


Custom table or form

i need a form or table plugin that can be customized to do this: For example: I am a parcel shipping company. I need some form that can be filled out with shipping info. Later, customer logs on the site to retrive information about the parcel with associated id number. Simple


ID for posts/blogs page

I have a website which has a static front page and a blog page where all the blogs are displayed. I am using my own theme and have created some custom meta boxes that display content in a sidebar based on the return value from `$post->ID`. The interesting behaviour I am getting is that `$post->ID` gives me the ID of the first blog not the id of the blog page itself. I am using $post outside the loop and have declared it global but to no avail. I have also tried using `$wp_query->post->ID` but that gives me the ID of the last post. The relevant code is where I use $post is below this piece of code is located in footer.php:               <?php require_once('wp-content/plugins/markdown.php'); ?>                      <?php                 global $post;                 $leftSidebar = get_post_meta( $post->ID, '_my_meta', true );                 // Convert markdown to HTML and then convert smilies                 if ( isset( $leftSidebar['leftContent'] ) ) {                     echo convert_smilies( markdown( $leftSidebar['leftContent'] ) );                 }             ?>               The code that is used for the loop is below and is placed in index.php:               get_header(); ?>          <?php if (have_posts()) : ?>         <?php while (have_posts()) : the_post(); ?>         <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php the_time(get_option( 'date_format' )); ?>
                          <?php the_excerpt(); ?>
Posted in: <?php the_category(', '); ?>

Tags: <?php the_tags(); ?>

        <?php endwhile; ?>     <?php else : ?>

Not Found

Sorry, but you are looking for something that is not available

     <?php endif; ?>      Please do let me know if any further information is required. If there is a way to find the ID of the blog page programatically and make the blog page recognize itself as the blog page and not the first post that would solve me problem I think. Thanks in advance.


Removing Automatic Redirects Without Plugin

I've been working on a wordpress site and run into the automatic redirect feature when you change a slug. On the current site I am using the Redirects plugin, and was able to modify the redirects so that I could reuse slugs that had been altered without getting the infinite loop problem. My company has a similar wordpress site that is not using the Redirects plugin. I am curious to know how I would be able to remove a redirect from a slug that WordPress has put into place without installing Redirects. From my understanding, it's in the database somewhere, but I'm not sure where to look.


Credit link that if removed stops site from working

Im trying add a credit link to the footer of all the WP sites i make saying: _Designed by ..._ While this is simple enough, i want to code it so that if this link is removed from the footer, the entire site shows an error or doesn't load up etc. Any one have ideas?


Exclude from search all custom posts which are NOT in a taxonomy term

I have a custom post with a taxonomy associated to it. That taxonomy only has one term, and posts either belong to it or not, in a boolean fashion. On the search results, I wish to show the custom posts that belong to the taxonomy, and not show the ones that don't belong. I've thought of two ways of accomplishing this, but I'm not sure which one is the best:   * include only custom posts that belong to the taxonomy term;   * exclude all custom posts that don't belong to the taxonomy term. I've managed to do the exact opposite from what I want, with the following code:               global $query_string;     $query_args = explode("&", $query_string);     $search_query = array();     foreach($query_args as $key => $string) {         $query_split = explode("=", $string);         $search_query[$query_split[0]] = urldecode($query_split[1]);     }          $custom_query = array();     $custom_query['tax_query'][] = array( 'taxonomy' => 'tax-whatever', 'terms' => array('term-whatever'), 'field' => 'slug', 'operator' => 'NOT IN' );     $args = array_merge( $wp_query->query, $custom_query );     query_posts( $args );          $search = new WP_Query($search_query);      This, of course, outputs all the custom posts which are NOT IN the term- whatever. How can I accomplish the exact opposite? **EDIT** I will try to explain my problem a bit better. Let's use an example. Imagine I have a taxonomy which is called "Selected" and **only one** taxonomy term called "Yes" that users can choose with a checkbox. I suppose I should have used two checkboxes ("Yes" and "No"), but I thought it didn't make much sense at the time. When users search for something in the website, all pages, posts and custom posts appear in the results. The only thing I want to remove from the search results are the custom posts **that are not associated** with the taxonomy term "Yes", leaving all the rest like it is. This means I want to output all pages, posts and "Yes" custom posts. Any ideas how I can achieve this? Thanks. **UPDATE** Here's an idea I had: Is there any way I can make two queries and merge the results?   * One query with all the posts and pages except the custom post (`'exclude_from_search' => true`);   * Other query with only the custom posts that match the taxonomy term (`$custom_query['tax_query'][] = array( 'taxonomy' => 'tax-whatever', 'terms' => array('term-whatever'), 'field' => 'slug', 'operator' => 'IN' );`). However, if I use something like:               $mergedposts = array_merge( $wp_query->query, $custom_query );     query_posts( $mergedposts );      It will only show me the custom posts. I suppose I could make a direct query with SQL but I've never worked with it. Although that is something I wish to learn in the future, right now it doesn't seem like a good way to solve this kind of problem, since I won't understand what I'm doing. Right now my best option so far is create a new taxonomy term and classify all the "uncategorized" custom posts with it. However, they are a few hundreds, so it will take a while. **NEW UPDATE** I found a way to detect if a custom post belongs to a specific term in a taxonomy. This is a piece of code I picked up somewhere, since I don't have the PHP knowledge to create something like this all by myself. However, I understand what's being done and I adapted it to my situation.               function is_selected( $selected, $_post = null ) {         if ( empty( $selected ) )             return false;              if ( $_post )             $_post = get_post( $_post );         else             $_post =& $GLOBALS['post'];              if ( !$_post )             return false;              $r = is_object_in_term( $_post->ID, 'selected', $selected );              if ( is_wp_error( $r ) )             return false;              return $r;     }      This function will work correctly but only if used inside the loop. However, if I change the loop after the search query is made, it can mess up the pagination, and the number of results found will possibly be wrong. Not sure if this is a step in the right direction, but at least it's a step.


Minimising number of queries on a page when using Advanced Custom Fields

I'm currently working on a site where there is extensive use of the popular Advanced Custom Fields plugin. However, as a result the page loading time can be quite slow, especially when using the Gallery plugin. Does anyone have suggestions regarding what the best practice is with managing a large number of custom fields? In some cases I am effectively working with thousands of variables, and need to reduce the page load time from some cases around 5s. Quite an open question I know, though really it would be great to have some suggestions regarding how number of queries in a page can be minimised (such as through directly accessing values in the database perhaps rather than relying on a plugin's APIs?).


Undefined index notice when using the $args parameter in add_settings_field()

I'm using the Settings API to provide my admin-user with some options for a plugin I'm writing. I have about 30 text fields to output on the plugin options page so I have created a very general callback:               public function my_fields_callback( $args ) {              $name = esc_attr( $args['name'] );         $value = esc_attr( $args['value'] );         echo "<input type='text' name='$name' value='$value' />";          }      The part I'm having problems with is the `$args` parameter in add_settings_field(). Specifically, I'm getting the following PHP debug notice: > Notice: Undefined index: height > > Notice: Undefined index: weight Here is how I'm adding my settings field(s):               add_settings_field( 'field-1', 'Field One', array( $this, 'my_fields_callback' ), 'slug', 'section', array( 'name' => 'settings[weight]', 'value' => $settings['weight'] ) );          add_settings_field( 'field-2', 'Field Two', array( $this, 'my_fields_callback' ), 'slug', 'section', array( 'name' => 'settings[height]', 'value' => $settings['height'] ) );      Why am I getting the 'undefined index' notice and how can I avoid this? I'm trying to pinpoint what I am doing wrong.


Add visual editor capability to custom excerpt window?

The custom excerpt field (under Add New Post) only accepts html. Thus, you can't just cut and paste a segment from the Visual Editor. If you want links to appear in custom excerpt, you have to know how to create them. This doesn't work so well for users who are unfamiliar with html. Is there any way to give the same Visual Editor capabilities to the custom excerpt field? Thank you.


Browser loading content from Twitter in admin area?

I have noticed that when I am in my Dashboard and switching from main Dashboard to for example plugins, Twitter seems to be loading something. As I am located in China where Twitter is blocked, it always takes forever for my browser to realise that Twitter cannot be loaded, and thus before the page(s) finish loading. This screenshot is for going to the plugins page, but it happens everywhere in the Dashboard. ![Browser at plugin page loading something from platform.twitter.com](https://img.skitch.com/20110519-m3224n1ur5mqmkwqsjq4g4adjd.jpg) Is this normal? And can it be blocked/removed/undone?


Using require_once() within admin

In my theme directory I have the following structure: /includes/functions-custom.php   /includes/avatax/AvaTax.php   /includes/classes/gmaps.class.php I'm making a call from the functions-custom.php to include the second file within the WordPress admin using this code               require_once('avatax/AvaTax.php'); //Avalara Sales Tax API     if ( is_admin() ) {         require_once('classes/gmaps.class.php');     }      The first require applies to both the theme and to the admin. The second, obviously, only applies to the admin. However, the first require fails with the following message:               Warning: require_once(/Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/classes/BatchSvc/WP_User_Search.class.php) [function.require-once]: failed to open stream: No such file or directory in /Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/AvaTax.php on line 23          Fatal error: require_once() [function.require]: Failed opening required '/Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/classes/BatchSvc/WP_User_Search.class.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/AvaTax.php on line 23      I don't feel like this should be such a stumper. Perhaps I'm overlooking something obvious? I've tried preceding the file path with the constant 'TEMPLATEPATH' and using the obvious WordPress functions like               require_once(get_template_directory().'/path/to/file');      I'm developing locally on MAMP. Particularly odd is the call to the file (in the error message) '/classes/BatchSvc/WP_User_Search.class.php'. Can anyone help?


Alternative to WP Remote - manage multiple WP sites in a dashboard (updates, plugins...)

Do you know of a (possibly free) alternative to WP Remote? It would be handy to have a dashboard to manage many Wordpress installations across multiple domains. They have no privacy policy, privacy gaurantee, or terms of use in any form on their website; and I'm not keen to jump on their bandwagon if they have no 'service gaurantees'.


I am using the enqueue function to link two javascript files. I get this error `Object [object Object] has no method 'slides'` I checked and I am not loading jquery more than once. The code that is causing this error is               jQuery(document).ready(function ($) {         $('#slides').slides({             preload: true,             preloadImage: '<?php echo get_template_directory_uri(); ?>/images/loading.gif',             play: 5000,              pause: 2500,              hoverPause: true                          });       });      Example Link


Limit content size

Does anyone know how I can set a limit on the char length for posts when using the "content=yes" function? I need something like excerpt_size but for the content, not excerpt. Before someone suggests using excerpt, it strips out the formatting and line breaks so I want to use the content output function but set a limit like you can with excerpt_size. I hope that makes sense to you. I don't mind hacking the php in the plugin if someone knows what I need to change in there. Thanks in advance!


Show Blogroll of another WordPress site

I am managing a couple of WordPress sites, all hosted on the same VPS, and the client would like the homepage blogroll of `Site A`, that the own, to appear on `Site B` that the also own with the same Author attribution, preferably to link to the originating sites author as opposed to a duped author on `Site B`. I was thinking of either querying the database on `Site B` with a replica `query_posts()` query however I am having trouble reverse engineering the `query_posts()` function. Is there a way to do this for an 'external' site? NB; sites are not `multisite`. I tried that but it all dropped off and a critical plugin we need is not compatible.


ow to change cutsom page url of wordpress site using htaccess

i need help in httaccess rewrite of a wordpress site. i have url like below http://thewhiterabbit.dk/beta/steder-detail/?id=floos i want it to be like http://thewhiterabbit.dk/beta/steder-detail/floos i have developed using id=floos, now instead of redeveloping all thing i just want a rule to change the url any help will be greatly appriciated thanks.


the_widget() and widget's ID

Let's assume I have a widget that displays only its name:                   <p>              <?php echo $args['widget_id'] ?>         </p>      So when I drag & drop my widget to any sidebar it shows:               <p>          myWidget-number     </p>      The problem is I want to call this widget with a shortcode:                   (...)                 ob_start();                     the_widget(MyWidget);                 return ob_get_clean();        }              add_shortcode('myWidget_short', 'myWidget_shortcode');      And when i do [myWidget_short] it shows only               <p>     </p>      Any ideas how to call widget's ID with a shortcode?


Creating a plugin to sanitize comment and the url field before display only

I want to create a plugin to sanitize comment and mainly the url field before display only (not before adding to database), to filter the url fields and only allow displaying this field only if it contains specific data, otherwise I want to replace this url field with something safe or clear it. ( i do not want users to enter the url as "test.com" or "example.com" , i want to remove it in these cases) How can I do that, which filter do i need to add to ? EDIT: based on the selected answer, I created this plugin to reset all urls to empty strings:               <?php     /*     Plugin Name: Get rid of websites before display     */     function my_custom_remove_website( $comments ) {         foreach ($comments as $k => $comment) {             $comments[$k]->comment_author_url = "";         }         return $comments;     }     add_filter( 'comments_array', 'my_custom_remove_website' );      Please feel free to comment or answer if this plugin is not done with best practices.


Is it safe use wp_editor in public contact form

I'm going to make a contact form for my site, and i want to use WYSIWYG editor (wp_editor) in my form message field. Here is my question, is that safe use wp_editor in public though disable media button? something like this: http://i.stack.imgur.com/dpspL.jpg Thanks.


How to redirect non admins to homepage if trying to view mysite.com/wp-admin/?

I want all my users (contributors and authors too) but the admin to be redirected to the homepage if they try to view mysite.com/wp-admin/. Contributors and Authors must be able to add and edit posts as usual, along with others they've to be forced to be redirected... I've already removed the link to the dashboard... I've also tried some plugins but the one that gets closer (Remove Dashboard Access) redirects to main page but prevents the contributors and authors from adding, editing and deleting posts. Thanks!