title: Display the latest content from subpages of another page

text: I know how to display content from one page on another page. Here is the code I use to display the last three video-titles, submitted to my video-page, on another page (using Advanced Custom Fields for the content)               <?php     $other_page = 5;     ?>     <?php if(get_field('video', $other_page)): $count = 0; ?>     <?php while (the_repeater_field('video', $other_page)): $count++; ?>     <?php the_sub_field('video_title'); ?>           <?php if($count==3) break; ?>        <?php endwhile; ?>     <?php endif; ?>       But what I want to do is to display content from the last three video- subpages, and not just the content displayed on the video page itself. Does anyone know how to do this? :)


title: Add custom taxonomy as a css class

text:
On a custom post type archive I'm trying to add the custom taxonomy terms slug as a css class to the tag. I've managed to get it to output the page->ID but struggling to get the $term->slug to work. Feel like I'm missing something really simple. Here's the full code, thanks for any help:                    <?php          $parent_pages = get_pages( array( 'parent' => 0, 'post_type'=> 'archive', 'orderby' => 'menu_order' , 'order' => 'ASC', 'sort_column' => 'menu_order' ) );     foreach ( $parent_pages as $parent_page ) {               echo '
post_name;     echo '">';          echo $parent_page->post_title;     echo '
';      echo '
';          $all_pages = get_pages(array( 'post_type'=> 'archive',  'orderby' => 'menu_order' , 'order' => 'ASC', 'sort_column' => 'menu_order' ) );     $child_pages = get_page_children($parent_page->ID, $all_pages );     foreach ( $child_pages as $child_page ) {            $terms = get_the_terms( $child_page->ID, 'media' );        var_dump($terms);       echo '
slug .'">';           echo '';            echo get_the_post_thumbnail( $child_page->ID, 'medium');            echo '';                   echo '
';       echo $child_page->post_title;       echo '
';       echo '
';     }          echo '
';       }       ?>


title: Getting featured image of particular size.

text: For my site I use WordPress 3.6, and a wp-bootstrap theme that is built on bones framework. When I set a featured image for a particular post, I see that the image is automatically saved at 6 different sizes: Dashrath-Manjhi.jpg (Original Image)   Dashrath-Manjhi-620x400.jpg   Dashrath-Manjhi-300x197.jpg   Dashrath-Manjhi-250x300.jpg   Dashrath-Manjhi-150x150.jpg   Dashrath-Manjhi-125x125.jpg **Q#1:** How to call a particular image using `the_post_thumbnail()`? `the_post_thumbnail('small')`, `the_post_thumbnail('medium')`, `the_post_thumbnail('large')` always displaying the full size image. I also gone through the theme documentation, I can't find how can I call. **Q#2:** I would like to know whether this is WordPress based, or theme based? Any ideas on how can I get the image of particular size using `the_post_thumbnail()` function would greatly be appreciated.


title: WordPress product catalog site

text: I need to create an e-commerce site with WordPress, but not 100% e-commerce. It is just a catalog site without shopping cart. Users can see various products on the site, for example, car showcase website.   I am a newbee to WordPress. To build such kind of site:   * What is a good start point to study?    * What plugins do I need to install?    * Do I need to install wp-ecommerce plugin? I appreciate for any help and suggestions.


title: Execute a function when the entire page is displayed

text: How can I execute a function, which is in a plugin, only once the entire page is displayed ?


title: Add custom field for author and show list author order by that field

text: I am using variables `$author_like_count` to count like from all post of author.               $author_like_count = $author_like_count + get_post_meta($post->ID, 'like_count', true);      My question : How to set `$author_like_count` as a custom fields in author profile. Then we can show this variables value in author page ! One more question : How to show list author of website and order them by that variables `$author_like_count`. Could anyone suggest me on this matter?


title: Pagination with custom post type not working

text:
For some reason I can'g get pagination using previous_posts_link and next_posts_link working. Here is the code I have...               <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>          <?php // The Query     $the_query = new WP_Query(     array(         'post_type'=>'article',         'posts_per_page'=>2,         'orderby'=>'date',         'paged'=>$paged     )     );          // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();          if($the_query->current_post == 0 && $paged == 1) :     ?>

LATEST ARTICLE:

<?=the_title(); ?>

                 <?php proagent_posted_on(); ?>

                 <?=get_the_content_limit(300, 'More'); ?>

<?=get_the_term_list($post->ID , 'topics', 'Topics: ',', '); ?>

         <?=the_post_thumbnail('feature-post-thumbnail'); ?>
          <?php else: ?>
         <?=the_post_thumbnail(); ?>

<?=the_title(); ?>

                 <?php proagent_posted_on(); ?>

                 <?=get_the_content_limit(300, 'More'); ?>

<?=get_the_term_list($post->ID , 'topics', 'Topics: ',', '); ?>

     <?php endif; ?>          <?php endwhile; ?>
<?php previous_posts_link('« Newer Articles') ?>

<?php next_posts_link('Older Articles »') ?>
           Also.. just noticed it works when I go to /articles/page/2 there is a link to /articles/ like there should be but from the /articles/ page there is no link to page 2.. WHY? PLEASE help if you can... this is driving me crazy. Thanks! mark.


title: Prevent WordPress from using resized/compressed versions of uploaded images

text: I am uploading an .jpg image to a page and selecting 'Full Size - 800 x 381' under 'ATTACHMENT DISPLAY SETTINGS'. However, when previewing the page I look at the source code and I see after the image filename in the img src: `?resize=800%2C381`. ( i.e. `<img src="http://domain.com/wp- content/uploads/2014/04/filename.jpg?resize=800%2C381">` ) It seems that WP is still compressing the image as the quality is worse than the original image on my computer. I have downloaded the plugin WP Resized Image Quality to increase the compression-level of uploaded images to 100% but `?resize=800%2C381` is still appearing after the image filenmae in the source code and the quality is not as good as the original. **How can I stop WP auto compressing my uploaded .jpg images?**


title: How to replace "wp-content/blogs.dir" with "media" for attachment permalinks?

text: How to replace "wp-content/blogs.dir" with "media" for attachment permalinks in a multisite environment? This is how links look now: http://url.com/wp-content/blogs.dir/21/files/2011/06/650026_x640_21.jpg _-or-_ http://subdomain.url.com/wp- content/blogs.dir/21/files/2011/06/650026_x640_21.jpg Ideally this is how the would look: http://url.com/media/2011/06/650026_x640_21.jpg _-or-_ http://subdomain.url.com/media/2011/06/650026_x640_21.jpg Thank you!


title: Custom Wordpress File Inclusion

text: I'm creating my own wordpress theme. I've decided to use a different way to handle the theming and not use the standard get_header() and so functions. What i do is have a general main.php page that is loaded by every page like blog.php, index.php, page.php and more. This main page, will be then responsible for creating the necessary templates and presenting the related page. Now, i would ideally want to create sort of like the standard switch that includes files, like :               $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 'home';          switch($page)     {         case 'home':           break;         case 'mail':           break;         case 'contact':        break;         default:             $page = 'home';     }          include("$page.php");      How can i do such a thing for wordpress ? Is there a clean way to know whether an included page is a blog.php, a single.php or other page, so that i can distinguish them?


title: WordPress front end AJAX. Return 0 :?

text: I have create the appropriate code to handle AJAX request on WordPress but I get 0 as responce from the server. My plugin code is here:               class my_plugin     {         function my_plugin()         {             add_action('wp_ajax_do_ajax', array($this, 'do_ajax'));             add_action('wp_ajax_nopriv_do_ajax', array($this, 'do_ajax'));             add_action('wp_head', array($this, 'init'));         }              function init()         {             ?>             <script type="text/javascript">                 var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";             </script>             <?php         }              function do_ajax()         {             print_r($_POST);             die();         }     }          $mp = new my_plugin();      This is my jQuery code:               jQuery(document).ready(         function($)         {             $.ajax(                 {                     type: "POST",                     url: ajaxurl,                     data: {action: "do_ajax", some_data: "some_value"},                     success: function(e)                     {                         console.log(e);                     }                 }             );         }     );


title: My UPDATED content ONLY shows when I am signed in.

text: Good Day, as mentioned in my title, my webpage Lasnersport.com only shows it's updated content when i am signed in. When not signed in it shows context from months ago as its current.


title: WordPress Subpages Fancybox Trouble

text: I have a website that I'm converting over from a static html site to WordPress. I got almost everthing done, but I'm having trouble with there "about us" page. When you click on their profile it opens up a html iframe about their bios. The current "about us" page I have created sub pages for the bios in WordPress , but it keeps the current style of the site instead of the style that they have for the bios. What's the best path I could take to solve this problem?


title: How do I implement an image viewer and rotator?

text: I am currently in the process of redesigning a WordPress site. There is a thing I want to have on my new site that I see all the time on other sites. Take a look at http://muvere.com/ and http://www.ibm.com/us/en/. Notice the image viewer and rotator thingie - is there a name for this thing? It is some kind of mechanism for displaying a variety of images and text, and automatically rotating between them. It seems to me like this would be an easy thing to implement in my web site. Is there a plugin that makes it easy? It's hard for me to research this topic on my own because I don't know what the thing that I want is called.


title: How to: get_user_meta - BuddyPress

text:
What is the proper way to display User Meta in the BP Loop using this line from codex?                <?php get_user_meta($user_id, $key, $single);  ?>      I added that line to the profile loop and switched those values with ones from my DB and nothing happened. What am I doing wrong?               <?php        $user_id = 9;       $key = 'last_name';       $single = true;       $user_last = get_user_meta( $user_id, $key, $single );        echo '
The '. $key . ' value for user id ' . $user_id . ' is: ' . $user_last . '
';      ?>


title: Refine/Filter the Search Results by Category

text:
I am currently creating the process of a function which allows one to refine results, Namely by category. Similar to themeforest.net refine the search results. When i gave as search term "Hello" and search in Category A, D, F, E, than are the filter displayed by the results (in those categories only where the search indeed available), and then when one press on the filter by Category D, then refines it the search results and shows only the result from the Category D. My only problem is that when my Url shows like this and i search by this cats:               ...&orderby=relevance&order=desc&adv_tag=0&adv_cat_52=on&adv_cat_57=on&adv_cat_58=on&adv_cat_53=on&adv_cat_56=on&...      then is the problem, that when i click on the refine filter, that this cats in the url not removed, but the clicked cat is added to the url. when i remove the other cats, then works as excepted. With which Rewrite/Remove Rule/Function can i solved this problem. I think with remove_query_arg or?               <?php           $filter_cats=array();     $i=0;                      while (have_posts()) : the_post();                     foreach((get_the_category()) as $category) {          $id = $category->term_id;     $cat = 'adv_cat_'.$id.'';          $base_url = remove_query_arg(array($cat));          $url = $base_url;          $url = $url;               $categores =  'cat_ID.'">'.$category->cat_name.'';                           $filter_cats[$i] = $categores;                      $i++;                     }                 endwhile;                       $filter_cats = array_map("unserialize", array_unique(array_map("serialize", $filter_cats)));                         //Einträge zählen          $anzahl=count($filter_cats);                    $i=0;     while($i<$anzahl){                       echo"<fieldset>{$filter_cats[$i]}</fieldset>
";             $i++;     }


title: How to solve a conflict between a plugin and a theme?

text: I'm using Photospace as a gallery slider within my hatch pro wp theme (you can check here). The default transition effect between slides is a crossover effect (like this example), but the effect in my slider seems to be image fade to white, then white fades to image. Not sure why this is happening. Here is the code that calls other scripts:                   /* Enqueue scripts (and related stylesheets) */          add_action( 'wp_enqueue_scripts', 'hatch_pro_scripts' );     function hatch_pro_scripts() {          if ( !is_admin() ) {              /* Enqueue Scripts */         wp_enqueue_script( 'hatch_pro_fitvids', get_template_directory_uri() . '/js/fitvids/jquery.fitvids.js', array( 'jquery' ), '1.0', true );                   /* Enqueue Fancybox */         if ( hybrid_get_setting( 'hatch_pro_fancybox_enable' ) ) {             wp_enqueue_script( 'hatch_pro_fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.pack.js', array( 'jquery' ), '1.0', true );                  wp_enqueue_style( 'hatch_pro_fancybox-stylesheet', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.css', false, 1.0, 'screen' );             wp_enqueue_script( 'hatch_pro_footer-scripts', get_template_directory_uri() . '/js/footer-scripts.js', array( 'jquery', 'hatch_pro_fitvids', 'hatch_pro_fancybox' ), '1.0', true );          } else {             wp_enqueue_script( 'hatch_pro_footer-scripts-light', get_template_directory_uri() . '/js/footer-scripts-light.js', array( 'jquery', 'hatch_pro_fitvids' ), '1.0', true );            }     }      } How can I resolve this? I'm comfortable with CSS, but not so much with PHP or other heavier coding.


