Loop with slider (slider not loading)

In my slider.php I have a loop that calls for a custom post type. That custom post type has a meta box for a slide url (link/title/etc). I can see the loop and everything else is working because in the source code it shows the corrent url from the meta box. But it will NOT load the slider. But lets say I drop a direct path to an image OUTSIDE the loop, the slider will work/load, and it will load the dynamic image from the metabox(as the second slide). It seems, and I know this is wrong, but its almost as if the image from the metabox is being loaded after the script for the slides. So it will not see that an image exists and will not execute the js code for slides. My head has the correct js function. My meta box and post type are wokring and saving. My home template which has include 'slider.php'. (below)

                <?php include 'slider.php'; ?>

       My slider.php which has                    <?php $args = array( 'post_type' => 'home_slider', 'posts_per_page' => 10 ); ?>     <?php $loop = new WP_Query( $args ); ?>
       <?php // query the "slider" custom post type and import its posts into the slider ?>       <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>            <?php $slide_img_src = smc_get_the_slide_img_source(); ?>              <img src="<?php echo $slide_img_src; ?>" class="max-image" width="" height="" alt="Slide 1">            <?php endwhile; ?>
           The slide.js file (the functions for slides) is also loading (obviously), and is being en-queued in the footer. Im racking my brain, and php is NOT my strong point. I feel like I just cant figure it out, or what to even search for. Thanks in advanced. Edit - If you need to see any more code, let me know. I dont know what else could be causing the problem.


the_post_thumbnail call removing li in code

Need some help here. I've been working on a widget to display a list of featured posts (custom post type) and want to display the featured image for each post so I was using the_post_thumbnail call with a custom thumbnail size included as the parameter and for some strange reason, the call is removing some of the HTML that is in my echo'd string output from the widget. Below is the line that I am calling:               echo '
'. the_post_thumbnail('talent-featured-thumb') .'
';      This is the HTML that is rendered:

      Any help?


Show category name, and last 5 post titles below category name?

Is there a function that will let me display a category title and the last 5 post titles from that category just below it? Is there a loop which can do this and list post titles of that category in an un ordered list with the category title just above outside the loop?


Get ID of the page where shortcode is included

I have a page with a shortcode that uses get_the_ID(). The shortcode displays custom fields from the current page. When I include that page within another page, get_the_ID() returns the ID of the second page, not the original page where the shortcode is. My question is: inside the shortcode, is there a way to get the ID of the page where the shortcode is included?


How to bypass 404 for certain pages/posts?

I have a site with urls like so: `site.com/folder/page-name` It is moving to another site built in wordpress and I am trying to recreate the page to ensure incoming links continue to work as normal. The posts are organised into different custom post types, but essentially they will display from the same page, so I have created a new page called `old_content.php` and I want to use this to display content from incoming links. I have created the page in wordpress using `old_content.php` as the template. When I load `site.com/folder/`, I can correctly see my `old_content.php` file. In `old_content.php`, I will `wp_query` the data for the page using the third url segment, e.g. `site.com/folder/my-page-name`. As soon as I add `my-page- name`, it 404's. How do I stop it from 404'ing so I can query the db and display the content?


Getting jQuery AJAX to work in Wordpress (getting -1)

I am trying to figure out how to use jQuery `$.ajax()` for a project. I setup this test using what I learned from TutsPlus.com. Everything seems to be working correctly except I am getting a `-1` returned. So I get an alert with `Success: -1` and `#test-div1` is populated with `-1`, instead of `Hello Everyone!`. **My HTML:**               <input type="hidden" name="GreetingAll" id="GreetingAll" value="Hello Everyone!" />       <input class="btn" type="submit" id="PleasePushMe" />

      **In functions.php:**               function add_myjavascript(){         wp_enqueue_script( 'ajax-implementation.js', get_stylesheet_directory_uri() . "/scripts/ajax-implementation.js", array( 'jquery' ) );       }            add_action( 'init', 'add_myjavascript' );          function MyAjaxFunction(){         //get the data from ajax() call          $GreetingAll = $_POST['GreetingAll'];          $results = "
".$GreetingAll."
";         // Return the String          die($results);       }       // creating Ajax call for WordPress       add_action( 'wp_ajax_nopriv_MyAjaxFunction', 'MyAjaxFunction' );       add_action( 'wp_ajax_MyAjaxFunction', 'MyAjaxFunction' );       **ajax-implementation.js:**               jQuery(document).ready(function() {                var GreetingAll = jQuery("#GreetingAll").val();                jQuery("#PleasePushMe").click(function(){            jQuery.ajax({                   type: 'POST',                   url: '/wp-admin/admin-ajax.php',                   data: {                       action: 'MyAjaxFunction',                       GreetingAll: GreetingAll,                   },                   success: function(data, textStatus, XMLHttpRequest){                       alert('Success: ' + data);                     jQuery("#test-div1").html('');                       jQuery("#test-div1").append(data);                   },                   error: function(MLHttpRequest, textStatus, errorThrown){                       alert(errorThrown);                   }               });         });          });      My only modification is changing `get_bloginfo('template_directory')` to `get_stylesheet_directory_uri()`, because I am using a child theme. Any thoughts on how I can get this working? Thanks!


Styling Custom Meta Boxes?

I've built a basic meta box and have this in my functions.php. The current code:               add_action( 'admin_print_styles-post-new.php', 'portfolio_admin_style', 11 );     add_action( 'admin_print_styles-post.php', 'portfolio_admin_style', 11 );          function portfolio_admin_style() {         global $post_type;         if( 'portfolio' == $post_type )             wp_enqueue_style( 'portfolio-admin-style', get_stylesheet_directory_uri() . '/styles/portfolio-admin.css' );     }               add_action('init', 'create_portfolio');         function create_portfolio() {             $portfolio_args = array(                 'label' => __('Portfolio'),                 'singular_label' => __('Portfolio'),                 'public' => true,                 'show_ui' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'rewrite' => true,                 'supports' => array('title', 'editor', 'thumbnail')             );             register_post_type('portfolio',$portfolio_args);         }          // Input fields     add_action("admin_init", "add_portfolio");         add_action('save_post', 'update_website_url');         function add_portfolio(){             add_meta_box("portfolio_details", "Portfolio Options", "portfolio_options", "portfolio", "normal", "low");         }         function portfolio_options(){             global $post;             $custom = get_post_custom($post->ID);             $website_url = $custom["website_url"][0];             $port_excerpt = $custom["port_excerpt"][0];     ?>
             Website URL:<input name="website_url" value="<?php echo $website_url; ?>" />             Excerpt:<input name="port_excerpt" value="<?php echo $port_excerpt; ?>" />
        <?php         }         function update_website_url(){             global $post;             update_post_meta($post->ID, "website_url", $_POST["website_url"]);             update_post_meta($post->ID, "port_excerpt", $_POST["port_excerpt"]);         }          add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");     add_action("manage_posts_custom_column",  "portfolio_columns_display");          function portfolio_edit_columns($portfolio_columns){         $portfolio_columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",             "description" => "Description",         );         return $portfolio_columns;     }          function portfolio_columns_display($portfolio_columns){         switch ($portfolio_columns)         {             case "description":                 the_excerpt();                 break;                       }     }      The problem is the stylesheet isn't changing the custom meta box's styling! I have the stylesheet being called from the correct directory in the code. If it matters, this is being used with custom post templates.


How to add post featured image to RSS item tag?

**I am able to add a post featured image to the RSS feed like so:**               function insertThumbnailRSS($content) {         global $post;         if(has_post_thumbnail($post->ID)){             $content = ''.get_the_post_thumbnail($post->ID, 'thumbnail', array('alt' => get_the_title(), 'title' => get_the_title(), 'style' => 'float:right;')).''.$content;         }         return $content;     }     add_filter('the_excerpt_rss', 'insertThumbnailRSS');     add_filter('the_content_feed', 'insertThumbnailRSS');      However, upon examining the XML generated for the RSS feed, I noticed it sticks the featured image into the XML description item tag. How can I insert post featured image into it's own RSS feed item tag of let's say "image", rather than just inserting it in with the post's content?


Weird string offset errors when displaying post attachments

I'm trying to create a gallery page that takes image attachments from a certain category and displays them. It works but I have a problem it seems where I'm trying to exclude certain attachment types from the returned attachment images. I am also using the WCK plugin to create some custom fields for the blog posts for images of differing sizes to be displayed in different locations. On the home page there is a more square one, on the blog page there is a skinny one, and on the actual post page there is a slightly bigger skinny version of the image. Here is how I'm calling the attachments, and there you will see how I am trying to exclude those images.               // WP_Query arguments         $args = array (             'post_type'               => 'post',             'pagination'             => false,             'posts_per_page'     => '99',             'category_name' => 'family'         );              // The Query         $query = new WP_Query( $args );              // The Loop         if ( $query->have_posts() ) {             while ( $query->have_posts() ) {                 $query->the_post();                      $thumb_ID = get_post_thumbnail_id( $post->ID );                 $blogimages = get_post_meta( get_the_ID(), 'blogimages', true );                  if ( $images = get_children(array(                         'post_parent' => $post->ID,                         'post_type' => 'attachment',                         'post_mime_type' => 'image',                         'exclude' => [$thumb_ID,$blogimages[0]['blog-image-inside'],$blogimages[0]['blog-image-front'],$blogimages[0]['blog-image-main']],                     ))) :                      foreach( $images as $image ) :                          echo '
';                         echo 'ID).'" rel="nivo">';                         echo wp_get_attachment_image($image->ID, 'full');                         echo '';                         echo '
';                         endforeach;             else: // No images                 //This post has no attached images             endif;             }         }         // Restore original Post Data         wp_reset_postdata();      I believe the problem is that those images are not set on those blog posts, so It is having an issue, perhaps because they are set as undefined? How can I fix this so that if the image is not uploaded it will exclude it and if it is uploaded it will still be excluded. The errors I'm getting by the way look like this over and over I assume for as many times as it's grabed a blog post and attempted to grab it's attachments               Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Warning: Illegal string offset 'blog-image-inside' in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Warning: Illegal string offset 'blog-image-front' in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Warning: Illegal string offset 'blog-image-main' in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50          Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/karmen-noel/wp-content/themes/karmen_noel/page-galleries-family.php on line 50


