Load a script just to custom post type in admin

I have created a custom post type "portfolio" with something like this :               $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => 4,         'taxonomies' => array('post_tag','category'),         'supports' => array('title','editor','comments','trackbacks','revisions','custom-fields','page-attributes','thumbnail', 'excerpt', 'tags')       );           register_post_type( 'portfolio' , $args );      And I have some other custom fields in there with an action :               add_action("admin_init", "admin_init");     function admin_init(){ // add_meta_box( $id, $title, $callback, $page, $context, $priority );        add_meta_box("media", "Media Type", "media", "portfolio", "side", "high");       add_meta_box("map_meta", "Mapping Info", "map_meta", "portfolio", "normal", "high");     }      Although I once had this working I can not figure out to get it to load scripts just for this page. Right now I just have them in with the rest of the `wp_enqueue_script` like this :               function my_init() {         if (!is_admin()) {                            ....             }           if (is_admin()) {             wp_register_script('Gmaps', 'http://maps.google.com/maps/api/js?sensor=false', false, '3.0', false);             wp_enqueue_script('Gmaps');                       wp_register_style('admin_js', get_bloginfo('template_directory') . '/admin.js');             wp_enqueue_script('admin_js');                  wp_register_script('Zmaps', get_bloginfo('template_directory') .'/scripts/maps.js', array('Gmaps'), '1.0', true);             wp_enqueue_script('Zmaps');             }                }     add_action('wp_enqueue_scripts', 'my_init');      But none of this is loading for me. How can I load these scripts into the admin pages? Better yet how can I load them specifically for the edit pages of the portfolio custom post type?


How i can manage the favorite posts which user marked

My site has many post and when a user is logged into the site, (s)he can mark the post as there "favorite post". So basically what I need is: > How can a user mark a post as her/his "favorite post", and after that > How can I display those "favorite posts" on a single page.


Do I have to use categories?

I don't want my blog to use "categories" is there a way to turn them off? I can just not define any but then they are still listed as "uncategorized"


Top Contributors Plugin with Custom Post Type

I am using the plugin Top Contributors. That's very helpful for all blogs. But the problem with this plugin is: it is not integrated with custom post types. How could I extend the plugin to do that?


Including new Javascript only after a comment is made

I am looking to call a new javascript function only after a new comment has been made by a user. Specifically, I want to include new javascript on the resulting page of the page reload after submitting the new comment form on a blog post. Does anyone know how to do this? My end goal is that I want to make a call using Mixpanel's (http://www.mixpanel.com) javascript API call and make an event called "Comment added" for a specific user. I know how to do the mixpanel side of things but am confused by the this specific use case of wordpress. Thanks in advance!


Query custom posts from custom taxonomy

I'm trying to do a custo slideshow, but I have problems with query the posts. I have defined a custom post type "slider" and a custom taxonomy "slideshow":   * custom post type:              function wms_slider_init() {     $labels = array(     'name' => 'Slider',     'singular_name' => 'Slider',     'add_new' => 'Add Slider',     'add_new_item' => 'Add New Slider',     'edit_item' => 'Edit Slider',     'new_item' => 'New Slider',     'all_items' => 'All Sliders',     'view_item' => 'View Slider',     'search_items' => 'Search Sliders',     'not_found' =>  'No Slider found',     'not_found_in_trash' => 'No Slider found in Trash',      'parent_item_colon' => '',     'menu_name' => 'Sliders'       );            $args = array(     'labels' => $labels,     'description'   => 'Holds our Slider poste specific data',     'public' => true,     'publicly_queryable' => true,     'show_ui' => true,      'show_in_menu' => true,      'query_var' => true,     'rewrite' => array( 'slug' => 'slider' ),     'capability_type' => 'post',     'has_archive' => false,      'hierarchical' => true,     'menu_position' => 5,     'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes')       );             register_post_type( 'slider', $args );     }     add_action( 'init', 'wms_slider_init' );        * custom taxonomy:              add_action( 'init', 'wms_create_slider_taxonomies', 0 );          //create SlideShow Category for the post type "slider"     function wms_create_slider_taxonomies()      {     // Add new taxonomy, make it hierarchical (like categories)     $labels = array(     'name'                => _x( 'SlideShows', 'taxonomy general name' ),     'singular_name'       => _x( 'SlideShow', 'taxonomy singular name' ),     'search_items'        => __( 'Search Genres' ),     'all_items'           => __( 'All SlideShows' ),     'parent_item'         => __( 'Parent SlideShow' ),     'parent_item_colon'   => __( 'Parent SlideShow:' ),     'edit_item'           => __( 'Edit SlideShow' ),      'update_item'         => __( 'Update SlideShow' ),     'add_new_item'        => __( 'Add New SlideShow' ),     'new_item_name'       => __( 'New SlideShow Name' ),     'menu_name'           => __( 'SlideShow' )       );                $args = array(     'hierarchical'        => true,     'labels'              => $labels,     'show_ui'             => true,     'show_admin_column'   => true,     'query_var'           => true,     'rewrite'             => array( 'slug' => 'slideshow' )      );            register_taxonomy( 'slideshow', array( 'slider' ), $args );     }      I made under taxonomy "slideshow" a "category" named - "homeslide" and I put in it a "slider" named "test". I try to set up a query to retrieve all posts from "homeslide", but the query is not working. here is my query and response               function wms_output_home_slides($cat) { // $cat = 'homeslide'       $home_slides_args = array(                 'post_type' => 'slider',                 'posts_per_page'  => -1,                 'tax_query' => array(                 array(                     'taxonomy' => 'slideshow',                     'field' => 'slug',                     'terms' => $cat                        )                      )     );     $sliders_query = new WP_Query( $home_slides_args );     //$print_out = '
'.print_r($home_slides_args, true).'
';     //loop     if ($sliders_query->have_posts()) :          $print_out .= '
';         while  ($sliders_query->have_posts()) : $sliders_query->the_post();             $slider_id          = $post->ID;                  $print_out .= '
';                      $print_out .= $slider_id;                  $print_out .= '
';         endwhile;         $print_out .= '
';     endif;               return $print_out;     }      Any Ideea why didn't get the post ID?


New user created as Participant rather than Contributor

On Wordpress settings we have it set such that a new user should be created as a Contributor: ![User Settings](http://i.stack.imgur.com/0GJUG.jpg) However, any users that are created are given a role of Participant: ![New User as Participant](http://i.stack.imgur.com/VeEOn.jpg) This means that they cannot create their own blog. I am pretty certain that this hasn't always been the case. For further information we are running:   * Wordpress 3.9   * BuddyPress   * WangGuard I cannot see any setting in these that might affect the issue. Any ideas?


List custom post types in dropdown

I have three custom post types, each with around 5 taxonomies and 2 of the custom post types share two taxonomies. I've just about got everything set up for posting from the front end other than the part of a dropdown to show the post_types. As it is now front end posting works but, the urls are broken because they dont have the custom post type in them, i've searched all over and can find zero on listing custom post types... can it be done? Regards Martin edit: Just stumbled upon this **over at codex**,,


How to create non-unique sub-category slugs?

What’s the best way to make Wordpress accept non-unique sub-category slugs? By default, Wordpress ensures that every ‘slug’ portion of permalink URLs is unique, and is very savvy about using this to ensure you never see a 404 from omitting a portion of the URL. This means if my permalink structure is… http://site-root.com/category-name/sub-category-name/post-name/post-id Then….   * http://site-root.com/category-name/sub-category-name/post-name/post-id   * http://site-root.com/category-name/sub-category-name/post-name   * http://site-root.com/category-name/sub-category-name/post-id   * http://site-root.com/sub-category-name/post-name/post-id will all take me to the same post. But if that kind of fail-safe redirection is less important to someone than being able to have non-unique slugs (and nicely structured directories), I’m SOL. Let’s say I’m writing a restaurant review guide in major cities. I want my top-level categories to be city names, and the types of restaurants to be the sub-categories. So I create “Boston”, “New York”, and “Seattle”, then I add the sub-categories “Chinese Food”, “Italian Eateries”, and “Luxury Dining” to Boston. But when I try to add the same sub-categories to New York, even when I specify the URL slugs, Wordpress starts forcing slugs like “http://[site- root].com/New-York/Chinese-Food-New-York/” — unnecessary repetition, and lengthening my links. This gets even worse if I want to have sub-sub- categories. I haven’t yet been able to find a way to force Wordpress to accept non-unique slugs. How would you recommend I accomplish this?


Wordpress not showing custom 404 page for not found images, zip files

My blog all the web page not found errors shows the theme's 404.php file. But if someone click on the file link (.img, .zip), it doesn't show that themes not found page. Instead of that it shows web browser "The webpage cannot be found" error page. For an instance http://www.example.com/sample.img (if this page doesn't exist it shows web browser 404 page, not the theme page) Logged in user can see this error (if click on invalid zip or img file) "Fatal error: Call to undefined function get_option() in /home/xxxx/public_html/wp- content/themes/splash/404.php on line 1". I use hotlink protection htaccess code. Is it a htaccess issue or 404 page issue? Are there any way to correct it?


Adding category dropdown list to theme options page

I am tyring to add a category drop down list to my theme options page. I am try it this way:               <p>                 Select a style from the list                 <?php                 $amp_categories_obj = get_categories('hide_empty=0');        $amp_categories = array();        foreach ($amp_categories_obj as $amp_cat) {        $amp_categories[$amp_cat->cat_ID] = $amp_cat->category_nicename;        }        $categories_tmp = array_unshift($amp_categories, "Select a category:");              echo "<select name='amp_options[amp_cat]'>";        foreach ($amp_categories_obj as $amp_cat) {         $selected = ($options['amp_cat']==$amp_cat) ? 'selected="selected"' : '';         echo "<option value='$amp_cat' $selected>$amp_cat</option>";        }        echo "</select>";             ?>                 </p>      I am not much of a PHP coder by the way. Any help would be appreciated.


Page as child in custom post type slug?

I have the following structure:   * `/projects` (archive of cpt `projects` with template `archive-projects.php`)   * `/projects/project-1` (single view of cpt with template `single-projects.php`)   * `/projects/downloads` (this is a page) When I try to open `/projects/downloads` I get an 404 error. Is there a way to set a page in the custom post type hierarchy?


How to not treat categories as tags in feeds

Basically we're (ab)using Category to determine whether a post is a News post or a Blog post, and so it's not a category in the traditional sense to the outside world. I'd like the category to not be indexed by feed- readers/crawlers, only the tags. I found an easy way to do it with an easy change to 1 function in the core, but I'd rather avoid that if possible. Is there a way to do that without modifying core? (Specifically `get_the_category_rss` in `wp-includes/feed.php`) EDIT: What I mean specifically is to not list the category in the feed. For example, this is what part the current RSS2 feed looks like:               <category><![CDATA[blog]]></category>     <category><![CDATA[test]]></category>     <category><![CDATA[testing]]></category>     <category><![CDATA[yeah!]]></category>      "blog" is a Wordpress Category, while "test", "testing", and "yeah!" are Wordpress Tags. What I want is to exclude the entry `<category><![CDATA[blog]]></category>` entirely from the feed. The same should apply to Atom feeds and any others.


How can I edit the Twenty Ten Theme to remove the comments box when a page uses a specific template?

I'm new to Wordpress and I'm trying to edit the Twenty Ten theme so that my template for basic pages (basic-template.php) does not show the comments box. I do want the comments box to show up on other pages, such as blog posts. I'm pretty sure that changes need to be made in loop.php, but my doesn't seem to be having the right effect. For the comments box, I edited:               <?php comments_template( '', true ); ?>      to be as follows.               <?php     wp_reset_query();     if ( is_page_template(‘basic-template.php’) ) {     comments_template();     } else {     comments_template( '', true );     }     ?>      When I get rid of the else statement, the comments disappear, so I think the problem is my code for that part. Any advice would be much appreciated!


Ajax from various plugins not generating responses (endless spinners)

This isn't a problem with a specific plugin, but with all of my plugins that use Ajax on the front-end (though surprisingly, none of the Ajax requests on the back-end are experiencing any issues). I'm working with plugins such as GD Star Rating and WP Polls, that all submit the user's response via an Ajax call, display a spinner while it waits for a result, and then displays the static result afterward. All I get is the spinner, though the submission DOES WORK and the data IS being received and processed. Just the response never makes the round trip. The only thing I can think of is that the SITE URL is www.mydomain.com but the HOME URL is www.mydomain.com/wordpress to correspond with the actual install location. I use a rewrite rule to make it look like the site is www.mydomain.com. Does anyone have any suggestions about how I can fix the Ajax issue?


get_posts - find out if querystring was crap and fallback is used

If we pass a String to functions like `get_posts`, and that string is not a meaningful querystring (for Example get_posts(' ')), the function returns the results of the default query (the last five posts or such). Is it possible either to suppress this behaviour or - even better - to find out, if the string was a meaningful querystring or if the function just fell back to default hence it was not? Changing the default query-settings is not a solution because I don't want to affect the main loop, but only a function call of `get_posts` in a plugin.


WP_Customize->add_control Navbar Background Image

I'm having trouble figuring out how to properly add a setting under Navigation in the Theme Customization page in order to customize and specify a background-image to use in the navbar.. similar to the pre-existing menu option to select a background-image. This is what I've got in my code so far:               $wp_customize->add_section( 'nav', array(         'title' => __( 'Navigation', 'thetheme' ),         'theme_supports' => 'menus',         'priority' => 100,     ) );


Headway body classes and W3TC page cache conflict

I'm currently working on a website using WordPress, Headway, Modernizr and W3 Total Cache. The problem I'm having is that W3TC is caching the body tag, which means that this isn't being updated depending on the users browser by Modernizr. An example of how this is a problem is that modernizr adds the 'firefox' body class, if this is then cached then in chrome, we have that same 'firefox' body class which makes any browser specific css inaccurate. I have tried using `<!-- mfunc -->any PHP code<!-- /mfunc -->` that I got from this answer The code looks like this               <!-- mfunc -->     headway_page_top();     <!-- /mfunc -->      I have experimented with using the same mfunc wrapper inside the headway_page_top() function so that it is directly around the body tag without success. The error I get comes from W3TC and says 'Unable to execute code:' and then all the markup wrapped by the mfunc is printed out (in debug mode). This also happens with debug mode disabled. This call is happening inside wp-content/themes/headway-2012/header.php, and I have added that path to the 'Cache exception list' inside the W3TC Page Cache settings to no avail. Does anyone have any suggestions as to how I can have the page cache run side by side with modernizr and not have this problem? **EDIT** : This problem isn't to do with Modernizr at all, I jumped the gun in thinking that it was. Headway is adding the body class in on its own and isn't using modernizr to do so. The problem is using W3TC and its fragment so that the body class remains dynamic. I haven't managed to get the fragment caching working at all, or find much documentation on it. Is fragment caching a feasible solution? I seem to be running out of possible solutions.


Retriving array size from serialized data

I've a custom field in Wordpress user meta, which store data in serialized array. I want to retrieve the number of arrays. For e.g.: `a:2:{blah blah}` * * * ![enter image description here](http://i.stack.imgur.com/wJvQy.jpg) Screenshot of my table * * * I tried the following code but it doesn't works. It should print 2               $number = $wpdb->get_var("         SELECT count(*)         FROM wp_usermeta         WHERE meta_key='bookmark_posts' AND meta_value LIKE '%".get_current_user_id()."%'     ");     if ( $number !== '' ) {         echo 'Total bookmarks (' . $number . ')';     }      I've an error log. (john_newsite is the database name) > `WordPress database error Table 'john_newsite.wp_usermeta' doesn't exist for > query SELECT count(*) FROM wp_usermeta WHERE meta_key='bookmark_posts'` **edit:** I just tried the following code. It works but counts the total bookmarks from all users. How can limit the result by current logged in user?               $meta_key='bookmark_posts';     $number = $wpdb->get_var( $wpdb->prepare(          "SELECT sum(meta_value)          FROM $wpdb->postmeta          WHERE meta_key = %s",          $meta_key     ) );     echo "{$number}";


How can i display on front page a movie that is atached in a post type

Im building a cinema site,   * In post's i store the Movies   * I have a post_type name "box-office" , this post type have 1-10 custom fields, with i can select the movies stored in post's. locul_1 - is one of that. How can i display on front page the movie atached to that custom field I want to display on front page 5 movies In post type BoxOffice i have 2 categories (box-office-sua, and another one) Custom Fields : locul_1,locul_2,locul_3,locul_4,locul_5 In addition, if somone know how to do that, i want when i add new post on Post Type Box-Office, i want in front page to automate chage with last post from Box-Office, let say categoty box-office-sua See image : http://i45.tinypic.com/a5o3k.jpg Wath is retriving the code down See - http://i47.tinypic.com/25hcvvt.jpg               <?php          $posts = get_posts(array(         'post_type' => 'box-office',         'meta_key' => 'locul_1',     ));          if( $posts ):     foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>     <?php setup_postdata($post); ?>
     <?php if(get_field('locul_1') != ""){foreach(get_field('locul_1') as $post_object): ?>
     <?php     if ( ! $img = get_field('img', $post_object->ID ) )         $img = '/wp-content/uploads/noimage1.jpg';     ?>     <a href="<?php echo get_permalink($post_object->ID); ?>">     <img src="/scripts/timthumb.php?src=<?php echo urlencode($img); ?>&h=55&w=40&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>

1.     <?php $key="incasari_totale"; echo get_post_meta($post_object->ID, $key, true); ?> $     <img class="bi-u" src="/wp-content/themes/movies/images/<?php $key="box_clasament_img"; echo get_post_meta($post->ID, $key, true); ?>" alt="Tip Clasament Box Office" title="Tip Clasament Box Office"/>

<a href="<?php echo get_permalink($post_object->ID); ?>">     <?php echo get_the_title($post_object->ID) ?>

<?php $key="titluro"; echo get_post_meta($post_object->ID, $key, true); ?>
     <?php endforeach;}?>
          <?php         endforeach;         wp_reset_postdata();         endif;      ?>      Solved..


Is it heavyweight plugins or lots of plugins that make a site slow?

I've often heard that having a lot of plugins will slow down a WordPress site. This makes sense of course, as the more code that executes, the longer it will take. I'm wondering whether the slowness is mostly:   * a result of the sheer number of plugins? (because WP has to do some processing to locate and load each plugin)   * a result of having a few slow/heavy plugins? More practically, when I am writing my own, should I combine functionality into fewer files to gain speed? Or is it okay to have 10-20 plugins each doing a quick task?


Is Git/GitHub a good WordPress deployment solution?

I'm currently developing my WordPress locally, committing my code to GitHub with Git and then SSHing into my server and doing a "git pull" to update my code. Is this a good option for code deployment onto a WordPress site (I obviously have root level access to my server in this case.) I know of things like Capistrano, but would that be overkill for deployment to a WordPress site? How can I make the most of Git/GitHub in this case?


Add ul to its children with get_posts

I want to add a ul to the list when a page have a child, Im making a foreach on all the post_types so i don't think that i can use something like wp_list_pages. I have been trying to sort this out but just ended upp with this:               // Check for children     $children = array();      foreach ( $values as $post ) {       if( $post->post_parent ) {         $children[] = $post->ID;       }     }     foreach ( $values as $post ) {       setup_postdata( $post );          if( in_array( $post->ID, $children ) ) {             $output .= '
';                $output .= '
ID .'" data-area="'. $area['area'] .'">
'. get_the_title() .'
'. __('Child', 'blocks') .'
';             $output .= '
';          } else {             $output .= '
ID .'" data-area="'. $area['area'] .'">
'. get_the_title() .'
'. __('Parent', 'blocks') .'
';          }         wp_reset_postdata();                                   }


working with newest post from plugin

I am going to write a wordpress plugin which will execute when user submits a new post. Suppose, user wrote a new post and pressed the submit button. Now, I want to save the post as a txt file in my plugin directory. How can I do this? Someone please show me the process for doing this.


how to change featured image path according to "alt" property

when a featured image is added, the path for this image is `http://domain.com/wp-content/uploads/filename` for some featured image i would like to use only "filename" in the path do you know how to change this ? thank you. EDIT: im modified a plugin in order to put an external url as featured image, but when it try to display the picture, the code look like this: `<img src="http://domain.com/http://external-url-of-the-picture.jpg >"`


Getting a "404 Not Found" error when "Preview Changes" is clicked

I'm using Wordpress 3.3.1, installed on my local machine. I've gotten everything up and running, and I'm able to add posts and pages through the admin interface, but whenever I try to click the "preview changes" button from either one of my posts or pages, I get a 404 Not Found page instead. The URL appears to be correct, I've even tried copying the permalink and pasting it into the address bar, but it still gives me a 404 page. As far as I can tell the posts and pages are being added correctly, and I can view and edit their contents from the admin interface, just not from the main site itself. What could be causing this and how do I fix it?


Old Website Address Still Showing

I had 'theshortfilm.co" before changing to my current url 'welovefilm.co'. I changed my address 6 months back, everything went fine. But now when I activated my networks, I get my old url in the code. Please see the image below. http://imgur.com/PW6oW But when I change the url manually to new address and add it to the wp-config file, I get an error saying website is on infinite redirect loop. Please help me fix this issue. Thank You.


How do I link to a blog not set as the homepage?

I have a blog here **/www.mysite.com/section/news/** that only shows news in a specific category. When I use **wp_get_recent_posts()** and **get_permalink($recent["ID"])** the link goes here **/www.mysite.com/the- post-title/**               <?php              $args = array(             'numberposts' => 2,             'category' => 14 );                   $recent_posts = wp_get_recent_posts($args);             foreach( $recent_posts as $recent ){             echo '
' .   $recent["post_title"].'
 ';     }     ?>      How do I direct links to **/www.mysite.com/section/news/the-post-title/** thanks, any help much appreciated. Regards,


WP-DBManager Plugin Can't Find Mysql Path

I support a WordPress 3.4.2 site, lifering.org, running on a GoDaddy Virtual Server. Recently I chose to upgrade the underlying O/S from CentOS 5 to CentOS 6. The rebuild was entirely automated and I don't know what it involved. I restored my site from backup, and since then the plugin WP-DBManager no longer backs up our MySQL database because it says it can't find the mysql path. The mysql path is /usr/bin/mysql, same as it always was, but for some reason the PHP utility that finds it is failing. I posted a question in the Wordpress support forum for the plugin several weeks ago and have no reply; the original supporter has a blog post that says, basically, I have a real job now, goodbye. After much research I think I may have a problem with PHP safe mode, but I don't know enough about it to evaluate. My PHP version is 5.3.3-14.el6_3. My php.ini contains these entries, in this order but not all together:               safe_mode_allowed_env_vars = PHP_     safe_mode_protected_env_vars = LD_LIBRARY_PATH     safe_mode_exec_dir =      safe_mode_include_dir =      safe_mode = off     safe_mode_gid = off      These must have been set during the rebuild. Reading the PHP manual, I think if I set safe_mode_gid = on it may solve my problem, but: if safe_mode = off why do I have a problem at all? I have no way of knowing what the compilation switches were. Can anyone suggest anything, including an alternative plugin? As far as I can tell there is NO other plugin that does what this does.


How to use has_archive but disable feed per post type?

What is the best way to disable feeds per post type but keep has_archive enabled?


WordPress Blank Screen Issue

I'm running a WordPress website with a custom template that is showing me a blank screen when I have not viewed the site in a few days. I've cleared the browser cache and I've empited all cache using w3 total cache. Once I cleared the cache,I typed in the URL each time, and it loaded the website perfectly. I did not copy and paste the URL. The URL combinations are listed below; I've also provided a list of plugins that are currently installed on the website.   1. all in one slideshow v1.3.1   2. ckeditor for wordpress v3.6.2.1   3. contact form 7 v2.2   4. contact form to db extension v2.2.4   5. duplicate post 2.0.2   6. easy picasa v1.1   7. events calendar pro 1.3.3   8. featured image widget v0.2   9. get the image v0.6.2   10. gravity forms v1.6.2   11. gravity forms + custom post types v3   12. gravity forms css ready class selector v1.0.1   13. latest news widget 1.0.1   14. mailchimp v1.2.4   15. members list v3.5.6   16. nextgen gallery v1.7.4   17. page restrict v2.03   18. picasa express x2 v1.5.3   19. really simple captcha   20. registration form widget v1.0   21. search everything v6.7   22. shortcode exec php v1.33   23. si captcha anti-spam v2.7.5   24. sidebar login v2.2.7   25. the excerpt re-loaded v0.3.2   26. w3 total cache 0.9.2.4   27. wordpress https v2.0.4   28. wp custom login logo v1.0   29. wp fade in text news v4.0   30. wpml cms nav v1.2.4   31. wpml multilingual cms v2.3.4   32. wpml string translation v1.2.2   33. wp user registration v2.4 Just wondering if there may be a plugin conflict or maybe a conflict between a plugin and wpml 2.3.4? I've got no issues disabling and re-enabling the plugins one by one, but if I cannot replicate the blank screen issue 100% of the time, disabling/enabling plugins will not be of any use. I'm also running other websites on my server none of which are showing me this problem. The server I'm running is Ubuntu 10.04 with Apache and MySQL. Any ideas on what might be causing this issue will be very much apppreciated.


How to Echo Metadata Value in Currency Format

I have a Custom Post Type with a Metabox and an input Text field for adding "Price" to the posts. Now I would like to display the input value which can be like 49 or 59 like 49.00 or 59.00 so far I have this code to output the meta as:               $meta = get_post_custom($post->ID);     echo '<h5> $'.$meta['price'][0].'/h5';      but this just return the value as $49 or $59. Can you please let know how I can make it to be render as $49.00 ? Thanks


Why toolbar would not be visible in the frontend but visible in the admin?

I'm trying to figure out why the WP toolbar/admin bar shows up in the admin section for a non-admin user, but in the frontend it does not - only empty space. I checked user profile setting, which technically what is used to show/hide it in the front end, but checked or unchecked, it doesn't do anything. Any ideas as to what might cause this or what to try? I'm using basic functions to add new menu options to the toolbar. Any help is appreciated.


WordPress theme options tabs

It is possible to create tabs in admin panel in Theme options like in Theme? Please see this screenshot: ![http://i33.fastpic.ru/big/2012/0322/7c/a22f2c8bc821b2249fb0bc4ed328307c.png](http://i.stack.imgur.com/0YRps.png) I can't find any official documentation about adding admin tabs.


Two column layout in Wordpress?

I'm not sure if this is a general web design or Wordpress question. I have a simple demo here to illustrate my question. http://www.ttmt.org.uk/forum/wp/ It's just a simple 2 column responsive layout. My simple question is how do I spilt the content between the two columns. The page will be a page in Wordpress and not posts (I think). I wanted to create a page in Wordpress and place the text on the content area There is one content area in Wordpress, is there a way to split this content so I can say this is the left column, this is the right column. The text will all be on the same subject but I need to split it between two columns. Thanks in advance for any help.


Decrease RSS cache time in plugin?

I'd like to decrease the default RSS cache time for a widget plugin i've made that outputs RSS feeds. I'm no php expert, I just copy and paste and understand little bits. I'm using this code to output the RSS                 function widget($args, $instance) {       // outputs the content of the widget           extract( $args );           $title = apply_filters('widget_title', $instance['title']);                   $tip_language = apply_filters('widget_title', $instance['tip_language']);                   echo $before_widget;           echo "
" . $title . "
";           include_once(ABSPATH . WPINC . '/rss.php');           $rss_feed = "http://mysite.org/feed";           $rss = fetch_rss($rss_feed);           $rss->items = array_slice($rss->items, 0, 1);           $channel = $rss->channel;                foreach ($rss->items as $item ) {               $parsed_url = parse_url(wp_filter_kses($item['link']));               echo wptexturize($item['description']);               echo "
" . wptexturize(wp_specialchars($item['author'])) . "
";           }           echo $before_after;       }


How to echo category_description() without stripping out html tags?

I'm in archive.php and attempting to write out the current category's description with full html. However, category_description() prints without the html markup. How can I force it to retrieve the full description complete with the html tags?


Where does Wordpress store the users customization in the theme

Good Day When you are inside the wordpress ctrl panel, and you edit/create posts, do theme changes etc, where does Wordpress store all that content? In which files? Thank you


How can I limit the amount of characters used for description in the manage categories grid?

My category descriptions consist of whole pages of content. When I view the manage categories screen, the grid does not truncate the text but rather, shows all of it. I realize I could turn off the description field in "screen options", however, I'd like to be able to truncate the amount of text that shows up there. How can I execute a filter that limits the amount of text used in this description field?


Moving an ASP Site to Wordpress - Looking for Help on Redirects

I am in the process of moving a site made up of asp pages to a completely redesigned Wordpress site. It has come time to create the 301 redirects for those old pages, so I don't break any links that are out there. I do have the redirection plugin installed as well. I've tried using it to do these types of redirects. I've also tried using htaccess, but everything I've tried results in getting this error. 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. It's my guess that the server is trying to process the page before applying the redirect. I'm sure others have done this before, so any thoughts/ideas would be greatly appreciated. Thanks, ## Jeremy               My htaccess currently looks like this:     FileETag None     Header unset ETag     Options +FollowSymLinks          Redirect 301 /customers/default.asp http://twostep2.com/customers/testimonials          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /          # BEGIN WordPress          RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      * * *


When should you use WP_Query vs query_posts() vs get_posts()?

It seems like half the tutorials in the Codex and around the blogosphere use `query_posts()` and half use `WP_Query`. What's the deal?


Looping through a custom query makes WordPress assume another template

I am calling this code from my custom sidebar, in order to get related postings from the same category:               query_posts(array(        'cat' => get_category_id(),        'showposts' => 5,        'post__not_in' => array(get_the_ID())     ));          get_template_part('article-list'); // outputs the posts      This works. The `have_posts()`-loop inside of my article-list.php now only outputs 5 other postings from the category. But this also causes a problem: No matter on what kind of page I am (single.php, index.php, ...), WordPress always assumes that I am in the category template. So `is_category()` always returns `true` after calling `query_posts('cat=...')`. Thus `is_single()` returns `false`, although the single.php-template is used. What can I do to tell WordPress that it is still using the single-template? Or: What other function can I use to detect which (main) view is loaded?


Use https for img src

My site requires the use of https for all img src HTML. This is the WordPress function I'm using to display images:               <img src="'.get_bloginfo("template_url").'/images/thumb-default.gif" />      This outputs an http img src - how can I convert that to https?


Update permalinks after domain change

I installed my blog in a free hosting webpage, the hosting gave me a free domain and I used that domain in my blog, then I did buy a .net domain, I changed the URL in Settings->General of my dashboard. I usually edit old posts, the problem is when a reader enters in the blog with the old free domain he gets the old version of my post, when the reader enters with my .net post he gets the modified version I tried fixing the problem renaming all the link in my database, but it didn't work. How can I fix this?


Why in the static pages of my theme are showing these information?

I am working on a WordPress theme and I have some problem with the pages\posts layout. For example if you go here: http://lnx.asper-eritrea.com/lassociazione/ This is a static page that show some text (and it is ok) but why under the text it is shown the possibility to let a comment and under it a calendar, categories, archive and meta? What can I do to don't have these things showed in my pages? Have I to modify the code of the pages template? This is the code of my **page.php** file:               <?php     /**      * The Template for displaying a single page      */          get_header();     ?>

Associazione per la Tutela dei Diritti Umani del Popolo Eritreo

     Association in Defense of the Human Rights of the Eritrean People

          <?php     if (is_front_page() && twentyfourteen_has_featured_posts()) {         // Include the featured content template.         get_template_part('featured-content');     }     ?>

          <?php     // Start the Loop.     while (have_posts()) : the_post();              // Include the page content template.         get_template_part('content', 'page');              // If comments are open or we have at least one comment, load up the comment template.         if (comments_open() || get_comments_number()) {             comments_template();         }     endwhile;     ?>

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


multiple queries to get posts from same category?

I am trying to make a so called featured category on my theme homepage. In that category I would like to display 6 posts from same category. The problem is that, I would like to devide these posts into three different html blocks. For example:
first 2 posts goes here

second 2 posts goes here

last 2 posts goes here
      The three divs have different html structure (eg. post image size etc). So, does it mean that I have to run 3 separate queries to get the above posts from the same category? Or would that be too much of load and I should use only one post query? Thanks.


Load WooCommerce templates from my plugin folder first

I try to write a plugin for WooCommerce (https://github.com/bassjobsen/woocommerce-twitterbootstrap). I want my templates load like this:   1. my custom theme / template path / template name    2. my custom theme / template   3. **my plugin / template name**   4. woocommerce / template name So when the template not exists in the theme folder it is load from my plugin folder (if exists) instead of the Woocommece folder. On http://www.skyverge.com/blog/override-woocommerce-template-file-within-a- plugin/ if found a working solution for templates load by `woocommerce_get_template`. But this will not work for `woocommerce_get_template_part` cause this function call `locate_template` instead of `woocommerce_locate_template` (is this a bug?). Question: I want to know how to overwrite / manipulate `locate_template()` so it try to load the files from my plugin folder first. Or any other solution to do this. **update** thanks to @jesper i cloud load templates now:               function           my_template_redirect(){        //pages you want to make true, ex. is_shop()        global $woocommerce;        if(is_shop()) {                 $plugin_dir = WP_PLUGIN_DIR.'/'.str_replace( basename( __FILE__), "", plugin_basename(__FILE__) );              var_dump($plugin_dir);              load_template($plugin_dir . '/templates/archive-product.php');        }     }          add_action('template_redirect','my_template_redirect');      ~~`/templates/archive-product.php` includes `content-product.php` from the same plugin template dir. `content-product.php` makes use of the `global $product` which is null in this case. Do i need to load a other function to set `$product`? The above also gives my an other error: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'woocommerce_before_main_content_grid' not found or invalid function name in /home/bass/Dropbox/testomgeving/jamedotheme/wordpress/wp-includes/plugin.php~~ With the above code i could write a function to conditional include files in templates/archive-product.php ( **so solved!** )


Removing template part when not on homepage if / else

Thank you in advance for any help! What I am trying to do is remove a template part from my home page after the user clicks on the pagination links from the posts, right now my template part serves as a "hero" or "featured" area, and I would like it to go away when the user looks at older posts, eg the pagination, here is what I am doing so far and it is not working, thanks!               <?php if( is_home() || is_front_page() ) : ?>      <?php get_template_part( 'hero' ); ?>     <?php else : ?>      <?php get_template_part( 'blank' ); ?>     <?php endif; ?>      as you can see i created a blank template , not sure if this was necessary , does it need to be inside the loop? thank you!


Is there a way to select posts and print to a template page dynamically?

I'm trying to print posts by selecting posts and doing a bulk action to dynamically add them to a template page I already have set up. Is this possible? * * * Update with more info: I'm using this function found in this example. More specific question: Can you pass part of a url from the admin to the front end?               function custom_bulk_action() {             global $typenow;             $post_type = $typenow;                  if($post_type == 'slides') {                      // get the action                 $wp_list_table = _get_list_table('WP_Posts_List_Table');  // depending on your resource type this could be WP_Users_List_Table, WP_Comments_List_Table, etc                 $action = $wp_list_table->current_action();                      $allowed_actions = array("export");                 if(!in_array($action, $allowed_actions)) return;                      // security check                 check_admin_referer('bulk-posts');                      // make sure ids are submitted.  depending on the resource type, this may be 'media' or 'ids'                 if(isset($_REQUEST['post'])) {                     $post_ids = array_map('intval', $_REQUEST['post']);                 }                      if(empty($post_ids)) return;                      // this is based on wp-admin/edit.php                 $sendback = remove_query_arg( array('exported', 'untrashed', 'deleted', 'ids'), wp_get_referer() );                 if ( ! $sendback )                     $sendback = admin_url( "edit.php?post_type=$post_type" );                      $pagenum = $wp_list_table->get_pagenum();                 $sendback = add_query_arg( 'paged', $pagenum, $sendback );                      switch($action) {                     case 'export':                              // if we set up user permissions/capabilities, the code might look like:                         //if ( !current_user_can($post_type_object->cap->export_post, $post_id) )                         //  wp_die( __('You are not allowed to export this post.') );                              $exported = 0;                         foreach( $post_ids as $post_id ) {                                  if ( !$this->perform_export($post_id) )                                 wp_die( __('Error exporting post.') );                                  $exported++;                         }                              $sendback = add_query_arg( array('exported' => $exported, 'ids' => join(',', $post_ids) ), $sendback );                     break;                          default: return;                 }                      $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );                      wp_redirect($sendback);                 exit();             }         }


merging two multisites

I need to merge two existing multistes. Each has some 40 blogs, and the end result should be that all 80 blogs reside on one WP installation. Any advice or experience on how to best apporach this task, other man doing it manually, by creating each new blog and user on the end server, and then use export/import for each individual new blog? I'd like it to be an efficient method, that could also be applied on much larger multisites. Direct DB manipulation and Script automatization.. I'm interested in paying for assistance, if anyone has proven experience, or can suggest a good solution.


Retrieve IDs from custom field, count and display results differently according to count

The function below is inside a single post loop. I have an array of IDs in a custom field. Such IDs represent related posts. I'm using Advanced Custom Fields (ACV) plugin and I manage the custom metas with it. In this case, to get the related_content meta, I can use the ACV function get_field('related_content') and grab post data from each retrieved post in the related_content field. According to the number of related posts retrieved, I want to display the results slightly different (using larger thumbnails or no thumbnails at all, etc.). So I came up with the php you see below. However, I'm not sure if this is efficiently optimized or can be written better. Would you mind checking it out? I am aware this is not strictly a Wordpress question but also PHP/Database related, but since it's related to wordpress objects, database and functions I thought it would be appropriate to post here. Maybe there's a better way to query WP for what I want... thank you               echo '
';     foreach( get_field('related_content') as $post_object) :              $post_type = get_post_type_object(get_post_type($post_object->ID));              for ($i = 0; $i <count($post_object); $i++ ) {                    if ($i == 0 && $i < 4 ) {                         printf('
ID).'">'.get_the_post_thumbnail($post_object->ID, 'small').'
'.$post_type->labels->singular_name.''.get_the_title($post_object->ID).'
');                    }                    elseif ($i > 3 && $i < 5 ) {                             printf('
ID).'">'.get_the_post_thumbnail($post_object->ID, 'smallest').'
'.$post_type->labels->singular_name.''.get_the_title($post_object->ID).'
');                    }                    elseif ($i > 6 ) {                             printf('
ID).'">'.$post_type->labels->singular_name.''.get_the_title($post_object->ID).'
');                    }              }     endforeach;      echo'
';


how to change displaying order of products in wp ecommerce

I am working on a wp-ecommerce enabled site and am trying to change the display order of the products on the product grid page. Any help would be greatly appreciated.


Edit image / Delete image link

There is a function in Wordpress that allows to display a "edit post" link if the user has sufficient rights.               <?php edit_post_link( __( 'Edit' ), '', '' ); ?>      Is there an equivalent for media files / attachments, UPDATE This sorts of work               $images = fdw_get_post_images('preview-onepost-thumbnail');     if ($images){       $counter= 0;      foreach ($images as $image){           $src = $image['src'];           $info = $image['info'];      edit_post_link( __( 'Edit image' ), '
', '
', $info->ID ); ?>      But the user actually need to be able to Delete the image. That screen does not allow it.


store simple data in get_option()

I am trying to store simple data, a few links inside wp_options. Basically using the following way: `update_option( 'simple_links', '<a href="">link 1</a>' );` my question is if it is allowed, I dont want to create new table for it, just a few links permanently stored inside the footer. Is that the valid way and will it actually save data inside options? Or there is any other better way for such a simple need? Thank you.


Where do posts get the sidebar from?

I'm trying to add an if statement on the sidebars that are displays in POSTS. I want posts to show a specific sidebar if it's in category x and display a different sidebar if it's not in category x. To do this, i'm trying to use the following code:               <?php if ( in_category( 'featured-listing' ) || ( in_category( 'listing-post' ) )) { ?>         <?php get_sidebar(); ?>     <?php } else { ?>        <?php get_sidebar2(); ?>     <?php } ?>      I've tried editing both the single.php and page.php to no avail. I thought maybe that since i removed the get_sidebar from my child theme that Wordpress was falling back to the Twentytwelve sidebar, but after trying a few things out it seems this isn't the case. So - the summarize; i've tried editing both single.php and page.php to try and display different sidebars based on the category that the post is assigned to. Thanks in advance.


storing database in version control

I am using a version control system to manage my wordpress code (git). What is the betst way to store the database information into version control? I want to go to my staging machine, run `git pull` to get the latest code from my development machine, then maybe click one button or something like that to update the DB to match what I have on my development computer. I also want a way to, on my stage machine, "merge" the my development DB with the production DB before pushing all of that to production. so:   1. how to update a DB after a `git pull`   2. how to "merge" DB information.


Attaching media to custom posts without editor

I'm creating a custom post type, "gallery", in which the admin should be able to upload images (these images would be attached to the post). The thing is that the "editor" meta box is disabled for this post type. And I need a way to add the image upload pop-up box to it, just like posts have. How can I do that? or maybe it's better to create my own uploader? if so, how could I attach the uploaded images to the post (gallery) that's being created? how do attachments work? are they custom post types too?


How do I set the default "feature image" size?

I know I can set up post, pages, and custom post types to use featured images in wordpress by enabling theme support:               add_theme_support( 'post-thumbnails');      Or enabling theme support for a specific set of post types:                   add_theme_support( 'post-thumbnails', array('post','page'));      I also know that I can add an "image size" like this:               add_image_size( 'media_library', 333, 230, true );      But how do you control which image size of the "feature image" actually displays on the edit screen of Wordpress? For example in TwentyEleven I have uploaded a square photo and it shows up as a rectangle in the featured image box on the edit screen: ![Picture 1.png](http://img72.imageshack.us/img72/1325/picture1fj.png) How do you pick which image size shows up there?


Need help deciding on a taxonomy

I'm working on a project that mimics a product Catalog, all products belong to a _Collection_ and they all have a _Type_ and _Attributes_. For instance, a shirt belongs to the Apparel Collection, so I created a Category called Collection and to which the Apparel Collection is a child. Products have _types_ , for instance a shirt is a type of product, a hat is another type of product, ideally I can group all the products of the same type together and filter accordingly, I'm using Tags for this, a tag 'shirt', another one 'jeans', etc. My problem resides on the fact that Products can also have attributes or characteristics, for instance a shirt can be white or screen printed, a pair of jeans could have a particular style or color. I want to filter my posts by Collection (Categories), Types (Tags) and Attributes (??) individually, which I can do up to Attributes, since I ran out of taxonomy? What is the best way to tackle this issue? Is it a custom post type for Types, since they can be enumerated and move the attributes to tags? Any help is greatly appreciated. Thanks, Leo


why is my custom loop failing?

I have a custom post type to get images. I am setting up my theme to display a specific way when it is first installed. For some reason, my code is stopping the bottom half of my page from displaying.
         <?php if( $loop->has_posts()): ?>

FROM THE GALLERY

         <?php             while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php if ( has_post_thumbnail()) : ?>                             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>"><?php the_post_thumbnail('frontpage_gallery'); ?>
                      <?php endif; ?>                 <?php endwhile; ?>
             <?php endif; wp_reset_query();?>
      When I view source, the only part of the gallery div that shows above is the opening div. Everything after that including the footer is gone. This happened when I put all the gallery stuff between the if statement. What am I missing?                if( $loop->has_posts()):           endif;


Call activation hook multiple times

I have a plugin that does some initialization stuff using `register_activation_hook` called from its `__construct()`. I've since extended my plugin to add functionality to it. For the sake of organization, I've moved the extended functions to it's own class. I need to create a table that will deal with data unique to this new class. My new class is instantiated from the construct of my main plugin. And from the `construct` of my new class, I am trying to call `register_activation_hook` a second time to create my table. Not surprisingly, this does not seem to work. (I have tested my db creation code elsewhere and it does work). Is there a way that I can hook into the `register_activation_hook` from my new class to ensure the database is created at activation, or maybe even piggyback onto the parent class somehow to make sure the db is created?


Is $object_type truly required with register_taxonomy()?

When registering a new taxonomy, the second argument of `register_taxonomy($taxonomy, $object_type, $args)` is the post type (or types) that this taxonomy is registered for. However, when registering a custom post type, you can also pass taxonomy as one of the arguments: > taxonomies (array) (optional) An array of registered taxonomies like > category or post_tag that will be used with this post type. This can be use > in lieu of calling register_taxonomy_for_object_type() directly. Custom > taxonomies still need to be registered with register_taxonomy(). Default: > None This is redundant. Which should be used? Can you register a taxonomy without associating it with a specific post type, and then later, when registering the custom post type, associate it then? * * * As a little backgrounder to why I should care (other than that I don't like inconsistencies and redundancy): I'm creating a fairly generic taxonomy that I can foresee using across a variety of implementations. I'd love to define this taxonomy once (in a separate file), without any foreknowledge of the custom post types that may want to take advantage of it in the future. Then, on a specific implementation, as I'm creating the custom post type, I know I have this taxonomy that I can associate with the post type. Hope this explains my reasons a bit.


Removing the "Powered by WordPress" Link?

Am I allowed to remove the _"Powered by WordPress"_ link in the footer?


How to change post status from frontend?

I'd like to add the posts in my loop the ability to toggle them between different post statuses (e.g. publish/draft). What's the best way to do it? Thanks in advance!


Pages section (only) not loading after publishing large number of pages

I'm having some issues with my first wordpress installation that's really throwing me for a loop. First some background info on the situation. I've been working on converting an HTML site into wordpress. Since the site was quite large (around 8000 pages) I used a plugin to import the HTML files. While doing so I found that I had to import them as drafts otherwise the import would fail. I started publishing groups of pages so that I could properly link from pages when i was fixing up the layouts and such. However when I get to around 3000 pages published the Pages section of wordpress no longer loads. I can access anything else in wordpress (Posts/Appearance/etc.) but clicking on any of the Pages section will cause Chrome to spit out:               "Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data."      I did some looking online and in the codex and found a few suggestions for fixes but nothing seems to be working. I've tried disabling/removing all plugins, removing all themes other than the default twentyten, deleting my wp_config file to set up a new install and copying the posts and postmeta to the new database in phpmyadmin, completely overwriting all wordpress files with a freshly downloaded copy, with and without a cache plugin, with pretty and ugly permalinks, and probably a few other small things. I've also tried accessing it from an entirely different location to make sure it wasn't an issue with my local connection. I had WP-DBManager plugin installed and if I revert to an older backup (less pages published) everything will work properly again. As stated it's my first wordpress site so I'm not familiar with all of it yet but I've not had any issues i haven't been able to solve easily up to this point. I'm also not the very familiar with SQL databases but I understand the basics of that fairly well. To me it seems like it might be a problem with the database but I've been unable to figure out how to approach it from here. I feel like i'm going around in circles a bit at this point. Not sure if this is important to this issue or not, but I did increase the WP_MEMORY_LIMIT in /wp- includes/default-constants.php to 64M initially to account for the increased database size prior to the problem and have tried it with 128M to see if that would solve the problem but does not. Any help or suggestions would be very much appreciated as I'm stuck at a standstill.


plugin wants to update to wrong plugin

I get a _"update available"_ notification for my custom plugin "breadcrumbs trail nav" (not hosted in the official repo). Point is that there's a) no update available and b) it wants to get updated to version whatever from the yoast-breadcrumb plugin. Case: local install. **My plugin header comment:**               /*     Plugin Name:    Breadcrumbs Trail Nav.     Plugin URI:     https://github.com/franz-josef-kaiser     Description:    Offers the whatever( $args ); template tag for a  semantically correct, seo-ready (well performing) breadcrumbs trail. All links are nofollow by default, but can be adjusted.     Author:         Franz Josef Kaiser     Author URI:     https://github.com/franz-josef-kaiser     Version:        0.2.1     License:        extended MIT/Expat license          (c) Copyright 2010-2011 - Franz Josef Kaiser     */      **Yoast plugin header comment:**               /*     Plugin Name:  Yoast Breadcrumbs     Plugin URI:   http://yoast.com/wordpress/breadcrumbs/     Description:  Outputs a fully customizable breadcrumb path.     Version:      0.8.5     Author:       Joost de Valk     Author URI:   http://yoast.com/          Copyright (C) 2008-2010, Joost de Valk     */      What's the problem?


Default plugin config to override wp_options?

I have a few plugins that I always set the configuration for exactly the same way. Every time I create a new site, the same plugins go in, and the same amount of time is needed to set them up. Would it be possible to create a config file that overrides whatever wp_options are set per plugin?


more types plugin - display all post of post type on page

I'm looking to display all the posts of a certain type in a page of posts. I'm using the wordpress plugin more types (http://wordpress.org/extend/plugins/more-types/) to create a custom type called pre-enjoyed. I'd like all the posts in pre-enjoyed to be displayed when on the pre-enjoyed page. I've never worked with custom types before and I'm not sure how to do this.


Help altering a query to exclude all but standard post format

I feel like I've been banging my head against the keyboard for a week with this problem. I'm trying to change my current query on my home page to show only posts that are set as **standard** posts using the new post format. I've looked everywhere for answers (including here and here) and tried everything I've found, but I can't get it to work within the framework of my current query. My query is provided below. Any help is greatly appreciated.               <?php          query_posts( array( 'post__not_in' => $ids, 'showposts' => 10, 'cat' => '-4' ) ); ?>     <?php while (have_posts()) : the_post(); ?>     -LOOP STUFF-       <?php the_excerpt(); ?><BR>     <?php endwhile; ?>      **UPDATE - March 30:** Since I posted this I found out how to properly query for, we'll say, image posts using this code:                   <?php      $args = array(       'post__not_in' => $ids,        'showposts' => 10,        'cat' => '-4,-1866,-27',       'tax_query' => array(         array(           'taxonomy' => 'post_format',           'field' => 'slug',           'terms' => 'post-format-image'         )       )     );                 query_posts( $args ); ?>     <!-- Look Stuff -->         <?php endwhile; ?>      But I still need to figure out how to do the opposite and only pull **standard** posts. **Second Update - March 30:** I found the answer after some more hunting. Apparently the only way to pull the standard posts is to add: 'operator' => 'NOT IN', So it looks for posts that aren't in the image post format. Or I have to add an array of terms to the terms line so it won't return any of those formats. Odd, but it works.


Searching multiple custom post types and pages

I'm using bainternet's method for searching custom post_types and it works great. However, I've recently been requested to return more than one "specific" post type and perhaps individual pages for a support section on our site. I thought adding additional hidden fields would do it, but that didn't work. And I have no clue how this will work with pages. Any help would be appreciated! * * * In the template:               <form action="http://apollo.website.net/" id="searchform" method="get" role="search">
Search for:         <input type="text" id="s" name="s" value="">         <input type="submit" value="Search" id="searchsubmit">              <input type="hidden" name="post_type" value="software" />
     </form>      In functions.php:               /* Custom Search Queries */     function SearchFilter($query) {     $post_type = $_GET['post_type'];     if (!$post_type) {         $post_type = 'any';     }     if ($query->is_search) {         $query->set('post_type', $post_type);     };     return $query;     }


Random and Erroneous Wordpress Redirect

Would somebody mind postulating and possible reasons why their is an automated redirect on my homepage that adds /admin to the URL. Please visit www.divethegap.com/update. You will see that it instantly redirects to /admin and does not load the page. There is a folder called admin that is not accessible to a user, but their is no redirect to it anywhere on the site. What is going on. I have removed all recent function additions in the theme and unistalled plugins. There are several include-template-paths that I use but I don't use any redirects. What has caused this. Any ideas? Marvellous HT ACCESS //               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /update/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /update/index.php [L]     </IfModule>          # END WordPress


Changing admin Textarea to integrated WP editor

I'm currently working on a theme for my page that utilizes wordpress's built- in gallery system to make a slideshow with php/jquery. (Post->create new post->add media-> create gallery) Since by default the gallery allows for only thumbnails, I'm making the theme take the data that is inserted and applying it to the slideshow. Here is an example: http://dev.sharetv.com/news/2014/07/test-gallery/ The caption is what you see as the title, and in the gallery "description" TEXTAREA is where you see all the dummy text. **Now, My Question:** How would I go about changing the built-in description textarea (see image), (in the gallery back-end) to the built-in wordpress editor (tinyMCE)? Our writers here aren't the best with HTML, and want to make it as easy as possible for them. ![enter image description here](http://i.stack.imgur.com/kQLDG.png) **Is it possible to do this without editing the wp-admin files?** And even if not, can someone point me in the right direction to handling this ? Thanks in advance!


wp nav menu: add attributes to menu items

I'm trying to figure out if it's possible to attach an attribute to a wp nav menu item.   To demonstrate, this php:               <?php         wp_nav_menu(array(         'menu'  =>  'main',         'container' => false     ));     ?>      would output a menu like so:

Menu 01

Menu 02

Menu 03

Menu 04

      but what I'd actually like is something like this:

Menu 01

Menu 02

Menu 03

Menu 04

      Is that at all possible to achieve? The attribute doesn't have to be `data- hook` I'm just using that as an example, just something I can use as an identifier.


Restrict users from editing post based on the age of the post

How can I restrict users (based on Capabilities) from editing their published posts after a custom amount of time. For instance, a user that can `publish_posts` (authors) can **not** edit a their post if it is older than 3 days, and a user that can `moderate_comments` (editors) can not edit any posts that are older than 20 days. Obviously, admins can edit anytime. How is such thing possible?


How to pass on Google Adwords gclid variable to other pages

i need to track if people filled out any of my forms on my wordpress blog if they where coming from a Google Adwords ad. There are many forms on my website like for booking a demo presentation, contacting me or subscribing to the newsletter. I receive the gclid varibale e.g. via www.domain.com/pagenameblablabla/?gclid=CILxsfsfsdiLMCsfaafaff33UAzw correctly on my page, but i **see only the Conversion in Google Adwords if the user sends the contact form _exactly on the same page_ he came to when he clicked on a Adwords ad.** When he makes one single more click on another page, wordpress looses the gclid variable and tracking stops. **How can I pass the Google Adwords gclid to further pages in wordpress?**


Using email_exists() wp function in an ajax request

I'm requesting the wordpress function `if (email_exists($email)) { ... }` from a file (email_check.php) via ajax. Using this function is causing a server error though. The origin (from an input text field):               var check = $('#email-input');     var email = check.val();     $.ajax({         url: "email_check.php",         data: {'email' : email},         type: "GET",         dataType: 'json',         success: function(data) {             if(data.result) {                 alert('Email exists!');             }             else {                 alert('Email doesnt!');             }         },         error: function(data){             //error         }     });      check_email.php               $email = $_GET['email'];     if ( email_exists($email) ) {$response->result = true;} else {$response->result = false;}     echo json_encode($response);          This results in no alert taking place. By going directly to `check_email.php?email=email@address.com` it give me a server error page. I also replaced `email_exists($email)` with the same direct email entered as the url param and it does work. Does anyone know why this is?


Get only the first term by taxonomy

Maybe it's a stupid question but I can't find the answer. I have a custom taxonomy (directores) and each director is a term. Some times a film has more than one director. I need to print only the first director no all directors from one film. Thanks!!!


How to get the post ID when creating JS variables with localize_script

how do you set the current post ID as a JS variable with localize_script? It seems like the $post variable isn't availible in the functions.php file. When is it created? Do i have to add localize script to a hook? Which?


Create ul list in Custom Meta Box?

I need to create an ul list in a Custom Meta Box. The content/text area of the post is already taken up with other information. Is it possible to create another text area like WP built in one so I could us the Unordered list button. -- EDIT -- I'm not sure how else I can describe this. I know how to create Custom Meta Boxes. I can create text input fields and textarea fields. I would like a Custom Meta Box that would output the information in it as an Unordered list on the site. In WP's textarea in a post I can type text, select it then press the unordered list button to make it into an unordered list. How can I do this with a Custom Meta Box?


Yoast SEO: title tags are repeating my website name and slogan

I am using the Yoast SEO plugin and I am finding that on my site it is repeating the website title and blog tagline twice. For example, it looks something like this in my browser tab: Example.com | This is my tagline Example.com This is my tagline I have implemented, just as Yoast says, the following code in my header.php:               <title><?php wp_title(''); ?></title>      Would it also be helpful for me to provide an export of my SEO plugin settings?


Bots finding WP users list. How to hide?

I have been monitoring about 20 WP websites login attempts. About half of these websites get hit by bots on a monthly bases, attempting to guess the login. You can tell it's a bot because the pattern is the same. However, I noticed that sometimes the username used is the same or similar to the username of each user in WP. That leads me to think that somehow these bots are getting a list of the WP users. So my question is... is it possible for bots to find out all usernames of a WP install? If so, is there anything I can do prevent this? I have already taken other security steps to stop bots, for example, changing the wp-login.php to something else. But I am curious to know how much information WP makes available for other to see - or for bots to crawl.


Is it possible to create a Wordpress tour? V3.3.1

I've recently upgraded to version 3.3.1 and noticed a nice feature that would be great for our non-Wordpress savvy clients - creating a tour of how to use Wordpress. I've used the Yoast SEO plugin for a long time and they've added a tour feature, which when you click the next buttons it goes through the various features (see screenshot): ![enter image description here](http://i.stack.imgur.com/mQtT5.png) Is it possible to create a custom tour of Wordpress on how to add pages, posts etc and create our own help content to go with it. I've got a standard set of plugins I tend to use so the tour (if possible) would need to jump through both the standard Wordpress setup as well as all the different plugins. UPDATE: I've dug around the web and found the following code. This will create a one off pointer that you can put custom content in. The only problems are that the popup appears with every reload even when it's dismissed (is there a way to improve the usability of this?) and also it's a one off window rather than a tour. Just use Firebug to find the div you want to attach the pointer to.               /*         Display custom WordPress Dashboard Pointers alerts         Usage: Modify the $pointer_content message to the message you wished displayed     */     add_action('admin_enqueue_scripts', 'enqueue_custom_admin_scripts');          function enqueue_custom_admin_scripts() {         wp_enqueue_style('wp-pointer');         wp_enqueue_script('wp-pointer');         add_action('admin_print_footer_scripts', 'custom_print_footer_scripts' );     }     function custom_print_footer_scripts() {         $pointer_content = '
The Works http://www.teamworksdesign.com
';         $pointer_content .= '
Welcome to your custom WordPress installation. Please navigate to the settings page to change your site preferences
';     ?>             <?php     }


Cannot get add_feed to work

I want to add a custom feed on my site for SEO purposes. So, I first copy the /wp-includes/feed-rss2.php file into my theme folder and renamed it. I figured I'll be able to easily edit my feed. Then I add this code :               function yandex_news_feed() {     load_template(TEMPLATEPATH . '/yandex-news.php');      }          function yandexnews_add_feed() {     add_feed('do_feed_yandexnews', 'yandex_news_feed');     }          add_action('init', 'yandexnews_add_feed');      I tried with many many ways and read a lot of documentation (almost always the same, a lot of people add rewrite_rules to the code but that's not the issue here) and source for `add_feed` tell that rewrite rules are taken care of. But, anyway, that's not working at all, weither i'm doing http://infoglam.exigences.biz/?feed=yandexnews or http://infoglam.exigences.biz/feed/yandexnews ; that's the same : blank page, empty, nothing. Please note that if use volontarily incorrect name like http://infoglam.exigences.biz/?feed=yandexnews5 I get a error `ERROR: yandexnews5 is not a valid feed template.` so it looks loke the feed name is registered, but the template isn't executed. I have check permissions on template file, i tried with and without `do_feed_` ; I tried with `include` instead of `load_template()` I guess I could at the end use a template page with a blank page on the admin, but I find this not elegant - if efficient and quick. I will use several feeds on the site and I don't really want to deal with blank pages, and if I use the theme elsewhere I will need to create pages again, it will be best to have it concelead with the theme. I guess the problem could be with the loading of the template but now I'm completely lost and cannot find where i'm doing it wrong. Could someone give me a hand please ?


Completely disable editor

How should I completely disable the visual _and_ html editor from pages? I know I can disable the visual editor in my profile, but I am trying to lock down the content input areas so that my client doesn't muck things up.


Shortcode return $content vs do_shortcode($content)

I think the title of my question says it all. When creating a shortcode, I've seen some people do `do_shortcode($content)` instead of `$content`. What is the difference? Another thing, let's say I have a shortcode `[hello]World[/hello]`. Wouldn't returning `do_shortcode($content)` result in `do_shortcode('World')`? From the codex, the examples given are as such, `do_shortcode('[hello]')` So what will returning `do_shortcode($content)` interpret? (in the case of `[hello]`) Any practical examples or clear explanations would be greatly appreciated. Thanks.


I need to develop a one-page design

I know how to add the scrolling effect, I just needed help that how should I code the onePage.php template by which I can handle different themes for the divs i.e. ABOUT, EVENTS ... each div has a different layout & background color.. Hardcoding the divs is not the solution .. I can also dynamically add the divs to the homepage .. but the main question is how to handle different layouts for each div? Right now using this as my Home Page Template               <?php     /*     Template Name: Home Page     */     get_header();     ?>
                  <?php         $args = array(             'sort_order' => 'ASC',             'sort_column' => 'menu_order', //post_title             'hierarchical' => 1,             'child_of' => 0,             'parent' => -1,             'exclude_tree' => '6',             'number' => '',             'offset' => 0,             'post_type' => 'page',             'post_status' => 'publish'         );         $pages = get_pages($args);         //start loop         foreach ($pages as $page_data) {             $content = apply_filters('the_content', $page_data->post_content);             $title = $page_data->post_title;             $slug = $page_data->post_name;             $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $page_data->ID ), 'index-post-thumbnail' );         ?>         <div class='page' id='<?php echo "$slug" ?>'><a name='<?php echo "$slug" ?>'>

<?php echo "$title" ?>
                 <?php echo $content; ?>

                 <img src="<?php echo $thumb[0]; ?>" />

              <?php } ?>          <?php get_footer(); ?>


Query: offset post list, unless it's a specific category

Here's my code:               <?php query_posts(array ('showposts' => '1', 'cat' => '-11'));       if (have_posts()) : while (have_posts()) : the_post();           get_template_part( 'content', 'archives' );          endwhile;       endif; ?>          <?php query_posts(array ('showposts' => '3', 'offset' => '1'));       if (have_posts()) : while (have_posts()) : the_post();           get_template_part( 'content', 'archives' );          endwhile;       endif; ?>      The first query excludes a category (user contributions to the blog) so that only our organisation's latest blog post is 'stickied'. The second query currently displays the latest 3 posts from all categories with an offset of 1 to stop the 'stickied' post being displayed, as it's already the latest. However, if the most recent post is then in the User Contributions category (we sometimes publish user content later in the day), it will be caught by the 'offset' and not displayed, and the stickied post will then appear at the front of that second query. Is there an alternative to 'offset' that allows the exclusion of a category from the rule? TL;DR - I want the second query to exclude whatever the result of the first query is


how to get post shortlink outside loop in wp

i need to show post shortlink outside loop in wordpress i use that code but didn't work the Code :               $id=get_the_ID();     echo wp_get_shortlink($id);      thanks


Deprecated error notice

I am doing a plugin tutorial, but it was made for wordpress v2.something. The problem is - when I go to admin menu, under Settings - I get a notice error => > has_cap was called with an argument that is deprecated since version 2.0! > Usage of user levels by plugins and themes is deprecated. Use roles and > capabilities instead. in C:\wamp\www\jw\wp-includes\functions.php on line > 3017 This is the relevant code:               <?php          if ( ! class_exists('SBC_Admin') ) {              class SBC_Admin {                  function add_config_page() {                      if ( function_exists('add_submenu_page') ) {                     add_options_page(                         'Seach by Category Options',                         'Search by Category',                         10,                         basename(__FILE__),                         array('SBC_Admin', 'config_page')                     );                 }             }                  function config_page() {                 if ( isset($_POST['submit']) ) { // we're updating options                      }?>

Search by category options
                     <form action="" method="post" id="sbc-config">                          </form>
                 <?php             }              }          }          // insert into admin panel     add_action('admin_menu', array('SBC_Admin', 'add_config_page'));          ?>


Add "add to cart" button in WooCommerce

I use the Mystile WooCommerce theme, where the "add to cart" buttons is removed by this code:               remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);      That is placed in this file `wp-content/themes/mystile/includes/theme- woocommerce.php` I know I can just remove the piece of code, but is there a option, so the buttons still will appear, after the `theme-woocommerce.php` file is changed after next update? I already tried to add this code to the my `functions.php` in my child theme.               add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);


How to let users have permissions to upload from the front end in Wordpress

I have a frontend form from using ACF that allows uploads to be uploaded but it only works when I am logged in. I want new users who have never logged in to still be able to upload. How can I accomplish this? What can I do to let non-logged in users upload files from the frontend?


Are there any server requirements for WordPress transients to work properly?

**Background Info** I sell WordPress themes where I include a Twitter widget. In the widget I use a WordPress transient that refreshes every 3 hours to cache the Tweets. I've got thousands of people using this and it seems to work for just about everyone. Also, I've done little tests on my end to ensure I know the cache is working properly with how I have everything setup. However, I've run into maybe 2 or 3 buyers where it's apparent that the cache is not working at all on their servers. _Note: I can tell because they keep getting timeout issues as they're hitting the Twitter API more than the allowed 150 times in an hour._ * * * **The Question** So, are there any reasons why someone's specific web server could have problems with WordPress transients? Or maybe something specific to someone's WordPress configuration? Is there anything else I could be overlooking?


How to get a buddypress user profile link and a certain user profile field for the current post author?

I want to replace get_author_link() and get_the_author_meta($feld) with something equivalent to point to the author of the current post Buddypress user profile page and retrieve a specific profile field from his Buddypress page ie, I just want to show a link to the post user profile and a biography from one of his BP profile fields I'm not sure which functions I should use for this... BuddyPress documentation is still not very clear unlike the WP Codex... thanks


Post specific text based on category displayed

So I'm working on a site and I need a news page that is slightly different. It is a post category but I want the text echoed at the top of the news category listing.               <?php endif; ?>     <?php /* If this is a category archive */ if (is_category()) { ?>
Board: <?php echo single_cat_title(); ?>
     <?php /* If this is a daily archive */ } elseif (is_category('news')) { ?>
News:
     <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
Daily Archive | Board: <?php the_time('F jS, Y'); ?>
     <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
Monthly Archive | Board: <?php the_time('F, Y'); ?>
     <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
Yearly Archive | Board: <?php the_time('Y'); ?>
     <?php /* If this is a search */ } elseif (is_search()) { ?>
Search Results:
     <?php /* If this is an author archive */ } elseif (is_author()) { ?>
Author Archive:
     <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
Archives:
     <?php } ?>      This code works fine for archives except the fact that `<?php /* If this is a daily archive */ } elseif (is_category('news')) { ?> <h2>News: </h2>` does not work when you view the news category. It shows the standard text for every other category. Then if you do `<?php if (is_category('News')) : ?> <p>News:</p> <?php else : ?>` it works and shows that text when viewing the news category. How do I get it to work so that when you view the news category it shows one specific set of text at the top of the page? Because the methods I have tried do not seem to be working.


Upload multiple images and insert them into custom html code

Good evening. :) Well, my mother is currently using a wordpress installation for her day to day blogging. Often, a post consists of some text and a few images, which are displayed via the very nice flexslider script. Usually, when the post is ready, I handle the flexslider part. However, I'm not always around, so posts get delayed, I get calls... You know. :) I'd like her to be able to do it herself, so I was thinking about writing a quick and dirty little plugin. Basically, just select some images from the library and paste the code into the editor. Nothing fancy, this shouldn't take longer than a night or so. The problem is, I've never developed anything wordpress, so some tips would be greatly appreciated. Of course, I'm not afraid of reading the documentation, but I don't have the time to really dive into it right now. Thanks for your time. :)


wp-admin returns 404

I installed theme-my-login and after playing with it decided it wasn't for me. I logged out my dashboard, went to log back in and now my wp-admin returns a 404 error - what do I do?


Attachment Display settings for Audio files

I'm using WordPress 3.8.1 and would like to stick with the plugin I have for embedding audio - The problem - When Uploading Audio you have a choice "ATTACHMENT DISPLAY SETTINGS" to Embed Media Player, Link to Media File, or Link to Attachment Page... Simple Enough - What I'm doing every time is Clicking "Link to Media File" - If I don't I get two embedded players and one can't find the file... I can't figure out how to change the default (For Audio Only) to "Link to Media File" I've looked at the OPTIONS.PHP that doesn't change the Audio default and trying to read wp_embed_defaults() which is located in wp- includes/media.php doesn't present a simple solution... Keep in mind that the choices for inserting audio look similar to pictures but the bottom is different.. it only gives the choice: ATTACHMENT DISPLAY SETTINGS - which is where I need to change the default to "Link to Media File" - every time - we upload a ton of audio files and forgetting to click the Link choice puts two players on the post...


How to redirect custom post type archive to first term of associated taxonomy?

I have a custom post type 'countries' and a taxonomy 'cities'. My cities are: boston, new york... I want my `archive-countries.php` redirect to the first term taxonomy. I mean, if my URL is `www.example.com/countries` this should redirect to `www.example.com/cities/boston`. How can I do this?


Why can't I update username through Wordpress API?

I'm just wondering about usernames... Why isn't is possible to change this through Wordpress API? (I understand why a user in the admin dashboard can't change username(s) but that isn't really same thing!?) Code below does just ignore the user_login - setting.               $pupil_obj= get_post($postid_pupil);          $user_login = $pupil_obj->post_name;     $user_nicename = $pupil_obj->post_name;          $user_args = array(         'ID'            =>  $current_user->ID,         'user_email'    =>  $email,         'user_login'    =>  $user_login,         'user_nicename' =>  $user_nicename                         );                     wp_update_user( $user_args ) ;      I could update the username to the database directly through `$wpdb`. This makes no sense to me. Can someone explain?


Blank line before doctype

I have a frustrating problem. In the page source, the first line is blank, which causes issues in some browsers. These are the steps I've taken to try to fix the problem:   * Gone back to twentythirteen theme   * renamed plugins folder to oldplugins. Checked in admin and they are all deactivated   * Made sure there is nothing outside of the php in index.php, header.php   * cleared out htdoc htaccess I'm at a loss!


next_post_link() on custom menu structure

In a blog, I am using `next_post_link()` and `prev_post_link()` extensively on posts. I also have a number of pages that I show in a WP3 menu. They are organized in topics and sub-topics e.g. like so:               Home     About     - Subpage 1     - Subpage 2      - Subpage 3      Contact      I would like to set up a "previous" and "next" navigation on these pages as well, so that when I'm on "About"'s Subpage 2, I can navigate to Subpages 1 and 3 using the "next" and "previous" arrows. The default behaviour of `next_post_link()`/`prev_post_link()` doesn't work for this: It calculates the next and previous items based on the list of _all_ pages. Is there an easy way to make `next_post_link()` and `prev_post_link()` sensitive to my menu structure, or will I have to build this myself?


Looks like image resize is not working well

Im searching for some clue about this behavior? I think it is a PHP memory_limit or WP define('WP_MEMORY_LIMIT', 'X') issue? Sometimes images are resized and sometimes not, in other scenarios the browser crash:   1. Im using Dreamhost as shared hosting, and their 7 upload limit.   2. Error printed with an uploaded image of 6.4MB of size and with a width and height of: 11684x3855: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 46736 bytes) in /PATH/wp-includes/media.php on line 254   3. Other users reports the same issue with files, for example, of 3MB but with higher width and height (superior to 2000px or 3000px). Any help is welcome. Thanks in advance.


How can I split long posts into pages?

I want to make one long post, but have it paginate. I read that you could add this: `<!--nextpage-->`, but all it did was hide the content under the tag. Is there a plugin that helps do this? Is it possible that my theme may not allow this?


Mass Import Users without sending new user notification

I need to import users via csv file. I see lots of plugins that do mass imports, but they all seem to send out new user emails to the new users. Since this is currently being set up on a dev site, I don't want to send out the new user emails. Are there any plugins that import users without sending out new user notifications


Whats wrong with my wp gallery?

i was making a gallery on my clients site using `[gallery]` sortcode. The gallery appears but when clicked it goes to clients other website which i have no idea why? here is the link http://www.build12.com/promotions-pictures/pictures/ check the wired link of the pictures. The wordpress version is 3.1.1. Please let me know what is your advice. Thanks!


syntax highlighting and <?php rewriting

I am using this plugin: http://www.megatome.com/syntaxhighlighter/ Which appears to work ok, minus a few glitches here and there. My problem, is that I think WordPress is rewriting `<?php` with `<!--?php` and other tags, presumably for security. Is there any way to disable this functionality, so that I can show code in it's full:               Here is some PHP in my text...<?php echo 'Foo'; ?>      rather than having to choose between no `<?php` tags and having messed up output. I ask, because often I write about code that goes in and out of PHP, so having the tags in place is crucial really. Hope this makes sense, and thank you. -- on a side note, is there any way to prevent wordpress parsing the following:
     return '';
      WordPress will attempt to find an image rather than just output the code, causing all kinds of problems. Long story short - what's the best way of showing PHP code on a wordpress blog without having to worry about wordpress breaking the output. thanks.


Wordpress -> If Is Role Subscriber Show Image?

So here's the deal..I have Wordpress + bbPress integrated with a membership software (aMember). On my bbPress forums, under people's username i want to show the Wordpress roles (Not bbpress roles) of every member and also an image depending of the role of every member. For example, If user role is subscriber -> Show role under username in bbpress -> Also show an image below. The reason why i want to show Wordpress roles (instead of bbpress roles) is that my membership software (amember) allows me to set different wordpress roles depending on the User's subscription. I have 2 different membership plans on my site (one free and on paid) and i want to show different images in my bbpress forums based on their plan. I went through the bbPress templates and i found this code (in loop-single- reply.php):               <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> // this shows the bbpress role     <?php echo 'Points: '.cp_getPoints(bbp_get_reply_author_id()); ?> // this shows the member points below the username - I use a points plugin)      Now how can i replace this code with a code that shows the Wordpress roles (not bbpress) for every user and also show an image under it depending on what roles it is. For example: If Is Role "Subscriber" -> Show Role + Image Under It If Is Role "Contributor" -> Show Role + Image Under It If Is Role "Administrator" -> Show Role + Image Under It I'm not a programmer so i have no idea how to accomplish this. Please help. I found some related code that i think i could use to make this work:               <?php if ( current_user_can('contributor') ) : ?>     Content     <?php endif; ?>      Now my failed attempt looks like this:               <?php      $user_roles = $current_user->roles;     $current_user = $bbp_get_reply_author_id; // i think this is wrong :P     $user_role = array_shift($user_roles);     ?>     <?php if ($user_role == 'administrator') : ?>          Show Role       Show Image          <?php elseif ($user_role == 'editor') : ?>          Show Role     Show Editor Image          <?php elseif ($user_role == 'author') : ?>          Show Role     Show Author Image          <?php elseif ($user_role == 'contributor') : ?>          Show Role     Show Contributor Image          <?php elseif ($user_role == 'subscriber') : ?>          Show Role     Show Subscriber Image          <?php else : ?>           Show Role          <?php endif ?>      I have no idea what i'm doing...The code above is something i found on Google. Can anyone help? I would really appreciate it.


How to know where this function definition is declared?

I am new to wordpress, I wanted to know where this definition is mentioned in wordpress               return apply_filters('check_password', $check, $password, $hash, $user_id);      I found it in `pluggable .php` file line no `1470` I wanted to know this because there are two types of password saved one is simple but with encryption and other is with $P$B infront of encrypted password. I wanted to know what is the difference between them and how they are managed. Please Help. Thanks


Automatically exclude categories from metabox based on title

I am designing a website which will be used as a school PA system. Users will be posting entries into categories named for specific dates that correspond to school assemblies. We have two assemblies a week, which means my site will need a lot of categories. I only want users to see the categories which correspond to recent/upcoming assemblies. Since our homepage is simply a list of categories, and all our categories are named in mm/dd/yyyy format, I wrote the following script to only display recent and not-to-distant assemblies (categories).               echo '
';      $categories = get_categories($category_id);           foreach ($categories as $cat) {          $category_link = get_category_link($cat);             if( strtotime($cat->cat_name) < strtotime('-3 days')) { }             elseif( strtotime($cat->cat_name) > strtotime('+2 months')) { }             else { echo '
' . $cat->cat_name . '
'; }      }           echo '
';      This code runs on my site's homepage and works perfectly. The problem is, I also want to run a similar script on the category meta box in the Wordpress site admin, so our users can only post to upcoming assemblies. Originally I hoped to modify the wp_terms_checklist function to work similarly to our homepage but had no luck. Recently, I discovered MikeSchinkel's code here. I think his method shows a lot of potential since it already has the capacity to exclude certain categories from the metabox. I have attempted to modify his code for my purposes but am having trouble combining the two scripts. Here's the closest I have been so far:               add_filter('list_terms_exclusions', 'yoursite_list_terms_exclusions', 10, 2);     function yoursite_list_terms_exclusions( $exclusions, $args)      {         global $pagenow;              foreach (get_categories() as $category)          {              if( strtotime($category->cat_name) < strtotime('-3 days'))              {                 $category->slug = $oldassemblies;             }             elseif( strtotime($category->cat_name) > strtotime('+2 months'))              {                 $category->slug = $futureassemblies;              }          }              if (in_array( $pagenow, array('post.php','post-new.php') ) )          {             $exclusions = " {$exclusions} AND t.slug NOT IN ('$oldassemblies', '$futureassemblies')" ;         }              return $exclusions;       }      Theoretically, I feel like this code should work but the foreach statement and the get_categories() function disrupt both the front and back ends of my site. I have had success replacing the excluded category slugs with variables declared in the same function, but as soon as I try to associate these variables with my rules, the site errors. I am still learning PHP and have tried every possible variation of combination of the code that I could think of but am still having trouble. Please let me know if you have any suggestions. Thanks, Jonathan Note: the edits to a meta-box are part of a series of special functions I am creating for an admin theme. All of the functions are placed inside a giant if statement so they only affect users with contributor access, so my code will not be affecting site admins.