title: Is there a real life use case for post formats except for microbloging?

text: I am trying to write a guide for using wordperss and can't quiet figure how explain the usage of post formats. I read all the documentation available on the web and then played with twentytwelve and woothemes's skeptical theme (on wordpress.com) and I was far from being impressed with the results. My main misunderstanding is based on the fact that except for the status format the other formats can be auto detected from inspecting the content and length of the post, and the status format is useless in a single author site. Can people provide real life use cases for the various post formats, or do you think the feature is not mature enough yet to be described in detail in any general wordpress usage guide?


title: Show full image thumbnail

text: How can I set full image thumbnail on category pages? Image should be small in dimensions but not been cropped. Currently my theme WP-Davici (Solostream) use "Get The Image" plugin to generate thumbnail. you may have a look at http://ideabroad.com/


title: Is server side Javascript possible with wordpress

text: Is it possible to run JavaScript server side on wordpress. I have about 5,000 lines of Javascript that I would like to run on the server, rather than the client (browser). 5,000 lines is a lot of code to convert to PHP, so looking for other solutions. Converter: I searched for a converter that might be able to auto convert some of the code. But there does not look to be anything available. Node js: I know node js runs server-side javascript. There is a post about integrating php and node js. http://webandphp.com/IntegratingNode.jswithPHP


title: Restrict ability to edit pages by username

text: I'm looking for a plugin or snippet with the following function: There is a WordPress Website with approx. 30 registered users. Every user get 2 Pages to edit his or her Products. Everyone can view the content but only the registered user can edit his oder her own Pages. Example: Peter can edit Page Id 222, Page 223 Tom can edit Page Id 224, 225 Admin can edit all All Pages will be shown to all unregistered Users Is there a PlugIn which allow this setting? The most Member Plugins I have seen, only allow to set roles and hide or view the content for other users. Thank you for your help! Cheers Marco


title: Is the wordpress user-model changed in wpmu?

text: I'm running wpmu on heroku using a postgres extension. It works great, but I have a plugin that needs to get the userId based on the e-mail-adress. This is how it does it:               $sql = 'SELECT id FROM ' . $wpdb->users . ' WHERE user_email=\'' . addslashes($from) . "' LIMIT 1;";     $user_ID = $wpdb->get_var($sql);      $wpdb->get_var($sql) returns nothing. I'm trying to figure out why.


title: What is basic structure of xml for importing a page in wordpress?

text: I am trying to import file from xml to word press i need to know waht is sturcture for importing the xml file into a page in wordpress


title: Get current category details the user is currently on in category.php

text: I want to get the current category details that the user is on in category.php.               $category = get_the_category();     $slug  = $category[0]->slug; // Why is this an array ?      In most cases (where there are no sub-categories) it returns and array of single length. But if there are sub-categories it (parent category and ) returns an array of 2 or more.               http://domain.com/category/cat-name/ -> get_the_category() returns an array of 2     http://domain.com/category/cat-name/sub-cat-name/ -> get_the_category() returns an array of 2


title: Can I make a search query which includes a space?

text: I want to search via `WP_Query` for the test "hello " including the last trailing space. Is this possible and if so, how do I do this?


title: How to add an admin alert for missing plugins

text: I'm trying to add an admin alert that reminds the user to install a certain plugin in case it is missing. I have found a way to generally add an alert box:               function addAlert() { ?>          <?php } add_action('admin_head','addAlert');      How do I only make it appear if the plugin is missing? I was thinking about something in the lines of `<?php if ( function_exists('...') ) ?>` but I am not too sure. I also need a way of adding a link to the plugin and a link to dismiss the box.


title: Post preview gives 404 when permalinks are purely date based

text: I have an issue pertaining specifically to the situation in which permalinks are set to be based only on publication date. My permalink structure is as follows: /%year%%monthnum%%day%/ When I try to preview a post, I get 404. The issue does not come up when I add other URL tags to the structure, like post ID or post name. I have already tried to diagnose the issue and one thing that came up was that Wordpress may be treating URLs consisting only of date tags as date archive pages. Indeed, is_date() returns TRUE when a post page is displayed. Is there a way around it that does not involve changing permalink structure? Thanks for help.


title: How to Publish WP original Source metabox value on front-end webpage

text: I use a plugin called WP original Source. It lets me add the URL of the original article source, which is handy as it credits the original source of article extracts and summaries that I publish of my website. This URL is then published as metadata in the source code of my webpage, such as:               <meta name="original-source" content="http://www.abc.com.au/article.html">      However, I also want to publish this URL at the bottom of the article extract itself, so that users who read the article extract and want more information, can click the link and get taken to the original full article. I can't work out how to do this however, being only a novice at php. I did manage to code the following, however instead of getting the URLs, I get the word "array"               $originalsource = get_post_meta(get_the_ID(), '_original_source', true);     echo $originalsource;      Can someone help me work out what php code I need to insert into the single.php form for the URL of the original source to be published as a visible URL, as well as the metadata statement?


title: Search through documents folder

text: Does anyone know why the following returns nothing?               <?php          $dir = get_bloginfo('template_directory') . "/documents/*";         foreach(glob($dir) as $file) {             echo $file;           }     ?>      I have files in the documents folder... Thanks in advance!


title: Exclude add_filter from the admin

text: I've created a custom filtering facility for a front end search, which also includes a specific user group. To add the function to the search I have used               add_filter('pre_get_posts','my_filter_the_search',10,1);          function my_filter_the_search($query){              $post_type = filter_input(INPUT_GET, 'post_type', FILTER_SANITIZE_STRING);              if($post_type == 'document'):                  add_filter( 'posts_search', '__search_by_title_only', 500, 2 );                  //Get array of slugs of checked terms             $terms = (array) $_GET['post_type'];                            //Tax_query array             $tax_query = array(array(                 'taxonomy' => 'access',                 'terms' => 'basic-user',                 'field' => 'slug',             ));                       //Tell the query to filter by tax             $query->set('tax_query', $tax_query);                  return $query;              endif;     }      This appears to be effecting the listing of a custom post type in the backend. How do I only use this for the front end of the site?


title: WP_Query with several meta_query-statements and order by meta_value