Survey pop-up plugin

I'm trying to pop-up a feedback form when users visit our website. I would only want this to appear once, and I would like it to simply go away (and never return!) if the user chooses to close the window. The form I have in mind has 8 questions; a few multiple-choice, a few rating and a few full-text answers. I imagined this to be done in a lightbox (or similar) window. Does such a plugin currently exist?


Images not showing on mobile browser?

When viewing my site on mobile Chrome/Safari, the images on the home page aren't showing up, and I can't figure out why. Does anyone have a clue why that might be? The site is trastaging.gopagoda.com I've tried it on a few different phones/browsers. They load, and then become empty containers. Any ideas or suggestions are appreciated.


Query for multiple post types does not work

I'd like my frontpage to display a list of my lastest blog posts merged with my latest "Products" custom post type posts. From the documentation i gather this should work:               query_posts( array('post_type' => array('post', 'product') ) );     while (have_posts()) : the_post();        the_title();        the_excerpt();     endwhile;      But that turns a weird list, made of pages ! Note that I've put it outside the loop. What am i doing wrong?


Information about Wordpress 4

Sorry if this is off-topic. Are there any details on when WP 4 will be released? Is it true it will be a fundamental re-write using considerable Ajax? I am really interested in the following issue which is reported as included in 4.0 https://core.trac.wordpress.org/ticket/14134 Thank you


How to determin which admin screen/sub screen I'm currently viewing

**Edit:** The Q narrowed down to the following: > "How would I retrieve the screen IDs of all admin UI screens at one time?" * * * **Edit:** I added a bunch of more plugin globals. * * * **Q** is the following: Check **which AdminUI submenu page/screen you're viewing** and check this **against some global var or some internal function**.               // This helps you inspecting the data - just drop it in some functions.php file of a theme     function wpse_inspect_admin_screen_data()     {         echo '
';             echo '
global $menu
';             print_r( $GLOBALS['menu'] );             echo '
';                  echo '
global $submenu
';             print_r( $GLOBALS['submenu'] );             echo '
';                  echo '
global $self
';             print_r( $GLOBALS['self'] );             echo '
';                  echo '
global $parent_file
';             print_r( $GLOBALS['parent_file'] );             echo '
';                  echo '
global $submenu_file
';             print_r( $GLOBALS['submenu_file'] );             echo '
';                  echo '
global $plugin_page
';             print_r( $GLOBALS['plugin_page'] );             echo '
';                  echo '
global $admin_page_hooks
';             print_r( $GLOBALS['admin_page_hooks'] );             echo '
';                  echo '
global $_parent_pages
';             print_r( $GLOBALS['_parent_pages'] );             echo '
';                  echo '
global $_registered_pages
';             print_r( $GLOBALS['_registered_pages'] );             echo '
';                  echo '
global $title
';             print_r( $GLOBALS['title'] );             echo '
';                  echo '
global $_wp_real_parent_file
';             print_r( $GLOBALS['_wp_real_parent_file'] );             echo '
';                  echo '
global $_wp_menu_nopriv
';             print_r( $GLOBALS['_wp_menu_nopriv'] );             echo '
';                  echo '
global $_wp_submenu_nopriv
';             print_r( $GLOBALS['_wp_submenu_nopriv'] );             echo '
';                  // built by set_current_screen() in /core_root/wp-admin/includes/template.php line 2085 (wp 3.2.x)             echo '
global $current_screen
';             print_r( $GLOBALS['current_screen'] );         echo '
';     }     add_action( 'shutdown', 'wpse_inspect_admin_screen_data', 9999 );      I already have an Array containing the slug and Label from both the parent and sub menu item. Here you can see an exemplary part of the array I built from `global $menu, $submenu;` and that I need to check against:               Array     (         [Appearance] => Array             (                 [0] => Array                     (                         [label] => Themes                         [slug] => themes.php                         [parent_label] => Appearance                         [parent_file] => themes.php                     )                 [1] => Array                     (                         [label] => Widgets                         [slug] => widgets.php                         [parent_label] => Appearance                         [parent_file] => themes.php                     )                 [2] => Array                     (                         [label] => Editor                         [slug] => theme-editor.php                         [parent_label] => Appearance                         [parent_file] => themes.php                     )             )         [Pages] => Array             (                 [0] => Array                     (                         [label] => All Pages                         [slug] => edit.php?post_type=page                         [parent_label] => Pages                         [parent_file] => edit.php?post_type=page                     )                 [1] => Array                     (                         [label] => Add New                         [slug] => post-new.php?post_type=page                         [parent_label] => Pages                         [parent_file] => edit.php?post_type=page                     )             )     )      * * * **Note:** The Q is _not_ the loop. Only what _exactly_ I can use to check which menu item _and_ subitem I'm currently watching.


how to proceed for a "new!" label on menu_nav?

I'm developing in Wordpress and would like to assign the label "new!" to specific custom-post-type's (not necessarily all post-types) if they contain new posts in the last 30 days. I found this code sample but do not understand. I don't understand how to specify which post-types to assign, and how to output the label within the loop.               $args = array( 'numberposts' => '1' );     $recent_post = wp_get_recent_posts( $args );     if (strtotime($recent_post[0]['post_date']) > strtotime('-7 days')) {         $class = "new!";     }      I found that if I change $class = "new!"; to something like 'echo: new', a text is displayed on the top of the page but I don't find how to integrate to wp_menu_nav


How to properly secure my Wordpress installation?

I'm currently on my own server (fredericpilon.com) with my own website. Wordpress being kind of a big shot of CMS, it may be targeted by hacks. Any tips and tricks on how to properly secure my Wordpress installation from said hackers and evil-doers?


My WordPress site SSL is in red crossed color and can't load at first time?

I enabled ssl connection on my wordpress website. From Admin panel -> settings -> and changed both URL from http to https. Then added               define('FORCE_SSL_ADMIN', TRUE);               if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')                 $_SERVER['HTTPS']='on';      to my wp-config.php file. But it's about 4 days any now while try to load it first page is give the error about unknown certificate. Then must click on continue anyway to load it, after the loading my HTTPS is in the red color with the crossed. Please help me how can I fix it I think my WordPress site need a certificate.ctr file that I must create it and upload in the wordpress root, but I don't know how to do it?


Pagination for two different post types on a same (category) page

First of all, I have searched the web as well as this site to get an answer, but couldn't find any. In theory, this would do what I want to do: How to fix pagination for custom loops? but I couldn't make it to work. The code I am presenting below has implemented the instructions of this post. I have the following issue: I have modified the category page (category.php) to include a loop of a custom post type (let's call them "events") above the default "posts" loop. Everything works fine, apart from the pagination. In particular, even though I can get it to count based on my custom query, the issue is that when I click on "Newer/Older Events" both the events and the posts start to offset. What I want to do instead is for the "Newer/Older Events" to affect only the custom loop and not the posts. I suspect my problem is related to the url, since after clicking "newer events", the url looks like this `http://localhost/category/THECATEGORY/page/2/` which probably automatically triggers pagination of the wp_query too. Perhaps if I could make it to be something like `/?eventpage=X` and `/?postpage=X` according to which pagination you change it would work, but unfortunately I don't know how. Any help will be greatly appreciated :)               <?php          $stand_args = array(                   'post_type' => 'event',                           ...                       my arguments                           ...             );               $stand_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;              ?>              <?php $the_stand_query = new WP_Query( $stand_args ); ?>              <?php $temp_query = $wp_query;         $wp_query   = NULL;         $wp_query   = $the_stand_query;         ?>              <?php if( $the_stand_query->have_posts() ): ?>              <?php while ( $the_stand_query->have_posts() ) : $the_stand_query->the_post(); ?>                 ---------------------- THE LOOP OUTPUT ------------                    <?php endwhile; ?>              <?php endif; ?>                       wp_reset_postdata();                    previous_posts_link( 'Older Events' );          next_posts_link( 'Newer Events', $the_stand_query->max_num_pages );                           ?>                     <?php              $wp_query = NULL;             $wp_query = $temp_query;              ?>                   <?php wp_reset_query();        thank you in advance


Can I stop authors from changing the font in their post?

I want the site to have a consistent look and feel so want to prevent authors from changing font, font color or font size. Is there a way to either override their choices, or remove the option? Cheers


How to fetch the data from Advanced Custom post when we search specific keyword or field name related to the post?

Actually i have created a custom post type and fetch the data from "Advanced Custom Fields" plugin after then connect to a custom search-form to search only the post data.It works good. But now i want to search post data from field name (label) or any other related keyword. This is code that works when i search post name but does not work when search field name and other related key word.               <?php      echo 'this is search=';      echo $s;     $args = array(         'post_type'=> 'beauty_salon',        's' =>$s,         'the_field'=>$treatments     );     query_posts($args);     ?>     <?php if ( have_posts() ) : ?>

                     <?php while ( have_posts() ) : the_post(); ?>
     <a href="<?php the_permalink(); ?>" >
<?php  the_title(); ?>
     <?php $attachment_id = get_field('beauty_salon_image_1');     $size = 'custom_archive_thumbnail';  //(thumbnail, medium, large, full or custom size)     $image = wp_get_attachment_image_src( $attachment_id, $size );     $attachment = get_post( get_field('beauty_salon_image_1') );     $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);     ?>     <a href="<?php the_permalink(); ?>" ><img src="<?php echo $image[0]; ?>" alt="<?php echo $alt; ?>"/>

