title: Where to insert get_comments?

text: I'm trying to setup a page and extract comments from an external post. I took this advice how to pull wordpress post comments to a external page and now I have this get_comments code at my disposal:               <?php      $comments = get_comments('post_id=15');         foreach($comments as $comment) :         echo($comment->comment_author);     endforeach;     ?>      Where on the page do I place this? Sorry for the noob question!


title: Don't send notification if author comments his own post plugin help?

text: is there any way to set an IF statement, that If the author of the post commented or replied on his own post that the wp notification is not sent to him, only if a different user comments he would recieve the notification?. I am using the Notify on comment plugin.               <?php     /*     Plugin Name: Notify on comment     Plugin URI: http://www.artbits.it     Description: Send a notification on comment to the author of the post     Version: 1.03     Author: Fabio Trezzi      Author URI: http://www.artbits.it     */          function notifyOnComment_send($commentID){     global $wpdb;     // Get the email of the post's author     $comment = get_comment($commentID);     $post = get_post($comment->comment_post_ID);     $user = get_userdata($post->post_author);     $to = $user->user_email;     // Set the send from     $admin_email = get_option('admin_email');     $headers= "From:noreply@bonetoz.com\r\n";     $headers .= "Reply-To:$noreply@bonetoz.com\r\n";     $headers .= "X-Mailer: PHP/".phpversion();          $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);     $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");          $moderationOpt = get_option('notifyOnComments_moderationRequired');          if($moderationOpt == 'true'){         // Only send the notification if the comments requires to be moderated         $approved = $comment->comment_approved;         if($approved != 0) return;  // No need to send the mail the comment is already approved     }             $template = get_option('notifyOnComments_emailTemplate');      // If not setted load the default from file     if($template || $template == "") $template = file_get_contents(dirname(__FILE__) . '/defaultTemplate.php');          // Replace all the constant with the rights values     $template = str_replace("{postID}", $post->ID, $template);     $template = str_replace("{postTitle}", $post->post_title, $template);     $template = str_replace("{author}", $comment->comment_author, $template);     $template = str_replace("{authorIp}", $comment->comment_author_IP, $template);     $template = str_replace("{authorDomain}", $comment_author_domain, $template);     $template = str_replace("{authorEmail}", $comment->comment_author_email, $template);     $template = str_replace("{authorUrl}", $comment->comment_author_url, $template);     $template = str_replace("{commentContent}", $comment->comment_content, $template);     $template = str_replace("{commentLink}", get_permalink($comment->comment_post_ID), $template);     $template = str_replace("{commentID}", $commentID, $template);     $template = str_replace("{commentsWaiting}", $comments_waiting, $template);     $template = str_replace("{siteUrl}", get_option('siteurl'), $template);          $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );          @wp_mail($to, $subject, $template, $headers);          return true;          }          function notifyOnComment_menu() {     $path = dirname(__FILE__);     $pathElements = explode('/', $path);     add_options_page('NotifyOnComments options', 'NotifyOnComments', 'manage_options',   $pathElements[count($pathElements) - 1] . '/options.php');     }          add_action('comment_post', 'notifyOnComment_send');     add_action('admin_menu', 'notifyOnComment_menu');          ?>


title: Adding The Post Template Dropdown to WP-Admin

text:
I'm developing a WP theme from the ground up for the first time. Having build WP sites before, I know there to be an option in Posts that will allow for the selection of a specific template. I have created the custom Post Templates with the appropriate headers, but the option to select anything is simply not there in WP Admin. Do I need to add something in functions.php in order for this to show? I've searched high and low for an answer but no-one seems to be having this issue and simply recommend disabling and enabling the theme, which has no affect. Thanks in advance! Template Code:               <?php     /*     Template Name Posts: Rooms Template     */     ?>          <?php get_header(); ?>

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

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


title: Wrap all post images inside a div element

text: I searched for all kind of solution but i really could find one that did what i was looking for, what i simple want done is wrapping all images inside a div element, old post aswell as new posts. All help is very much appreciated p.s. I did a little jquery snippet but I really would like another solution the jquery code               <script>     $(function(){         $('a:has(img.postthumbimage)').wrap('<div class="myphoto" />');     });     </script>


title: getting url in wp_enqueue_style

text: I'm having trouble getting the second argument in wp_enque_style. Here's how my site is setup:   * style.css    * custom_style.css   * index.php In a template, I have this code:               $stylesheet_url = bloginfo('template_directory') . '/custom_style.css';      wp_enqueue_style( 'custom_style', $stylesheet_url );       Which isn't working. Any reasons why? The output is just the path to my template directory, outputted as raw text, which is obviously not the correct behavior.


title: Trouble Adding New Logo

text: I'm trying to replace an old logo on a site with a new one.   * The old logo was 222×120px    * and the new one is 222×150px.  I uploaded the new one and had it overwrite the old one. My site hasn't changed though. The 30px added to the new logo is the only difference between the two and it just says "Productions". There should be room for at least part of the "Productions" part to show, but it looks exactly like the old one. How can I fix this? I'm supposed to have this site finished today and this is the last thing stopping me from being done. The logo I'm talking about is the one in the top-left corner of this site. Thanks


title: Query from a different database than the default

text: I'm making a layout for a wordpress page. The layout needs to connect to a second database (both databases are in the same domain). But the problem is, when i execute just the file it works. But when i included inside the wordpress layout i don't get data, no errorrs, nothing The script is just:                $con = mysql_connect('host','user','pass');      mysql_select_db('db', $con);      $q = mysql_query('SELECT * FROM vars', $con);      var_dump(mysql_fetch_array($q));      As i say. If i execute the file alone: > http://example.com/blog/connect.php it works great, and returns data. But if i do inside the layout (creating a wordpress page, and giving the layout to it) Returns nothing. Any idea what can be happening there?


title: Modification to wp_list_categories

text:
I dug this up to help me modify wp_list_categories and place the featured image from the latest post in that category, inside the generated li.               class CategoryThumbnail_Walker extends Walker_Category {         // A new element has been stumbled upon and has ended         function end_el( &$output, $category, $depth, $args ) {             // Output the standard link ending             parent::end_el( &$output, $category, $depth, $args );                  // Get one post             $posts = get_posts( array(                 // ...from this category                 'category' => $category->cat_ID,                 'numberposts' => 1             ) );             // If a post has been found             if ( isset($posts[0]) ) {                 // Get its thumbnail and append it to the output                 $featured = get_the_post_thumbnail( $posts[0]->ID, 'extrathumb', null );                 $output .= $featured;             }         }     }         Used thusly:-               <?php wp_list_categories( array(                                       'show_count' => 1,                             'walker' => new CategoryThumbnail_Walker()) ); ?>      This does almost exactly what I want, to output the featured image along with the category name and the post count from that category. The only problem is it outputs the img OUTSIDE the li, like so
Around The Web  1
           I need that image to be INSIDE the category li Any ideas?


title: What is a trackback

text: A new trackback on the post "Roll-o-matic_4" is waiting for your approval http://onboardsolutions.com/clean-room/disinfection-technology/vileda- professional/roll-o-matic-clean-room-mop/roll-o-matic_4/ Website : My Homepage (IP: 5.157.45.216 , 5.157.45.216) URL : http://www.z9U8DJqqx.org Trackback excerpt: **... [Trackback]**


title: get_posts and wp_autop (remove filter)

text:
I just transformed my query_posts function in a get_posts function. Here is my old function:               <?php     // The Query     query_posts( 'cat=170&showposts=4' );     remove_filter('the_excerpt', 'wpautop');     // The Loop     while ( have_posts() ) : the_post();         echo '
 '; the_title(); echo '

'; the_excerpt(); echo '
';     endwhile;     // Reset Query     wp_reset_query();     ?>      Here's my new one                   <?php     $args = array( 'posts_per_page' => 4, 'category' => 170 );     $tag_posts = get_posts( $args );         foreach ( $tag_posts as $post ) :           setup_postdata( $post ); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php the_excerpt(); ?>
         <?php endforeach;         wp_reset_postdata(); ?>      The problem is that now the `remove_filter('the_excerpt', 'wpautop');` directive doesn't work anymore.. I tried putting it before and after get_posts( $args );, doesn't affect the output.. :( how can I remove the filter for get_posts too?


title: How can I get the blog page ID?

text: As above, for example this is the blog page url: `http://192.168.1.100/wordpress/?page_id=30` Let assume that I don't know the exact ID of blog page and I want to write `if` condition for this page.


title: Putting php inside an echo php shortcode

text: I am using wordpress. I am using the plugin social locker. I have figured out how to display the shortcode via PHP: `<?php echo do_shortcode('[sociallocker id="3071"] My content Here [/sociallocker]'); ?>` However I want to display this button that will allow for a print popup in between there. This code is: `<?php if ( function_exists( 'pdf_print_popup' ) ) pdf_print_popup(); ?>` So my question is can I do this: `<?php echo do_shortcode('[sociallocker id="3071"] <?php if ( function_exists( 'pdf_print_popup' ) ) pdf_print_popup(); ?> [/sociallocker]'); ?>` If not what do I need to do? My goal is to make it so the social locker dissapears once the user shares and they see the print button. Thanks Guys :)


title: paginate_links() returns NULL instead of the pagination links, but pagination is actually happening

text: **What I'm trying to do:**   Print the pagination links on the home, which uses template `index.php`, with pagination functions such as `paginate_links()`, outside The loop. **What happens instead?**   Instead of getting the pagination links, `paginate_links()` just returns NULL. This would be ok if there was no pagination, I.E. there are fewer posts found by the query than the max posts per page setting. But there are actually 10 posts found (`paginate_links() == 10`) and only 5 are showing (`$wp_query->query_vars['posts_per_page'] == 5`) so it's evident that some kind of pagination is actually happening. If I set max posts per page to 10, all 10 posts show up on the home. **My code**   There's no significant code to post, but this is it:               get_header();     if( have_posts() ) {         while( have_posts() ) {             the_post();             the_title();         }     }     echo paginate_links();     get_sidebar();     get_footer();


title: Single Multisite Signup Page

text: I'm trying to turn the WordPress multsite signup page into a one step process instead of two. I'm wanting people to choose their username, email, password and a confirmation of their password, along with choosing their blog domain (subdomain), blog title, along with the captcha on one page. The way I have it set up now though, it doesn't work. It displays all the forms correctly, but it doesn't register the user or the blog and just takes you to a blank page when you hit "Create site." Here's the code for my custom sign up page: http://pastebin.com/pje9icNL What am i doing wrong here? Thanks in advance!


title: How do i retrive a post from a custom post type

text: How can i retrive a post from a Post Type were "distributie_seriale" is a relationship field. Ex: I add an Actor to PostType - actors ( Add post) next I add an Serial on PostType- serial ( Add post) I link the serial in Relathionship Field with the actor. After i do that i click Publish. Results: On the Serial Page i retrive the actor, but the question is... How i retrive the serial on Actor Page. Extra : The movies are in WP Post's The code down it retrive me the movies of post's Page. How can i retrive a post's that is select, from a Post Type , in my case -- serial               $movies = $wpdb->get_col("SELECT post_id FROM $wpdb->wp_postmeta WHERE meta_key = 'distributie' AND meta_value LIKE '%".get_the_ID()."%'");         $the_query = new WP_Query( array( 'post__in' => $movies) );


title: get_*_meta doesn't always return an array

text: I find it annoying that functions like `get_user_meta` or `get_post_meta` will return an array if the meta key exists or false if it doesn't. This means I need to do a check like so:               $meta = get_post_meta($id, $meta_key);     if ($meta) {         foreach ($meta as $value) {             // ...         }     }      I was hoping for a way where I wouldn't have to check if it's not a falsy value first.


title: How to use is_rtl with my main style.css?

text: Sorry if this is an ignorant question. I'm a first timer on working with rtl languages. Say we have a theme with standard style.css for English languages. so I use is_rtl() and this returns TRUE, we won't load the style.css and only rtl.css? IF someone can provide an example on this on loading rtl.css on rtl languages and style.css on other languages (aside from the WordPress documentation which I already seen), I would be happy. Thanks.


title: Filter results with custom field values and dropdown

text: I need to filter posts by a custom field value. My specific example:   * User browse to products > category 1 > subcategory A.    * ALL "subcategory A" items (products custom post type) are displayed as default by date.   * Each item in subcategory A has a custom field "size". User can select the size with a dropdown menu and posts are filtered displaying only items with "custom field:size" = "selected size". Filter is kept also in pagination, because products are on more pages. I've checked a lot of answers, but no case was simple as that. I was thinking about doing it using a custom search or a plugin, but I really don't know where to start. thanks for your help. EDIT: the custom field values are fixed, not auto-populated. The select can be built in plain html without extra queries.


title: how to add a .php file to wordpress

text: I have a php file in my server (say www.example.com/up/up.php). If i access that file through the url, my site says no page found. but i want to call that php file using url parameter. I want to call that file to a download file using url access( say www.example.com/up/up.php?f=207). can someone help me how to do this. as usual i searched fr few days for my problem and came here when i totally cornered. my up.php contains the following code               <?php /* Template Name: Upload */ ?>               <?php       $app_id = "12345678901234567890";       $app_secret = "12345678901234567890";       $post_login_url = "www.mysite.com";       $album_id = "7777";       $photo_url = "URL";       $photo_caption = "cool pics";            $code = $_REQUEST["code"];            //Obtain the access_token with publish_stream permission        if (!$code){          $dialog_url= "http://www.facebook.com/dialog/oauth?"           . "client_id=" .  $app_id           . "&redirect_uri=" . urlencode( $post_login_url)           .  "&scope=publish_stream";         echo("");       } else {         $token_url="https://graph.facebook.com/oauth/access_token?"           . "client_id=" . $app_id           . "&client_secret=" . $app_secret           . "&redirect_uri=" . urlencode( $post_login_url)           . "&code=" . $code;         $response = file_get_contents($token_url);         $params = null;         parse_str($response, $params);         $access_token = $params['access_token'];              // POST to Graph API endpoint to upload photos         $graph_url= "https://graph.facebook.com/"            . $album_id . "/photos?"           . "url=" . urlencode($photo_url)           . "&message=" . urlencode($photo_caption)           . "&method=POST"           . "&access_token=" .$access_token;              echo '';         echo file_get_contents($graph_url);         echo '';       }     ?>      I should pass a value to the url by using link


title: Getting all months in one year Wordpress Archive

text: Alright, I was starting on the code for my blog today when I ran into a little issue. However, before I ask my question, it my help if I actually explain what the functionality I am hoping to achieve. (you can also view my header comp at http://louisstephens.cc/comps/blog.png ) In my header, I am going to have the year with all the months listed under it. The current month will be selected showing all the posts for that month. However, the other months will also be selectable, and doing so will fade out the current month's post to show the newly selected month's posts (as well as changing the "active" state of the selected month). When a new year comes around, you can simply click on a side arrow (that will be next to the year), and it will slide the header over to that year and month set). Maybe this can't be done, but I was having an issue. For the life of me, I can not figure out how to show all the months regardless of them containing any posts. I know I can use:               <ul>     <?php wp_get_archives('type=monthly'); ?>     </ul>      But if no posts are present, no months show up. Has anyone ever figured out a way around this, or have any clue of what can be done to achieve my desired effect?


title: Raw output (preventing wpautop)

text: Using WordPress 3.5. I'm trying to put a `<form>` into a Page of a WP-based site. Unfortunately, WP is "helpfully" screwing up the formatting of the form by inserting `<br>` and `<p>` tags in inappropriate places next to the form controls. I don't want to disable `wpautop` globally, as it's still helpful for blog posts (particularly as this is a multi-author site). I don't even want to disable it for the whole of the page. I want some way to disable it only in this one specific section of this one page. I read in the WP changelogs that supposedly shortcodes do not run `wpautop` on their output any more, so I tried creating the following shortcode:               function raw_shortcode( $atts, $content = null ) {        return $content;     }     add_shortcode('raw', 'raw_shortcode');      Unfortunately this does not appear to work -- surrounding the form with this still results in undesirable breaks and paragraphs being added. I've seen a few examples suggesting a modification to the standard filters, but I've also read some other pages that suggest this is a bad idea.


title: Image uploaded in media library, can only see it when I using the WP Edit Image feature. 404 when trying to view in browser

text: I have an image that I've uploaded through the WP media library. I can see this image in my uploads folder via ssh/ftp. I cannot see this image if I put the URL in my browser, like www.site.com/files/image.jpg (It's a multisite and all uploads go into individual folders rather than be separated out by months). In WP, the image shows as broken in the media library listing of uploaded files. Only when I select this image file and choose "edit image" does the image show up. The 404 is not the regular WP 404 page template, it's a blank page that only says "404 — File not found." And the best part is that this does not happen for all images/uploads. Does anyone have any ideas I can take action on? EDIT: It looks like any file with "pdf" in the file NAME (not file extension) is having this problem. .pdf files work fine. I don't know why the filename would make this happen...


title: How to get userid at wp_logout action hook?

text: I need to perform some cleanup after a user logged out, so I added a wp_logout action hook. Problem is, wp_get_current_user() already returns null if called from within the wp_logout action hook. How do I get the logging out users userid inside a wp_logout action hook?


title: Wordpress wp_unregister_GLOBALS causing 100% Apache CPU Usage

text: I've been testing the Wordpress (by making about 5 requests/s) CMS, but the problem is that Apache is constantly using 100% of the CPU. Lately I've had enough of that and I've traced down a problem to the wp_unregister_GLOBALS function that's located in the /wp-includes/load.php file and called from wp- settings.php. The function is as follows:               function wp_unregister_GLOBALS() {             if ( !ini_get( 'register_globals' ) )                    return;                  if ( isset( $_REQUEST['GLOBALS'] ) )                    die( 'GLOBALS overwrite attempt detected' );                  // Variables that shouldn't be unset             $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );                  $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );             foreach ( $input as $k => $v )                    if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {                            $GLOBALS[$k] = null;                    unset( $GLOBALS[$k] );                    }     }      I've tried commenting out the whole function body and commenting the function call in wp-settings.php, but the Apache was still using 100% of the CPU. THe only thing that helps is chaning the name of the function; then Apache is fine and everything is OK. But I would like to know why; I know that the function unregisters the GLOBAL variables, but why is it taking up 100% of the CPU. And why is it taking up 100% of the CPU when I've commented out the entire function's body and just returning null? If anybody know the answer to the question, please let me know; otherwise it would be great to knowing whether I can change the name of the function for good: it's just for testing purposes only.


title: expecting 404 but redirecting to post with url subdirectory in post title

text: I'm seeing something unexpected, although I'm not sure whether it's a feature I can disable or whether it is something introduced by the custom theme I'm using that I need to track down. If I enter a url for a non-existent page, e.g. mysite.com/london, before throwing a 404 it will search for a post with a title that starts with "london" and show that if it finds it, e.g. mysite.com/events/london-weekend- party. (I have a number of different CPTs, but this redirect is CPT-agnostic, i.e. it doesn't seem to care which post type contains 'london' in the title. When I register the CPTs the only rewrite rule is for the slug, e.g. `'rewrite' => array('slug'=>'events'`.) I used the plug-in Debug This to look at the rewrite rules, but it hasn't helped because it appears to be showing the rule that matched after the rewrite happened, i.e. not that it matched against `mysite.com/london` but against the post it found, i.e. `events/([^/]+)(/[0-9]+)?/?$`. I only discovered the 'problem' because I was looking at how to intercept 404s before the 404 template is loaded to check the urls against a whitelist so that if I get a match for, say mysite.com/london, I can do something London- specific before a redirect. If anyone has any tips on where to get started with that, I'd be grateful to hear them. My first instinct was to $_GET hooked into wp but I'm not talking about `?name=value` style parameters.


title: Print_r displaying two different post->ID if placed in sidebar or single.php

text: My website is displaying, if print_r, two different ID for the same post. If i ask:               <?php echo $post->ID;?>      in the single.php it gives me a number. If i do the same thing in the sidebar it gives me a completely different one. This is what I get with the print_r on the single.php               stdClass Object ( [ID] => 59 [post_author] => 1 [post_date] => 2012-01-01 20:29:18      [post_date_gmt] => 2012-01-01 20:29:18 [post_content] => È universalmente     riconosciuto (...) [post_title] => fdsfdsfs [show_in_menu] => 1 [link_link] => 1     [no_follow_link] => 0 [alt_link_text] => [custom_link_class] => [redirect_url] =>     [target_blank] => 0 [alt_title_attribute] => [post_excerpt] => [post_status] => publish     [comment_status] => closed [ping_status] => closed [post_password] =>     [post_name] => fdsfdsfs [to_ping] => [pinged] => [post_modified] => 2012-01-07 19:53:44     [post_modified_gmt] => 2012-01-07 19:53:44 [post_content_filtered] =>     [post_parent] => 0 [guid] => http://www.museidibra.it/prova/?p=59 [menu_order] => 0     [post_type] => post [post_mime_type] => [comment_count] => 0     [ancestors] => Array ( ) [filter] => raw )      While this is what I get from the sidebar:               stdClass Object ( [ID] => 93 [post_author] => 1 [post_date] => 2012-01-02 08:39:29     [post_date_gmt] => 2012-01-02 08:39:29 [post_content] => prova 3 (...)     [post_title] => prova 3 [show_in_menu] => 1 [link_link] => 1 [no_follow_link] => 0     [alt_link_text] => [custom_link_class] => [redirect_url] => [target_blank] => 0     [alt_title_attribute] => [post_excerpt] => [post_status] => publish     [comment_status] => closed [ping_status] => closed [post_password] =>     [post_name] => prova-3 [to_ping] => [pinged] => [post_modified] => 2012-01-07 13:06:15     [post_modified_gmt] => 2012-01-07 13:06:15 [post_content_filtered] =>     [post_parent] => 0 [guid] => http://www.museidibra.it/prova/?p=93 [menu_order] => 0     [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw )      It is basically 2 different posts. NOTE: this thing happens only in post that i tagged. I f i don't tag the post, the resulting IDs will be the same. Here, you can find an example of this from my website, where print_r shows 2 different IDs for the same post. Help please, this thing is freaking me out. Thanks


title: More Fields WP Plugin

text: one of my clients use More Fields WP plugin and we want to generate a feed of the data entered using that plugin. http://wordpress.org/support/plugin/more-fields Have installed JSON WP plugin to generate the feed but the feed does not pick up the data entered using More Fields plugin. http://wordpress.org/extend/plugins/json-api/ is there a another WP plugin that will be able to pick up data entered using More Fields plugin? if not, what are the other options to get that data via a feed? also couldn't locate the data in the main tables?


title: Checking post format during xmlrpc_publish_post

text: WordPress apparently stores post format information outside of the `$post` object. During `publish_post` this isn't (usually) a problem because you can check on formats via `get_post_format( $post->ID )` outside the loop. This doesn't appear to work during `xmlrpc_publish_post` or `app_publish_post`. People have to be working around this to get plugin/theme functions working on mobile/desktop apps. My specific code is below in case it's an error on my end.               function posse_twitter( $post_ID ) {         error_log('Executing posse_twitter()');         global $post;         // check post format if necessary         if ( get_post_format( $post->ID ) != 'status' ) return;         error_log('posse_twitter() made it past format check');              $post_id = $post->ID;         $shortlink = wp_get_shortlink();         $tweet_content = $post->post_content.' '.$shortlink;              // ...run code once         if ( !get_post_meta( $post_id, 'tweeted', $single = true ) ) {                  error_log('posse_twitter() not tweeted before');                  // require the relevant libraries             require get_template_directory() .'/inc/posse/libraries/tmhOAuth/tmhOAuth.php';             require get_template_directory() .'/inc/posse/libraries/tmhOAuth/tmhUtilities.php';             $tmhOAuth = new tmhOAuth(array(                 'consumer_key'    => 'XXXXX',                 'consumer_secret' => 'XXXXX',                 'user_token'      => 'XXXXX',                 'user_secret'     => 'XXXXX',             ));                  $code = $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array(             'status' => $tweet_content             ));                  error_log('posse_twitter() made it past tmhOAuth, should be on Twitter now');                  update_post_meta( $post_id, 'tweeted', true );         }     }          add_action( 'xmlrpc_publish_post', 'posse_twitter' );      add_action( 'app_publish_post', 'posse_twitter' );     add_action( 'publish_post', 'posse_twitter' );      `error_log()`s included since I've been debugging this. It's firing when `xmlrpc_publish_post` and `app_publish_post` get hit, but it doesn't make it past the format check. Update: This also doesn't work even if I save the post as a draft first (via XML-RPC).


title: Combining wordpress themes

text: Is there any way to combine two Wordpress themes without using a plug-in that renders pages in different themes, and if there is, what is the most efficient way to do so? Is it as simple as copying and pasting one theme's function.php (and other files) into the first theme? Do I make a child theme? I'm trying to build a database for clean energy initiatives across the globe, and like the map functionality of one the themes I've purchased. However, once you go pass the map, the theme is not very user-friendly and cannot hold a lot of information. This is where the second theme comes in. I want to keep both the functionalities of both themes if possible.


title: Adding a filter to qTranslate to change display of language chooser

text:
This is a problem I am having with qTranslate, but I suppose the solution is more of an instruction in how Wordpress hooks and filters work. Instead of using the qTranslate widget, I am using the hook               <?php echo qtrans_generateLanguageSelectCode('text');?>      to call the language chooser in my header and then modifying its appearance in my CSS. This is no problem. However, I would like to add a "style" to the Language Select Code function so that instead of displaying the full language text, which would be "Francais" and "English" in my case, it will show just the language code instead (`EN` and `FR`). I had figured this out by changing (and I know this a very bad thing to do) `qtranslate_widget.php` and adding a new case to function `qtrans_generateLanguageSelectCode($style='', $id='')`. This worked great, but then I updated Wordpress and had to update qTranslate as well, so obviously my modification went away. So instead of re-doing that operation, I was wondering if anyone has any suggestions for how to add a filter to the function in my own theme's functions.php? I figure it would be something like               add_filter('qtrans_generateLanguageSelectCode', 'qtrans_myLanguageSelectcode',      but after that I get lost and don't know enough about filters. I hope this is clear enough! When I updated, I obviously lost my modification but I think that below is what should work (I haven't tested it yet!)               case 'code':     foreach(qtrans_getSortedLanguages() as $language) {                 $classes = array('lang-'.$language);                 if($language == $q_config['language'])                    $classes[] = 'active';                 echo '''.$language.'';              }     break;      Not to make this post too long, but the following is the existing function in the qTranslate plugin:                   // Language Select Code for non-Widget users     function qtrans_generateLanguageSelectCode($style='', $id='') {         global $q_config;         if($style=='') $style='text';         if(is_bool($style)&&$style) $style='image';         if(is_404()) $url = get_option('home'); else $url = '';         if($id=='') $id = 'qtranslate';         $id .= '-chooser';         switch($style) {             case 'image':             case 'text':             case 'dropdown':                 echo '
';                 foreach(qtrans_getSortedLanguages() as $language) {                     $classes = array('lang-'.$language);                     if($language == $q_config['language'])                         $classes[] = 'active';                     echo '
'.$q_config['language_name'][$language].'
';                 }                 echo "

";                 if($style=='dropdown') {                     echo "\n";                 }                 break;             case 'both':                 echo '
';                 foreach(qtrans_getSortedLanguages() as $language) {                     echo '
'.$q_config['language_name'][$language].'
';                 }                 echo "

";                 break;         }     }


title: Posts in sidebar only by admin

text:
I want to show in latest posts widget only posts by admin (now its showing latests posts by all suers). How I can do it ? via wp query ? Thanks :)               <?php // setup the query                         $args='&posts_per_page='.$numreviews.'_reviews&order=DESC&orderby='.$feedsort.$metakey;                                                      $cust_loop = new WP_Query($args);                          if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;                             // if we're sorting by rating and this item does not have a rating, hide it                             $rating = get_post_meta(get_the_ID(), "Rating", $single = true);                              if(($rating && $feedsort=="meta_value") || ($feedsort!="meta_value")) {                                                                      $ratings = con_setup_rating($rating); //setup the ratings array                                       ?>
                                                                                <?php con_show_rating($ratings[0], $ratings[1], $ratings[2]); // show the stars or hearts ?>                                          <a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
                              <?php } ?>                          <?php endwhile;                      endif;                      wp_reset_query(); ?>


title: Separate page for comments using permalinks and add_rewrite_rule

text: I have been at this for days now, going through plenty of answers here, guides on using .htaccess, guides on using add_rewrite_rule() within Wordpress and examples throughout the web. I am not sure if there is a malfunction in my regex to detect the correct URL, or a disconnect between what I want to accomplish and what can be accomplished. Basically, I am trying to separate comments from posts (or better yet, comments from content) by forcing them to a separate page "associated" with the content. So for example, `http://localhost/wp/2011/02/25/hello-world-2/` is a post, and the comments for that post should appear at `http://localhost/wp/2011/02/25/hello-world-2/comments/`. Now, a "little bird" once said that this could be done with the following: `RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comments/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&comments=1 [QSA,L]` (seeing as I do not really need to work inside the /archives/ for my above example to work, I removed it), which I translated into this plugin:               <?php     /*     Plugin Name: Gingah Permalink Rewrite     Plugin URI: http://gingahmail.com/wordpress/     Description: Useful Permalink-structures, that required a plugin to work.     Version: 1.0     Author: Gingah     Author URI: http://gingahmail.com/     */          register_activation_hook( __FILE__, 'gingah_rewrite_activate' );     function gingah_rewrite_activate() {         gingah_rewrite();         flush_rewrite_rules();     }     register_deactivation_hook( __FILE__, 'gingah_rewrite_deactivate' );     function gingah_rewrite_deactivate() {         flush_rewrite_rules();     }     add_action('admin_init', 'gingah_rewrite');     function gingah_rewrite() {         add_rewrite_rule( '^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comments/?$', '/index.php?year=$1&monthnum=$2&day=$3&name=$4&comments=1 [QSA,L]', 'top' );     }     ?>      (based on countless examples _just_ like it, around the web) This does, however, not work. Even though, visiting `http://localhost/wp/2011/02/25/hello-world-2/?comments=1` does produce the expected result. So what is going wrong here?


title: How to add drag and drop functionalities to a div inside option panel

text:
Hi to all it's a few days that I'm trying to add some new functions to my theme option-panel, you can see my questions here:   * How to add an export function to a custom Option Theme Page   * Add a preview to a Wordpress Control Panel   * Modify CSS via Theme Control Panel What's wrong with it? I'm trying to add a live preview of some modification BEFORE saving them but...I'm not able to add it...I'm almost a completely newbie in JS, I know a little PHP, enough CSS and HTML so here are the reasons of my questions... Anyway my new idea is to add the possibility to DRAG & DROP some DIVs, place them on a map, save their position and show them inside my website. I try to explain it better. Actually in my option-panel I have 10 functions: zona1, zona2, zona3 ..... with 4 values:   * zona1c = checkbox to choose if you want to show it or not   * zona1x = X Axys position (it changes LEFT CSS ATTRIBUTE)   * zona1y = X Axys position (it changes BOTTOM CSS ATTRIBUTE)   * zona1l = user have to write the URL of the post linked to this point Everything is working so if I write a value inside zona1x and zona1c is set to TRUE it shows the div in my website. But I would like to improve this because sometimes I make mistakes so I don't want to go "live" before everything is good. What I would like you to teach me is how to add a preview of that page then if zona1c is set to true I want to be able to move this DIV inside the preview (that is visible in my admin-panel) choose the right position, drop it and SAVE. Is there any easy or STEP BY STEP (Please, I would like to learn something new) solution for my problem? Thank you very much to all! Let's start with the code: This is my Functions.php : http://pastebin.com/8cVmne1s This is my admin-panel.php: http://pastebin.com/xX8G4Zxr or:               <?php     /** Declare the themename and shortname -- Ecco il nome del template e la sua abbreviazione **/     $themename = "Appartamenti Acquario";          $shortname = "appaqua";     /** Set the array with all the theme options -- Impostiamo l'array con tutte le opzioni del tema **/          $options = array (          array(          "desc" => "
IMPOSTAZIONI GENERALI
",     "type" => "title"),     array( "name" => "Prima di cominciare",         "type" => "section"),     array( "type" => "open"),     array( "name" => "Link pagina mappa",         "desc" => "Inserisci il link alla pagina della mappa",         "id" => $shortname."_pama",         "type" => "text",         "std" => " "),     array( "type" => "close"),     array( "name" => "General",         "type" => "section"),     array( "type" => "open"),     array( "name" => "Logo URL",         "desc" => "Inserisci il link all'immagine del tuo logo",         "id" => $shortname."_logo",         "type" => "text",         "std" => " "),       array( "type" => "close"),     array( "name" => "Homepage",         "type" => "section"),     array( "type" => "open"),     array( "name" => "Homepage Immagine Slide 1",         "desc" => "Inserisci il link alla prima immagine degli slide",         "id" => $shortname."_header_img",         "type" => "text",         "std" => "http://nextube.info/images/ImmijQuery/image-1.jpg"),     array( "name" => "Homepage Immagine Slide 2",         "desc" => "Inserisci il link alla seconda immagine degli slide",         "id" => $shortname."_header_img2",         "type" => "text",         "std" => "http://nextube.info/images/ImmijQuery/image-2.jpg"),     array( "name" => "Homepage Immagine Slide 3",         "desc" => "Inserisci il link alla terza immagine degli slide",         "id" => $shortname."_header_img3",         "type" => "text",         "std" => "http://nextube.info/images/ImmijQuery/image-3.jpg"),     array( "name" => "Homepage Immagine Slide 4",         "desc" => "Inserisci il link alla quarta immagine degli slide",         "id" => $shortname."_header_img4",         "type" => "text",         "std" => "http://nextube.info/images/ImmijQuery/image-4.jpg"),     array( "name" => "Homepage Immagine Slide 5",         "desc" => "Inserisci il link alla quinta immagine degli slide",         "id" => $shortname."_header_img5",         "type" => "text",         "std" => "http://nextube.info/images/ImmijQuery/image-5.jpg"),     array( "name" => "Homepage Immagine Slide 6",         "desc" => "Inserisci il link alla sesta immagine degli slide",         "id" => $shortname."_header_img6",         "type" => "text",         "std" => "http://nextube.info/images/ImmijQuery/image-6.jpg"),     array( "type" => "close"),     array( "name" => "Footer",         "type" => "section"),     array( "type" => "open"),     array( "name" => "Google Analytics Code",         "desc" => "Inserisci il tuo codice Google Analytics per tracciare le visite che ricevi.",         "id" => $shortname."_ga_code",         "type" => "textarea",         "std" => ""),     array( "type" => "close"),     array( "name" => "Social",         "type" => "section"),     array( "type" => "open"),     array( "name" => "Indirizzo Feed",         "desc" => "Feedburner è un sistema fornito da Google per ottimizzare la distribuzione dei tuoi feed, inserisci qui il link al tuo feed",         "id" => $shortname."_feedburner",         "type" => "text",         "std" => get_bloginfo('rss2_url')),     array( "name" => "Facebook URL",         "desc" => "Inserisci il link alla tua pagina Facebook",         "id" => $shortname."_facebook",         "type" => "text",         "std" => "http://facebook.com/pages/Downloadtaky/325661998362"),     array( "name" => "Twitter URL",         "desc" => "Inserisci il link al tuo account Twitter",         "id" => $shortname."_twitter",         "type" => "text",         "std" => "http://twitter.com/downloadtaky"),     array( "type" => "close"),     array( "name" => "Punti sulla mappa",         "type" => "section"),     array( "type" => "open"),     /** Copia da qui per aggiungere un nuovo punto - start copy to add a new point on the map **/     array( "name" => "Zona 1",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 1?",             "desc" => "Seleziona se vuoi il primo fermaposto",             "id" => $shortname."_zona1c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 1 Nome",         "desc" => "Inserisci il nome del primo appartamento",         "id" => $shortname."_zona1n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 1 Asse x",         "desc" => "Scegli dove posizionare il primo punto, se attivato asse x",         "id" => $shortname."_zona1x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 1 Asse y",         "desc" => "Scegli dove posizionare il primo punto, se attivato asse y",         "id" => $shortname."_zona1y",         "type" => "text",         "std" => "Top:???"),     array( "name" => "Zona 1 URL",         "desc" => "Inserisci il link al post della zona 1",         "id" => $shortname."_zona1l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     /** Copia fino a qui e rinomina progressivamente in zona2, zona3, zona4 ecc -- Copy from here to add a new zone like zone3, zone 4 and so on**/     array( "name" => "Zona 2",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 2?",             "desc" => "Seleziona se vuoi il secondo fermaposto",             "id" => $shortname."_zona2c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 2 Nome",         "desc" => "Inserisci il nome del secondo appartamento",         "id" => $shortname."_zona2n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 2 Asse x",         "desc" => "Scegli dove posizionare il secondo punto, se attivato asse x",         "id" => $shortname."_zona2x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 2 Asse y",         "desc" => "Scegli dove posizionare il secondo punto, se attivato asse y",         "id" => $shortname."_zona2y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 2 URL",         "desc" => "Inserisci il link al post della zona 2",         "id" => $shortname."_zona2l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 3",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 3?",             "desc" => "Seleziona se vuoi il terzo fermaposto",             "id" => $shortname."_zona3c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 3 Nome",         "desc" => "Inserisci il nome del terzo appartamento",         "id" => $shortname."_zona3n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 3 Asse x",         "desc" => "Scegli dove posizionare il terzo punto, se attivato asse x",         "id" => $shortname."_zona3x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 3 Asse y",         "desc" => "Scegli dove posizionare il terzo punto, se attivato asse y",         "id" => $shortname."_zona3y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 3 URL",         "desc" => "Inserisci il link al post della zona 3",         "id" => $shortname."_zona3l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 4",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 4?",             "desc" => "Seleziona se vuoi il quarto fermaposto",             "id" => $shortname."_zona4c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 4 Nome",         "desc" => "Inserisci il nome del quarto appartamento",         "id" => $shortname."_zona4n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 4 Asse x",         "desc" => "Scegli dove posizionare il quarto punto, se attivato asse x",         "id" => $shortname."_zona4x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 4 Asse y",         "desc" => "Scegli dove posizionare il quarto punto, se attivato asse y",         "id" => $shortname."_zona4y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 4 URL",         "desc" => "Inserisci il link al post della zona 4",         "id" => $shortname."_zona4l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 5",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 5?",             "desc" => "Seleziona se vuoi il quinto fermaposto",             "id" => $shortname."_zona5c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 5 Nome",         "desc" => "Inserisci il nome del quinto appartamento",         "id" => $shortname."_zona5n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 5 Asse x",         "desc" => "Scegli dove posizionare il quinto punto, se attivato asse x",         "id" => $shortname."_zona5x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 5 Asse y",         "desc" => "Scegli dove posizionare il quinto punto, se attivato asse y",         "id" => $shortname."_zona5y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 5 URL",         "desc" => "Inserisci il link al post della zona 5",         "id" => $shortname."_zona5l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 6",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 6?",             "desc" => "Seleziona se vuoi il sesto fermaposto",             "id" => $shortname."_zona6c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 6 Nome",         "desc" => "Inserisci il nome del sesto appartamento",         "id" => $shortname."_zona6n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 6 Asse x",         "desc" => "Scegli dove posizionare il sesto punto, se attivato asse x",         "id" => $shortname."_zona6x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 6 Asse y",         "desc" => "Scegli dove posizionare il sesto punto, se attivato asse y",         "id" => $shortname."_zona6y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 6 URL",         "desc" => "Inserisci il link al post della zona 6",         "id" => $shortname."_zona6l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 7",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 7?",             "desc" => "Seleziona se vuoi il settimo fermaposto",             "id" => $shortname."_zona7c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 7 Nome",         "desc" => "Inserisci il nome del settimo appartamento",         "id" => $shortname."_zona7n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 7 Asse x",         "desc" => "Scegli dove posizionare il settimo punto, se attivato asse x",         "id" => $shortname."_zona7x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 7 Asse y",         "desc" => "Scegli dove posizionare il settimo punto, se attivato asse y",         "id" => $shortname."_zona7y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 7 URL",         "desc" => "Inserisci il link al post della zona 7",         "id" => $shortname."_zona7l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 8",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 8?",             "desc" => "Seleziona se vuoi l/'ottavo fermaposto",             "id" => $shortname."_zona8c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 8 Nome",         "desc" => "Inserisci il nome dell/'ottavo appartamento",         "id" => $shortname."_zona8n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 8 Asse x",         "desc" => "Scegli dove posizionare l/'ottavo punto, se attivato asse x",         "id" => $shortname."_zona8x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 8 Asse y",         "desc" => "Scegli dove posizionare l/' ottavo punto, se attivato asse y",         "id" => $shortname."_zona8y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 8 URL",         "desc" => "Inserisci il link al post della zona 8",         "id" => $shortname."_zona8l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 9",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 9?",             "desc" => "Seleziona se vuoi il nono fermaposto",             "id" => $shortname."_zona9c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 9 Nome",         "desc" => "Inserisci il nome del nono appartamento",         "id" => $shortname."_zona9n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 9 Asse x",         "desc" => "Scegli dove posizionare il nono punto, se attivato asse x",         "id" => $shortname."_zona9x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 9 Asse y",         "desc" => "Scegli dove posizionare il nono punto, se attivato asse y",         "id" => $shortname."_zona9y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 9 URL",         "desc" => "Inserisci il link al post della zona 9",         "id" => $shortname."_zona9l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "name" => "Zona 10",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Attivare zona 10?",             "desc" => "Seleziona se vuoi il decimo fermaposto",             "id" => $shortname."_zona10c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 10 Nome",         "desc" => "Inserisci il nome del decimo appartamento",         "id" => $shortname."_zona10n",         "type" => "text",         "std" => "Nome dell'appartamento"),     array( "name" => "Zona 10 Asse x",         "desc" => "Scegli dove posizionare il decimo punto, se attivato asse x",         "id" => $shortname."_zona10x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 10 Asse y",         "desc" => "Scegli dove posizionare il decimo punto, se attivato asse y",         "id" => $shortname."_zona10y",         "type" => "text",         "std" => "Top:???"),         array( "name" => "Zona 10 URL",         "desc" => "Inserisci il link al post della zona 10",         "id" => $shortname."_zona10l",         "type" => "text",         "std" => "Indirizzo del post qui"),     array( "type" => "close"),     array( "type" => "close"),     );          function appaqua_add_admin() {          global $themename, $shortname, $options;          if ( $_GET['page'] == basename(__FILE__) ) {              if ( 'save' == $_REQUEST['action'] ) {                  foreach ($options as $value) {             update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }          foreach ($options as $value) {         if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }              header("Location: admin.php?page=admin-panel.php&saved=true");     die;          }      else if( 'reset' == $_REQUEST['action'] ) {              foreach ($options as $value) {             delete_option( $value['id'] ); }              header("Location: admin.php?page=admin-panel.php&reset=true");     die;          }     }          add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'appaqua_admin');     }          function appaqua_add_init() {     $file_dir=get_bloginfo('template_directory');     wp_enqueue_style("functions", $file_dir."/includes/css/functions.css", false, "1.0", "all");     wp_enqueue_script("rm_script", $file_dir."/includes/js/rm_script.js", false, "1.0");     wp_enqueue_script("site_preview", $file_dir."/includes/js/preview.js", false, "1.0");     };          function appaqua_admin() {          global $themename, $shortname, $options;     $i=0;          if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

';     if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

';          ?>

<?php echo $themename; ?> Settings

     <form method="post">     <?php foreach ($options as $value) {     switch ( $value['type'] ) {          case "open":     ?>          <?php break;          case "close":     ?>

               <?php break;          case "title":     ?>
To easily use the <?php echo $themename;?> theme, you can use the menu below.
               <?php break;          case 'text':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'])  ); } else { echo $value['std']; } ?>" />      <?php echo $value['desc']; ?>

     <?php     break;          case 'textarea':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea>      <?php echo $value['desc']; ?>

          <?php     break;          case 'select':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>          <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">     <?php foreach ($value['options'] as $option) { ?>             <option <?php if (get_settings( $value['id'] ) == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>     </select>              <?php echo $value['desc']; ?>

     <?php     break;          case "checkbox":     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>          <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>     <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />                   <?php echo $value['desc']; ?>

     <?php break;      case "section":          $i++;          ?>

<img src="<?php bloginfo('template_directory')?>/includes/css/images/trans.png" class="inactive" alt="""><?php echo $value['name']; ?>
<input name="save<?php echo $i; ?>" type="submit" value="Save changes" />

     <?php break;     }     }     ?>     <input type="hidden" name="action" value="save" />     </form>     <form method="post">
     <input name="reset" type="submit" value="Reset" />     <input type="hidden" name="action" value="reset" />
     </form>
Icons: WooFunction

      <iframe id="themepreview" name="themepreview" src="<?php echo get_option('appaqua_pama'); ?>/?preview=1">     <?php     }     ?>     <?php     $nonce = wp_create_nonce('site_preview');     ?>     <?php     add_action('admin_init', 'appaqua_add_init');     add_action('admin_menu', 'appaqua_add_admin');     ?>      This is the css stylesheet of the divs I would like to move with DRAG & DROP **(only in backend** ): http://pastebin.com/pih7yaT1 or:               <?php define('WP_USE_THEMES', true);     require('./wp-blog-header.php');?>     .mappa{width:960px;height:394px;background:url(<?php bloginfo(template_url);?>/mappa/images/mappa.png);margin:0 auto;}     #zona1{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona1x');?>px;left:<?php echo get_option('appaqua_zona1y');?>px;}     #zona2{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona2x');?>px;left:<?php echo get_option('appaqua_zona2y');?>px;}     #zona3{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona3x');?>px;left:<?php echo get_option('appaqua_zona3y');?>px;}     #zona4{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona4x');?>px;left:<?php echo get_option('appaqua_zona4y');?>px;}     #zona5{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona5x');?>px;left:<?php echo get_option('appaqua_zona5y');?>px;}     #zona6{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona6x');?>px;left:<?php echo get_option('appaqua_zona6y');?>px;}     #zona7{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona7x');?>px;left:<?php echo get_option('appaqua_zona7y');?>px;}     #zona8{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona8x');?>px;left:<?php echo get_option('appaqua_zona8y');?>px;}     #zona9{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona9x');?>px;left:<?php echo get_option('appaqua_zona9y');?>px;}     #zona10{width:27px;height:27px;background:#000;z-index:10000;position:relative;top:<?php echo get_option('appaqua_zona10x');?>px;left:<?php echo get_option('appaqua_zona10y');?>px;}      I hope that someone can help me and please, if you need more info just ask... Thank you very much to all!


title: How do I add version control to my workflow?

text: I develop themes, lots of them. I am given a PSD, code up the HTML/CSS, slap the code into Wordpress, and make corrections as they get QC'd. Once live, clients can edit blog posts like normal or upload photos using a custom plugin. Sometimes I have to make changes to the theme or to the page/post content, which means I either make them live or have to download and setup the site to a development environment to be approved by the client. I have no backup, I have no version control, and I realize this needs to change. Git and Mercurial have been suggested, and I would like to take advantage of these tools, but I am confused about how to fit them into a workflow. Do I require all changes to a site on a development server and then push them live once approved? What about writing blog posts? Seems like overkill to write posts on dev and push the changes live, but then how do I sync the databases if they are edited on the live site? I have scoured the internet. Some guidance would be appreciated.


title: Detect if a plugin was included in a certain page

text: I´m developing a theme that include plugins. One of this plugins is a contact form. And this plugin have an asociate code to validate input data. Because I don´t know in what pages contact form was been added... I want to find a right way to detect if a plugin is included in a current page. Sample: page.php               <?php get_header(); ?>          <?php if( is contact form included ) : ?>         //include php form valdiation...     <?php endif; ?>          //page content code ...          <?php get_footer(); ?>      **Note** : I don´t want to check if a plugin is activated. The plugin is included with theme, therefore is active. I want to detect if is current using for example in page.php. The issue should be include php form validation only when page include contact form. Any suggestion or advice are welcome :) Thanks.


title: My new Wordpress theme based on the TwentyEleven theme doesn't display the front page OR the blog page

text:
I copied TwentyEleven and used all its resources to start, I've done all the steps, added my own widgets, menus, css, js and all but I'm stuck with this issue: I set the front page to be static and set a page for it (it has content in it), also set a blank page for the blog posts. The theme just shows the pages as blank for both in all situations unless I specify a wrong file name in which it will show the 'Not found' text. I'm sure I'm doing something horribly wrong, but what? Here's the part that loads the content in index.php:                           <?php /* Start the Loop */ ?>                 <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', get_post_format() ); ?>                      <?php endwhile; ?>                  <?php else : ?>

<?php _e( 'Nothing Found', 'twentyeleven' ); ?>

<?php _e( 'Page not found.', 'twentyeleven' ); ?>

                  <?php endif; ?>


title: pagination hook doesn't work with search results

text: I use my custom **Pagination function** on my web site;               #Pagination          function pagination($prev = '«', $next = '»') {             global $wp_query, $wp_rewrite;                 $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;                 $pagination = array(                     'base' => @add_query_arg('paged','%#%'),                     'format' => '',                     'total' => $wp_query->max_num_pages,                     'current' => $current,                     'prev_text' => __($prev),                     'next_text' => __($next),                     'type' => 'plain'                 );             if( $wp_rewrite->using_permalinks() )             $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'sayfa/%#%/', 'paged' );                     if( !empty($wp_query->query_vars['s']) )                         $pagination['add_args'] = array( 's' => get_query_var( 's' ) );                          echo paginate_links( $pagination );             };      Also i use **search by title custom hook** ;               #Search Just in Title.     function __search_by_title_only( $search, &$wp_query ) {         global $wpdb;              if ( empty( $search ) )             return $search; // skip processing - no search term in query              $q = $wp_query->query_vars;             $n = ! empty( $q['exact'] ) ? '' : '%';              $search =         $searchand = '';              foreach ( (array) $q['search_terms'] as $term ) {             $term = esc_sql( like_escape( $term ) );             $search .= "{$searchand}($wpdb->posts.post_title LIKE '{$n}{$term}{$n}')";             $searchand = ' AND ';         }              if ( ! empty( $search ) ) {             $search = " AND ({$search}) ";             if ( ! is_user_logged_in() )                 $search .= " AND ($wpdb->posts.post_password = '') ";         }              return $search;     }     add_filter( 'posts_search', '__search_by_title_only', 500, 2 );      But whenever you call **search results page** ; For example "wordpress tema" _(search results for wordpress tema)_ the pagination hook doesn't work. Please check the link also you can find some functions on SE here, for search results page . I think problem is about my second hook: What is wrong with this ? **_What should we do?_** Thanks any help.


title: Twenty Eleven header resize

text: I seem to have a problem customizing the Twenty Eleven theme. I would like that the top header above the header image to have a background color that goes from side to side in the window. Found out that the problem may come from max-width set to 1000px, but could not find where to put it so it doesn't mess up the theme elsewhere. How can I achieve to have a color on the top of the page (ex. like facebook top blue header) that has the width of the browser?


title: Wordpress API Menu/Submenu Order

text: I'm developing a child-theme using _Wordpress 3.4.2_ and the development version of the _Options Framework_ by _David Price_. This is my first theme and I'm relatively new to this, so I've had a look into the _Wordpress Codex_ and checked out registering items into the API. Without tampering with any external files outside of my theme, I was wondering if there was a way to re-arrange where the _Theme Options_ page is located within the hierarchy of the _Appearance_ menu - so when my theme is activated, the position is not like the first image but like the second. ![old](http://i.stack.imgur.com/AEZMG.jpg)![new](http://i.stack.imgur.com/prXjj.jpg) I know you can create either a menu (such as the _Appearance_ tab, _Plugins_ , _Users_ etc.) or a sub-menu ( _Themes_ , _Widgets_ , _Menus_ etc.), but how would I go about setting a sub-menu say, second from the top? From what I gather, somewhere there is an order being called and any other additional pages within the `functions.php` file are placed after those? In my functions.php file:               // Add our "Theme Options" page to the Wordpress API admin menu.     if ( !function_exists( 'optionsframework_init' ) ) {         define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' );         require_once dirname( __FILE__ ) . '/inc/options-framework.php';     }      Thanks.


title: How to pass custom field value to shortcode?

text: I want to call custom field in `single.php` template to complete a short code and thus show a menu. I places the below code but it is not working               <?php echo do_shortcode("[custommenu menu=<?php echo get_post_meta($post->ID, ‘tabmenu’, true); ?>]?>")


title: PHP form is not sending mail if I use mime type and version in header. How to solve this?

text:
If I use the following code, then the form works fine and I am getting form submissions to my email.               <?php          if($_POST["submit"]) {         $recipient="meemail@gmail.com";         $subject="New request";         $headers  = 'MIME-Version: 1.0' . "\r\n";         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";         $sender=$_POST["sendername"];         $senderEmail=$_POST["senderEmail"];         $message=$_POST["message"];         $name_title=$_POST["name_title"];                 $mailBody = "Name: $name_title $sender\n                      Email: $senderEmail\n\n                      Message: $message";              $mail_sent = mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");     }          if ($mail_sent) {     ?>
Mail sent
     <?php } ?>      If I change the `$mail_sent = mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");` **TO** `$mail_sent = mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>", $headers);`, then the form stops working. What is the issue?


title: WordPress trims an encrypted field

text: Problem is that when I try to insert a new post into WordPress, the password (encrypted, see code below) is cut. For example: encrypted `Ivt9=f:;itKun+TiIarze-GyX5Rt` is only `Ivt` in WordPress.               add_action( 'eb_register_user', 'eb_register_user_callback' );     function eb_register_user_callback() {            $posts = $_POST;       $esc_posts = array_map( 'esc_post', $posts );       extract( $esc_posts, EXTR_PREFIX_ALL, 'eb' );                 $new_customer = wp_insert_post( array(         'post_title' => $eb_f_name . ' ' . $eb_surname . ', ' . $eb_city,         'post_status' => 'publish',         'post_type' => 'customer'       ) );            update_post_meta( $new_customer, 'type', $eb_type );       update_post_meta( $new_customer, 'company_name', $eb_company_name );       update_post_meta( $new_customer, 'company_nip', $eb_company_nip );            update_post_meta( $new_customer, 'f_name', $eb_f_name );       update_post_meta( $new_customer, 'surname', $eb_surname );            update_post_meta( $new_customer, 'street', $eb_street );       update_post_meta( $new_customer, 'city', $eb_city );       update_post_meta( $new_customer, 'email', $eb_email );       update_post_meta( $new_customer, 'phone', $eb_phone );            update_post_meta( $new_customer, 'uuid', get_uuid( $new_customer ) );            require_once 'classes/crypt.class.php';       $cryptastic = new cryptastic;       $key = $cryptastic->pbkdf2( 'SOME!$#pass', 'SOME!$#salt', 1000, 32 );       $encrypted = $cryptastic->encrypt( $_POST['password'], $key );       update_post_meta( $new_customer, 'password', $encrypted );            wp_redirect( home_url() . '?ep = ' . $encrypted );     }      When redirected to home url, `ep` GET parameter contains correctly encrypted password, but meta field not. Any idea?


title: how to display the repeatable meta field value in front end?

text:
I would like to display my all meta field value in template file but i have no idea on displaying repeatable meta field value would anybody please help me.. My code is ..               <?php     /**      * Plugin Name: (SO) Repeatable fields demo      * Plugin URI:  http://stackoverflow.com/a/14452453/1287812      * Description: How to make repeatable fields in a meta box      * Author:      brasofilo      * License:     GPLv3      */          add_action( 'admin_init', 'add_post_gallery_so_14445904' );     add_action( 'admin_head-post.php', 'print_scripts_so_14445904' );     add_action( 'admin_head-post-new.php', 'print_scripts_so_14445904' );     add_action( 'save_post', 'update_post_gallery_so_14445904', 10, 2 );          /**      * Add custom Meta Box to Posts post type      */     function add_post_gallery_so_14445904()      {         add_meta_box(             'post_gallery',             'Custom Uploader',             'post_gallery_options_so_14445904',             'post',             'normal',             'core'         );     }          /**      * Print the Meta Box content      */     function post_gallery_options_so_14445904()      {         global $post;         $gallery_data = get_post_meta( $post->ID, 'gallery_data', true );              // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'noncename_so_14445904' );     ?>

         <?php          if ( isset( $gallery_data['image_url'] ) )          {             for( $i = 0; $i < count( $gallery_data['image_url'] ); $i++ )              {             ?>

                   Image URL                   <input type="text"                          class="meta_image_url"                          name="gallery[image_url][]"                          value="<?php esc_html_e( $gallery_data['image_url'][$i] ); ?>"                   />

                   Description                   <input type="text"                          class="meta_image_desc"                          name="gallery[image_desc][]"                          value="<?php esc_html_e( $gallery_data['image_desc'][$i] ); ?>"                   />

                 <img src="<?php esc_html_e( $gallery_data['image_url'][$i] ); ?>" height="48" width="48" />

                 <input class="button" type="button" value="Choose File" onclick="add_image(this)" />
                 <input class="button" type="button" value="Remove" onclick="remove_field(this)" />

             <?php             } // endif         } // endforeach         ?>

                     Image URL                     <input class="meta_image_url" value="" type="text" name="gallery[image_url][]" />

                     Image Link                     <input class="meta_image_desc" value="" type="text" name="gallery[image_desc][]" />

                  <input type="button" class="button" value="Choose File" onclick="add_image(this)" />
                 <input class="button" type="button" value="Remove" onclick="remove_field(this)" />

           <input class="button" type="button" value="Add Field" onclick="add_field_row();" />

            <?php     }          /**      * Print styles and scripts      */     function print_scripts_so_14445904()     {         // Check for correct post_type         global $post;         if( 'post' != $post->post_type )             return;         ?>                                  <?php     }          /**      * Save post action, process fields      */     function update_post_gallery_so_14445904( $post_id, $post_object )      {         // Doing revision, exit earlier **can be removed**         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )               return;              // Doing revision, exit earlier         if ( 'revision' == $post_object->post_type )             return;              // Verify authenticity         if ( !wp_verify_nonce( $_POST['noncename_so_14445904'], plugin_basename( __FILE__ ) ) )             return;              // Correct post type         if ( 'post' != $_POST['post_type'] )              return;              if ( $_POST['gallery'] )          {             // Build array for saving post meta             $gallery_data = array();             for ($i = 0; $i < count( $_POST['gallery']['image_url'] ); $i++ )              {                 if ( '' != $_POST['gallery']['image_url'][ $i ] )                  {                     $gallery_data['image_url'][]  = $_POST['gallery']['image_url'][ $i ];                     $gallery_data['image_desc'][] = $_POST['gallery']['image_desc'][ $i ];                 }             }                  if ( $gallery_data )                  update_post_meta( $post_id, 'gallery_data', $gallery_data );             else                  delete_post_meta( $post_id, 'gallery_data' );         }          // Nothing received, all fields are empty, delete option         else          {             delete_post_meta( $post_id, 'gallery_data' );         }     }      Thank you in advance.


title: Exporting a portfolio with pictures

text: I wonder if a kind soul could help, as I'm going crazy here. I just recently started using Wordpress, and created a website where I have a lot of portfolios. The images in the portfolios have been fully SEO optimized with tags, etc. So this is my question: I have created another website where I want to use some of the portfolios from the first website, but the thought of importing all the images and optimizing them again is putting me off, so is there a way to export the portfolios from the first website to the new one with the pictures included? I used the Wordpess export tool, but the .xml file has no pictures on it; it did import the portfolio, but without any pictures. Kind Regards Jorge


title: Display pages in alphabetical order

text: I think I am missing something in my `functions.php` because my pages in the admin are displayed randomly. How can you display the pages in admin alphabetically? Thanks!


title: Wordpress special characters coming in ascii code

text: The article title on this website is `"Meet Youngest Art Director of Pakistan – Babrus Khan"` The special character in the title is not encoded back when retrieved from Database and Hence I can see in Html code, the title is `"Meet Youngest Art Director of Pakistan – Babrus Khan"` When shared on Social Media the ASCII codes appear rather than the special characters. How can I solve this problem?


title: How to trap "Publish" button to check for meta box validation?

text: I'm trying to do some form validation on my custom meta box, and I remember somewhere reading about some javascript function to disable/enable the Publish button - except I can't find it. How do I either a) enable/disable the publish button or, b) when Publish is clicked, trap it and prevent the update and alert the user, but in such a way that it can be updated later I've tried just a simple click handler with e.preventDefault() and e.stopPropagation however the swily icon comes up and the button stays disabled because it never finishes Thanks


title: bbpress plugin moderation

text: I am using the bbpress wordpress plugin for the first time and I can't see any settings for moderation. Does bbpress have moderation built in? I did a search for any moderation plugins but only found one for the standalone version. Is there a way to enable moderation?


title: Premium Members Section of website

text: Have used emember in the past and looked at Tadlock's membership as well as another premium offering by jigowatt. However, I don't want to just hide the post's content.... I want to hide the entire post... and entire categories/taxonomies. I'd like the menu to show "Products" and when you visit that particular page you are prompted to log in to view it. Logging it would also "unlock"/reveal sections of the site that weren't previously visible. For instance, the menu might now have widgets and gizmos underneath the main "products". to me this seems different than what the plugins i mentioned before can handle. is there a plugin that does this or am i looking at creating my own?


title: Admin area for user, custom theme or admin theme?

text: In my WordPress site, I need to provide some backend functions for logged in user, so currently I have two choices   1. use the wp-admin, customize the menu by hiding irrelevant items   2. create a custom theme (for the backend), and switch the user theme from public theme to this customized backend theme when they visit the url, say `/admin/*` The advantage for the (1) is I can re-use the existing functions such as menu, dashboard, topbar, post type / taxonomy CRUD, wordpress settings functions etc. But to customize the wp-admin is quite difficult and might break when WordPress is upgraded in the future. For (2), it is more easy, but more code need to be written, e.g. need to re- implement the CRUD for basic post type / taxonomy etc. Are there any better suggestions for my requirement besides the above?


title: Renaming wp-admin without hard-coding it. Is it really possible?

text: I would like to rename my wp-admin folder due to some security concerns. Is it really possible? **The less it looks/is built like default WP, the harder it is to attack known vulnerabilities. Being able to rename those directories can help stop an exploit dead in its tracks.** Otto mentioned in this thread its possible using "admin_url" filter. Is it really possible? If yes can someone give me some sample code. I hope this is a useful question


title: Wordpress Jquery Confliction with Plugin

text: Hey guys, thanks in advance for your help. I've done my research and I'm a bit stumped with this... I'm building a Wordpress website for a client and it is going to have an e-store. I'm using wp-ecommerce. All of the store pages are loading with a javascript error: http://www.thecollectiveclothingco.com/products-page/t-shirts/               jQuery("form.product_form").livequery is not a function     [Break On This Error] jQuery("form.product_form").livequery(function(){       After some extensive google-age, I believe I've diagnosed the issue as a script conflict. In other words, either WP or the plugin itself is serving up jquery, and I'm also including it for some other things on the site. When I delete my jquery script call, the issue goes away and the store works fine. But I need that jquery... I've read about using WP enqeue to fix the issue:               function my_init_method() {         if (!is_admin()) {             wp_deregister_script( 'jquery' );             wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');             wp_enqueue_script( 'jquery' );         }     }         add_action('init', 'my_init_method');php wp_head();       I believe I've done this right, but does not seem to be fixing anything. Any ideas? Thanks again. ## EDIT: Alright, I figured it out... it was the enqueue script that fixed things. I wp(head); had to come before the deregister and enqueue part. I must have read the documentation wrong. Here's what I added to my header:               <?php     wp_head();     wp_deregister_script('jquery');     wp_enqueue_script('jquery', MYURL .'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', FALSE, '1.4.4');      ?>


title: Site not getting correct featured image from my query

text:
On the home page of my site I have a series of tiles that link to various parts of the site. One tile links to the blog and I have written some code to pull the latest post with an image attached to it and output it along with the post title. Here is the code from the theme file:               $z=0; //sets post counter     query_posts(array(  'meta_key' => '_thumbnail_id'  )); ?>     <?php if(have_posts()) : ?>     <?php while(have_posts() && $z<1) : the_post();                //Call a post image attachment         $args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $post->ID );          $attachments = get_posts($args);              if ($attachments) {                  foreach ( $attachments as $attachment ) {             $image = wp_get_attachment_image_src($attachment->ID,'homethumbs');      ?>     <a href="<?php echo get_posts_page_url(); ?>" title="Visit the Serge Blog" id="homelink3" class="top_homelink"><img src="<?php echo $image[0]; ?>" width="308" height="308" id="home-blogthumb" class="side-homethumb wp-post-image" />
Blog
Latest Post: <?php the_title(); ?>
        <?php $z++;     }     //$usedthumbnails[] = get_the_post_thumbnail();      }     ?>     <?php        endwhile;      endif;      wp_reset_query(); ?>      I realise that this code doesn't in fact get the featured image but instead gets 1 image that is attached to a post. This is because the blog posters sometimes forgot to "set as featured image" but any pic uploaded to the post was attached automatically. With 3.5 it now seems that featured images are not necessarily attached to the posts so will be missed by the above code. What's the best approach to solve this? Perhaps by only calling the latest featured image... I can just make sure post writers add a featured image to their posts. The site is http://sergedenimes.com **EDIT:** Here is my renewed code:               <?php     global $post;     $args = array( 'numberposts' => 1, 'meta_key' => '_thumbnail_id' );     $myposts = get_posts( $args );          foreach( $myposts as $post ) :  setup_postdata($post);      $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'homethumbs' );     ?>          <a href="<?php echo get_posts_page_url(); ?>" title="Visit the Serge Blog" id="homelink3" class="top_homelink"><img src="<?php echo $thumb[0]; ?>" width="308" height="308" id="home-blogthumb" class="side-homethumb wp-post-image" />
Blog
Latest Post: <?php the_title(); ?>
           <?php endforeach; ?>      What I want to make sure is that say I posted a new post but didn't give it a featured image, would the above query just ignore it and output the last post that _does_ have a featured image? I'm hoping that the `'meta_key' => '_thumbnail_id'` arguement should do this. If I am wrong I would expect that no url of the attachment would be got and the tile on the home page would just be blank (no image).


title: Strip the folder path away from wp_get_attachment_url to show filename only

text: I'm using a function to display all files attached to a post and listing them as links. The result is something like this:               echo 'ID) .                '" class="dir-attachment" />' . wp_get_attachment_url($attachmentImage->ID) . '';      As expected, this display a hyperlinked version of the hyperlink, but I'd like to clean it up. Is there some way to strip the http://mydomain/wp- content/uploads from the second instance display the file name only, rather than the full path?


title: I've got a theme I can't update and won't let go

text: I created a custom theme for a client a while back and then it sorta mysteriously broke several months later by reverting to an early version that had a few links to my website hard coded into it. I made the fixes but then discovered that no matter how I tried to make the changes - ftp'ing up the file, fixing from right within wordpress, etc. - wordpress just went right back to the version that was currently up there. I even added random text to check my theory and that wouldn't show up either. Yet, oddly enough, I could go into the theme editor in Wordpress and see the correct version of the file showing up. I finally decided to just switch to another theme, nuke that one and try to fix it and upload it again. Wordpress won't let me switch to another theme. I'll pick another theme and activate it, the website will completely stop showing up, and I'll go back to the Theme editor and the original theme will be appearing as the default theme. At this point, I'm a little afraid to remove the template. I'm wondering if this is some type of database issue. However, my client's control panel does not give her access to the database. Does anyone have any thoughts?


title: Two-way synchronizing of a post type among multisite blogs

text: Is it possible to two way sync a post type between multiple sites on a multisite install? For example if someone makes a change to an entry under post type "inventory" on Site A how can I make that reflect on Site B automatically and vice versa? I am thinking that there are two main possible way of doing this, neither of which I'm sure can easily be done. 1) A plugin hooks into the edit_post so when a change is made the plugin edits the sister entry in the other blog's database table. 2) Anytime Site B views or edits an "inventory" post type it is reading it from Site A's database table.


title: Bookshelf plugin and/or widget

text: I'm looking for some kind of plugin and/or widget to display a list of book covers in the sidebar. Are there any good options out there?


title: Row actions not showing? Why?

text:
I have constructed a `WP_List_Table` that displays on a custom theme page that I have built. I am having some trouble getting the row actions to display, despite me reviewing all the possible info on the Internet about WP_List_Table. Any help would be great!               class Testimonials_List_Table extends WP_List_Table {          function __construct() {         parent::__construct( array(         'singular'=> 'testimonial', //Singular label         'plural' => 'testimonials', //plural label, also this well be one of the table css class         'ajax' => false //We won't support Ajax for this table        ) );     }          function get_bulk_actions() {         $actions = array(         'delete' => 'Delete'         );         return $actions;     }          function process_bulk_action() {         if( 'delete'===$this->current_action() ) {         wp_die('Items deleted (or they would be if we had items to delete)!');        }       }          function get_columns() {     return $columns= array(         'cb' => '<input type="checkbox" />', //Render a checkbox instead of text         'name'=> 'Name',         'company_name'=> 'Company Name',         'company_url'=> 'Website URL',         'testimonials_quote'=> 'Testimonial'     );     }          function column_name($item){         $actions = array(             'edit'      => sprintf('Edit',$_REQUEST['page'],'edit',$item['ID']),             'delete'    => sprintf('Delete',$_REQUEST['page'],'delete',$item['ID']),         );              //Return the title contents         return sprintf('%1$s (id:%2$s)%3$s',             /*$1%s*/ $item['name'],             /*$2%s*/ $item['ID'],             /*$3%s*/ $this->row_actions($actions)         );     }                    function column_cb($item){         return sprintf(             '<input type="checkbox" name="%1$s[]" value="%2$s" />',             /*$1%s*/ $this->_args['singular'],  //Let's simply repurpose the table's singular label ("movie")             /*$2%s*/ $item['ID']                //The value of the checkbox should be the record's id         );     }          function prepare_items() {     global $wpdb, $_wp_column_headers;     $screen = get_current_screen();     $wpdb->show_errors();          $query = "SELECT * FROM wp_testimonials";      $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'ASC';     $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : '';         if(!empty($orderby) & !empty($order)){ $query.=' ORDER BY '.$orderby.' '.$order; }         $totalitems = $wpdb->query($query); //return the total number of affected rows         $perpage = 8;         $paged = !empty($_GET["paged"]) ? mysql_real_escape_string($_GET["paged"]) : '';         if(empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }         $totalpages = ceil($totalitems/$perpage);         if(!empty($paged) && !empty($perpage)){             $offset=($paged-1)*$perpage;             $query.=' LIMIT '.(int)$offset.','.(int)$perpage;         }     $this->set_pagination_args( array(         "total_items" => $totalitems,         "total_pages" => $totalpages,         "per_page" => $perpage,         ) );     $columns = $this->get_columns();         $hidden = array();         $sortable = $this->get_sortable_columns();         $this->_column_headers = array($columns, $hidden, $sortable);         $this->items = $wpdb->get_results($query);          }          function display_rows() {     $records = $this->items;     list( $columns, $hidden ) = $this->get_column_info();     if(!empty($records)){foreach($records as $rec){         echo '
name.'">';         foreach ( $columns as $column_name => $column_display_name ) {             $class = "class='$column_name column-$column_name'";             $style = "";             if ( in_array( $column_name, $hidden ) ) $style = ' style="display:none;"';             $attributes = $class . $style;                 $editlink  = '/test/wp-admin/themes.php?page=testimonials&tab=add_new_testimonial='.urlencode((int)$rec->id);             switch ( $column_name ) {                case "cb": echo '<input type="checkbox" />	';break;                case "id": echo ''.stripslashes($rec->id).'	';break;                case "name": echo ''.stripslashes($rec->name).'	'; break;                 case "company_name": echo ''.stripslashes($rec->company_name).'	'; break;                     case "company_url": echo ''.stripslashes($rec->company_url).'	'; break;                     case "testimonials_quote": echo ''.stripslashes($rec->testimonials_quote).'	'; break;             }         }         echo'
';         }}         }               } // End WP_List_Table class


title: Similar Posts - NO plugin

text: How can I make a similar posts section in my theme, but without using a plugin. I'm going to be giving my theme away for free, so I don't want to have to force people to install plugins to use my theme. How can it be done?


title: Give Children Unique ID's

text: Is there a way I can give each wordpress children (subcategory UL lists) unique ID's? I'm creating a dropdown list for subcategories and I want to position them but `:nth-child` isn't supported by everything yet.


title: Is there a way to backdate posts?

text: Is there a way to backdate posts on WordPress? The reason is that I am migrating content over from another site and want to keep their original publishing dates. * * * ## Edit The content is being migrated manually from a non-wordpress website


title: wp_schedule_event not working

text: I 'm going to create a sheduled update_post_meta and for some uknown reason the function is never fired. Below is the code:               add_action( 'save_post', 'scheduled_upm');          function scheduled_upm() {              wp_schedule_event( time(), 'hourly', 'do_this_every_hour');          }               add_action( 'do_this_every_hour','do_this_every_hour' );          function do_this_every_hour() {               update_post_meta('3197', 'meta_key', '8');               }      The normal (as far as I can understand), is that do_this_every_hour function, will run immediately and after this, it will run every hour. Am I wrong somewhere? Thanx in advance!