text: This is my query:               $the_query = new WP_Query(         array (             'post_type'         => 'pass',             'posts_per_page'    => '-1',             'post_status'       => 'publish',             'orderby'           => 'meta_value',             'meta_key'          => 'start_time',             'order'             => 'ASC',             'meta_query'        => array(                 'relation'      => 'OR',                 array(                     'key'       => 'event',                     'value'     => $tmp_posts->ID,                     'compare'   => '=='                 ),                 array(                     'key'       => 'meeting_type',                     'value'     => 'other',                     'compare'   => '!='                 )             )         )     );      My problem is this query does not order the posts by start_time. If I remove the second meta_query array (and the 'relation' => 'OR') then the orderby works great. Why is that? If I var_dump $the_query this is the query outputted:               SELECT wp_posts.*     FROM wp_posts     INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id     INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)     INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id)     WHERE 1=1 AND wp_posts.post_type = 'pass'         AND (wp_posts.post_status = 'publish')         AND (wp_postmeta.meta_key = 'start_time'             OR (mt1.meta_key = 'event'             AND CAST(mt1.meta_value AS CHAR) = '10011'         )         OR (             mt2.meta_key = 'meeting_type'             AND CAST(mt2.meta_value AS CHAR) != 'other')         )     GROUP BY wp_posts.ID     ORDER BY wp_postmeta.meta_value ASC      How can I get this to order my posts by start_time?


title: How to add rewrite rules adjust to permalink structure

text: I want to create an Archive Widget for Custom Post Type (product). I let my client to change permalink structure by himself. So, my question is: how to add rewrite rules adjust to permalink structure?


title: WordPress front-end media (image) upload ERROR!

text: I pasted my codes **HERE** in Pastebin. Thing is that, I have posts, where the post thumbnail is the first image and the custom fields are used to store the other 3 images of the post. The form fields are working, because I could change/edit the fields, but the problem is with the media uploader. By the time I'm uploading an image it's not taking the image, but storing an error message to the database: > O:8:"WP_Error":2:{s:6:"errors";a:1:{s:12:"upload_error";a:1:{i:0;s:212:"File > is empty. Please upload something more substantial. This error could also be > caused by uploads being disabled in your php.ini or by post_max_size being > defined as smaller than upload_max_filesize in > php.ini.";}}s:10:"error_data";a:0:{}} But I used advanced custom fields plugin, and that's working properly with the same image, and the WordPress default media uploader is working too with the same image file. So, I think there is no restriction like max_filesize in my localhost. And also, I tried this on the server, and it's till working the same. I failed to upload an image. **What's the problem in my code?**


title: display post tags on single.php inside loop

text:
I want to display the tags of the current post in the single.php and do the following:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>

<?php echo get_post_meta($post->ID, 'subline', true) ?>

<?php echo wp_get_post_tags($post->ID); ?>
      <?php endwhile; endif; ?>       and everything just works fine, except the `wp_get_post_tags` method. All I get displayed inside the `.single_tags` is the string `Array`. I am new to wordpress and would like to know what I am doing wrong. Thanks


title: How I can show short content with short tag

text: I am using wordpress I want to show ** short content with limit ** of wordsfor every post on home page for this I am using this code functions.php               function abc_the_content($num_words) {          $get_the_content = get_the_content();     $striptag_from_content = strip_tags($get_the_content);     echo $content = wp_trim_words($striptag_from_content, $num_words = $num_words, $more = null)}      home.php                abc_get_content(100);      Its showing content perfectly but when I am using               [gallery]          shortcode inside post editor its showing me same as text rather then showing gallery.THis is also issue in if i am using vemio vedio tag because its strip my tag. I just want to strip image tag from editor not any other tag like vemio.or gallery short code How i can modify my function PLease provide me your valuable answer Thanks USING


title: How to use wordpress content class?

text:
Sponsor

This is new post

This is new post

This is new post

This is new post

This is new post

This is new post

      I like to make my widget like this code. But problem is here I can't use widget content like bellow. How can I give sidebar content div with "sidebar_area" class.

Sponsor


title: Why would switch_to_blog stop working?

text: I'm using the Multisite functionality of WordPress 3.0, and I have a network of sites built where I display one random post from one of the subsites on the main site's front page. I accomplish this, in part, by using the `switch_to_blog` function from the old WPMU function list. Up until yesterday I could call a function that called `switch_to_blog`, created an array, added the blog's name, the post details, the post thumbnail, etc. to the array, and then used `restore_current_blog` to jump back to the main blog's context. Then I used that array to echo out the things I needed for that post I grabbed. It worked fine. All of a sudden, when I call `switch_to_blog` and then from within that block I call `bloginfo()` just to test it, it still echoes the name of the top level blog, and NOT the switched to blog. Is that function completely deprecated and unworkable due to random bugs? Anyone have any insight or ideas to get around it, or do I need to write a custom `$wpdb->get_results();` query to get around this? Thanks!


title: Multiple Queries with meta_query

text:
I am trying to list posts in category 'Featured1314' split into two lists, upcoming events are >= todays date, past events are < todays date. I have added custom fields to the posts with the name of 'concert_date' and the values match the date format Ymd (ex: 20140611) The code I am using below is close, the first query has the correct results, but the second query results are duplicates of the first query.
2013-14 Concert Season
             <?php                 $today = date('Ymd');                 $args1 = array(                     'type' => 'post',                     'category_slug' => 'Featured1314',                     'meta_key' => 'concert_date',                     'meta_query' => array(                         'relation' => 'AND',                             array(                                 'key' => 'concert_date',                                 'value' => $today,                                 'compare' => '>='                             )                         ),                     'orderby' => 'meta_value_num',                     'order' => 'ASC'                     );                 $upcoming_query = new WP_Query($args1);                  if( $upcoming_query->have_posts() ) { ?>
Upcoming Concerts

<?php while ( $upcoming_query->have_posts() ) { $upcoming_query->the_post(); ?>                 <li id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php the_excerpt() ?>

             <?php } }?>
             <?php                  rewind_posts();                 $today = date('Ymd');                 $args2 = array(                     'type' => 'post',                     'category_slug' => 'Featured1314',                     'meta_key' => 'concert_date',                     'meta_query' => array(                         'relation' => 'OR',                             array(                                 'key' => 'concert_date',                                 'value' => $today,                                 'compare' => '<'                             )                         ),                     'orderby' => 'meta_value_num',                     'order' => 'ASC'                     );                 $past_query = new WP_Query($args2);                  if( $past_query->have_posts() ) {?>
Past Concerts

<?php while ( $past_query->have_posts() ) { $past_query->next_post(); ?>                 <li id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php the_excerpt() ?>

             <?php } }?>


title: Display posts separated by Category in Author's page

text: I created an author's page using:                <?php       if(isset($_GET['author_name'])) :       $curauth = get_userdatabylogin($author_name);       else :       $curauth = get_userdata(intval($author));       endif;      ?>      and then a standard loop, which displays all posts' titles published by that author. I'm trying to separate the display of the posts, according to the category they belong to (1, 2 or 3), so I tried using               <?php query_posts('cat=1'); ?>      but then all my blog posts are displayed, not just that author's. Something is certainly wrong. I know I have to use a custom query when there is more than one loop per post, but given that just using a single standard query, with the "cat" filter isn't working, I'm a bit lost.


title: allow edit of custom post type but not regular posts?

text: Is it possible to set the capabilities of a role to allow editing of a custom content type but not editing of the regular post types? If so, how would I go about doing that? Thanks!


title: Is there a way to share your Facebook Page's stream on a WordPress page or post?

text: Everybody knows how to share a WP post to Facebook. **Is the reverse possible**? Is there a way to share things you post on a Facebook page to a particular WordPress page or post? If so, I'd really love to hear about a solution; I've googled to no avail. Thanks!


title: What is the earliest hook comment meta can be saved?

text: I'm trying to integrate a new security checker service into WordPress comments. My goal is to tell the service's api to scan all links in a comment. My question is: what is the earliest (or most proper) hook to use to add comment meta keeping in mind that the goal is to automatically mark comments as spam?


title: wp_get_attachment_image_src match smallest edge

text: I'm trying to get the minimum image source that fills the given size. `wp_get_attachment_image_src(get_post_thumbnail_id(), array(180, 180))` gets the image which fits the size and not which **fills** it. Is there any built-in possibility to get an image with minimum size? I have an container DIV and want to put the posts thumbnail as background- image and want to the image to be `=>` sized.


title: Custom query posts error

text:
I have the following code which display different things, that's why I'm using many filters in the query. The problem is that it displays the same thing, no matter the query from the switch. If I do something like               SELECT * FROM wp_posts WHERE ID='100'      as example, it will display               SELECT * FROM wp_posts ...       Also, I've added where `post_type='post'` and it display all kind of things that he found in the database, like pictures, contact form, etc.                if(isset($_GET["submit"])){            $nume_searchq=$_GET["nume_doc"];       $spec_searchq=$_GET["specializare_doc"];       $instit_searchq=$_GET["spital_doc"];           switch($_GET['filter1']){                 case "ALL":         $querystr = "SELECT * FROM `wp_posts` WHERE post_type='post' OR LOWER(post_title) LIKE '%$nume_searchq%' OR LOWER(post_content) LIKE '%$spec_searchq%' OR LOWER(post_content) LIKE '%$instit_searchq%' LIMIT $limit";         break;     case "AB":         $querystr = "SELECT * FROM `wp_posts` WHERE post_content LIKE '%Alba%' AND post_type='post' OR LOWER(post_title) LIKE '%$nume_searchq%' OR LOWER(post_content) LIKE '%$spec_searchq%' OR LOWER(post_content) LIKE '%$instit_searchq%' LIMIT $limit ";         break;     case "AG":         $querystr = "SELECT * FROM `wp_posts` WHERE post_content LIKE '%Arges%' AND post_type='post' OR LOWER(post_title) LIKE '%$nume_searchq%' OR LOWER(post_content) LIKE '%$spec_searchq%' OR LOWER(post_content) LIKE '%$instit_searchq%' LIMIT $limit ";         }            $pageposts = $wpdb->get_results($querystr, OBJECT);?>       <?php if ($pageposts): ?>       <?php foreach ($pageposts as $post): ?>        <?php setup_postdata($post); ?>            <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">          <?php the_title(); ?>
         <?php //display_rating_result(); ?>
        <?php the_content('Read the rest of this entry »'); ?>
         <?php edit_post_link('Edit', '', ' | '); ?>          <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

       <?php endforeach; ?>       <?php else : ?>