Treatments:<?php echo the_field('treatments') ?>

Bookings 1:<?php echo the_field('bookings_1'); ?>

Bookings 2:<?php echo the_field('bookings_2'); ?>

Address:<?php echo the_field('address'); ?>

     <?php endwhile; ?>

     <?php else : ?>     <?php get_template_part( 'content', 'none' ); ?>               <?php endif; ?>                      //one template above      And i used code for search form given below.     <form id="searchform-ajax" action="<?php bloginfo('home'); ?>/" method="get">     <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s"  class="txt" />     <input type="hidden" name="post_type" value="beauty_salon"  />     <input id="searchsubmit" class="ser-icon" type="submit" value="Search" />     </form>


Removing the FeedBurner redirect

When I set up my blog i was using the default RSS feed which worked fine. Then I switched it to using FeedBurner using the FeedSmith plugin which also worked without issue. Now though I want to go back to the default WordPress feed instead. I've removed WordSmith but www.mydomain.com/feed/ still gets redirected to FeedBurner and I can't find a way to stop it. It's not mentioned in my .htaccess file and the database rewrite_rules only changes that URL to use index.php?feed=rss2 which is the bit that redirects to FeedBurner. I can use feed=rss or atom to get the wordPress generated feeds but I want the defautl one to use it as well. I've poked around a little in the source to try and trace it but to no avail so far. Does anyone know where this unwanted redirect might be hiding itself? As a temporary workaround I'll set the rewrite_rules to redirect it to the RSS 1 feed but would rather it went to the RSS 2 one.


Order search results by category

I'm using this code to order my search results by post type and title, but I would like to order by category too. How can I do it?               add_filter('posts_orderby','my_sort_custom',10,2);     function my_sort_custom( $orderby, $query ){         global $wpdb;         if(!is_admin() && is_search())              $orderby =  $wpdb->prefix."posts.post_type ASC, {$wpdb->prefix}posts.post_title DESC";              return  $orderby;     }


Widget malfunction in Reponsive theme

Hi – I would like to put an existing RV Flagpicker (displays international flags with links) Widget into the TOP widget on our Responsive site. Just changed to this theme yesterday. When I drag the Flagpicker widget into the Top Widget field and look at the page, I get this message: function WP_Widget::widget() must be over-ridden in a sub-class. when create new Widget I am working in a the child theme provided by Cyberchimps. Still trying to figure out how best to edit, within Styles.css or Functions, or both? If you can point me to the basics of customizing within the child site that would be very nice. Can I edit PHP in the child site, within the WordPress editor? I know this is more than one question. I appreciate your help!


Sample code for validating custom metabox?

I've found very little on this site or in Google searches for examples of validating metabox custom fields. If anyone wants to give examples, here are some cases that would be useful 1) Date entered as 05/02/2011 is valid date format   2) Number entered in text box is numeric and between 100 and 500   3) Text in text box is > 25 chars long My question is not so much the code to validate the fields but where to put the validation code? Use Javascript or PHP? If it hooks on save-post, techniques for dealing with failed validation - Update the post? Don't update the post? - how do you stop it from updating? Best way to notify the user of the problems. All suggestions are appreciated. Sample code is more helpful than just a description of a technique. ( This would be a very good topic for someone to write an article on. ) Thank you


Changing post status

Refering to Post status because it's not allowed to do a question on a answer ?!   Original post is from _Bubka Gob_ and the answer came from _Chris O_ .   I have add their code to functions.php:                 add_action('post_submitbox_misc_actions', 'send_for_correction_button');     function send_for_correction_button()     {         //global $post;         echo '                      ';     }     add_filter( 'wp_insert_post_data' , 'my_filter_handler' , '99', 2 );     function my_filter_handler( $data , $postarr )     {         if ($postarr['save'] == 'Send for correction')             $data['post_status'] = 'on-correction';              return $data;     }      Because I have following plugin installed: CMS Tree page View I can see the page which is "marked" as on-correction. But as soon this plugin is deactivate the page isn't showing up anymore when I click All Pages.(In back-end/Admin)   Does anyone have a clue/hint or solution? Thanks in advance for time and effort. _(looking forward to a responce because we would love to use this nice solution for the reason that we also have multiple authors.), Sorry if I am wrong and duplicate now because lack of knowledge for the how to respond on excisting answers on stackexchange.com.   _


Change post date in menu to post title

I'd like to have my posts displayed in the menu as a name, not as the date they're published. Is that possible? Regards Peter


Migrated wordpress site give "Undefined variable: php" warnings

I have just migrated my wordpress site from my laptop to my desktop. I get server error 500 when I try /localhost/wordpress/wp-admin. So I turned on WP_DEBUG and now I get a series of               Notice: Undefined variable: skype_mu_dir in /var/www/wordpress/wp-content/plugins/skype-online-status/skype-status.php on line 42      Notice: Undefined variable: skype_mu_dir in /var/www/wordpress/wp-content/plugins/skype-online-status/skype-status.php on line 43      Notice: Undefined variable: user in /var/www/wordpress/wp-content/plugins/wp-symposium/symposium_hooks_filters.php on line 553      Notice: Undefined variable: user in /var/www/wordpress/wp-content/plugins/wp-symposium/symposium_hooks_filters.php on line 555      Notice: Undefined variable: uid in /var/www/wordpress/wp-content/plugins/wp-symposium/symposium_hooks_filters.php on line 600      Notice: Undefined variable: uid in /var/www/wordpress/wp-content/plugins/wp-symposium/symposium_hooks_filters.php on line 602      Notice: Undefined variable: cache_needs_updating in /var/www/wordpress/wp-content/plugins/s2member/includes/classes/cache.inc.php on line 97      Notice: Undefined index: level-1_label in /var/www/wordpress/wp-content/plugins/s2member/includes/classes/constants.inc.php on line 287      Notice: Undefined index: contact_me_data in /var/www/wordpress/wp-content/plugins/contactme/contactmedotcom.php on line 34      Fatal error: Class 'Memcache' not found in /var/www/wordpress/wp-content/plugins/flexicache/FlexiCache/Store/Memcache.php on line 63      A ls -l on /var/www shows               drwxr-xr-x  7 www-data www-data 4096 2012-06-13 21:35 wordpress      A ls -l on /var/www/wordpress shows               drwxr-xr-x 11 www-data www-data  4096 2012-06-13 19:24 wp-admin      A ps -ef | grep apache2 reports               prompt:/var/www/wordpress$ sudo ps -ef | grep apache2     root     14040     1  0 19:23 ?        00:00:00 /usr/sbin/apache2 -k start     www-data 14043 14040  0 19:23 ?        00:00:00 /usr/sbin/apache2 -k start     www-data 14044 14040  0 19:23 ?        00:00:01 /usr/sbin/apache2 -k start     www-data 14045 14040  0 19:23 ?        00:00:00 /usr/sbin/apache2 -k start     www-data 14046 14040  0 19:23 ?        00:00:00 /usr/sbin/apache2 -k start     www-data 14047 14040  0 19:23 ?        00:00:00 /usr/sbin/apache2 -k start     www-data 14048 14040  0 19:24 ?        00:00:00 /usr/sbin/apache2 -k start     www-data 14056 14040  0 19:24 ?        00:00:00 /usr/sbin/apache2 -k start      I wonder what I am missing. I am sure its something really small.


Disqus plugin outputs script as literal text