Not Found
       <?php endif; ?>      Where might be the problem in these queries?


title: Custom Fields within custom post type

text: Am newbie. I have a custom post type 'dogs' and i want just 2 custom fields in this type. A pic on the left and text on the right - repeatable fields. Anyone know how to do this? I've no clue of php but can copy and paste! Am using Suffusion Custom Post Types and Custom Field Suite - I tried doing the above but I think i need to put some code in some php file somewhere...but I don't know where? or what code?! Thanks


title: Datetime on time tag wordpress puts it outside the tag

text: I want to use a time tag with the datetime attribute in it... I tried this in **functions.php** :               <time class="time" datetime='. the_date('d-m-Y') . '>%3$s '.get_the_time( $d, $post ).'</time>'      But instead of putting it in the `time tag`, it outputs the date in the content itself, which is very weird... How can this be solved?


title: Best Practices for Seperating jQuery from HTML/PHP

text: I am creating several jQuery scripts to help validate forms before they are submitted. I have read that it is best to always separate jQuery scripts into a separate file so that you can load the script with `wp_enqeue_script`. However, if I am doing something like this:               jQuery(function()     {         var ButtonSelector = "#submit-button";              jQuery(document).on('click', ButtonSelector, function()         {             var ValidEntry = true;                  ClearError('#venue_name');             var name = jQuery("#venue_name").val();             if (name == "")             {                 CreateError("#venue_name", "Name is Required");                 ValidEntry = false;             }                  if (!ValidEntry)             {                 jQuery('html, body').animate({scrollTop:0}, 'slow');             }                  EnableButton(ButtonSelector);             return false;         });     });      Since this function is only used in the one individual form, would it still make sense to separate it out? If I did separate it, wouldn't that mean that it would load for every single page?


title: Meta data not saved on save_post

text: When I try to save my post after inserting it via an external php script, it returns my the post id, but it's not able to retrieve the post meta created in the database. I am getting an array having an `_encloseme` parameter when retrieving through `get_post_meta` and I know it means that the enclosure process is still running and metadata is not yet saved. Please can anyone tell help me get the meta data when I use `save_post`.               Array(         _encloseme=>1;         )


title: How to eliminate the Web Address / Web Link textbox from comment forms

text: I tried this below but it does not work. I added it to my functions.php in my mu-plugins directory.               <?php     // to remove website textbox from Comments form     add_filter('comment_form_default_fields', 'url_filtered');     function url_filtered($fields) {       if(isset($fields['url']))       unset($fields['url']);       return $fields;     }     ?>


title: Can I open a popup TEXT window from an image click?

text: I have looked and looked, but have had no luck doing the following: I have a portfolio section of a blog I'm putting together and I want to have images that when clicked a popup window opens that contains text. I know there's lots of plugins to allow you to click on text and an image opens, but I want it the other way around. I would like the popup to consist of white text on a red background, which would go with my theme. And if possible I would like to have a link in the text that when clicked would close the popup and go to that link in the main window (the links would be to posts in the blog). I'm willing to pay for a commercial plugin if it's available. I have this site pretty well done, but can't show it to my client until I get this part of it worked out. here's a link to the site so you have an idea of the page I'm looking to do this on: http://bluegrassphotography.net/testwordpress/?cat=9&paged=2 Thanks in advance for any help!


title: Exclude posts from certain meta_key

text: I have query to retrieve all posts, but how can I check the condition for post `meta_key ="develop"` and `meta_value='anything'`                SELECT DISTINCT date(p.post_date) as post_date           FROM $wpdb->posts p           LEFT JOIN $wpdb->postmeta pm ON p.ID = pm.post_id           WHERE p.post_status='publish'            AND p.post_type IN ('%s')           ORDER BY p.post_date DESC      Here it reads dates of all posts. My problem is that query should exclude the posts which has meta_value(it can be anything) of which `meta_key="develop"` . How can I write the query for that ? I feel it will be in this form for `wp_query`                  $args[ 'meta_query' ]= array (                      'relation'= >' AND ',                              array (                                 'key' = > 'respect'                          ),                         array (                                 'key' => 'develop',                                 'compare' => 'NOT EXISTS'                              )                     );


title: Ajax loop refresh on click

text:
I display a random post loop on a page. I'd like to put a "refresh" link to refresh the content of the loop via ajax. Is this possible? This is my loop if it helps:
                 <?php query_posts('posts_per_page=20&orderby=rand'); ?>                 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                         <a href="<?php the_permalink(); ?>">                             <img src="<?php echo $my_image_url = get('thumbnail'); ?>" alt="" />                             <?php the_title(); ?>                             <?php $articletags = strip_tags(get_the_tag_list('',', ',''));echo $articletags;?>
                 <?php endwhile;?>                 <?php endif; ?>                 <?php wp_reset_query(); ?>


title: Removing label 'Wordpress' from title bar

text: Generally on our wordpress blogs,there will be a label "Wordpress" displayed on title bar .Does any body have idea how to hide or remove it? **Update** : Here is a website's screenshot,which shows the label :![shared at pixavid.com](http://pixavid.com/uploads/lGQ2At.png) My website is powered by wordpress multisite installation and like many people I wanted it as self branded even though I keep link back to wordpress.org at footer . Is it inappropriate to do this ? Thanks in advance !


title: Set Edit Post meta boxes inactive

text: I'm simply looking to set certain meta boxes inactive. I know about remove_meta_box() but I only want to make them inactive so that the user is still able to turn them back on from the screen options tab at the top. I've used the Adminimize plugin (http://wordpress.org/extend/plugins/adminimize/) and it functions the way I was hoping to do it. Based on the user role it deactivates the meta boxes you want but doesn't remove them. Do you know how this plugin does it?


title: Add a "has-children" class to body tag?

text: I need to add a "has-children" class to the tag if the current page's or post's menu item in fact has children. As this "logic" has to work with Pages, Posts, Categories etc. menu items it seems it is not easy to find out. Thanks in advance! Edit: I am not sure I explained good enough: I need to add "has-children" not if the current page is a page-child but only if the current page's menu-item is a menu-item-child...


title: Update nav menu item position programmatically

text: I've tried adding a new programmatically on wordpress with the function:                wp_update_nav_menu_item($menu, 0, array('menu-item-title' => $title,                 'menu-item-object' => 'page',                 'menu-item-object-id' => $post_id,                 'menu-item-type' => 'post_type',                 'menu-item-status' => 'publish', // is there any 'delete', 'unpublish' ??                 'menu-item-parent-id' => $parent             ));      This works when I create a page but I want to change the parent or just update the page this function adds the page again in the menu.I want to know if there is a way I can delete or update the menu item from dhe menu?


title: Display custom-post type based on the Title matching the current selected value

text: Ok quite a complex thing I'm trying to do here, and I'm a bit unsure how I will do it with wordpress, but I'm hoping some genius out there can help. I'm basically creating some comparison functionality, and I currently have two select boxes on the page. These select boxes will display the list of all posts within the custom post-type **'countries'** inside them, and when the user selects one of the options from the list, I will use ajax to display the content of that particular post below. I currently have a non-wordpress version of what I am trying to do, and here's the code. **HTML**               <select id="compare-one">     <option value="United Kingdom">United Kingdom</option>     <option value="Belarus">Belarus</option>     <option value="Albania">Albania</option>      **Jquery**               $('#compare-one').change(function(e){     $('#compare-one-container').empty();     $(this).find(':selected').each(function(i,e){         $.get("callbacks.php",           // used to prevent caching in IE           { nbRandom: Math.random() },           function(data){             $("#compare-one-container").html(data);          });       });      }); **callbacks.php**               <?php $test = "Home" ?>      So as you can see, I have no implemented this into Wordpress just yet - simply because I'm unsure of the right way to do so! **I think my main question is how to replace this current php code with something that checks to see if the _current selected value_ is equal to _the page title_ , and if so _echo the information (content, custom fields etc) from that particular page title_ it matches.** Any help on this would be greatly appreciated! Thanks


title: wp e-commerce single-product template giving 404

text: this page was working initially, and then I made some changes which *** _didn’t_ *** appear, and then it just stopped showing that page altogether. I have tried deleting my `wpsc-single_product.php` and replacing it with the default one provided but it still just shows 404. My category page does the same, in fact the only pages I can get to work are the ones that are actual pages (checkout, transaction results etc.) - this made me think it could be a url rewrite problem but considering it was working before and I haven’t made any changes to my .htaccess or infact any other file it probably isn’t. Shouldn't it default to the `wpsc-single_product.php` file that is in the plugin directory anyway - like it did before I copied the file over in the first place? What could have made this happen?! Please help? Thanks in advance for any help or advice, Billy


title: Wordpress custom login and register page problem?

text: I have created custom pages login page and register page in wordpress. My login page has to come when i visit the site. How do i make login page as the first page on the site. And how do i remove register and login pages from the tab structure.


title: Filter the HTML content of plugin

text:
I am using the Marketpress plugin. I want to modify `single_order_funct()` function HTML content in it. I want to make changes so that, when it is updated, I don't lose them.               class PluginClass{      function single_order_funct() {     ?>
test
     <?php     }          function orders_funct() {      if (isset($_GET['order_id'])) {         $this->single_order_funct();         return;      }     }      Whenever `single_order_funct()` function is called, I want to modify the HTML content it returns. How can I do it with `remove_action()` and `add_action()` or is there any other way to do it?


title: How to hide something from custom home page with php code?

text: I need help to get the issue resolved. I have a wordpress custom-made site and it is with a custom home page. The index page of the wordpress site is used for updates purpose(blog). I want to hide something and not displaying on the custom home page. When the time i use "is_home()", the thing on blogging page is hiding and the thing is hiding when the time i use "is_page()". What code should i use to make it hide only on custom home page? Thank you!


title: Wordpress 2014 Theme - Featured Content with multiple tags?

text: My company is using the new 2014 Theme for our portfolio blog. We really like the Featured Content section on the home page. What we would like to do is have multiple pages all with different Featured Content sections. This is how much we have been able to work out so far. All of the key information is held in `/inc/featured-content.php`. This gets handed to `functions.php` under the class featured-content, and then onto featured-content.php (note the lack of `/inc/`) under the class `twentyfourteen_get_featured_posts`, and finally, gets called on `page.php` under the class featured-content once again. We want to target the variable tag-name with different tags on different pages. Our plan is to create a number of page templates, all with something in them forcing featured-content to call up a different tag. While we are moderately versed with PHP, we are not sure how to code this.


title: Retrieving custom field value with get_post?

text: There's no mention of custom fields values in Get_post's codex page. Is it impossible to use get_post to get a custom field value of some post, and if so, is it necessary to perform a whole loop just for that?


title: NextGEN Gallery - open all images on page in fancybox

text: For now, I am not using NextGen Gallery. For now I am adding `class="fancybox"` and `rel="gallery"` to each image and it opens all images within a page in fancybox. However, client wants to start using it. I have to figure out if it can be used also for this purpose. Can I use NextGEN Gallery for this scenario:   * I have Pages with images and text   * Images are floated throughout the text   * I need images to be opened in fancybox (for example, if I press first image it will open all images on page in fancybox) I do understand how to create NextGEN Gallery and show a gallery on page, but I am not able to understand how can I show single images from gallery throughout a Page and then open them in fancybox.


title: Archive page - problem with pagination

text:
I have a problem to display pagination using `WP_Query`. I've created a custom page, code below:               <?php     /*          Template name: Models          */     ?>     <?php get_header(); ?>     <?php the_post();?>         <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/models.css">            <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/responsive-min.css">     <section id="galery" style="background-image:url('<?php the_field('tlo');?>');">
     <?php $kat = get_field('kategory');?>     <?php $the_query = new WP_Query(array('post_type' => 'modelki', 'taxonomy' => $kat, 'posts_per_page' => '4')); ?>     <?php $i=1;?>     <?php if($the_query->have_posts()) : ?>          <?php while($the_query->have_posts()): $the_query->the_post(); ?>
             <a class="buka" href="#data-<?php echo $i;?>">

                 <img src="<?php the_field('thumb');?>" alt="buka">
                 <?php the_title(); ?>                 <a class="more buka" href="#data-<?php echo $i;?>">WIĘCEJ   >

                 <div id="data-<?php echo $i;?>" class="fan">                     <?php $galeria = get_field('gallery'); ?>                 <?php if( $galeria ): ?>                 <div class="swiper-fans buka-<?php echo $i; ?>">
                                       <?php foreach( $galeria as $obrazek ): ?>                         <div class="swiper-slide" style="background-image:url('<?php echo $obrazek['sizes']['large']; ?>');">
                     <?php endforeach; ?>

                 <?php endif;?>

<?php the_title();?>

<?php the_field('more_data');?>

                  <?php $i++;?>         <?php endwhile; ?>     <?php endif; ?>
         <?php echo generatePagination(get_query_var('paged'), $the_query); ?>
      It should work, all looks fine, but all pages display only the 1st four posts. Any sugestions?


title: wordpress multisite create different author template for mainsite and subsites

text: I am using authors.php to display authors pages. From my landing page of my WPMU installation I am trying to redirect the author page requests to different template. That is the requests to the following URL /authors/author/ **authorname** should redirect to template#1 and the request to the following URL /authors/ **innersite** /author/ **authorname** should redirect to template#2 Please let me know how could I do this.


title: How to structure model showcase

text: I need to make a website of models that contain the following components:   1. Model page - model info, editorials of that particular model   2. Editorial page - containing some editorial info, link back to model, photographer, magazine, etc.   3. Photographer page - editorials of particular photographer   4. Magazine page - editorials that were published in this particular magazine (and maybe a few more) I can use posts to do all this, but it might require a lot of time to manually rewrite info every time something is updated. (example. First we add some models, magazines & photographers. Now when we post an editorial we can pick which models are in this photo session, who shot it and where was it published. When we publish the editorial it will then automatically be shown on the page of each one of the mentioned above.) I'm looking for any ideas that will make this easier. In other words, how to structure the website using WP.


title: Remove (Unattached) Attach from "Uploaded to" in Media Library

text: I've already removed the Unattached link through functions.php, the last thing I need now is to remove the **(Unattached) Attach** from " **Uploaded to** " in **Media Library**. I've no clue about what code should I add in functions.php to get rid of it and it's hours I'm searching on the web... Help please...


title: remove_menu_page breaks "Add media"

text: Using the the remove_menu_page function results in a really strange bug. By adding the code below in the functions.php file the integrated "Add media" widget starts to bug.               function remove_menu_pages() {              // Remove admin menu pages that are not used         remove_menu_page( 'link-manager.php' );         remove_menu_page( 'tools.php' );     }     add_action( 'admin_init', 'remove_menu_pages' );      When clicking "Add Media" while editing a post no files will show up under "Media Library", even tough the Media Library has plenty of files uploaded to it. If you try to upload a file, it will show up, but you won't be able to insert it into the WYSIWYG editor. If you close the "Add Media" window and then open it again the file is gone (but it's there if you navigate to the media library in the main navigation). Have anyone experienced this? Can anyone replicate it? Thanks!


title: Wordpress multisite htaccess

text: I set up Wordpress as a multisite and as part of the steps, it gave some instruction to update and replace the .htaccess file. Wordpress instructed me to replace the htaccess with this:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      However this caused some jquery on a plugin to break. I thought it might be useful, but could someone help provide some insight into what each of these lines does? In particular this line:               RewriteRule ^(.*\.php)$ $1 [L]      As, if I remove this line, my plugin works fine. Thanks in advance :)


title: How can I style an IFRAME element that has a constantly changing class name?

text: On my blog, the Pinterest button creates a small gap underneath the footer. Looking at the code, the cause is the iFrame that the Pinterest javascript embeds in the page. It looks like this:               <iframe src="//assets.pinterest.com/pidget.html?r=862117.4577227819#via=http%3A%2F%2Flocalhost%3A8888%2Finternet-security%2F&type=pidget" height="0" width="0" frameborder="0" class="PIN_1361148986939_log"></iframe>      I can use Chrome's dev tools to apply display: none; to it, but here's the problem: The class changes every time you load the page. Is there a way to targe this specific iFrame in CSS without using the class name?


title: Move wordpress sidebar on homepage up to new position

text: This should be a simple task, however I am having no such luck. I am using a theme that has a homepage slider which spans across the entire content area. I have been asked to reduce the size of the slider and move the sidebar up next to it. I've attempted to call the sidebar in different and seemingly logical locations but the page breaks. Any help would be much appreciated. index.php code here: http://pastebin.com/9FMWL7cC. Style sheet and site URL in comments if needed.


title: How to eliminate custom posts where the "date" value is expired?

text: I have this code calling a list of custom post events. It calls them in the right order, but when the event is passed, it stil displays the event. Any ideas what's wrong with the code?                 $args2 = array(         "post_type" => "gig",         "meta_key" => "_gigswhen", // Change to the meta key you want to sort by                 "meta_query" => array(                 array(                  "meta_key" => "_gigswhen",                  "value" => date(),                     "compare" => ">=",                ),          ),         "orderby" => "meta_value_num", // This stays as 'meta_value' or 'meta_value_num' (str sorting or numeric sorting)         "order" => "ASC"         );      The date in "_gigswhen" is stored as strtotime (unix timecode)


title: Easiest way to simulate WordPress's URL resolution to retrieve post ID, etc?

text: I'm curious if it is possible, in a plugin/custom code, to take an URL that has been generated by the currently running WordPress site & parse it to retrieve the $blog_id and $post_id? ie. taking a string like "myblog.mysite.com/2012/03/16/whatever/" and determining that this is post #6 ("whatever") on blog #2 ("myblog"). I realize that I can probably strip the URL and parse the domain myself, but I hope that there might be recommended WordPress methods exposed to make this more robust across URL formats.


title: Post added via wp_insert_post with category doesn't show in category listing

text: I've created a plugin that auto creates a post and attaches a category to it, which is then hidden from the main blog and only shows in the category listing... I can successfully add a new post via wp_insert_post with all the correct params and once the post_id is returned I'm calling wp_set_object_terms with the category I want that post to be included under. I can confirm that the post is created, and the post has the correct category. However, if I visit the category listing for that particular cat, I see all the previous posts but not the dynamically created one. If I manually add a new post and select the same category, it does display in the list. I haven't found anything regarding why this is happening... Has anyone else run into this issue? Everything seems to be working fine, except with the category listing... (Edited to add code sample)                   $new_post = array(         'post_title' => $postTitle,         'post_content' => '$postContent,         'post_status' => 'publish',         'post_date' => date('Y-m-d H:i:s'),         'post_author' => $current_user->ID,         'post_type' => 'post'     );          $post_id = wp_insert_post($new_post);          wp_set_object_terms($post_id, array(24), 'category');


title: Search results load individual post in slide out div