After installing the Disqus plugin, their JavaScript code started popping up as plain text on my site in several places. My hypothesis is that it pops up at the end of any loop involving `the_post()`. This is one of them. ![Screenshot of the glitch](http://i.imgur.com/0CTn0ls.png) Here's a snippet from my `front-page.php`:               foreach ($terms as $term) {         $query = new WP_Query(array(             'post_type' => 'portfolio',             'skill' => $term->slug,             'orderby' => 'meta_value',             'meta_key' => 'pf_startyear',             'nopaging' => true,             'order' => 'DESC',             'posts_per_page' => 4         ));     ?>

<?= $term->name ?>

     <?php         if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();     ?>
                         <a href="<?= get_term_link($term->slug, "skill") . "#" . $post->post_name ?>"><img src="<?= wp_get_attachment_url(get_post_meta($post->ID, "pf_img", true)) ?>" alt="<?php the_title() ?>" title="<?php the_title() ?>" class="pfItem" />
<?= get_post_meta($post->ID, "pf_pitch", true) ?>

     <?php         endwhile;         endif;     ?>

     <?php     }     ?>      This is how it renders: ![Output tree](http://i.imgur.com/5fs3n7n.png) Why is this happening and how can I prevent this script from breaking my site layout?


Show posts in a list separated by day

I want to display posts on index page within a links-list, with only the titles, till now i did the job, but now i want to have space between titles and be separated by day. Please check wimp.com and see how the titles are separated. Right now my code is something like this               <?php query_posts($query_string.'&cat=-3');           while (have_posts()) : the_post(); ?>                     <?php the_time('M j') ?>     -     <a class="title" href="<?php the_permalink() ?>"><?php the_title(); ?>      Thanks.


Custom Post Type Navigation on Custom Field

I'm working on a Custom Post Type sorted on a Custom Field. No problem when I list out the posts. But when I go to the single post page for one of these, I want the Prev and Next navigation links to take us to the prev/next posts in the sort order dictated by the Custom Field. By default, WP orders them by post date. Code for sorting list:                   // shortcodes         // lor_list of letters: Lists all letters of reference in a table format         add_shortcode('lor_list', 'aaaConsultant_shortcode_lor_list');              function aaaConsultant_shortcode_lor_list() {             global $wp_query;                  $oWP = new wp_query(array(                 'post_type' => 'letters_of_ref'                 , 'orderby' => 'meta_value'                 , 'meta_key' => 'aaaConsultant_dateofletter'             ));                  $out = '
' . "\n";             if (!$oWP->found_posts) {                 $out .= '
d\'Oh! We don\'t have any Letters of Reference yet.
' . "\n";             } else {                 while ($oWP->have_posts()) {                     $oWP->the_post();                     $out .= '' . get_the_title( $oWP->post->ID ) . '' . "
\n";                 }             }             $out .= '
 ' . "\n";                  wp_reset_postdata();             return $out;         }      How do I do that? Thanks for your help.


Allow Duplicate Email Address for Different Users

I need to be able to have different users share the same email address. (Running a site where parents will be creating accounts for their children who may not have their own email address, so the parent will need to use his or hers for each of the children's accounts.) I have seen other suggestions, some include edited core (which I don't want to do), but nothing seems to work. Does anyone have any ideas on how to bypass the email_exists check on user creation? Thanks in advance. P.S. Since I don't have the rep, I can't comment on the other post to ask if the OP found a solution.


Multiple URL from Custom post name

I would like to do something special for a website in Wordpress. I have a "custom post type" whose data are all "post custom fields" except the name of the post. I need to create multiple urls for each of the "post custom fields" of the same post, and shows custom post field value. For example The custom post type is custompostA This custom post type has the following "custom post fields": customfieldA, customfieldB I add a new post whose title is "Example1" Based on this, I want two different urls www.domain.com/custompostA/Example1/customfieldA www.domain.com/custompostA/Example1/customfieldB The first URL will display the customfieldA value and the second URL will display customfieldB value I hope I have been clear since my exposure. Thank you very much Javier


Recurring scheduled task help

I'm trying to set up a scheduled task in my Wordpress installation which will (eventually) run a script to send an email once a day with a load of data in. However I can't seem to get a scheduled task to fire at all. I am testing it with a 2 minute interval to see if I can get it working. What I have so far is below, and is at the bottom of my `functions.php` file. Any idea where I'm going wrong?               add_filter('cron_schedules','my_cron_definer');     function my_cron_definer($schedules){         $schedules['twomin'] = array(             'interval'=> 120,             'display'=>  __('Once Every 2 Minutes')         );         return $schedules;     }          add_action('my_periodic_action','my_periodic_function');     function my_periodic_function(){         mail('email@address.co.uk','Test!', 'Test Message');     }     wp_schedule_event(time(), 'twomin', 'my_periodic_action');      I'm aware my Wordpress site needs to be getting it's pages visited for the function to run, so I have been clicking around on the site hoping to trigger my function but no luck! **Note:** I have swapped my real email address out!


How can I call a PHP function inside a hardcoded shortcode?

Maybe I'm doing this the long way but I need to make something like this:               <?php echo do_shortcode('[mu-events months="11" startmonth="today" orderby="time" orderas="ASC" sites="?> <?php get_current_site();?> <?php"]'); ?>     <?php echo do_shortcode('[mu-events months="11" startmonth="today" orderby="time" orderas="ASC" sites="11"]'); ?>      I guess I simply don't know if a function can be inserted inside a shortcode, but in this case it seems like it just has the incorrect syntax. Appreciate any pointing in the right direction!   Thanks **NOTE** There is a different between CURRENT_SITE and current BLOG_ID, see my note below


Custom Menus and taxonomies

OK I just started using WordPress not very good and I have a menu problem I can REALLY use some help please. I am working on a website and it has multiple locations, and not all the locations sell the same products. All the locations are pages with a parent structure. > Ohio -Contact Us -About us -Products etc... > > West Virginia -Contact Us -About us -Products etc... > > Pennsylvania -Contact Us -About us -Products etc... I got the hang of custom page templates and adding a custom menu to them (so all my Ohio pages use a custom Ohio template i made and included a custom Ohio menu). I am using posts to create the product information pages and display them using:               *post_type="post" taxonomy="category" posts_per_page="10" tax_term=*      which seems to work out nice on a general product page, (especially since i would like to only create the product pages once sine there are a lot of them) but i cant figure out how to add a custom menu based on the parent pages they came from. So if they come from my custom Ohio page and click on the link to a product post, there is not menu since that product might also be in West Virginia but not in Pennsylvania, so i cant use a standard menu. Any way to get the parent info from where they just came from or something? Any thoughts? I am really new at WordPress coding so please be gentle


Refine/Filter WP_Query Posts with jQuery or Ajax

I know this has been asked many many times, but I literally searched for an answer for more than 5 hours without finding anything that drives me in the right direction. What I'm trying to achieve is something similar to this http://car- insurance.findthebest.com/ where you select terms on the left hand side and these terms are added (in this case they are showed on top of results) with the X next to them to remove those terms from the query. I have seen many many examples of filtering plugins but most of them are based on the SEARCH and I don't want to have a search. My example: Custom Post Type = jobs Custom Taxonomies = Country, Type, Job Area (like engineers, designers, programmers, etc) Simple Query getting all the jobs (simplified)                   <?php             $jobs = new WP_Query('post_type=jobs&posts_per_page=10');             while ($jobs -> have_posts()) : $jobs->the_post();          ?>
<?php the_title(); ?>
         <?php the_excerpt(); ?>              <?php endwhile; ?>      Anyone that could point me to a tutorial, a plugin, something in the right direction?


Private Posts/Pages & Search

I have a site up where there is one private page and one private post. When logged is as admin, i can view both of these, and they even appear in the search. However, when logged in as an editor, I can still see the posts, but they don't appear in the search. I found this a bit strange, was wondering if anyone has experienced this or knows how to make the private pages and posts appear in the search when logged in as an editor?


Custom Post Type Posts Not Showing Up in Admin

I am using this theme called IronBand. It has a few custom post types, and one of them is called "Gig." I created some custom posts under that Custom Post Type. Later, I wanted to changed the name of the Custom Post Type to "Show," so I fiddled with some php files. It seemed like it was too complicated to change everything accordingly, so I replaced the php files I fiddled with to the original php files. Now in the admin panel of "Gig," it says "No Gigs Found" Even if above the post list it says there are 17 published posts. How could I make the published posts show up again?


How to add custom post type archive page links to nav menu?

I cannot figure this out. There seems to be no checkbox or anything similar in function to add the newly created custom post type archive page into the menu. Also the link must be active, if you are on the page. This probably isn't possible, but is there some plugin for it? For the love of me, I cannot find it :( I only found this plugin called Custom Post Type Archives in Nav Menus, that doesn't really do anything, but add custom link to the menu..with the full site-url. It doesn't go active or isn't very dynamic. I thought that, probably the easiest way would be to override `wp_nav_menu()` and add my links manually and then use `$_GET` information to control the "currently active link".


Add Google Map Stylers to PHP

I would just like to add the following Google Map stylers to my WP maps, but a little lost on where to include in the .twig Here are the stylers:               [      {     "stylers": [       { "saturation": -100 },       { "gamma": 0.96 }        ]       }     ]      And my map .twig:               {% if wp.get_post_meta(post.ID, '_property_latitude').0 and wp.get_post_meta(post.ID, '_property_longitude').0%}
{{ wp.__('Map', 'aviators') }}

                {% endif %} Help?


Set a WordPress website's language without affecting the back-end

I have a WordPress website. What I want to do is leave the back-end of the website in English, but in the meantime I want the front-end of it to be in Chinese. (So that it translates every text generated with plugins by script). Thank you in advance for your answers.


Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu

I currently developing a wordpress plugin that is using two custom post types. What I want to know here: is it possible to add a custom post type menu as another custom post type's sub menu?


Link each category to last post

I would like that each category link to the last post of each category.   * category 1 ----> link to the last post of category 1    * category 2 ----> link to the last post of category 2    * category 3 ----> link to the last post of category 3 How can I do it?


Insert Captcha Code info Any Form (Created of Plugin)

I am looking for best option on Captcha. Plugin's don't seem to be the answer because this is a custom form for the theme I am using. Unfortunately, they don't offer any spam protection. The form is heavily styled so I do not want to start from scratch. I do have access to the contact form code and can plug one right in. I can't imagine I am the only one with this issue. Doing a Google search hasn't been very insightful as well. Is my best option to find a plugin or add custom code? if so - can I do some kind of Javascript only protection? I'd rather not integrate it with PHP unless I have to...


Custom query shows custom post types in trash

I have a custom wordpress query like so:               $query = new WP_Query(array('post_status' => 'future || publish', 'post_type' => 'kalender', 'order' => 'ASC'));      But the problem is that the items shown on the pages also include the items that are in the trash? I don't understand why because according to the `post_status` only published & future posts should be shown? The item in the trash is a post in the future though? Maybe that's why it's shown but how can I exclude that one?


Cannot find webarh/malware redirect infection that only shows on Chrome

Several months ago my site (powered by WordPress) got hit by that webarh malware infection that set up a bunch of .htaccess redirects to its domain. Restoration of a good site backup nixed the problem, but apparently not entirely. Specifically, whenever I use Chrome, I log into my website's admin panel, and either edit an existing post or add a new post, as soon as the page finishes rendering I'm immediately kicked out to Chrome's warning page about my site containing content from this malware site. I've done a MySQL search of all post_content and comment_content, as well as ran a grep through all the PHP/JS/CSS files I can find, in addition to searching for any remaining rogue .htaccess or index.php files, to no avail. As I mentioned, it happens the moment the post.php or post-new.php finishes rendering and just before any existing text shows up in the box. This leads me to believe it's a plugin that's somehow associated with the text editor that's infected, but I'm not really sure where to look. Also, Firefox issues no warnings at all and allows me to edit as usual. Only Chrome does this (and has been ever since restoring the site). Any thoughts would be appreciated! **Edit:** In the interest of full disclosure, this is my site: www.magsolweb.net . Again, everything seems to be fine, except when adding a new post or editing an existing one.


How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?

I've been troubleshooting an issue over the past few days and keep going in circles. Could really use a fresh pair of eyes to help me answer this question... So I'm working with a wordpress site where posts have a few custom fields relevant to the query I need to run: "post-expired" and "my-sort-order". When I run my query_posts I want the results to be posts where the "post-expired" is NOT "yes" (this part works in my code). I also want the results sorted by the DESC number value of "my-sort-order" (works as well) AND if there's a tie on "my-sort-order" I would like a secondary sort by date with the most recent posts first. The secondary sort by date is where I'm having trouble. Here is the code I have right now:               <?php                    $args = array(         'paged' => $paged,         'meta_query'=> array(             array(                 'key'=>'post-expired',                 'value'=> 'yes',                 'compare' => '!='             )         ),         'meta_key'=>'my-sort-order',         'orderby'=>'meta_value_num',          'order'=>'DESC'     );          $args = array_merge( $args , $wp_query->query );          query_posts( $args );     ?>      Using the code above I correctly get back the non-expired posts and they're sorted by my-sort-order descending (i.e. 100 shows up before 99, etc). But if both posts have the same sort order value there is some type of secondary sort happening I can't seem to control (and can't figure out what it is actually being sorted on). My first idea to solve this was to only add values to "my-sort-order" if I wanted to set a specific sort order for that post. I thought if the value for this field was left blank for the rest of the posts, they would simply be returned in the default sort by DESC date (after the posts with a set sort order). However, what actually happened was any posts that didn't have a sort order value set were NOT returned at all... Next, I tried adding multiple values in the orderby field like this:               ('orderby'=>'meta_value_num date')      That completely blew up both sort orders I was going for and returned the posts in an unexpected way. I was under the impression that multiple orderby values were allowed, but for some reason it's not working here. At this point I'm not sure how to make either of these potential solutions work. Does anyone know how I can either 1) Sort posts by the "my-sort-order" field first, then have the remaining posts with no value in that field returned with the default date sort; or 2) Figure out how to control the secondary orderby sort so any posts that have a tie on "my-sort-order" will be sorted by date (newest first)?