text: Hi this is more of a solution and advice question. I want to search my wordpress site and load the search results in a very typical way (unordered list with title, image and excerpt). Upon clicking the title of each post I want to load the post itself in a div directly in a new panel on the right. I want the search results to minimize in width to around 30% and then a new panel containing the post slide in from the right at 70% width. This giving you a side panel to select other posts and load into the new panel. I've tried a number of solutions here, ajax, permalink load in and styling with css to get rid of headers, json plugins. I am wondering if anyone had suggestions on how they might approach this. **NOTE:** my search results use infinite scrolling, the post loaded has related posts plugin. I also have a button to slide the div back out to go back to original search results view. It's essentially like a preview feature but your being give the whole post and shortcodes. Thanks!


title: Show posts of category in a page

text: I would like to be able to display all the posts in a certain category on a page so that all posts are on that one page and there is no pagination. If possible, I would also like to display a short preview of the posts - all posts will have a thumbnail and a short paragraph at the start. I've tried various different plugins, but so far none of the one's that I have found do the job. Does anybody know of a plugin or a way to do this? Alternatively, modifying the default category pages so there is no pagination is an option if all else fails...


title: post_title is empty on global $post object

text: My plugin uses publish_post hook to get the post data and do some processing:               add_action('publish_post', 'publish_post');          function publish_post($post_id) {           global $post, $blog_id;           $author = get_userdata ($post->post_author);           $title = $post->post_title;           //some processing here...     }      I notice that for a new post, $title is always blank, while all other fields are available. If I publish the post again (update), then the title becomes available. **Edit** I printed out the $post variable and notice that that the post_status is draft:               [post_title] =>     [post_excerpt] =>     [post_status] => draft      So it seems the $post variable contains what was loaded from the database, but not what is currently on the screen. How should I get the $post that reflects what is currently on the screen? Is there a hook that fires after a post is saved to the database?


title: Blackberry mobile theme redirection

text: I've got a this site Casarão Amneo Reseda, that has 2 themes, the main one for any desktop browser and a second one, mobie friendly, based on the jQuery mobile framework. I'm currently using the WPtap Mobile Detector plugin to redirect any mobile browser to the mobile theme. It works just fine on iphone 3/4, samsung android, sony xperia and ipad (that was just for testing, it currently loads the desktop theme). But the bug comes when i test with a Blackberry Bold 9700. The phone loads the normal theme. Which sould not. In the admin of the plugin, there's already a Blackberry Storm registered as one of the devices with a mobile agent that goes like this `blackberry9500|blackberry9530`. Not having a Storm with me, i tried to add a new device for my Bold. So i added another blackberry device with the user agent `blackberry9700`, a guess rather than a real device-agent that i found. Didnt work. So i tried to add a 'global' blackberry agent: `blackberry|Blackberry`. Without luck too. So i then looked for other solutions.   1. I've tried mobilepress, but i only managed to get it load my mobile theme for iphone, not blackberry, android and sony xperia.   2. Then, i went for the WordPress Mobile Pack plugin. I got to get the defualt themes to work on iphone and not on blackberry. I couldn't get my mobile theme to load, even on iphone.   3. Then i looked at WPTouch. This is not a good solution either as i doesn't load my custom theme, but one of its own. And it didn't load either the mobile theme on blackberry... So am getting really annoyed with this Blackberry problem and wonder if there is any way to get my custom mobile theme to load?


title: How do I use add_action from a class method?

text: For some context, we're building an activation system for new users of an app using WordPress as a framework. We've got a plugin driving most of our interactions, where all of this code resides. When a new user signs up, they are sent an activate link via email, which when clicked, sends them to an activate page. When they save their details, we want to create the user with appropriate meta data, and redirect them to a custom routing template that shoots them off to their personal subsite. We have the username and password of the newly created user available to us, so we can use wp_signon(). We've got a Registration_Model class that is instantiated somewhere else. Our class method to start the sign in process is where I believe we want to call add_action.               public function sign_user_in() {         add_action( 'init', array( $this, 'auto_sign_in') );     }      Our method to process the sign-in is below, but be aware, I've tested out the function to see if the action is even being cued by WordPress by echoing a string, which does nothing.               public function auto_sign_in()     {         // if ( ! is_user_logged_in() ) {                   //determine WordPress user account to impersonate              $creds = array();              $creds['user_login'] = $this->user->email;              $creds['user_password']  = $this->user->password->one;              $creds['remember'] = true;              $user = wp_signon( $creds, false );              if ( is_wp_error( $user ) ) {                  echo $user->get_error_message();              } else {                  wp_redirect('/_router/'); exit;              }          }     }      It really appears that I'm stuck on the action not being run, or something. Can the add_action be run from somewhere other than the class constructor? Any and all advice or help is appreciated. **EDIT** I've adjusted the function to use `$this` instead of `__CLASS__`, although we still get nothing when hooking into 'init'. Just as a test, I've used the absolute last hook that fires, 'shutdown', and I can echo a test string to the browser using it. So I know that there's a whole bunch of operations loading, so I probably need to move the add_action somewhere else so it fires earlier.


title: How to using custom DB tables

text: I create a new theme. One of my targets is to enable the admin to add unique text (html code) to unique table which the theme will automatically create (I mean something like `wp_myhtml`). My questions are:   1. How to define that the theme will create a new table only at the first time the admin activate it (if the table exists - don't create again. I know to do it with pure PHP / SQL, but maybe there is an option with WordPress to create custom tables)?   2. How to CURD rows from this table via the panel? and only read via the website itself? are there unique functions to do this? I don't use `options` functions (add_option, update_option, etc) because the html codes can be very long, and one field of LONGTEXT won't handle it. In addition, I don't use the editor (Appearence > Editor) because I need it in the DB.


title: Saving custom metabox data with a twist

text: I've got more than a few metaboxes being used with a custom post type and I'm running into an issue where my data is not being saved as expected. Here is the relevant part of the code, and its within a function hooked to `save_post`.               // Loop through our custom metabox post data     foreach ($_POST['product'] as $key => $value) {         // Clear the previous featured product if it needed         if ($key == 'homefeature' && $value == 'on') {             $wpdb->query(                 "                 UPDATE      $wpdb->postmeta                 SET         meta_value = 'off'                 WHERE       meta_key = 'the_prefix_homefeature'                             AND meta_value = 'on'                 "             );         }              // Update meta         update_post_meta($post_ID, 'the_prefix_' . $key, $value);     }      The query seems to work just fine (I've tested it outside of Wordpress) but in the end the product will not be flagged as the `homefeature`. The weirdest thing is that if I put a `die` in after the above loop finishes, it seems to work as expected. It almost seems like Wordpress is caching the query or something. Any help figuring out why this is happening would be great, and let me know if you need more info/code.


title: wp_get_archives breakes Html5 validation

text: I have a issue with **wp_get_archives** because it breaks my **Html5** validation.   Inside validator I get this message: **Bad value archives for attribute rel on element link: Not an absolute IRI. The string archives is not a registered keyword or absolute URL.** My archive links looks like this:   http://robertpeic.com/wordpress_template/2013/01/' />   http://robertpeic.com/wordpress_template/2012/12/' />      I am guessing that those errors are happening because spaces inside my links, now if I change my **Doctype** into **Strict** my page validates **fine**.   Can someone please tell me how can I validate my page as **HTML5**? Thank you!!      My wp_get_archives looks like this:`wp_get_archives('type=monthly&format=link');` Validator link


title: How to make woocommerce product shortcode a dynamic?

text: I am using woocommerce plugin in my application, is there any way to make the product shortcode([product id="" sku=""]) of it a dynamic one so that I can send the product id through the url, then the corresponding product is displayed on the page. I require this for making the quickview of the product, on clicking product quickview(I used a quickview plugin which uses product description page URL to show in the popup, I am trying to override the url so that I can send product id appended to it). Can you please also suggest is this the better approach of quickview or any other way


title: Php code error in wordpress if else statements

text:
I have created an if statement inside the "else" of an if/else statement.However the code below the function does not run.When i remove the function the code below the function runs.Could you please help me out. This code causes the problem:                   <?php $googleplay= get_option('director_googleplay');?>         <?php if($googleplay): ?>             <a href="<?php print $googleplay; ?>">                 <img src="<?=IMAGES?>/googleplay.png" class=" img-responsive  top-buffer-5"  alt="Image"/>             </>         <?php endif;?>       The php:                 <?php  $category_id = get_cat_ID('Category Name'); ?>       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>            <?php if ( in_category("1") ) { ?>

           <?php } elseif ( in_category("2") ) { ?>

            <?php } else { ?>
       <?php $googleplay= get_option('director_googleplay');?>         <?php if($googleplay): ?><a href="<?php print          $googleplay; ?>"><img src="<?=IMAGES?>/googleplay.png" class=" img-responsive  top-buffer-5"  alt="Image"/></><?php endif;;?>
         <?php } ?>        <?php endwhile;else: ?>
Sorry, no posts matched your criteria.
        <?php endif; ?>
        <?php $facebook= get_option('director_facebook');<?php if($facebook): ?><a href="<?php print       $facebook; ?>"><img src="<?=IMAGES?>/Facebook.png" class=" img-responsive pull-left"alt="Image"/></><?php endif; ?>


title: WP E-Commerce Update Problems "add_option was called with an argument that is deprecated since"

text: I recently took over an existing website from a new client that had the Kelontong Premium theme and WP E-Commerce installed. Nothing had been updated since 2011 so I took my time and updated all the plugins wordpress version one at a time, when I updated WP E-Commerce I got the dreaded blank screen. I turned on debugging and got the following errors:               Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /wp-includes/functions.php on line 3008           Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in wp-includes/functions.php on line 3008           Notice: Trying to get property of non-object in /wp-content/plugins/wp-e-commerce/wpsc-includes/shipping.helper.php on line 510 Warning: Invalid argument supplied for foreach() in /wp-content/plugins/wp-e-commerce/wpsc-includes/shipping.helper.php on line 510          Fatal error: Call to a member function get_shipping_method() on a non-object in /wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 278           Notice: is_feed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.) in //wp-includes/functions.php on line 3049       I have tried reinstalling the plugin but it did not work. When I disable the plugin I can see the homepage but it does not function correctly. Any help would be gratefully be appreciated. Thanks


title: Wordpress - Shortcode or Merge tags

text: I want to use shortcode feature. The only issue is that, I am having multiple parameters. The code I have till now is :                  add_shortcode('lorem', array(&$this, 'lorem_function'), 10, 1);             function lorem_function() {            return 'Lorem ipsum****';        }             do_shortcode('[lorem]');       But in my case I will be having multiple shortcodes. These shortcodes will be generated by the user and it is dynamic. Is there a way I can create a general function? Using these shortcode I want to retreive the values from the database. Is there a way that, say suppose there are 2 shortcodes [lorem] and [Ipsum] then when I am executing the query then the handler should be called only once to handle both the tags at the same time. In case I call the handler separately, then this will affect the performance as database query will be executed every single time a new tag is invoked. I hope the question is clear enough. If not let me know. I will try to reframe it otherwise. Just one more question. I have seen some plugins use shortcode in {shtcode} format. i.e with curly braces. I assume this will also be follwing shortcode api. Do correct me, If I am wrong about it.


title: List Posts By Custom Taxonomy

text: Apologies if this is a stupid question, I've had a google and a look on the site but can't find an answer to my question. I'm working on a project and have created a custom post type called 'books'. I've also created a taxonomy called 'genre', which has a term 'fiction. How do you show all posts of taxonomy type 'fiction'... i.e.               http://www.example.com/books/fiction/      I can get /books/the-book-title/ as standard, but how do I get a listing page to work?


title: Post Filter by Date and time

text: I'm trying to get wordpress post by filtering date and time, for example get post 01/02/2014 to 07/02/2014. thanks for the help me.


title: retrieve data form wordpress into app problem with $.ajax access to an object

text: i'm working on my first app, based on my blog created with wordpress, anyway the problem is that i can't access to to different categories using json api. This my code:               var requestData = {                  dataRock:'category_name=rock&count=2&order=desc',                  dataPop:'category_name=pop&count=2&order=desc',                  dataElectronica:'category_name=electronica&count=2&order=desc'              };                  $.ajax({                 url: 'http://ultravoz.org/api/get_category_posts',                 dataType: 'jsonp',                 //data:'category_name=rock&count=2&order=desc',                 data: requestData,                      success: function(data) {                          //console.log(requestData.dataRock);                          var albumsRock = function()                     {                                $('albumsRock').html(''); // vaciamos previamente el html                              for(var i=0; i < data[requestData.dataRock].posts.length; i++)                         {                             addAlbum(data[requestData.dataRock].posts[i]);                         }                          }      the problem is this **data[requestData.dataRock].posts.length** , show me this error: **TypeError: data[requestData.dataRock] is undefined** i'm new with objects and javascript, can you give me a help? thanks.


title: Building plugin with changeable custom post type values...advice needed

text: I'm about to embark on creating a new WP that, at the core, will rely on a custom post type. I'm building this plugin for a client, but plan to make it flexible enough to release in the future. My client has a specific need for the plugin and I ultimately want it to be flexible enough to meet the needs of many users. As such, I plan to create an admin area where a user can enter the various args that would go into the `register_post_type` function. My thoughts in doing so are that the end user will be able to leverage the power of my plugin while also being able to preciously control the custom post type that the plugin generates. I like the idea of easily giving this control over to non-technical users; however, my concern is that I could invite a number of potential issues by doing so. For instance, imagine that a user uses the interface to name the custom post type "whirly-doos", but later thinks that's a dumb name and decides to call it "howdy-doos". This could potentially orphan their previous custom post types. So...my questions are: is this a good way of going about building this plugin? How would you implement the plugin and maintain a nice balance between customization and stability? Thanks in advance!


title: Check if user is logged in else login page

text: I like to secure a certain page for admins. How do I check if a user is logged (and is admin)? Of their not logged in, I want to show the login module.


title: Check to see if there a wordpress user account and create one if not outside of wordpress

text: Please note that this was posted on wp-hackers mailing list. Hi guys, Just wondering, does anyone know how I can go about checking to see if there a wordpress account and create one if there isn't? Script that I got: https://gist.github.com/Danielx64/7519092 There a marker in the file that has "// Somewhere here I want to put a check to see if there a wp account" What I want to happen there is that a check get done to see if there is a wordpress account and if there not, create one. Does anyone know if it can be done? PS, I don't need to worry about logging into wordpress as that will get taken care of by a different script. Also anyone who can help me out will also get credit in the source code and readme :) Regards, Daniel


title: Network setup tab is not shown under Tools

text: Im trying to create a multisite so I did the necessary steps .i.e 1) created a wildcard subdomain 2) backed up of course files wp-config.php and .htaccess 3) edited the config file with adding line "define('WP_ALLOW_MULTISITE', true);" before the line "...Happy blogging.." and now I cannot continue executing the following steps since the Network setup is not appearing under tools. please help. thank you million for your support