How can I remove filters from custom post types?

I created a custom post type which I'll use as landing page for PPC. Now on that custom post type I would like to remove all the filters which are adding the social media buttons for example. I tried already with the following code but that did also remove the shortcode filter which I would like to keep on that custom post type. Here's the code I used:                   function landingpage_remove_plugin_filters() {              global $wp_filter;         global $wp;         if ($wp->query_vars["post_type"] == 'landingpage') {         remove_all_filters('the_content', 'plugin_filters');         }         }                 add_action('wp','landingpage_remove_plugin_filters');      Does anyone know what I need to change in order to keep the shortcode filters on that custom post type? Thanks a lot for your efforts. Daniel


__FILE__ in WordPress plugins

I'm using Sidebar Generator in all my themes. The plugin works perfectly normal from "plugins" directory, but I want to embed it somehow to my themes, so it won't display on Installed Plugins list. I've just copied sidebar_generator.php (the whole code is luckily in one file) to mytheme/plugins and included it in functions.php               require_once (MY_PLUGINS . '/sidebar_generator.php');        Now, it worked for all other plugins, but not for this one! This way when I click on "Sidebars" it refreshes the actual page instead of loading plugin's admin_page. Any ideas why is it happening and how to make it working? I believe the problem lays here:               add_submenu_page('themes.php', 'Sidebars', 'Sidebars', 'manage_options', __FILE__, array('sidebar_generator','admin_page'));      Chaning **FILE** to something else helps, but I'm not sure how to point this submenu link at the actual plugins admin page.


Pagination problem with multiple loops on the same page

I'm using 4 custom loops to display 3 posts on each one and every loop has its own pagination which works fine once the page loads up, the problem is that when I click on the 2nd page of the first loop it does show me the next 3 posts of that loop but it does the same for the other 3 loops, so if one of these loops has only 2 posts it won't show any if I click on the 2nd page of any of the other. Is there a way to page the pagination aware of what the loop is and only scroll through that loop? Thanks in advance!


WordPress menu with custom taxonomy

I'm looking for a scalable, best-practice way to do the following: I need a menu to have a link to the homepage, a standard page, and a variable number of custom post type archives. Each archive must also have one standard sub-page and a category page with all the posts with a specific custom taxonomy. So the menu would look like this:                Home      About      Artist 1 Archive           About Artist 1           Custom Taxonomy      Artist 2 Archive           About Artist 2           Custom Taxonomy      And so on for all other artists. Currently, I'm using WordPress's built-in archives for the custom post types, so they're not showing up in my menu--but I'm not adverse to just using a custom url (e.g., /artist-1/). What I'm having difficulty with is how to create the archives for the custom taxonomy. Is there a way I can set up a page template and somehow use `get_query_var()` to get the post type? Or is there a more natural way to do this? Finally, I also have to redirect the URL; the custom taxonomy's category will be `yes`, but I need to change it to be accessed at `portfolio`. Thanks very much for your help.


How translate it? Intensedebate

http://www.part.lt/img/4490330b04db19a9043999a460246e39489.JPG (IMG) Look at yellow background. How translate it, to Lithuanian lang? Thanks! I using IntenseDebate comments system.


Multi post thumbnails doesn't return anything

I am using the multi post thumbnails plugin. I have a custom post type "artist" who has a logo. In the loop I want to echo out the following:               $logo = MultiPostThumbnails::get_post_thumbnail_id('artist', 'Logo', $post->ID);     echo $logo;      Nothing gets returned - I used a `var_dump` on $logo to check, it is just an empty string. `$post->ID` returns the right id, and the parameters `artist` and `Logo` should be correct, too. What am I doing wrong here?


Show div based on custom meta value

I've search all over for a solution to this but can't seem to find anything that does exactly what I want it to. Basically what I want to do is display a particular div within a post based on the value of a specific custom field. For example; If the value of the "featured" custom field is "1" then I want to be able to show a div within single.php for that particular post But if the value of the "featured" custom field is anything other than 1 then I don't want anything to appear. Does that makes sense?


Orbit Slider and Events Manager Plug-in JavaScript