title: Wordpress site is sloooow, but admin is fast....any ideas?

text: I have a Linode VPS running a single Wordpress blog. It has been running just fine until today. The admin panel is snappy, but the site is very slow. I am still finishing the site, so there shouldn't be any traffic. When I go to mydomain.com it takes 45+ seconds to load, then each click on the link takes about the same amount of time. I didn't update any WP plugins (or WP), but I did add a google analytics plugin a week ago, but seemed fine. I disabled that and no difference either. I tried rebooting nginx, and then rebooted the whole machine... still slow. My "free -m" output is:                user@myserver~ $ free -m              total       used       free     shared    buffers     cached      Mem:     469        147        321          0          3         45      -/+ buffers/cache:   98        370      Swap:    511          0        511      The weird part is nothing has changed in the last few days....Any ideas?


title: wp-super-cache exclude file from caching

text: Is there any mean to exclude a `*.php` file to WP Super Cache?   I've in my `single.php` page an `include news.php`, the file `news.php` contains ten links to my last articles. So I want to cache `single.php` but to exclude `news.php` that is included in `single.php`. It is possible? How can I do that?


title: WP_Query parameter conflict

text: I am writing a query to retrieve instances of a custom post type I created called "Specialist". In the query I specify a name and more than one taxonomy.   I want to retrieve just those `specialist` which respect **both** parameters.   If I run the two queries separately, the correct specialists are returned but when I integrate the two in one single query, it seems that the `post_name` takes the priority on the taxonomy. For example, if I run the query asking for a `specialist` named `test` with taxonomy `therapist`, I have back the `specialist` called `test` even if it does not have a `therapist` taxonomy. Here is the code:               $args = array(         'post_type'=>'specialist',         'name' => 'test',         'tax_query' => array(             array(                 'taxonomy' => 'type',                 'field' => 'slug',                 'terms' => 'therapist'             )         )     );          $specialists = new WP_Query($args);


title: Woocommerce Change The Price Of A Product Once Woocommerce Has Retreived It From Database

text: In a normal case the Woocommerce retrieves the price from the database and displays it. How can one customize Woocommerce so that when the price of the product is retrieved from the database it is then changed at the very initial stage before it is used anywhere else (for checkout, cart etc). **Visualization:-** ![enter image description here](http://i.stack.imgur.com/yxwfS.png) **Constraints:-** The price should not be changed in the database. PHP script should change the price and manage it. **Progress:-** I'm not getting any directions in this problem. I believe that I've to modify `class-wc-product-simple.php` at `line:68`                      if ( $children_by_price ) {                 foreach ( $children_by_price as $child ) {                     $child_price = get_post_meta( $child, '_price', true ); // that's line 68.                     update_post_meta( $this->get_parent(), '_price', $child_price );                 }             }      so that I can modify the price as it is just retrieved from the database.I know that modifying WooCommerce core is not recommended, but that's okay for me for the time being.


title: Using conditionals, maybe from a DB, to register & enqueue files, for varying pages, in functions.php

text: **I wanted to include some javascript and css files on only some of my WordPress pages.** To do this, I registered and enqueued the files in my child theme's functions.php file, and used conditionals to select my target pages. For example, to include a javascript file only in a page called "publications", I used this:               define('child_template_directory', dirname( get_bloginfo('stylesheet_url')) );          function add_my_js() {     if (is_page('publications')) {     wp_register_script('my_js_script',child_template_directory.'/js/my_js_script.js');     wp_enqueue_script('my_js_script');     }     }     add_action('wp_enqueue_scripts', 'add_my_js');      I added a number of these in my child theme's functions.php file, some being javascript files (using `wp_enqueue_script`), and some being css files (using `wp_enqueue_style`). **There may be more than one page where I wanted to place the files** (say, on an "essays" page as well as on "publications"), so I thought maybe I could do something like:               if ( (is_page('publications')) || (is_page('essays')) ) {     //[etc]     }      **But, as well as the possibility of there being many of them, I may now also be in the situation where the target pages may vary from time to time** , so I'm wondering how to cater for this. I thought of keeping the names of the pages (like "publications" and "essays" above) which would have to go into the conditional, in a database table, then, via a query, placing them into an array ('publications','essays'), and then perhaps using something like `in_array()` in place of the `if` conditional - or maybe a `switch()` statement. Basically I'm wondering (1) what's the best way to write the query first, and (2) how to place the array elements into what sort of conditional (or switch, or whatever), inside the functions. Hope this all makes sense.


title: Wordpress capabilities on pending post status

text: I have user with contributor user role. In default if you publish article as contributor you can only view it and you can't delete or edit it. But when you submit new post for review, you can do all those things (edit, delete, preview). I want to restrict edit and delete actions for contributor, if post have "Pending Review" status. I already try many user role management plugins, but none of them have such features. So I want to know is there are any other plugin or any other way to do this. Thanks!


title: Wordpress MU subdomain vhost

text: Ok so i have my mu setup with subdomains and need a subdomian to point to a different path. My issue is when i add the vhost file it loads before wordpress and loads it path for everything that does not have an assigned path in my vhosts config. But if i load after wordpress domain install then it trys to create a site for the subdomain entered. What i need is this:   sub2.mydomain.com - points to /path/to/sub/directory   *.mydomain.com - points to /path/to/wordpress/install **UPDATE:**   I am using a domain mapping plugin which i think is causing my issue. All sub sites load fine but when i load a mapped domain to a sub site it does not work. I can not add my mapped domain each time to my vhost config since i plan on allowing others to map domains


title: Admin to user notices - best practices?

text: I am trying to replicate specific functionality from my vb forums in my wordpress install. Specifically I can create 'user notices' that are displayed on the front end of the website. Basically I can create a post that only displays to non-logged in users, moderators, admins, etc. My plan of attack is to create a custom post-type so that I can easily organize my notices. I am very comfortable working with post-types, and it seems logical. ## questions: 2) When I create a new 'notice post' what would be the best way to 'categorize' it to target a specific group, i.e. - not-logged-in, moderator, subscriber, etc? _I was thinking about using a custom taxonomy so that I would select a term like 'moderator' in order to categorize the posts._ Where I get a bit stuck is how to best call the post on the front-end without resorting to a ton of if/else statements. (there can and will be about 20 conditions on a pretty high traffic site) if tax_term = moderator then display x, else if not_logged_in display y, else... 2) One important condition is to be able to display the notices to users that have not posted a specific post-type 'forum-topic' within the last 30 days. *Can someone provide me with a function that meets this specific condition? finally: If there is a better way to approach this, I am very open to other ideas. I did search the plugin directory for inspiration but really didn't find anything. thanks


title: Display the last date, regardless of articles

text: i would like to display a date on my Blog. I have used this Code for displaying the date: `<?php the_time('l, j. F Y'); ?>` But that uses the time of the latest article. How can i display the current date?


title: Show shortcode only in posts

text: I created a shortcode to show the short URL from a post. I use canvas, that has an option to show shortcode after content, but I only want to show the shortcode only in posts, not in homepage. How is possible to do that?


title: Exclude Child Terms From Parent Posts

text:
How can I exclude the child term posts from showing up in the parent term posts output?? Right now it's duplicating in both parent and child term outputs.                //Function to display posts grouped by taxonomies         function display_posts_per_taxonomies($parent_term, $post_type = 'beat_posts', $taxonomy = 'beats'){         $parent_posts = get_posts(array(         'tax_query' => array( array(         'taxonomy' => $taxonomy,         'field' => 'slug',         'terms' => $parent_term             )),             'post_type' => $post_type         ));         echo '
';         foreach($parent_posts as $post){             echo "
{$post->post_title}
";          }         $children_terms = get_terms($taxonomy, array(             'parent' => get_term_by('slug', $parent_term, $taxonomy)->term_id         ));          foreach($children_terms as $term){             echo '
';             display_posts_per_taxonomies($term->slug, $post_type, $taxonomy);             echo '
';         }         echo '
';        }      Below is what I'm trying to get rid of.

adsf

ergerg
 <---get rid of this one (duplicate)
asdfasdfsdf
 <---get rid of this one (duplicate)
rthhdhdfhdhdfhdfg

ergerg

asdfasdfsdf


title: What is the current page's Taxonomy?

text: I need to be able to switch between the current page taxonomy so I can load in the appropriate menu:               $current_tax = 'need to get this from somewhere';     switch ($current_tax) {         case 'tax1':             // load menu1         break;         case 'tax3':             // load menu2         default:         break;     }      I'm not sure which method is best to get the current page's taxonomy.


title: WP calendar summary attribute validation error

text:
When the calendar widget is activated in the sidebar, it generates the following validation error (W3C markup validation): > The summary attribute is obsolete. Consider describing the structure of the > table in a caption element or in a figure element containing the table; or, > simplify the structure of the table so that no description is needed.               …alendar

      How can I rectify this without messing with any core file? Working with WP3.1.4, twentyten theme. Thanks.


title: Why does hitting enter in Visual Editor add <p> instead of <br>?

text: Why does hitting the enter key in Visual Editor add `<p>` instead of `<br>`? What I want sometimes is a new line that starts immediately after the previous line. Unfortunately, the visual editor automatically wraps my new line in a `<p>` tag when all I really want is a `<br>` tag so that there is no space between the two lines. How can I solve this without specifically changing my code in the HTML tab?


title: Email admin when post pending?

text: I have this little bit of code that sends me an email whenever a new posts is published by an author, but I want to be alerted to posts in 'pending' status by contributors too.               add_action('publish_post', 'send_admin_email');     function send_admin_email($post_id){         $to = 'myemail@email.com';         $subject = 'New Post on The Articist';         $message = "new post published at: ".get_permalink($post_id);         wp_mail($to, $subject, $message );     }         Can I have emails sent to me so I'm informed when posts are pending? Code from userabuser's first solution, this doesn't seem to actually send emails(yes, I have changed it to my actual email address in the functions.php).               add_action( 'transition_post_status', 'pending_post_status', 10, 3 );          function pending_post_status( $new_status, $old_status, $post ) {              if ( $new_status === "pending" ) {             function send_pending_email($post_id){                 $to = 'myemailaddresshere@mysite.com';                 $subject = 'New Pending Post';                 $message = "new post Pending";                      wp_mail($to, $subject, $message );                }              }          }


title: Using jQuery in widget development

text: I'm working on a widget that do some magic with jQuery (slide,fades elements). The problem is that the jQuery script attached to widget is not called when I delete and then replace the widget in the sidebar . Even If I have in the form function something like this :               public function form( $instance ) {              wp_register_script('script', get_template_directory_uri() . '/script.js', array('jquery'), null, true);         wp_enqueue_script('script');     }      The script is present in the page (If I `view source` it is there) but the document.ready function is not triggered so all the onclick action are disabled. Refreshing the page resolve the problem but it's there a way to resolve this somehow ? I need something like `document.on("widget-attached-to-sidebar", function(){});` **EDIT:** Steps to reproduce this problem :   * `refresh the page`   * `my jQuery script works`   * `delete the widget`   * `add it again`   * `my jQuery script is not working anymore (need to refresh the page again)` The script.js is still there in the page (`view source`) through all those steps .


title: Why can't my admin account manage attachments on a custom post type with a unique capability type?

text: I've created a custom post type called 'directory' and assigned it the capability type of 'listing'. It has a unique capability type because I want to restrict Contributors to only be able to create/edit/publish this post type, which I am restricting via capabilities. There are the capabilities that were created by the MapCap plugin:   * Delete listings    * Delete published listing posts   * Edit listings    * Edit private listing posts   * Edit published listing posts   * Publish listings   * Read private listings For the Contributor, everything is working properly, and he/she can create, and only edit his/her own posts, and can upload attachments. The Admin account has all the same capabilities, but isn't fully working. I can create a post, and edit any of the others. But it does not give me full rights to the attachments. In the media library, any files I upload with this custom post type can't be deleted when I am logged in as the admin. (I am still able to Trash the attachments by other authors, just not my own uploaded as admin.) The closest thing I've found is this message on WordPress Trac that describes how attachments can't be edited without the edit_post/delete_post capability. I assume this is simply a matter of me not having proper capabilities assigned to the post type, but I've not had any luck finding the right combination.


title: How to show page title in blog post of wordpress site

text: I want to show the page title in single post page of wordpress theme. I tried to use `<?php echo get_the_title() ?>` but it returns the post title, not the page title. basically I want to show my page title, in this case "Blog" below my header area in single.php file. how do I make it?


title: get the image of the post

text: Im running 'the loop' and I want to get the image of the post (in original size - not thumbnail), how do I do it? thank you.


title: What is a good way to test that plugin upgrades have completed properly?

text: I'm working to automate plugin upgrades across all my WordPress installs. Part of that process is making sure the plugins upgraded correctly, didn't introduce errors and don't cause new conflicts with other plugins. Is there a way to check that plugins have upgraded correctly afterwards?


title: Adding admin menus to wordpress

text: I am trying to add a menu box to `Pages > Pages` or `Pages > Add New`, basically whenever they access a page, be it to edit an existing page or add a new one, I would like to add a menu box under the `Page Attributes` box on the right, or anywhere on those pages that I can add a input form into to work in conjunction with the plugin I am trying to build. I am very very new to wordpress plugin development, so please forgive my ignorance on the subject, any learning materials or good resources on the subject would also be greatly appreciated! Thanx in advance!


title: How to save post change url youtube link?

text: In functions.php i using this to change width url from youtube:               add_action('save_post', 'set_url_youtube');     function set_url_youtube() {         $post = get_post($post_id);          $content = $post->post_content;         preg_match_all('#(http://www.youtube.com)?/(v/([-|~_0-9A-Za-z]+)|watch\?v\=([-|~_0-9A-Za-z]+)&?.*?)#i', $content, $urls, PREG_SET_ORDER);         if(is_array($urls)) {            foreach ($urls as $url)            $videos_url[] = $url[0];         }              if (is_array($videos_url)) {             $videos_url = array_unique($videos_url);             rsort($videos_url);         }                 if($videos_url) {             foreach ($videos_url as $video_url) {                 $content = str_replace($video_url, $video_url.'&w=550', $content);             }             remove_action( 'save_post', 'set_url_youtube' );             wp_update_post( array('ID' => $post_id, 'post_content' => $content) );             add_action( 'save_post', 'set_url_youtube' );         }     }     ?>      But when save post is, url `http://www.youtube.com/watch?v=KTRPVo0d90w` not change to `http://www.youtube.com/watch?v=KTRPVo0d90w&w=550` How to fix it ?