I have this slider(orbit slider http://foundation.zurb.com/docs/orbit.php ) and a wordpress plugin(event manager http://wp-events-plugin.com/ ) that loads all this jQuery-ui stuff(               /**        * Enqueing public scripts and styles        */       function public_enqueue() {         //Scripts         wp_enqueue_script('events-manager', plugins_url('includes/js/events-manager.js',__FILE__), array('jquery', 'jquery-ui-core','jquery-ui-widget','jquery-ui-position','jquery-ui-sortable','jquery-ui-datepicker','jquery-ui-autocomplete','jquery-ui-dialog')); //jQuery will load as dependency         //Styles         wp_enqueue_style('events-manager', plugins_url('includes/css/events_manager.css',__FILE__)); //main css       }            /**        * Localize the script vars that require PHP intervention, removing the need for inline JS.        */       function localize_script(){         global $em_localized_js;         $locale_code = substr ( get_locale(), 0, 2 );         //Localize         $em_localized_js = array(           'ajaxurl' => admin_url('admin-ajax.php'),           'locationajaxurl' => admin_url('admin-ajax.php?action=locations_search'),           'firstDay' => get_option('start_of_week'),           'locale' => $locale_code,           'dateFormat' => get_option('dbem_date_format_js'),           'ui_css' => plugins_url('includes/css/ui-lightness.css', __FILE__),           'show24hours' => get_option('dbem_time_24h'),           'is_ssl' => is_ssl(),         );      ) on the very top of every page on the site(               <link rel='stylesheet' id='events-manager-css'  href='http://at.theplural.com/wp-content/plugins/events-manager/includes/css/events_manager.css?ver=3.4.2' type='text/css' media='all' />     <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.widget.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.position.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.mouse.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.sortable.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.resizable.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.draggable.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.button.min.js?ver=1.8.20'></script>     <script type='text/javascript' src='http://at.theplural.com/wp-includes/js/jquery/ui/jquery.ui.dialog.min.js?ver=1.8.20'></script>      ) . I'm basically trying to block that javascript from loading on the front page, or ideally, loading on only the specific page it's needed on -> page('events'). I tried my best to 'dequeue' the js, but it's not working


BBPress private topics by default

I'm using the BBPress plugin for WordPress and also the Members plugin. Does anyone know of an easy way to make Topics for members only by default? I know the Gravity Forms forum does this but I do not see an obvious way to go about it. Thanks for the help!


custom permalink/shortlink with base62 encoded post ID

I want my post-links to look like /%post_id62%_%postname%/ where %post_id62% is the post ID in base62 encoding (e.g. http://example.com/y9Rlf_test/) and my shortlinks to consist of /%post_id62% only (e.g. http://example.com/y9Rlf). This is what i've got so far (in my `functions.php`) which obviously doesn't work:               add_action( 'init', 'yoyo_init' );     function yoyo_init() {       add_rewrite_tag( '%post_id62%', '([A-Za-z0-9]+)' );     }          add_action('generate_rewrite_rules','yoyo_generate_rewrite_rules');     function yoyo_generate_rewrite_rules($yoyo_rewrite) {       global $wp_rewrite;       $new_rules['/([0-9A-Za-z]+)/?$'] = 'index.php?p=' .         base622dec($wp_rewrite->preg_index(1));  // DOESNT WORK OF COURSE (executed only once when rewrite_rules are generated)       $wp_rewrite->rules = array_merge($new_rules, $wp_rewrite->rules);     }          add_filter( 'post_link', 'yoyo_post_link', 10, 2 );     function yoyo_post_link( $permalink, $post ) {       if ( false !== strpos( $permalink, '%post_id62%' ) ) {         $post_id62 = dec2base62( $post->ID );         $permalink = str_replace( '%post_id62%', $post_id62, $permalink );       }       return $permalink;     }          add_filter('pre_get_shortlink', 'yoyo_custom_shortlink', 10, 4);     function yoyo_custom_shortlink($false, $post_id, $context, $allow_slugs) {       global $wp_query;       if($post_id or ($context == 'query' and $post_id = $wp_query->get_queried_object_id())) {         return home_url('/' . dec2base62($post_id));       }       return false;     }          function dec2base62($number) {       $digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';  $string = '';  while($number > 0) { $string = $digits[$number % 62] . $string;  $number = floor($number / 62); }       return $string;     }     function base622dec($string) {       $digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';  $number = 0;  while(strlen($string) and ($number *= 62 or strlen($string))) { $number += strpos($digits, $string[0]);  $string  = substr($string, 1); }       return $number;     }      Any idea how to tackle the problem? Bonus points for avoiding the -N slug suffix when there's another post with the same title created (which might be avoided actually when setting the link structure to "/%post_id62%_%postname%/" but in order to have the shortlink functionality it should be "/%post_id62%" I guess; cf. Turn off %postname% auto-incrementing?)! Thanks!


WYSIWYG eating up first p in td

Basically going mad on this one. Been googling about for quite some time now to find an answer. Most hits are on year old posts. I tried to alter how TinyMCE initiates with "remove_linebreaks" set to false in functions.php. The thing is altering text, at least this little group of three paragraphs in two td-cells in a table.   1. At first I alter the HTML to my liking and save. (This error occurs with or without the MCE Table Buttons plugin, so you need not worry about me having forgot to turn that off.) _New user can't post image so description is:_ two equal sized td-cells with three paragraphs each, with some internal line breaks as well.   1. Everything is at first all fine. But when I do some, or no, edits and save again this screen meets me. The first paragraph in each td-cell is joined with the second paragraph. This mating removes the seperating spaces all together. _New user can't post image so description is:_ Same cells and sizes, just that the first paragraph and the second merged, removing all separating spaces between them (end of p1 is on the same line as start of old p2). Paragraph 3 is unaffected.   1. When I save a third time the first paragraph again mates with the second (thus only one paragraph exists in both cells). Ofc this looks very ugly, and this is very hard to explain to the client (they do have zero html-understanding). _New user can't post image so description is:_ Now all paragraphs has become one, with end of old p2 being on the same line as the start of old p3.   1. After the save on step 3 in admin this is shown on the frontend. This means that the html must get broken on hitting save, or while loading it into the editor AND on the page. * _New user can't post image so description is:_ It looks exactly as in the admin. Been digging around some in autop, but that's beyond my php-skills. Anybody else known to this -- as it looks -- very common problem? I use Wordpress 3.3, haven't tested in any other version. Any suggestions?


How wp_ajax_nopriv since Wordpress 3.1

I have a question. When I was on Wordpress 3.0, my ajax function worked. It return good things when I'm log in and log out. add_action('wp_ajax_my_action', 'my_action_callback'); add_action('wp_ajax_nopriv_my_action', 'my_action_callback'); Now since Wordpress 3.1, I saw **wp_ajax_nopriv_my_action** _is deprecated_. So, for a visitor, my ajax function doesn't work. What is the alternative ajax function for Wordpress 3.1 ? Please


What code do you use to generate the text to go into the HTML title tag?

The question title says it all. Myself I just stick with the default code from one of the packaged templates that comes with WordPress out of the box:               <title><?php         /*          * Print the <title> tag based on what is being viewed.          */         global $page, $paged;              wp_title( '|', true, 'right' );              // Add the blog name.         bloginfo( 'name' );              // Add the blog description for the home/front page.         $site_description = get_bloginfo( 'description', 'display' );         if ( $site_description && ( is_home() || is_front_page() ) )             echo " | $site_description";              // Add a page number if necessary:         if ( $paged >= 2 || $page >= 2 )             echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );              ?></title>      Do any of you use different code for this?


Style every second widget?

I need to apply a certain style to every second widget in my sidebar, and I'm reluctant to use :nth-child due to cross-browser compatibility issues. Is there a bit of PHP that will allow me to apply a class to every other widget?


How to List Events by Year and Month Using Advanced Custom Fields?

I have a custom post type "Kalender_item" with a custom Date Field (YYMMDD). I want to list all the posts on a page sorted by Year and Month. For example:   * November 2012 (all events that occure in November 2012)    * December 2012 (all events that occure in December 2012)  And so on... I have succeeded in ordering them like so               $kalenderItems=query_posts('post_type=kalender_item&post_status=publish&meta_key=kalender_item_datum&orderby=meta_value');      This gives me all my posts in the correct order. Now I want to group them by Month Year and display the Month Year as a title for each group. How to group my results by year and month?


how to get nav menu list through menu name in wordpress

How to get nav menu list through menu name in WordPress I'm using this code by this code but showing all pages not working with custom nav menu name               <?php wp_page_menu('sort_column=ID&sort_order=desc;'); ?>


phpMyAdmin error #1062 - Duplicate entry '1' for key 'PRIMARY'

I'm new to PHP! I'm trying to import an SQL file using phpMyAdmin through a GoDaddy cPanel(please don't make fun of me) Here's a full readout               -- -- Dumping data for table `wp_commentmeta` -- INSERT INTO `wp_commentmeta` (`meta_id`, `comment_id`, `meta_key`, `meta_value`) VALUES (1, 3, 'rating', '5'), (37, 39, 'rating', '5'), (35, 37, 'is_customer_note', '0'), (4, 6, 'is_customer_note', '0'), (5, 7, 'is_customer_note', '0'), (6, 8, 'is_customer_note', '0'), (7, 9, 'is_customer_note', '0'), (8, 10, 'is_customer_note', '0'), (9, 11, 'is_customer_note', '0'), (10, 12, 'is_customer_note', '0'), (11, 13, 'is_customer_note', '0'), (34, 36, 'is_customer_note', '0'), (13, 15, 'is_customer_note', '0'), (14, 16, 'is_customer_note', '0'), (15, 17, 'is_customer_note', '0'), (16, 18, 'is_customer_note', '0'), (17, 19, 'is_customer_note', '0'), (18, 20, 'is_customer_note', '0'), (19, 21, 'is_customer_note', '0'), (45, 44, 'rating', '4'), (46, 45, 'rating', '4'), (22, 24, 'is_customer_note', '0'), (23, 25, 'is_customer_note', '0'), (24, 26, 'is_customer_note', '0'), (25, 27, 'is_customer_note', '0'), (26, 28, 'is_customer_note', '0'), (2[...]      I'm pretty inexperienced in PHP and I'm probably going to need this broken down like I'm a little baby, just a precaution


How to empty debug.log when file size is above xyMB?

Sometimes I forget to empty my debug.log file (or that it exists) and after trying to get around a bug, I find it having simply too much content to open it in ex. the basic Windows Text Editor. Part of my wp-config.php file:               error_reporting( E_ALL );     define( 'WP_DEBUG',         true );     define( 'SAVEQUERIES',      true );     define( 'WP_DEBUG_LOG',     true ); // file: /core_root/wp-content/debug.log     define( 'WP_DEBUG_DISPLAY', true );      **Question:** Is there a way to do this via Wordpress, or do I have to do it with basic php functions?


Making custom post type visible for only logged in users

I'm making a custom post type which is intended to be viewed by logged in users only, I've created a single-{postType}.php to override the default rendering and has included a logincheck in the top which redirects to the login page and back, after login. I've not enabled archive for my post type, so I imagine I don't have to override the custom archive page in addition. And this seems to work as intended, and easy maintainable without any plugins or whatnot. But is this enough to make sure the posts won't be visible for unauthorized users? What possible viewmodes/url-paths does a custom post type have? Afaik, I have to make the post publicly_queryable = TRUE, as I want it to be visible on the front end, although, only for logged in users. I'm not sure if there is some trickery I can do with the settings for the custom post type, or specific queries I may use in the single-{postType}.php to fetch non public queryable posts?


How would I go about creating a user ranked post popularity page?

I currently run a music blog using Wordpress as my CMS and i'm looking to redesign the site in the very near future. Part of my plan for the redesign is to try and integrate a user ranking system for each blog post. Ideally registered users would be able to upvote or downvote songs (posts), with the results being shown on a separate, dedicated page where viewers could show the most popular tracks from the last day/week/month/year/all-time. The best analogy would be a hybrid between Reddit and Hypem (or even Stack's system) but hopefully with much less technical proficiency needed for its development. Are there any plug-ins that may be able to help me develop such an idea? If not could people suggest how I should go about coding it myself? I don't mind taking on such a project but I would love to know how to get started so I'm not wasting time unnecessarily. Thanks.


Theme Options Panels, What are some good examples from Frameworks or Premium Themes?

I really like https://github.com/devinsays/options-framework-plugin Does anyone know any other good implementations of an options panel from a Framework or from another premium Theme? I think its a major factor in deciding whether to use a theme. I'd like to get a good list of whats being done out there. Wordpress StackExchange Community, what are your thoughts in general this?


Custom Query for Taxonomy

What is the correct wpdb custom query for this:               taxonomy=pa_main-genre&post_type=product&orderby=name&order=asc      Basically i am trying to do is,list all the terms for pa_main-genre. Thank you very much


Unicode characters are saved in a funny way in the DB

I have a custom website in which I am using `wp_insert_post()` to manually create posts that have a title which has characters thare are non-English Unicode letters (Arabic to be more specific). The URL that gets created by `wp_insert_post()` is something similar to the following: http://example.dev/%d8%b1%d9%88%d8%b3%d9%8a%d8%a7-%d8%a7%d9%84%d8%b9%d9%85%d9%84-%d8%b9%d9%84%d9%89-%d8%a7%d8%a8%d8%aa%d9%83%d8%a7%d8%b1-%d9%84%d9%82%d8%a7%d8%ad-%d9%81%d8%b9%d8%a7%d9%84-%d8%b6%d8%af-%d9%85%d8%b1/ (note that I have permalinks enabled) Now, how do I prevent the above link from being saved as show? How do I ensure the Unicode characters are used instead of the %-and-number combination for each letter?


minimum code requirements for new template

I am trying to create a very light-weight wordpress template which loads the minimum code overhead from the wordpress stack. I would like to have my template recognize that its part of wordpress, so for example it knows when you are logged in as displays the logged in status. Also it detects when you are admin so it shows the admin bar. What are the minimum function calls required to achieve this?


Redirect to custom variable

I am currently working on a redirect function. At the moment users must be logged in to view any page of the site. If a user goes to an URL directly, for example: `www.mysite.com/?p=3467373`, it will redirect them to a custom login page which will be something like this: `www.mysite.com/login`. Once they have logged in I would like the user to be redirected to the page they originally tried to access. At the moment I have this:               if (!is_user_logged_in() && is_single()){              $_SESSION['HolUrl'] = $_GET["p"];         header('Location: http://www.mysite.com/login/?'.$_SESSION['HolUrl']);            }      This works fine and passes over the variable `p`. The part I am having problems with is the login redirect. I have this set up in my `functions.php` but for some reason it doesn't grab the variable `p`:               function my_login_redirect( $redirect_to, $request, $user ){              global $user;         if( isset( $user->roles ) && is_array( $user->roles ) ) {             //check for admins             if( in_array( "administrator", $user->roles ) ) {                 // redirect them to the default place                 return home_url().'/wp-admin';             } else {                 return home_url().'/?p='.$_GET['p'];             }         }         else {             return $redirect_to;         }     }     add_filter("login_redirect", "my_login_redirect", 10, 3);      Can anyone see any problems with the above?


Create a form with media Library on frontend

I have created a form for my custom post-type. There is a problem with uploading images. I don't know how to use media library. because media library has a good option which users can place images whereever you want. I have found that a good sample page for it. please see the 2nd picture. http://0.s3.envato.com/files/64830849/Screenshots/08_bf-easyadmin.jpg http://1.s3.envato.com/files/64830849/Screenshots/11_bf-easyadmin-additem.jpg <\------ This is what I need. If you have any experience or links, tutorial, please let me know. Thanks,


Get custom_user meta value and add entry

I created a custom user meat value and want to add a new key/value to this array. But somehow I can't get it to work correctly, I always get a new array in side the array so that I always have e new dimension. But I want to keep just one dimension and add the new key/value pair. I know this is nothing complicated but somehow I can't get it to work. I would appreciate any help. my entry script:               $invoice_meta = get_user_meta( $_GET['id'], 'invoices');     $random = substr(number_format(time() * rand(),0,'',''),0,5);     if(empty($invoice_meta)) {         $invoice_array = array();         $invoice_array[date('d.m.Y').'_'.$random] = $pdf_save_path.$pdf_name;         add_user_meta( $_GET['id'], 'invoices', $invoice_array);     } else {         $invoice_array = $invoice_meta;         $invoice_array[date('d.m.Y').'_'.$random] = $pdf_save_path.$pdf_name;         update_user_meta( $_GET['id'], 'invoices', $invoice_array );     }      The first entry var_dump looks like this:               array(1) {       [0]=>       array(1) {         ["07.05.2013_51584"]=>         string(69) "user-data/26/rechnung/tierportal-d_07-05-2013_587543369Y48693K_26.pdf"       }     }      after second one it looks like this:               array(1) {       [0]=>       array(2) {         [0]=>         array(1) {           ["07.05.2013_51584"]=>           string(69) "user-data/26/rechnung/tierportal-d_07-05-2013_5875448693K_26.pdf"         }         ["07.05.2013_37016"]=>         string(69) "user-data/26/rechnung/tierportal-d_07-05-2013_58754348693K_26.pdf"       }     }      But I want to look it like this               array(1) {       [0]=>       array(2) {         ["07.05.2013_51584"]=>         string(69) "user-data/26/rechnung/tierportal-d_07-05-2013_587543369Y48693K_26.pdf",         ["07.05.2013_51534"]=>         string(69) "user-data/26/rechnung/tierportal-d_07-05-2013_587543367Y48693K_26.pdf"       }     }


Sort posts by each day in the loop

I want to sort the posts in the loop by each day's posts. Since I have added filter to get posts from only last week, therefore there will not be repeating days (eg. There will be wednesday only once). For example: **Wednesday:** post 1, post 2. **Thursday:** post 1 post 2 How can I do that in the posts loop? I have simple loop to get the posts:               while (have_posts()): the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php     endwhile;


Is there a list of all possible WordPress URL's?

I'm looking for a way to find out how my WordPress site handles various incoming requests, some of which I have not written templates for. For example, there are a number of archive views (year, author, etc.) that I'm currently not using, but I still want to have control over what is displayed if a user (or attacker…) would "guess" such a URL. I can think of a few of them, but would ideally want a complete list I could go through, testing each URL against my site and evaluate the result. Is there such a list available?


Page permalink conflict with Date

I need to access a page which is name 2011. The trouble is that WP thinks that I am trying to read the 2011 posts of my blog. The only way I can make it work for the moment, is to change the permalink of my 2011 page to be mypage-2011. Is there anyway I can make/force WP to use 2011 as permalink for the page 2011, so it can be viewed via www.site.com/2011 thx s


Custom Nav Walker menu - Display children count

I have a custom walker menu.( See the code below) I would like to have my nav menu like this               ----------------------------------     Home | link1 | link2 | link3 (5)     ----------------------------------      Where `5` is the children count of link3. Can someone help me to implement this? Here is my current custom nav walker code.               <?php     /**      * Cleaner walker for wp_nav_menu()      *      * Walker_Nav_Menu (WordPress default) example output:      *
Home
      *
Sample Page</l      *      * Roots_Nav_Walker example output:      *
Home
      *
Sample Page
      */     class Roots_Nav_Walker extends Walker_Nav_Menu {       function check_current($classes) {         return preg_match('/(current[-_])|active|dropdown/', $classes);       }            function start_lvl(&$output, $depth = 0, $args = array()) {         $output .= "\n
\n";       }            function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {         $item_html = '';         parent::start_el($item_html, $item, $depth, $args);              if ($item->is_dropdown && ($depth === 0)) {           $item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"', $item_html);           $item_html = str_replace('', ' ', $item_html);         }         elseif (stristr($item_html, 'li class="divider')) {           $item_html = preg_replace('/]*>.*?<\/a>/iU', '', $item_html);         }         elseif (stristr($item_html, 'li class="nav-header')) {           $item_html = preg_replace('/]*>(.*)<\/a>/iU', '$1', $item_html);         }              $output .= $item_html;       }            function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) {         $element->is_dropdown = !empty($children_elements[$element->ID]);              if ($element->is_dropdown) {           if ($depth === 0) {             $element->classes[] = 'dropdown';           } elseif ($depth === 1) {             $element->classes[] = 'dropdown-submenu';           }         }              parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);       }     }          /**      * Remove the id="" on nav menu items      * Return 'menu-slug' for nav menu classes      */     function roots_nav_menu_css_class($classes, $item) {       $slug = sanitize_title($item->title);       $classes = preg_replace('/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', 'active', $classes);       $classes = preg_replace('/^((menu|page)[-_\w+]+)+/', '', $classes);            $classes[] = 'menu-' . $slug;            $classes = array_unique($classes);            return array_filter($classes, 'is_element_empty');     }     add_filter('nav_menu_css_class', 'roots_nav_menu_css_class', 10, 2);     add_filter('nav_menu_item_id', '__return_null');          /**      * Clean up wp_nav_menu_args      *      * Remove the container      * Use Roots_Nav_Walker() by default      */     function roots_nav_menu_args($args = '') {       $roots_nav_menu_args['container'] = false;            if (!$args['items_wrap']) {         $roots_nav_menu_args['items_wrap'] = '
%3$s
';       }            if (current_theme_supports('bootstrap-top-navbar')) {         $roots_nav_menu_args['depth'] = 3;       }            if (!$args['walker']) {         $roots_nav_menu_args['walker'] = new Roots_Nav_Walker();       }            return array_merge($args, $roots_nav_menu_args);     }     add_filter('wp_nav_menu_args', 'roots_nav_menu_args');


Events: Check for other event with same start date and category

I am using The Events Calendar and (correct me if I'm wrong) there is no checking to see if an event has a time conflict with another event that's already been entered. For example, if there is already an event with a certain start time in a category, there cannot be another event posted with the same start time and in the same category. That would be a conflict. Is there any way I can check values in the database for start time and category when the event post is submitted, and if both those values already exist for a post, kick the user back to the Add Event page? EDIT: Here is what I am attempting to use in the functions.php file as the original save_post hook:               add_action('save_post', 'nu_time_conflict');          function nu_time_conflict($post_id) {         $prevent_publish = NULL;         if (isset($_REQUEST['EventStartDate']) && isset($_REQUEST['EventStartHour']) && isset($_REQUEST['EventStartMinute'])) {                 $start_date = date( TribeDateUtils::DBDATETIMEFORMAT, strtotime($_REQUEST['EventStartDate'] . " " . $_REQUEST['EventStartHour'] . ":" . $_REQUEST['EventStartMinute'] . ":00") );         } else {             die('Ingen datum valde.');         }         if (isset($_REQUEST['EventEndDate']) && isset($_REQUEST['EventEndHour']) && isset($_REQUEST['EventEndMinute'])) {                 $end_date = date( TribeDateUtils::DBDATETIMEFORMAT, strtotime($_REQUEST['EventEndDate'] . " " . $_REQUEST['EventEndHour'] . ":" . $_REQUEST['EventEndMinute'] . ":59") );         } else {             die('Ingen datum valde.');;         }         //Query post type 'tribe_events' to check for posts whose meta values match the POSTed ones         $args = array(           'post__not_in'=> array($post_id),           'post_type' => 'tribe_events',           'post_status' => array('publish','pending','future','private'),           'meta_query' => array(               'relation' => 'OR',               array(                 'key' => 'EventStartDate',                 'value' => array(strtotime($start_date),strtotime($end_date)),                 'compare' => 'BETWEEN'               ),               array(                 'key' => 'EventEndDate',                 'value' => array(strtotime($start_date),strtotime($end_date)),                 'compare' => 'BETWEEN'               )           )         );         $existingMeta = get_posts( $args );              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )          return;              if(empty($existingMeta)){             remove_action('save_post', 'nu_time_conflict');             wp_update_post(array('ID' => $post_id, 'post_status' => 'pending'));                   $current_user = wp_get_current_user();                  $user_mail = $current_user->user_email;             $admin_email = get_option('admin_email');             $type = get_post_type( $post_id );                  if (( !wp_is_post_revision( $post_id )) && ($type = 'tribe_events' )) {                              $to = array($user_mail, $admin_email);                         $subject = 'Ny bokning';                         $message = $current_user->user_firstname.' '.$current_user->user_lastname.' har skapat en ny bokning.
';                         $message .= 'För att redigera gå in på ' .get_permalink($post_id).'

';                         $message .= 'OBS! Bokningen är inte giltig utan att bli bekräftad av administratören.';                         wp_mail($to, $subject, $message );                 }                       add_action('save_post', 'nu_time_conflict');             $prevent_publish = FALSE;         } else {            $prevent_publish = TRUE;           }              if ($prevent_publish) {                 remove_action('save_post', 'nu_time_conflict');                 wp_update_post(array('ID' => $post_id, 'post_status' => 'draft'));                 add_action('save_post', 'nu_time_conflict');             }              }      And here would be my redirect and custom message:               add_filter('redirect_post_location','nu_redirect_location',10,2);              function nu_redirect_location($location,$post_id){             if (isset($_POST['publish'])) {                 $status = get_post_status( $post_id );                      if($status=='draft'){                     $location = add_query_arg('message', 10, $location);             }             }             return $location;         }                  add_filter('post_updated_messages', 'nu_custom_messages');                  function nu_custom_messages($messages){                      $messages['tribe_events'][10] = 'Den valda tiden är inte tillgänglig. Välj ny tid';                    return $messages;             }      It either isn't doing the comparison to check if those dates exist, or there is something wrong with my IF statement. It thinks all entries are valid and sends emails, and I am purposefully putting wrong ones in. So the posts aren't being marked as drafts, and the message is the one for a successful post. (The emails are also sent when the page is loaded, before any data is sent. What is with that? Should I not be using save_post?) Any help is greatly appreciated. Since The Events Calendar has no availability function as far as I can tell, getting this to work would be perfect.


Refresh external feeds only in cron?

Is there an easy way to ensure that external feeds (via `fetch_feed()`) are only fetched via cron, and not when a regular user visits the site? This is for performance reasons, I want to minimize the page load time. The only time a feed should load in a normal request are probably when the cache is empty (the first time it is loaded) and maybe when a logged in user is visiting the page (because I will be the only one with a user account).


How to use get_template_part()?

Could someone please explain to me how this function works? I know what it does but when I look at the source code in the twenty_ten template, I don't get how all loops are being collected in one single loop.php ( I saw that file too). So how do for instance abstract away a certain common part of template and then reuse it across other templates?


Adding a querystring to an image URL when clicking 'insert into post'?

I have written a plugin which does some fancy stuff with GD lib when you upload an image. Everything is working fine, however I need to get the image title and add it to the image URL (and file name of the image) when the user clicks 'insert into post', but can't find any references which could help me.


How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?

I know the question is quite ambiguous. Let me explain: I have a page that lists all posts with a certain value of a custom field. (Eg.: The page `Rentals` lists all posts with the value `rental` of custom field `offer_type` ). I'd like to add a filtering option by city, so that only posts with a certain value of `city` custom field get displayed. For this I created a form using the `get` method that builds a custom query (in my ex. with two custom fields, 'offer_type' and 'city'). **What I need** is a way to list all the cities (values of `city` custom field) for the posts with the `rental` value of `offer_type`. Each city has to be listed once. I tried this bit of code (note that I took all the form wrapping out):               $metakey = 'city';        $cities = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value                 FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );             if ($cities) {                         foreach ( $cities as $city ) {                      echo $city;                 }             }      but this lists all the values of `city` custom field for all the posts (so if for eg. I have a post with value of `offer_type` different than `rental`, its value of `city` custom field will be displayed in my list). I know the issue revolves around sql queries and joining tables, but I really lack the skills to solve this problem. Please help!


Query Posts to fetch Posts with Unique Tag

I am trying to write a query post such that it returns a list fixed list of posts from a category along with any of the one tag associated with it. For eg:               <?php $arg = array('cat' => '1','showposts' => 10,'offset' => 0); query_posts($arg); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>     <a class="post-link" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?>     <?php $posttags = get_the_tags(); $count=0; if ($posttags) { foreach($posttags as $tag) { $tag_link = get_tag_link($tag->term_id); $count++; if ($count == 1)      { echo 'term_id).'">#'.$tag->name.''; } } } ?>       ### Posts in Topic A Post_Title_1 #tag1   Post_Title_2 #tag2   Post_Title_3 #tag3   Post_Title_4 #tag2 <\-- I don't wan't this Post one as Tag2 has been displayed already. The issue is I want only posts with unique tags to be shown.... How can i do that... Please help


Using wp_set_auth_cookie for custom user account system

I've built a custom user account system using a custom post type. I was wondering whether it is safe to use the built-in function `wp_set_auth_cookie($user_id, $remember, $secure)` Wordpress uses for the built-in user system. For `$user_id` I figured I could use the post id. But wouldn't this clash with the existing system? Is there a nifty trick to keep the default user cookies from clashing with the custom user cookies or shouldn't I use this function at all?


Arguments ignored/markup changed in wp_nav_menu if no menu is selected

I've created a menu using wp_nav_menu in my theme using the most simple setup as possible:               wp_nav_menu( array( 'theme_location' => 'my_theme_top_menu') );      And in my functions.php:               register_nav_menus(         array('my_theme_top_menu' => 'Top Menu' )     );      However, I'm running into strange behaviour when the user creates a menu in wp-admin and assigns it to this menu. When you first select the theme, it defaults to the default menu built from pages, the markup looks like this:

                About Us      But, if a user selects one of their pre-defined menus the markup that builds the menu completely changes:

                    Home
      Why is this happening? It's like when uses a defined menu WP menu it WP defaults(or settings I've defined), yet when there is no defined menu and it falls back it uses a different, bastardized set of options which I haven't actually set anywhere myself.


Search breaks when querying main loop for category

In my theme I provide an option for users to set a 'blog category' that queries and displays only posts from that category on `index.php` using `WP_Query`:               $shortname = get_option('of_shortname');     $cat_option = get_option($shortname.'_cats_in_blog');     $catid = get_cat_ID($cat_option);     $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;     $args = array(        'cat' => $catid,        'paged' => $paged     );          $query = new WP_Query( $args );          // Queries fine, but search stops working            while ( $query->have_posts() ) : $query->the_post();          // Loop stuff here          endwhile;      This works well, but the search widget breaks. I have also tried using `query_posts` but that has the opposite effect; the queried category isn't shown but the search still functions. Here's that code:               $shortname = get_option('of_shortname');     $cat_option = get_option($shortname.'_cats_in_blog');     $catid = get_cat_ID($cat_option);          // Search is working, querying is not     global $query_string; // required     $posts = query_posts($query_string.'&posts_per_page=3&cat=$catid');          while ( $query->have_posts() ) : $query->the_post();          // Loop stuff here          endwhile;      I checked the `$catid` variable and it is returning what is should. Am I querying the wrong way or in the wrong place? Any help is greatly appreciated, thanks in advance.


how to include other jquery file and css file in wordpress plugins

I have jquery file like as follows "portfolio.css"   "jquery-ui-1.8.18.custom.css"   "portfolio.js" I want to include these files into my plugin... if anyone have solution for how to include above mentioned file into wordpress plugin then tell me.... please.... thank you in advance


Why to check if function doesn't exists in functions.php?

I see in the twentyeleven theme, before most custom functions they check if it exists               <?php if ( ! function_exists( 'twentyeleven_comment' ) ) :     function twentyeleven_comment( $comment, $args, $depth ) {      Why is that?


Custom Page Template for "Older Posts" Pages

My home page feed has a variety of items including a featured post and other features that I'd only like present on the home feed. When a user clicks on pagination to load older posts, I'd like to load up a new page template without all the home page bells and whistles. Is there a WP template file I'm overlooking or is this not supported?


How To View Site from Non-Logged-In User's Perspective

I am working on anew blog. I am logged in as administrator, and above every post there is a option to 'edit this entry'. Can I have WordPress set up so that even is I am logged in as administrator, I will still view the front end of the website as if I was not logged in. This was I can see how the user would see the page. One option is to just view the website in another browser, but I guess there has to be another page.


Advice for a Newbie Wordpress Web Designer/ Themes?

I am digging into a freelance career and I would like to know what the best advice is out there when it comes to buying themes for clients? What is the best practice? Themeforest? Bundles? What should be my criteria when choosing themes to develop and offer to clients?


How can I make posts visible only to specific users (not roles)?

I've tried the "User Specific Content" plugin, but it shows the post titles to everyone, even though it hides the post content. Tried "S2Member," but it's pretty clunky, and I believe it changed the post titles to "Private," but still showed them in the list. I tried this: http://www.smashingmagazine.com/2012/01/27/limiting-visibility-posts-username/ But it appears to be outdated, didn't work. Surely there is a good way to go about doing this? I would have thought that this would be a more common use case.