next_post_link / previous_post_link not working with WP_Query

I am trying to add next and previous page buttons to my template, but when I try to use either `next_post_link` or `previous_post_link`, it just does not work. Could it be because I am using `WP_Query`? Here is my code thus far,               <?php get_header(); ?>                      <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>                 <?php $args = array(                     "post_type" => "page",                      "page_id" => $post->ID,                      ); ?>                      <?php $query = new WP_Query($args); ?>                      <?php if ($query->have_posts()) : ?>                          <?php while ($query->have_posts()) : $query->the_post(); ?>                                              <?php endwhile; ?>

<?php previous_post_link(); ?>

<?php next_post_link(); ?>

                      <?php else: ?>                                                      <?php endif; ?>          <?php get_footer(); ?>      Am I maybe missing essential parameters? From what I can see in the codex, it should work fine as I am using it now?


admin_notices after register_uninstall / deactivate_hook

I've successfully added admin notices to display on `register_activation_hook`, and when the plugin updates, but I'm not seeing any way to display `admin_notices` after the uninstall or deactivation hooks. Is this at all possible? ~~Alternatively can use javascript at this stage?~~ (yes sort of). * * * **EDIT:** To answer @G. M. I've already read the docs and @kaiser I've already seen your great writeup on these hooks, but unless I've been sloppy and missed something these two hooks seem to operate differently then the activation hook. Here is what I've tested: This does **not** display a notice on the admin page, on deactivation or uninstall (though with _deactivation only_ , you _will_ see the message displayed briefly on a white screen after the hook runs, but just before the plugin admin page reloads):               register_deactivation_hook(__FILE__, "gfahp_deactivate");     function gfahp_deactivate(){         $notices = sprintf('%sSome notice%s', '

', '

');     echo $notices;      }      This also does not work (on either):               register_deactivation_hook(__FILE__, "gfahp_deactivate");          function gfahp_deactivate(){           add_action( 'admin_notices', 'gfahp_checks', 0 );      }     function gfahp_checks(){         $notices = sprintf('%sSome notice%s', '

', '

');         echo = $notices; // return does not work either      }      Javascript DOES work on deactivation but NOT uninstall:               register_deactivation_hook(__FILE__, "gfahp_deactivate");     function gfahp_deactivate(){         $notices = 'Some notice';         echo "";      }


Override private status - Enable users to read private posts

**Hidden private posts for not logged in users** The private posts are by default only visible when logged in. **Override, show private posts for everyone** Is there a clever way to override this? Make it visible to everyone? **404 page** I know about using it in queries but the big problem is the 404 page that is shown. Instead of 404 template it should use single.php template.


(Wordpress) How to get custom taxonomy parent name?

I'm using **custom taxonomies** and **custom post type** in my blog and everything is running fine so far. The problem is, I've made a small query to list all my child categories, but now I can't get the name of each parent because of the condition on line 10. Here's my code:               <?php     $args = array(             'orderby' => 'id',             'order' => 'ASC',             'taxonomy' => 'album'     );                       $categories=get_categories($args);     foreach($categories as $category) {     if($category->parent!=0) {     ?>

             <a href="<? bloginfo('url'); ?>/album/<?php echo $category->category_nicename; ?>" rel="nofollow">                             <img src="<?php bloginfo('url'); ?>/covers/<?php echo $category->category_nicename; ?>.jpg" alt="">
                     <a href="<? bloginfo('url'); ?>/album/<? echo $category->category_nicename; ?>">                             <? echo $category->parent . ' - ' . $category->name; ?>

         <?         }     }         ?>      Any workaround?


Custom post type's slug gets wrong when adding a custom meta box

I'm trying for hours now to find the error moving back and forth. I have a custom post type. Everything works fine until I add my custom meta box. Now suddenly the slug gets the title of one of `$post->ID == '21'` child pages instead its own title when creating a new custom post. It always is the title from the page with the lowest `$post->ID`. But when I remove my custom meta box again. Everything works fine. I may have tracked it down to the `foreach` but I can't see what's wrong there. Besides this `%postname%` error everything's fine. The custom field gets saved correctly. I even can edit the slug manually. But that's not how it is supposed to be. Please help! * * * Tried it without the `<form>` tags now. Problem still persists. Calling `wp_reset_postdata()` didn't work as well. But I realized the slug always gets created right after I fill the title text input. Also when I edit the custom post later and change some content the slug gets wrong again.               add_action( 'init', 'cpt_init_cases' );     function cpt_init_cases() {       register_post_type( 'case', array(         'labels' => array(           'name' => __( 'Cases' ),           'singular_name' => __( 'Case' )),         'description' => 'Create cases to be displayed on single customer child pages',         'public' => true,         'menu_position' => 6,         'rewrite' => array('slug' => 'case'),         'supports' => array('title', 'editor', 'thumbnail', 'custom-fields')       ));     }          /*** when I delete everything below this line slugging works as expected ***/     add_action('admin_init', 'admin_init');     function admin_init(){         add_meta_box('refInfo-meta', 'Reference', 'reference_meta_callback', 'case', 'side', 'high');     }            function reference_meta_callback( $post ){            global $post;            $custom = get_post_custom($post->ID);       if( isset($custom['reference_id'][0]) ) {         $reference_id = $custom['reference_id'][0];       } else {         $reference_id = '0';       }            wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );            ?>         <form action="<?php bloginfo('url'); ?>" method="get">           <select name="ref_id" id="ref_id">             <option value="0" <?php selected($reference_id, '0'); ?>>- choose client -</option>                <?php           $args = array( 'numberposts' => -1, 'post_type' => 'page', 'post_parent' => 21);           $posts = get_posts( $args );           foreach( $posts as $post ) : setup_postdata( $post ); ?>             <option value="<?php echo $post->ID; ?>" <?php selected($reference_id, $post->ID); ?>><?php the_title(); ?></option>           <?php endforeach; ?>                </select>         </form>       <?php     }            add_action( 'save_post', 'save_reference_id' );       function save_reference_id( $post_id ) {            global $post;            if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;            if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;            if( isset($_POST['ref_id']) ) {         update_post_meta($post->ID, 'reference_id', $_POST['ref_id']);       }     }


wp uses index.php instead taxonomy.php

I have created taxonomy AUTO with terms and rewrite rules -               add_rewrite_rule("^auto/?$", "index.php?taxonomy=auto", "top")     add_rewrite_rule("auto/([^/]+/?)$", 'index.php?taxonomy=auto&term=$matches[1]', "top")      **The problem:** `site/auto/audi uses taxonomy.php` as WP must do, BUT `site/auto` uses `index.php`, while in both cases `$wp->query['query']['taxonomy'] = auto`.


Wordpress loop only displaying one post

I don't know enough PHP perhaps to recognize immediately why the loop in my wordpress theme is only displaying one post and so I humbly ask for assistance.

                          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                              <?php                                get_template_part( 'content', get_post_format() );                      ?>                            <?php endwhile; ?>                      <?php web2feel_content_nav( 'nav-below' ); ?>                  <?php else : ?>                      <?php get_template_part( 'no-results', 'index' ); ?>                  <?php endif; ?>

     <?php get_footer(); ?>      I believe that it then references the content.php file which is as follows               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                              <?php if ( 'post' == get_post_type() ) : ?>
                             <?php web2feel_posted_on(); ?>
                         <?php endif; ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
                                                    <?php                         $thumb = get_post_thumbnail_id();                         $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)                         $image = aq_resize( $img_url, 780, 400, true ); //resize & crop the image                     ?>                          <?php if($image) : ?>                     <img class="img-responsive" src="<?php echo $image ?>"/>                     <?php endif; ?>
                         <?php the_excerpt(); ?>
                                                   <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>                             <?php                                 /* translators: used between list items, there is a space after the comma */                                 $categories_list = get_the_category_list( __( ', ', 'web2feel' ) );                                 if ( $categories_list && web2feel_categorized_blog() ) :                             ?>                                                              <?php printf( __( 'Posted in %1$s', 'web2feel' ), $categories_list ); ?>                                                          <?php endif; // End if categories ?>                                  <?php                                 /* translators: used between list items, there is a space after the comma */                                 $tags_list = get_the_tag_list( '', __( ', ', 'web2feel' ) );                                 if ( $tags_list ) :                             ?>                                                              <?php printf( __( 'Tagged %1$s', 'web2feel' ), $tags_list ); ?>                                                          <?php endif; // End if $tags_list ?>                         <?php endif; // End if 'post' == get_post_type() ?>                              <?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>                         <?php comments_popup_link( __( 'Leave a comment', 'web2feel' ), __( '1 Comment', 'web2feel' ), __( '% Comments', 'web2feel' ) ); ?>                         <?php endif; ?>                              <?php edit_post_link( __( 'Edit', 'web2feel' ), '', '' ); ?>
      Any help would be appreciated. Thank you. Also this has nothing to do with the wordpress backend settings. They are indeed set to show 5 posts on the blog page.


pre_get_posts returns non property object when using posts__not_in

I'm displaying posts from a category and want to show all but the first one using posts__not_in. The code below is returning a property of non object error.               function modify_onthisday_cat( $query ) {              if ($query->is_category(7) && $query->is_main_query() ) {                  global $post, $wp_query;                  set_query_var( 'day', date('d') );             set_query_var( 'post__not_in', array($post->ID) );                  return;         }     }     add_action( 'pre_get_posts', 'modify_onthisday_cat');      If I replace $post->ID with a specific post id, it will work, but I need it to be dynamic. From what I understand this action is ran before the query so getting that id dynamically is going to take some more work. I'm just not sure how to get there. Edit (clarification): Currently, I have a category page served up with the category.php template. I have a featured post displayed above and the remaining posts displayed below. The featured post is called from a custom function and the remaining posts are called from the default wordpress loop. My goal is to show the posts below while not showing the first post and preserving pagination.


Fetching data from other website in wordpress

I am developing a website in which I want that on clicking a push button named "Get date" the client get's to know the date. The data will be fetched from supremecourt of India's website...the data required for fetching the date will be filled in my website..Is it possible to do so??


3.1 update erases customized function page?

I recently performed the 3.1.1 update on a localhost install, but first performed a backup of my entire wamp directory. Once the install was complete, it seems all the edits to my functions page are now gone. This was my custom post types & taxonomies. I have my backups, so I guess I can just copy and paste. but will I have to do this every time there's an update? Did I perform the update wrong? Don


Wordpress | Sub-domain switching

I'm finding a way to redirect to a sub-domain. Sub-domains contain instances of multiple languages, say for an example -: `http://mysite/?p=7694` This is the English site and I want it to redirect to (when user selects particular language)               http://chinese.mysite/?p=7694      Is there a simple way of doing this want to know if there are any plugins to do so. This the requirement of my client, and they wont to do it in that way. Thanks.


How to keep track of new plugins published on wordpress.org?

Is there any RSS feed to keep track of the Newest Plugins published on wordpress.org?


Missing current_page_item in custom menu

I'm using the new custom menus in my side navigation and it only creates a class sub-menu in the `UL's` but does not use the `current_page_item` like when you use `wp_list_pages()`. I have 3 levels and only want to show the sub menus of the page you are on, easily done using `wp_list_pages()` but I can't do it with the custom menus? Can someone please help? Thanks


How to put Stack Exchange Flair as widget?

I want to put my flair in as a widget in the top of my sidebar in my blog. There was a similar question asked here but the only answer links to the flair page and suggests copying and pasting the html into the theme. I don't want to edit my theme, I want to be able to add is as a widget. Is this possible?


Where sales manager of WP-Commerce plugin?

This is screenshot after when i installed wp-commerce plugin ![enter image description here](http://i.stack.imgur.com/cx7tZ.png) This is manager screenshot on ecommerce plugin website http://getshopped.org/wp-content/uploads/2010/01/screenshot-install-06.jpg i can't to find out sales manager like as on ecommerce website.


Display post titles that match string in post content

I'm trying to search through the content of the current post and look for any strings in the content that match the title of any 'term' custom post types. The idea is that any terms we have that are in the post description are right there for a user to view if they need clarification. This script works perfectly when I put in any string for the variable $content_search, but stops working properly when I set               $content_search = get_the_content();      It spits out the matching terms, but also a few seemingly random ones as well. I've been staring at this block of code for quite some time and I just can't figure out what's wrong. Any help would be awesome!                                   <?php                                  // search for matching glossary terms that are in the description                                  $content_search = get_the_content();                             $content_search = strtolower($content_search);                                  $args_terms = array(                                 'post_type' => 'term',                                 'orderby'   => 'title',                                 'posts_per_page' => -1                                 );                                  $glossary_terms = new WP_Query($args_terms);                                  echo '
Terms Used in this Lesson:
';                                  while ($glossary_terms->have_posts()){                                 $glossary_terms->the_post();                                 $tt_title = strtolower(get_the_title());                                      if (strpos($content_search, $tt_title) !== false){                                          $tt_title = ucwords($tt_title);                                     $tt_content = strip_tags(get_the_content());                                     echo do_shortcode('[tooltip tooltip_title="' . $tt_content . '"]' . $tt_title . '[/tooltip]');                                     echo ' | ';                                     }                                 }                                      wp_reset_postdata();                             ?>


Display all categories as plain text

Within my loop i'm currently outputting one category that a post is assigned to as plain text. Its being used as a class name within my markup (not visible to users) but if a post is assigned multiple categories, my code below only outputs one category, how do I get ALL categories (that the post has assigned to it) to appear as class names instead?               <?php //begin new query                     $project_query = new WP_Query('cat=14,15,16,17,18,19');?>                          <?php while ($project_query->have_posts()) : $project_query->the_post(); $do_not_duplicate = $post->ID; ?>                                                                          <div class="element <?php $category = get_the_category(); echo $category[0]->category_nicename; ?> sports">
                                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                                          <img src="<?php the_field('leading_image') ?>" />
<?php the_title(); ?>

                          <?php endwhile; wp_reset_query(); ?>


Is there a limit on the number of attachments?

It seems there's a limit on the number of attachments of a post? I have 265 images uploaded for one of the posts (yes, I know it's quite a few), and when I want to put them into order. The result: only 125 of them gets number, the others a left without one and also I only see 140 images. The tabs says "gallery (265)", and it is ok, but I only see 140 images when I open the gallery tab.


Query posts alphabetically within this function

I've been given some code to tidy up and edit a bit and the client wants to organize a custom post type named "plans" alphabetically. It's not a straight forward query and I've never come across anything like this before, any ideas?               <?php $planIDs = get_post_meta($post->ID, '_lm_comm_plans', false); ?>     <?php foreach ($planIDs as $planID) : ?>         <?php $pdfID = get_post_meta($planID, '_lm_plan_pdf', true); ?>             <?php $pdfURL = wp_get_attachment_url($pdfID); ?>                 <?php $planTitle = get_the_title($planID); ?>

     <?php endforeach; ?>


my blog crashes ie7?

hey guys, weird problem. My blog theme works fine in ie8, ie9 and all other major browsers... however ie7 doesn't even render it? in ie7 it seems like my blog even has serverside problems? ![enter image description here](http://i.stack.imgur.com/MEh09.png) any idea what could cause that? In my programming history i've encountered ie7 styling issues and stuff but never something like this that the webpage doesn't even get rendered? Sometimes the page is kind of loaded in ie7, however the browser does crash anyway. any idea what could cause that? If sometimes the page gets loaded in ie7 the bar at the bottom says: "loaded but with errors" ... I do not have a single error if I validate the page!


Open a wordpress single post in a lightbox without the header and footer

I am developing a plugin which requires to open a single wordpress post inside of a lightbox. Here are a few details :   * Currently,I am using colorbox for lightbox. The lightbox is triggered to open an external .php file which received the post id as $GET variable.   * Only the Title, Meta information, Content and comments part should open in the lightbox and not the theme header and footers.   * All the shortcodes , embedded youtube links etc should work in the opened post.   * It would be great if there is a way to pick up the current theme's single.php file, strip the header , sidebar and footer from it and display only the formatted content. But i believe that depends on themes and is not a generic solution Here is the current plugin link :http://test.anshulsharma.in/ The current code for the external php file is :               if(!function_exists('get_post'))     {     require_once("../../../../wp-load.php");     }     $thepost = get_post($_GET["ID"]);     $thecontent = $thepost->post_content;     $thetitle = $thepost->post_title;     $thelink = get_permalink($_GET["ID"]);     ?>         <div id="cg-post-container" style="width:<?php echo get_cg_option('lightbox_width'); ?>px;">
         <a href="<?php echo $thelink; ?>"><?php echo $thetitle; ?>

                   <?php echo $thecontent; ?>

      In the current version of the plugin, only the posts content shows up. Shortcodes dont work and embeded links dont show up. Also there is no way to view or add comments. I am willing to write a custom single.php file for this and add my own styling . But i just want to know the BEST way to do it and also how to communicate the post id (from the $GET variable to the single.php) to the lightbox.


Closest post to a date

So I've got a wordpress blog I've been posting to once a week for a couple of years - I'd like to be able to press a button, or use a bookmarklet, or edit the url in such a way that I see that I see the post from a year ago. For example if the date is 31 December 2012. I'd like to be able to retrive the post that was made closest to 31 December 2011. Any ideas?


Problem with WordPress output text ('esc_html' & 'wp_richedit_pre')

I have a problem with output text. When I editing text in the WordPress control panel everything looks normal: http://i.stack.imgur.com/GaIut.png but when I output it to the html:               <?php esc_html( wp_richedit_pre( $_product->details ) ); ?>      It looks like this: http://i.stack.imgur.com/r81xE.png What could be wrong? Please for help.


can I 'combine' categories as a menu item?

I have custom post type and I want to have a menu where I combine category or categories from default Wordpress post type and from my custom post type. Let's say I have these categories   * sport, books, movies, any in default post type   * sport, books, school, any in my custom post type can I have a menu link where I would display   * **sport** posts from both post types?   * **sport, books** posts from default post type and **any** from my custom post type?


Where do I start from

I'm student web developer and I'd like to know the things I should know before venturing into WordPress. Where do I start?


Proper procedure for wp_insert_post?

I just found the magnificent wp_insert_post function and have a few basic question about it. *For reference I used this on a multisite install for a number of blogs running theme_x. I simply wanted to add a page to each blog (without having to do it through WP Admin). This seems to have mostly-worked though I'm not sure I'm using it for its intended purpose?   1. **What happens if the specified page title already exists on several blogs?** Does it a) terminate the function b)rename in typical WP fashion to "page-name-2" format, or c) something else?   2. **Should I remove the code from the theme template now that I have done what I needed to?** I'd like to leave it in just incase more blogs are added which use this theme but I'm wondering if it creates unnecessary database overload (does it get run every page load)?   3. **The page doesn't appear anywhere in WP admin?** Though all blogs using this theme do indeed resolve to the newly-added page like so ... URL/newly-added-page. This is fine for me in this instance, but it makes me think I'm not using the function "properly" (I kinda expected a new page in WP Admin also)


Save Theme Options (options.php) From The Frontend

I try to save an option from the frontend but i can't find yet how to do it.   So, the idea is to give the blog owner a simple form with a dropdown that can select a different stylesheet.css. I have build it for the wp-admin area and it works fine, but i want to do the same in the frontend, i have tried to include the wp-admin/options.php in the header but nothing, just errors,   i post the form to "wp-admin/options.php" but it redirect me in the wp- admin/options page. here is the frontend form:               <form id="save-theme" name="save-theme" action="/wp-admin/options.php" method="post">     <select>         <option>Select Theme</option>         <option>Red</option>         <option>Dark</option>         <option>White</option>     </select>     <button name="update-options" type="submit">Save</button>     <?php wp_nonce_field('update-options'); ?>     </form>      thanks a lot!


How to list users that have written custom post types and hide the ones that have not?

I'm trying to build an author list that would show all authors that have written a Custom Post Type post, and hide authors that have no posts. With `wp_list_authors` it would be easy to show users that have written Posts (not CPT). This does not show the users that have published Custom Post Types, it affects only to Posts.               wp_list_authors('hide_empty=1');      I looked in to the `get_users` function but managed to only build a list with it (more control over the list but not what I was aiming for).                $blog_url = get_bloginfo('home');      $blogusers = get_users('orderby=display_name&role=editor');      foreach ($blogusers as $user) {         echo '
user_login . '">' . $user->display_name . '
';       }      I found this really nice post dealing with how to show the post counts in the backend. It defines a function `_yoursite_get_author_post_type_counts()` that could possibly maybe be some help in this... Any idea how to do this? Thanks! :)


Display a post map on a blank/new page

On my single.php file I am displaying the_title(), the_content() and a link to a Google Map (Javascript v3). Lat/Lng coordinates for each location map are held in two separate meta fields attached to each post. How can I structure my single.php file to grab the Lat/Lng values and display only the map when the map link is clicked? I think I need to append the lat/lng values to my permalink somehow and then when single.php notices these values present it strips out everything except:

      I am using jQuery Mobile as the presentation layer for this project and have pretty permalinks enabled. My single.php file looks like:               <?php get_header(); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                    <?php the_title(); ?>          <?php the_content(); ?>          <a rel="external" href="<?php echo get_permalink(); ?>">Map

          <?php endwhile; ?>     <?php endif; ?>     <?php get_footer(); ?>      While in the head of my template I call a simple JS file as below:                     Thank you.


remove empty paragraphs from the_content?

Hey guys, I simply want to prevent the creation of empty paragraphs in my wordpress post. That happens quite often when trying to manually space content. I don't know why this doesn't take effect?               /*Remove empty paragraph tags from the_content*/     function removeEmptyParagraphs($content) {              /*$pattern = "/
]*><\\/p[^>]*>/";            $content = preg_replace($pattern, '', $content);*/         $content = str_replace("

","",$content);         return $content;     }          add_filter('the_content', 'removeEmptyParagraphs');      edit/update: seems like the problem is this:               function qanda($content) {              // filters for [q=some question] and [a=some answer]         // wraps it inside of

         $content = preg_replace('/\[q=(.+?)].+?\[a=(.+?)]/is', '

$1

$2

', $content);              return $content;     }          add_filter('the_content', 'qanda');      i did this function myself to filter for a kind of shortcode pattern in my posts and pages. Even though in my backend the post is completely done without paragraphs and unnecessary spacings the outcome looks like this:

...

...

...

      any idea where this empty p's come from?


Easy way to update a single translation entry without having to translate

I'm using the "Featured Image" meta box which allows you to attach a secondary thumbail to a post. The title for this box is defined in the Wordpress codebase like so:               __('Featured Image')      Which looks to be a wrapper for the translate methods. I'm wondering how to change this text without having to do any translation files. Is it as simple as an action or filter hook?


Custom post type pagination error

Another one of these paging errors you see here so often. I searched high and low for a fix but have come up with nada so far. I am paging CPT results using my archive-{$post_type}.php template and getting an incomplete return of posts. I have set posts_per_page to 8, and am return 3 pages to get 24 results. There are 27 posts, so I am missing 3 (ie. paging falls short of showing last 3 posts). Here's my template file (HTML stripped for clarity):               <?php   /* SET UP */                  wp_reset_query();                  // Selected team member             $team_member_id = $_GET['member'];                  // Top post by menu order             $top_post = get_posts('post_type=team&numberposts=1&orderby=menu_order&order=ASC');             $top_post_id = $top_post[0]->ID;                       // Set $current_team_member_id             if ($team_member_id) {                 $current_team_member_id = $team_member_id;             } else {                 $current_team_member_id = $top_post_id;             }          ?>               <?php   /* MENU */                  // Paging             $page = (get_query_var('paged')) ? get_query_var('paged') : 1;                  // Args             $args = array(                 'post_type'=> 'team',                 'posts_per_page' => '8',                 'paged' => $page,                 'orderby' => 'menu_order',                 'order' => 'ASC',             );                       // New instance of WP_Query             $loop = new WP_Query($args);                       if ($loop->have_posts()) :          ?>               <?php next_posts_link('Next' ); ?>     <?php previous_posts_link('Back' ); ?>               <?php while ($loop->have_posts()) : $loop->the_post(); ?>          <?php   $post_id = get_the_ID();             $postclass =  '';                  if( $current_team_member_id == $post_id ) {                      $postclass = 'current';                   } elseif ( $top_post_id == $post_id && $current_team_member_id == NULL) {                      $postclass = 'current';                   } else {                      $postclass =  'post';                   }                   $url = get_bloginfo('url').'?post_type=team&member='.$post_id.'&paged='.$page;           ?>          <a id="team-member-<?php print $post_id; ?>" href="<?php print $url; ?>" class="<?php print $postclass; ?> <?php print $top_post_id; ?>"><?php the_title() ;?>
     <?php echo get_post_meta( $post->ID, '_exit_member_metabox_pos', true ); ?>          <?php endwhile; ?>               <?php   /* MEMBER PROFILE */                  $current_team_member_post = get_post($current_team_member_id );              setup_postdata($current_team_member_post);          ?>          <?php echo $current_team_member_post->post_title; ?>     <?php echo get_post_meta( $current_team_member_id , '_exit_member_metabox_pos', true ); ?>     <?php the_content(); ?>     <?php echo get_the_post_thumbnail($current_team_member_id, 'pic-third'); ?>                    <?php else: ?>
Sorry, but this content is not available.
          <?php endif; ?>      What am I doing wrong? What's missing?


Adding Widget form fields dynamically

I am trying to add form field to a WordPress widget dynamically. So if the user want to add another date to an event they can click a button to get more fields. The question is: **How do save newly created input fields to my database?** Do i need to write a custom update function? Any tips? This is how the widget looks: ![enter image description here](http://i.stack.imgur.com/sn2kO.png) This is my php code for the widget (so far):                   class Spillelister extends WP_Widget {              public function Spillelister() {                  $widget_options = array (                 'classname' => 'spillelister-widget',                 'description' => 'Widget for å illustrere spillelister.');                  parent::WP_Widget('spillelister_widget', 'Spilleplan', $widget_options);         }              // The actual widget user interface         public function widget($args, $instance) {                  extract( $args, EXTR_SKIP);             $title = ( $instance['title'] ) ? $instance['title'] : 'Spilleplan';             $body = ( $instance['body'] ) ? $instance['body'] : 'Ingen flere forestillinger';                  ?>                      <?php echo $before_widget; ?>                 <?php echo $before_title . $title . $after_title; ?>
<?php echo $body; ?>
                  <?php         }              public function update() {              }              public function form() {         ?>

                 Dato <input type="text" class="datepicker">
                 Tid <input type="text">                 Remove

                 Add fields
              <?php          }               }          function spillelister_init() {         register_widget('Spillelister');         }     add_action('widgets_init', 'Spillelister_init');      Any tips, hints or answers are appreciated. :)


Post revisions don't save or show up only for custom post types

My website makes use of a number of custom post types as well as the traditional "posts" and "pages" types. For all "posts" and "pages" revisions show up as they should, with a history of edits visible, the option to compare posts, and so on. For all custom post types, I have no revision history at all. I've enabled revisions when defining each of these post types in functions.php, so on each of these post types I get a blank tab that says "Revisions" but does not display or collect any revisions data. I'm at a loss for how to fix this and any help would be appreciated! Thanks in advance for any assistance.


How can I create podcast posts automatically from the contents of a particular directory?

All of the Wordpress Podcasting plugins I have seen allow you to easily insert a podcast into a post. Is there any way to automate the creation of the post (and the podcast feed) by simply uploading the podcast into a specific directory? For example I could upload 10 podcasts into the `/media/` directory and then it would automatically create a post for each of the 10 files I uploaded. Ideally it would take the information from the ID3 tags. The key factor here is not having to do anything in wordpress after the initial setup.


How to allow visitors to enter custom post type?

I wanted to use a custom post type to create a "share your story" type of feature. People would fill in the text boxes and "share their story". This would then be automatically posted on to a stories page. But I can't figure out how to have the data entry page be a decent looking page instead of one of the admin pages, i.e. I want the data input screen to be on the front end instead of the back end. Does anyone have any examples/tutorials on how to do this?


$wp_query->current_post restarts from zero on paged pages

I know how to keep track on the 'index' of the current post when running the loop using               $wp_query->current_post      Bu this restarts the count from zero on subsequent paged pages. So if I have 20 posts, and show 5 posts per page, then on page 2 the posts are again numbered 0-4 instead of 5-9. My question is: Is there a build in way to get the absolute index when running the loop on a paged page, or do I have to calculate the offset myself, using information about page number and posts per page?


Help with WP Business Directory Manager Plugin?

I'm using the WP Business Directory Manager plugin and I'm having some problems. The developer hasn't been supporting the plugin lately, so here I am.   * I need to change the field order. Currently the option is there, but it doesn't work.   * I need to target the field for CSS purposes, with custom classes/ids   * And I need to be able to query the post from certain categories from its directory. I would want to post different list on throughout the site and Im not sure how to do that. The plugin is very useful, I just need some help with these issues...PLEASE. Thanks for any help that can be provided.


How to use widget in a widget-less WordPress theme?

I have a widget-less WordPress theme to which I want to add Subscribe by Email functionality. Unfortunatly the plugin only comes in the form of a widget. How can I use the widget functionality without widget support.


Removal of all posts content in bulk, keeping the posts itself

How to, using PHP scripting or WordPress overwrite all of the posts (permamently, so it takes effect on database) with some static text such as "Content removed."?


Run functions only in the admin area?

I'd like this code to only run inside the admin area as it is resorting the items on the public side admin bar too.                 /* Reorder Admin Menu to put "Pages" at the top */       function menu_order_filter($menu) {       $content_menu = array('edit.php?post_type=page');       array_splice($menu, 2, 0, $content_menu);       return array_unique($menu);       }       add_filter('custom_menu_order', create_function('', 'return true;'));       add_filter('menu_order', 'menu_order_filter');


Pick out specific menu item from code

I'm using this bit of code to generate a menu:
       <?php $args = array(         'depth'        => 1,         'show_date'    => '',         'date_format'  => get_option('date_format'),         'child_of'     => 0,         'exclude'      => '426, 508',         'include'      => '',         'title_li'     => __(''),         'echo'         => 1,         'authors'      => '',         'sort_column'  => 'menu_order, post_title',         'link_before'  => '',         'link_after'   => '',         'walker' => '' ); ?>

<?php wp_list_pages( $args, 'sort_column=menu_order' ); ?>

      It's generating the menu fine but one of the links I need it to goto another page. Is it possible to pick out that page by ID and tell it to goto a different address? If so, how can I do it?


URLs ending with number higher than 2147483647 redirects to to domain.com/2147483647

I've got a javascript implented on my Wordpress site with the purpose to the substring of the URL and if it matches some criteria, it'll load a specific piece of content. So, if you input this URL for example `http://domain.com/subpage/84708495222` it should catch `84708495222` and find the content associated with this number. This works as intended. BUT, the problem is that Wordpress for some reason redirects `http://domain.com/subpage/84708495222` into `http://domain/subpage/2147483647`. I guess it's due to some sort of rewriting mechanism in Wordpress. Is there some way to avoid this? `84708495222` in this example is not generated by me, and cannot be changed to a lower number..


How to get rid of the username of registration form in theme my login wp plugin?

I have tried disabling the username in the functions.php through                if(!is_admin()){       remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );       add_action( 'personal_options', 'prefix_hide_personal_options' );     }     function prefix_hide_personal_options() {     ?>     <script type="text/javascript">       jQuery(document).ready(function( $ ){     $("#registerform #user_login, #your-profile #user_login, #your-profile #nickname, #your-profile #display_name, #your-profile #url,  #your-profile #description").parents("div.form-group").hide();       });     </script>     <?php     }      I have added this id name #registerform #user_login to be hidden but nothing happens in the registration form page, still username is showing up. Any idea that could help me point out the problem and what to do. I am newbie in wp, don't have yet solid understanding in plugins.


Custom Search Form WP_Meta_Query - Filtering Custom Fields

I'm trying to build a search form that will filter users based on their custom fields. These custom fields are things like 'company_name' 'user_country' etc. I have some code and I am having a small amount of success with things so far. I can search for cities for example, but I am not sure if these cities are actually relating to the city names I have created. I think it's better if I show a code example:               <?php     function aio_search_meta_data($atts, $content = null) {     global $wpdb;          extract(shortcode_atts(array(         "role" => '',         "number" => 3,         ), $atts));          // Search general terms      $search_term = (isset($_GET['aio_keyword_search'])) ? sanitize_text_field($_GET['aio_keyword_search']) : false;          $number = sanitize_text_field($number);     $page = (get_query_var('paged')) ? get_query_var('paged') : 1;     $offset = ($page - 1) * $number;     // Set up the Query     if($search_term) {     $meta_query_args = array(         'meta_query' => array(             'relation' => 'OR',             array(                 'key' => 'user_city',                 'value' => $search_term,             ),             array(                 'key' => 'user_country',                 'value' => $search_term,             ),             array(                 'key' => 'user_company',                 'value' => $search_term,             ),         ));     // Instantiate a new object      $meta_query = new WP_Meta_Query($meta_query_args);     // Retrieve SQL     $mq_sql = $meta_query->get_sql(         'user',         $wpdb->users,         'ID',         null     );           } else {     $meta_query_args = new WP_User_Query(         array(             'role' => '',             'offset' => $offset,             'number' => $number,             'meta_query' => array(                 'key' => 'user_country',                 'value' => ''             ),             'meta_key' => 'company_name',             'orderby' => 'meta_value',             'order' => 'ASC'         ));      } ?>               <form class="member-directory-listings" method="get" action="<?php the_permalink(); ?>" role="form">

                 <input type="text" name="aio_keyword_search" id="aio_keyword_search" class="form-control" placeholder="Enter Keywords">                 Search for network partners by country, city, or company name

                 <select class="form-control" name="aio_countries">                     <option value="">Value</option>                 </select>

                 <select class="form-control" name="aio_countries">                     <option value="">Value</option>                 </select>

                 <select class="form-control" name="aio_countries">                     <option value="">Value</option>                 </select>

     <input type="submit" class="grey-btn" value="Search">     </form>               <?php      if(!empty($mq_sql)) { ?>

                 Logo	                 Company Name	                 City	                 Country

          <?php     foreach($mq_sql as $mq) {         $args = array(             'role' => '',         );         $author_info = new WP_User_Query($args);          $author_details = get_userdata($mq->ID);?>
                              <img class="member-profile-img small-image-bg" src="<?php echo $author_details->image; ?>" alt="User image" />             	                          <a href="<?php echo get_author_posts_url($mq->ID); ?>"><?php echo $author_details->company_name; ?>             	                              <?php echo $author_details->user_city; ?>             	                              <?php echo $author_details->user_country; ?>             	             <?php }  ?>

      I have to complete this project by Friday. Can anyone help me to put this form together? I need to be able to create drop downs too with predefined information.


Return a custom value in a function added to an action hook

I looked into the difference between action and filter hooks, and as far as I understand, it is not possible to have a function, which is added to an **action** hook, **return a (custom) value**. My scenario:   * Upon saving a post, I **try** to save another post. Therefore I use `add_action( 'save_post', 'create_another_post');`   * Depending on some conditions, saving this additional post takes place (for that case I'd like to return `true`) or it doesn't (return `false`) How would I go about implementing this `true/false` scenario? I appreciate your help and ideas.


Why doesn't my simple the_title filter get applied?

I have added the code below to an active plugin, but it's having no effect on my posts.               add_filter( ‘the_title’, ‘myfunction’);          function myfunction($title) {      return "Why won't this work?" . $title;     }      What am I missing here? The post templates are definitely using the_title(), and the theme is normal (wp_head(), etc), and there are no conditionals surrounding the function in the plugin that would make it not run. I have also tried adding different priority in the add_filter function, from -9999 to 9999, to no effect.


Is that possible show user's post after user login

I have website, Administrator setup one post for each register user, only this user can see it when he/she login.(the author of the post is the user's name). I think when user login just search user name equal to author name will be fine. The question is how to do it, I don't know too much about PHP, Hard to make it work. He is some code, maybe useful.                 <?php     if ( is_user_logged_in() ) {     echo 'Welcome, registered user!';     } else {     echo 'Welcome, visitor!';     }     ?>


One taxonomy template for all categories?

I'm looking at the Codex about template hierarchy. However, I have a custom post type with many categories from a custom taxonomy I created also. This post type allows users to add new categories to their posts. I read in the codex that I can create a `taxonomy-{taxonomy-name}.php` template file for each of my taxonomies. What I am wondering is if I can create one template file to "catch" all of the CPT's categories.


change menu item names from front

how do i change current menu item names? I have a form that gets the new names the user chose from front. I can not find anywhere a function that handles it. this function:                wp_nav_menu_update_menu_items()      returns an error that says there is no such function. Should I change the information directly in the database? Or is there a simpler way to do this?


Cannot get Jquery to work with wordpress

I can't figure out why Jquery isn't working on my Wordpress site. Am I setting it up right? Any help or suggestions is appreciated! Thanks. Here is what I have in my function.php                function my_scripts_method() {          wp_deregister_script( 'jquery' );          wp_register_script( 'jquery', 'ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js');      wp_enqueue_script( 'jquery' );     }              add_action('wp_enqueue_scripts', 'my_scripts_method');      and on my header.php               <!DOCTYPE html>     <html>     <head>         <meta charset="<?php bloginfo('charset'); ?>">                 <title>          <?php             wp_title('-', true, 'right');             bloginfo( 'name');         ?>         </title>         <?php wp_head(); ?>         <script type="text/javascript" src="js/script.js"></script>         <meta name="viewport" content="width=device-width, initial-scale = 1.0">           <!--[if lt IE 9]!>      <script src="dist/html5shiv.js"></script>      <![endif]-->     </head>


How to check homepage contain blog post?

I try to add some content on the post excerpt in wordpress. For a category page excerpt condition working perfect. but i am not sure how to check in home page i tried is_home and is_front_page like that                   function addtoexcerpt($excerpt) {         ob_start();              $values = ob_get_clean();         return $values.$excerpt;              }     if(is_single()||is_category()||is_front_page()) {         add_filter('the_excerpt','addtoexcerpt');     }      But for homepage itself is not come's up, i a homepage there is 3more columns with these one of the column as blog post how to check the homepage blogpost in order to append the content I am using expound theme template. Thanks vicky


Wordpress with broken paging page 3

I am working with a blog page that uses the following query:               <?php         $paged = (get_query_var("paged")) ? get_query_var("paged") : 1;         query_posts("category_name=blog&posts_per_page=2&paged=".$paged);     ?>      and my pagination looks like:               <?php         $next = get_next_posts_link("Next >>");         $prev = get_previous_posts_link("<< Prev");         if ($prev || $next) { ?>
         <?php } ?>         <?php if ($next) { ?>
                 <?php echo $next; ?>
         <?php } ?>         <?php if ($prev) { ?>
                 <?php echo $prev; ?>
         <?php } ?>         <?php if ($prev || $next) { ?>

         <?php } ?>         <?php if ($prev || $next) { ?>
         <?php }      ?>      The pagination is working to a certain extent...I see the previous and next links and can click next until I get to page 3, instead of arriving at page 3 I get a 404, which is weird because I know there is more content WordPress just doesn't display it for some reason. Anyone know what could be causing this issue, the weird thing is I am using the exact code on another website without error :-( The permlinks are set to the default and I am not using a custom post type. Thanks,   Josh


Self-hosted blog Admin Panel Forwarding to WP.com

I was goofing with the settings (first problem) in the "General" tab of my wp- admin panel on my self-hosted blog. There are two settings: Wordpress.com URL and Blog URL (or something). They were both originally set to my self-hosted `www.domain.com/blog`. I thought if I changed the Wordpress.com URL to an empty blog that I set up on Wordpress `www.myblog.wordpress.com` that it would simply connect the two blogs so that my site went into the Wordpress.com directory. **This did not happen.** Now, if I visit MY self-hosted URL, I see my blog, but it's clearly missing a stylesheet. And now I can't access the admin panel of my own blog. I don't know what happened. Can I remedy this? Is there a file on my server where I can just edit the line that I changed and switch it back to what it should be?


Wordpress query fire inner join in one table 5 times?

Dear friends this is my arguments for WP_Query.               $args = array('post_type' => 'job_listing',     'relation' => 'OR',         'meta_query' => array(             'relation' => 'OR',             array(                 'key' => 'app_trailer-type',                 'value' => $job_tailor,                 'compare' => 'LIKE'             ),             array(                 'key' => 'app_pay-type',                 'value' => $app_pay_type,                 'compare' => 'LIKE'             ),             array(                 'key' => 'geo_address',                 'value' => $geo_address,                 'compare' => 'LIKE'             ),             array(                 'key' => 'geo_country',                 'value' => $geo_country,                 'compare' => 'LIKE'             ),             array(                 'key' => 'geo_short_address',                 'value' => $geo_short_address,                 'compare' => 'LIKE'             ),         ),     );      WordPress Returns query like.               SELECT SQL_CALC_FOUND_ROWS wp_posts.id     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 )            INNER JOIN wp_postmeta AS mt3                    ON ( wp_posts.id = mt3.post_id )            INNER JOIN wp_postmeta AS mt4                    ON ( wp_posts.id = mt4.post_id )     WHERE  1 = 1            AND wp_posts.post_type = 'job_listing'            AND ( wp_posts.post_status = 'publish'                   OR wp_posts.post_status = 'expired'                   OR wp_posts.post_status = 'tr_pending'                   OR wp_posts.post_status = 'tr_failed'                   OR wp_posts.post_status = 'tr_completed'                   OR wp_posts.post_status = 'tr_activated'                   OR wp_posts.post_status = 'private' )            AND ( ( wp_postmeta.meta_key = 'app_trailer-type'                    AND Cast(wp_postmeta.meta_value AS CHAR) LIKE '%Flatbed%' )                   OR ( mt1.meta_key = 'app_pay-type'                        AND Cast(mt1.meta_value AS CHAR) LIKE '%Per Week%' )                   OR ( mt2.meta_key = 'geo_address'                        AND Cast(mt2.meta_value AS CHAR) LIKE '%Davenport%' )                   OR ( mt3.meta_key = 'geo_country'                        AND Cast(mt3.meta_value AS CHAR) LIKE '%United States%' )                   OR ( mt4.meta_key = 'geo_short_address'                        AND Cast(mt4.meta_value AS CHAR) LIKE '%Davenport%' ) )     GROUP  BY wp_posts.id     ORDER  BY wp_posts.post_date DESC     LIMIT  0, 10        please help, i can't understand why it creates inner join 5 times on one table.


Update woo-commerce cart content on post update

I am using the woo-commerce plugin for a payment gate-way when I did add to cart first time that time I am inserting the product to cart it's working good.Just having the issue with how to update cart if I added cart before in same session.I tried lots of but not getting any idea how to do it.               <?php         add_action('init', 'customcart');                    function customcart() {              // simple form for testing                      if (isset($_POST["addcustomcarts"])) {               echo"mypostif";             global $woocommerce;           if(empty($_SESSION['update_post'])){                 echo"mypostif2";             $my_post = array(               'post_title'    => 'My post',               'post_content'  => 'This is my post.',               'post_status'   => 'publish',               'post_author'   => 1,               'post_type'     =>'product'             );             // Insert the post into the database             $product_ID = wp_insert_post( $my_post );             $postupdate=1;              $_SESSION['update_post']=$postupdate;              if ( $product_ID ){               add_post_meta($product_ID, '_regular_price', 100 );               add_post_meta($product_ID, '_price', 100 );               add_post_meta($product_ID, '_stock_status', 'instock' );               //Getting error on this line.               $woocommerce->cart->add_to_cart( $product_ID, $quantity=1 );               exit( wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) ) );               echo"mypost1";             }           }         else             {                 $my_post = array(               'ID'=> 426,               'post_title'    => 'My post222222',               'post_content' => 'This is the updated 55545content.'           );         // Update the post into the database           wp_update_post( $my_post );             echo"mypost2";             exit( wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) ) );         }           }           }         ?>


Load a template for add menu page

How to load a template from twentytwelve theme for add menu page function.               add_action( 'admin_menu', 'register_my_custom_menu_page' );          function register_my_custom_menu_page(){     add_menu_page( 'custom menu title', 'custom menu', 'manage_options',   'custompage', 'my_custom_menu_page', plugins_url( 'myplugin/images/icon.png' ),   6 );      }          function my_custom_menu_page(){     echo "Admin Page Test";       }          In the function my_custom_menu_page, i need to load a template or show a web page instead of echo something.How can i do this.      Please help.


add_action second argument missing

I don't know what is missing here. I have a **do_action()** and **add_action()**. Only the first argument passed, to the function:               function testing($a, $b) {         echo $a . $b; // Here is just get A, and an error for missing $b     }          $a = 'A';     $b = 'B';     do_action('test', $a, $b);          add_action('test', 'testing');


Making Wordpress-built website mobile friendly

I have a website that is built with `WordPress` but hosted on GoDaddy. I need to make it more mobile-friendly. I installed `WPTouch` and the `WordPress- Mobile Pack` to do so. However, I find that even after installing the plugins and re-installing the website on `GoDaddy`, the site remains mobile- unfriendly. Writing to GoDaddy support did not help much either since I was redirected to WordPress support. My question(s):   1. How do I make a WordPress website that is hosted by GoDaddy mobile compatible?    2. How do I activate plugins like WPTouch on GoDaddy?


Assign tags records that have a keyword

I have a lot of records without labels, I want to assign a specific tag such records. If the name of the record found a certain word, then it is assigned a specific tag. I think it can be done through SQL-query, but how to realize it is not possible, because the tags and records are in different tables. I would be very grateful for your help. Sorry for my bad English!


What is the precendence of item types within WordPress

I recently stumbled across an issue on a site that uses the following URL structure;               /%postname%/%post_id%/      An old blog entry had the URL www.mysite.com/my-blog-post/1918/ Since that entry was made there was some media added to the site with the name My Blog Post, meaning the slug for it was also my-blog-post. Since the addition of the media anyone going to www.thesite.com/my-blog- post/1918/ would be shown the media page instead of the blog page. I can't see this happening too often, I have corrected the error and informed the guys in charge of content to be mindful of it but it got me thinking about the precedence of different item types. I would have thought off the bat that Media types would be lower down the list, but apparently not. **What I would like to know is how I go about finding what the precendence of WordPress items is and if there is any way of changing it.**


load wp_menu dynamically with enquire.js

I'm trying to dynamically load the wp_menu with enquire.js but it just doesn't work. If the screen is < 1080px the wp_menu(mobile) should be loaded, otherwise the wp_menu(desktop). In my homepage-template.php I regularly call the header and then I use enquire.js as per instructions.                     Enquire works, but Wordpress doesn't and kicks out this error message:               Fatal error: Call to undefined function wp_nav_menu() in /kunden/372333_10437/webseiten/dev.andreapuiatti.com/dev4/wp-content/themes/spk/templates/headernav-computer.php on line 20      Any Idea on how to dynamically load that menu? follows the content of headernav-computer.php:               <?php wp_nav_menu( array('link_after' => '

', 'menu' => 'primary', 'container_class' => 'menu') ); ?>


How to remove a tab in Media Upload page in wordpress

I use wp_enqueue_script('media-upload') show upload box,but i don't want show "Media Library" I use upload for frontend and don't want remove it on backend. Can you help me modify it Thanks I fixed this problem               if(current_user_can('subscriber')){         function remove_media_library_tab($tabs) {                 unset($tabs['library']);             //    unset($tabs['type_url']);                  return $tabs;         }         add_filter('media_upload_tabs', 'remove_media_library_tab');     }


How to get pretty URLs with add_query_arg in permalinks

With `add_query_arg()` it is nice to add additional parameters to an URL and it is also easy to create a rewrite rule. So far so good. But the problem is the URL replacement done by wordpress. When I have an URL, like:               www.mysite.com/?page_id=1&myvar=test      and I type this URL into the address line of the browser with activated permalinks. This link will become to:               www.example.com/pagename/?myvar=test      **BUT** : what I would like to get is:               www.example.com/pagename/test      Finally, I would like to use code like:               <a href="<?php add_query_arg( 'myvar', 'test', get_permalink() ) ?>"> .... </a>      which would result in:               www.example.com/pagename/test      How can this be achieved? I have spent hours in reading documents and I couldn't found a solution.


Is there any record of installed plugins in the database?

I have my live install on one server and a development install on another. I've added a plugin to both but it only appears in the plugin list in `wp- admin` on one. For a plugin to appear in `wp-admin` does it need to appear in the database at all? Or is it that just by having the plugin file(s) in the `plugins` directory that it'll be detected? Cheers!


How do I add php to all links automatically?

I'm using the Qtranslate plugin for my site. It's a pretty cool plugin and works great to a degree. I'm having a problem though when users add links to internal content in the WYSIWYG editor in that the link will just be outputted in one language. I would like to insert some php automatically to all links to internal content created in the WYSIWYG editor of my site. I want `<?php echo qtrans_getLanguage(); ?>` to be added to every internal link. For example if the following is done in WP:               London      I want it to be outputted as this:               <a href="/<?php echo qtrans_getLanguage(); ?>/london/">London      This way any links inserted in content using the WYSIWYG editor will automatically forward to the right language. There's a further complication that means I don't want external links to have the php added. So if a link looks like this: `<a href="http://www.google.com/">Google</a>`I want it to stay like this. Any idea how this could be done? I couldn't find any other posts that were addressing such an issue.


how to edit attachments?

when attaching eg. files to a post, how can i edit/delete them afterwards? couldn't find anything in the post editor. thanks


Is function_exists() considered a good practice when using 3.0+ functions?

I Know it's not needed if we're using the latest wordpress but I'm just wondering if it's a good practice to always use it or just use new 3.0+ functions without it, and should we use it for commercial themes ? thanks in advance.


Adding a filter to related posts not working

I'm using the the filter below to filter related posts by author, I added an author ID to test but they are not filtering by author               add_filter( 'woocommerce_product_related_posts', 'woo_custom_attribute_filter' );     function woo_custom_attribute_filter( $q ) {                      array(                 'orderby'        => 'rand',                 'posts_per_page' => $limit,                 'post_type'      => 'product',                 'author'        => 2,                 'fields'         => 'ids',                 'meta_query'     => $meta_query,                 'tax_query'      => array(                     'relation'      => 'OR',                     array(                         'taxonomy'     => 'product_cat',                         'field'        => 'id',                         'terms'        => $cats_array                     ),                     array(                         'taxonomy'     => 'product_tag',                         'field'        => 'id',                         'terms'        => $tags_array                     )                 )             );         //print_r($q);         return $q;     }


Namespace spl_autoload problem in Wordpress admin

I am experimenting with PHP namespacing within Worpdress plugins. The plugin includes a loader file which sets up the spl_autoload functionality and then instantiates a different controller depending on whether the current page request 'is_admin()' or not. [WP_PLUGIN_DIR]/lhes_experiment/loader.php               use lhes\system\controllers as sys;          set_include_path('./wp-content/plugins/lhes_experiment/' . PATH_SEPARATOR .     get_include_path());     spl_autoload_extensions(".php"); // comma-separated list     spl_autoload_register( 'spl_autoload' );          $config = array( ... );          if( is_admin() ){        error_log( var_export( new sys\experiment( ), true ), 0 );     }else{        error_log( var_export( new sys\experiment( ), true ), 0 );     }      [WP_PLUGIN_DIR]/lhes_experiment/lhes/system/controllers/experiment.php               namespace lhes\system\controllers;        class experiment extends test{           public $property;           function __construct( ){              $this->property = 'owls';           }        }      [WP_PLUGIN_DIR]/lhes_experiment/lhes/system/controllers/test.php               namespace lhes\system\controllers;        class test{           public $test;           function __construct( ){              $this->test = 'hi';           }        }      When the request is **not** and admin page, the code runs as expected and the error log shows:               [23-Jan-2013 12:55:27 UTC] lhes\system\controllers\experiment::__set_state(array(        'property' => 'owls',        'test' => 'hi',     ))      However, when the request **is** to an admin page the exact same code does not work:               [23-Jan-2013 12:56:17 UTC] PHP Fatal error:  Class 'lhes\system\controllers\test' not found in C:\Program Files (x86)\Zend\Apache2\htdocs\wp-content\plugins\lhes_experiment\lhes\system\controllers\experiment.php on line 4      I've spent many an hour googling the problem but can't seem to find anything. If anyone has any ideas as to why this might be happening I would really appreciate some pointers.


issues with object cache (memcached as backend) and wpmu when flush_all is run

Im running a rather large wpmu setup bloggersdelight.dk - from time to time, we need to reset the object cache when doing changes on the site. When we do this, things mess up. Option values from sites gets mixed together and homeurls for blogs redirects to wrong blogs etc. This is the current object-cache.php im working with. http://pastebin.com/QgM5tR9n As you can se the flush function is created in a way that it does not allow to flush if multisite. This was the default for the plugin found on wordpress.org. In order to flush a blogs cache i need to do some "fun" created stuff like this:               switch_to_blog($blogid);          $pattern = "/^" . $blogid . ":/";          $memcache = new Memcache();     $memcache->connect( $server, $port );          $list = array();     $allSlabs = $memcache->getExtendedStats( 'slabs' );     $items = $memcache->getExtendedStats( 'items' );     foreach ( $allSlabs as $server => $slabs ) {     foreach( $slabs as $slabId => $slabMeta ) {     if ( !empty( $slabId ) ) {     $cdump = $memcache->getExtendedStats( 'cachedump', (int) $slabId );     foreach( $cdump as $keys => $arrVal ) {     if ( !is_array( $arrVal ) ) continue;     foreach( $arrVal as $k => $v ) {     if(preg_match($pattern, $k))     {     $list[] = $k;     # $memcache->delete($k);     $parts = explode(":",$k);     print_r($parts);          wp_cache_delete($parts[2],$parts[1]);          }     }     }     }     }     }     return $list;      This seems to work for a single blog, allthough some items do not get cleared. Anyways, the problems occour when i do this telnet localhost 11211 and then type flush_all then things get weird and option values get mixed between blogs. If i run the flush_all command multiplte times then the problem usually is reducd and less blogs gets wrong option values. Does anyone have any suggestion to how to solve this ? Do i need to create some kind of key SALT ?


Vertical Sidebar Menu Parent and Child not displaying correctly

I am developing a WordPress site and trying to display my menu correctly. How can I display all Parent items but only show the Child items when it's Parent has been selected. I hope that makes sense. Below is what I'm trying to achieve: ![What I want to achieve](http://www.officiallymade.com/_dev/snowflake- live.jpg) And below is basically how it currently looks right now: ![What's actually happening](http://www.officiallymade.com/_dev/snowflake- test.jpg) Here is my CSS code:               /*** Single Level ***/     #widget_nav_menu, #widget_nav_menu ul {         clear: both;         float: left;         padding: 0;         margin: 0;         list-style: none;          line-height: 1;          }         #widget_nav_menu a {             display: block;             font-family: Arial, sans-serif;             font-size: 13px;             color: #174267;             text-decoration: none;             padding: 7px 0px 7px 7px;         }         #widget_nav_menu a:current,         #widget_nav_menu a:hover {             width: 213px;             background-image: url(images/hover_bg.png);             background-position: right -5px;             position: absolute;             z-index: 1005;             color: #fff;             margin-right: -17px;         }         #widget_nav_menu li.current_page_item a {             width: 213px;             background-image: url(images/hover_bg.png);             background-position: right -5px;             color: #fff;             margin-right: -17px;         }         #widget_nav_menu li {             float: left;             background: #f4f8fa;             width: 202px;             border-bottom: 1px solid #c3ced5;             height: 34px;             text-indent: none;             color: #174267;         }                  #widget_nav_menu li ul {                 position: absolute;                 width: 213px;                 left: -999em;             }             #widget_nav_menu li:hover ul {                 left: auto;             }                  #widget_nav_menu li:hover ul, #widget_nav_menu li.sfhover ul {                 left: auto;             }                      /*** Multi Level ***/                 #widget_nav_menu li ul ul {                     margin: -1em 0 0 10em;                 }                      #widget_nav_menu li:hover ul ul, #widget_nav_menu li.sfhover ul ul {                     left: -999em;                 }                  #widget_nav_menu li ul li.current_page_item a:hover {                 width: 213px;                 background-image: url(images/hover_bg.png);                 background-position: right -5px;                 color: #fff;                 margin-right: -17px;             }      I'm not sure if I need to use the a:first-child and a:last-child pseudo selectors and etc. Can anyone shed some light on this please? I'm sort of half way there I think, just need to get the Child items sitting in between the Parent items, instead of the drop down overlay...


Query by 2 values of a repeater ACF field

Let's say I have a custom post type called `Film`, with a repeater field called `Showings`, with fields `start_datetime` and `discount`. I need to make a query for those Films that have at least one showing that is in the next week and (this showing) has also a discount. The query I have now, retrieves the films with at least one showing in the next week and at least one showing (maybe other) with a discount. It doesn't check that these 2 showings are the same! My query:               $args = array(         'numberposts'       => -1,         'post_type'         => 'film',         'meta_key'          => 'showings_%_start_datetime',                  'meta_value'        => array( time(), strtotime('+1week') ),         'meta_type'         => 'NUMERIC',         'meta_compare'      => 'BETWEEN',         'orderby'           => 'meta_value',         'order'             => 'ASC',         'meta_query'        => array(             'relation'  => 'AND',             array(                 'key'       => 'showings_%_discount',                 'value'     => 'students',                 'type'      => 'CHAR',                 'compare'   => '='             )         )     );      I've been checking the generated SQL query and I don't think it's possible, because the showings, since it's a repeater field, don't have a proper ID, so we'd need to check that the number inside the meta_key are the same, for example `showings_5_start_datetime` and `showings_5_discount`. Any ideas please?


Wordpress Media Image Manager -- Creating Lots and Lots of Odd Sized Images

This is odd. Whenever I upload an image, I get a whole myriad of generated files. If I upload test_image.jpg (which is 971x698 pixels in size) I then get the following ten generated files: `test_image-960x447.jpg test_image-650x698.jpg test_image-430x698.jpg test_image-430x283.jpg test_image-260x315.jpg test_image-260x170.jpg test_image-207x136.jpg test_image-185x185.jpg test_image-184x184.jpg test_image-140x94.jpg test_image-140x170.jpg` I'll be honest, I never really looked at this 'feature' before, but something really seems amiss here. Small, medium and large thumbnails make sense. This is weird. Generally speaking the images are cropped about center. Look at the aspect ratios.. sometimes the image is landscape other times portrait. Or perhaps my purchased theme is injecting code somewhere (in this case Deep Focus from Elegant Themes)? All I know is these images are pretty worthless. Is there a place to coherently setup defaults for images when uploaded via Media? (Scale, don't randomly crop, etc?) I'm using wordpress 3.9.2 with an DeepFocus from Elegant themes with my own child theme. There are virtually no other plugins present. My concern is this just adds confusion to the site, intended for update and daily management by my customer. (Q) What is causing this behavior? (Q) Is this core wordpress? (Q) Anybody know which core functions are involved (so I can hunt down and clean up the mess fix?) Many thanks, zip. Update: with the hints provided by Drai, I was able to figure out what happened. This came from the theme.. not sure what those guys are... smoking, er... I mean... thinking. `               $et_theme_image_sizes = array(         '185x185'   => 'et-page-full-thumb',         '650x9999'  => 'et-single-thumb',         '960x447'   => 'et-featured-thumb',     );          $et_page_templates_image_sizes = array(         '184x184'   => 'et-blog-page-thumb',         '207x136'   => 'et-gallery-page-thumb',         '260x170'   => 'et-portfolio-medium-page-thumb',         '260x315'   => 'et-portfolio-medium-portrait-page-thumb',         '140x94'    => 'et-portfolio-small-page-thumb',         '140x170'   => 'et-portfolio-small-portrait-page-thumb',         '430x283'   => 'et-portfolio-large-page-thumb',         '430x860'   => 'et-portfolio-large-portrait-page-thumb',     );`


.htm re-write is adding an ending / to my URL bar

The client site I am working on required me to make the Page post type pages to end with the .htm extension. I got that working, however when you go to a page... `www.domain.com/mypage.htm` it loads the page but it then add an ending `/` to the URL in the address bar so it turns into this `www.domain.com/mypage.htm/` my client is asking me if I can disable this. Does anyone know if this is possible?


using media_handle_sideload() to add mp4 files to Media Library

For a site I'm building (for a client), I've written a shortcode, where the poster can enter `[vine id="..."]` followed by the ID of a Vine video. When the post is saved, my PHP functions will then go away and find the URL of the Vine (it's in the Meta Data of the Vine) and download it to the server. This was all great until my client decided to use Amazon S3 to host all Media files. The way I had originally implemented the downloading of the Vine (.mp4), it went straight to default upload location on the server, not the S3 Bucket. So I rewrote the script to do this, using `media_handle_sideload()`. Here it is:               function vineDL() {         $post = get_post();         $post_id = $post->ID;         $post_content = get_post_field('post_content', $post_id);         if (in_category("Vines")) {             preg_match_all('/\[vine.+id=[\'"](.+?)[\'"]\]/i', $post_content, $matches); // find the [vine id=''] part and fetch value of ID             $vineID = $matches[1][0];                  $url = vine($vineID); // the vine() function deals with grabbing the url of the .mp4 file             $tmp = download_url( $url ); // put in a temp locaiton             $file_array = array(                 'name' => basename( $videourl )  . "-" . $post->ID . ".mp4",                 'tmp_name' => $tmp             ); // set up an array a bit like $_FILES                  if ( is_wp_error( $tmp ) ) {                 @unlink( $file_array[ 'tmp_name' ] );                 return $tmp;             } // check for errors                  $id = media_handle_sideload( $file_array, 0 ); //download the file (0 represents the Post ID. (At this point in time I don't want it to be attached to a post so I've left it as 0)             // Check for handle sideload errors.             if ( is_wp_error( $id ) ) {                 @unlink( $file_array['tmp_name'] );                 return $id;             }                  $attachment_url = wp_get_attachment_url( $id );         }     }     add_action('save_post', 'vineDL');      Problem is, `media_handle_sideload()` doesn't seem to like Video files. When I change the extension part on `name` (in the `$file_array`) to `.jpg` instead of `.mp4` it downloads fine and adds it to Media Library (obviously it doesn't work, but at least it downloads). But for mp4 it doesn't. Does anyone have a way to fix this, or an alternate way to do it? Thanks for any help :)


Correct place to register and enqueue scripts

I'm queueing several scripts in my themes Functions.php:               if ( ! function_exists('b99_init_scripts') ) :         function b99_init_scripts(){                  if ( !is_admin()){                 wp_deregister_script('jquery');                 wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, null, false);                 wp_enqueue_script('jquery');                  wp_register_script('B99', get_template_directory_uri().'/javascript/site/B99.js', array('jquery'), null, false);                 wp_enqueue_script('B99');                  wp_register_script('B99-Nav', get_template_directory_uri().'/javascript/site/module/B99.Navigation.js', array('B99'), null, false );             wp_enqueue_script('B99-Nav');                      if ( is_page('portfolio') || is_front_page() ){                     wp_register_script('B99-Portfolio', get_template_directory_uri().'/javascript/site/module/B99.Portfolio.js', array('B99-Nav'), null, false);                     wp_enqueue_script('B99-Portfolio');                 } // fails if add_action is set to 'init'                      if ( is_singular() && get_option( 'thread_comments' ) ){                     wp_enqueue_script( 'comment-reply' );                 }             }         }         endif;         add_action( 'wp_enqueue_scripts', 'b99_init_scripts' );      I have read that the proper place to add_action is to 'init'               add_action( 'init', 'b99_init_scripts' );      However, my `is_page('xxx')` checks all fail during init. Coded as I have pasted above:               add_action( 'wp_enqueue_script', 'b99_init_scripts' );      works as expected and the page checks work normally, but I don't think I should be deregistering, registering, and enqueueing during the wp_enqueue_scripts routine. Is there a better location to hook into, or can I alter my page check during init to function correctly (I assume the page check doesn't work because the needed queries haven't fired yet).


Change name & menu_name for Profile in the default menu, w/o altering core files?

I want to change the name and menu_name of the profile menu in the default menu without altering the core files.


post categories

I have posts which i would like to put in to 3 categories News, Events, and Press Releases, then i have three pages which are using the same template. I would like to display those posts on to relevant pages so News posts on News page etc. Could someone tell me what would be the best way to do that. I guess its something easy but I'm fairly new to Wordpress. Many thanks,


Page and post loop same template

I try to make template that has Page content in the main div but in the same page there is category base post loop whit title, day, content and read more link. What i had now is like this               <?php if(have_posts()): while(have_posts()): the_post(); ?>              <?php         //Post thumbnails need this in functions.php: `add_theme_support('post-thumbnails');`         if(has_post_thumbnail()) the_post_thumbnail(array(100,100));         ?>
<?php the_title(); ?>
         <?php the_content(); ?>                        <?php endwhile; ?>         <?php else: ?>                  <?php endif; ?>      and to post the category loop is this.               <?php $my_query = new WP_Query( "cat=4" );            if ( $my_query->have_posts() ) {                 while ( $my_query->have_posts() ) {                     $my_query->the_post();                                     echo '
';                      echo '
';                     the_title();                     echo '
';                     the_date('m.d.Y');                         the_content();                         echo '
';              }            }            wp_reset_postdata();         ?>      How ever i see only one day format in the loop? And how i see the read more link?


Wordpress converting my code

I am having difficulty with Wordpress continually changing my code on me. IE: **FROM THIS:**               <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/swfobject.js" ></script>      **TO:**               <script src="<?php echo get_stylesheet_directory_uri(); ?" type="text/javascript">// <![CDATA[     /js/swfobject.js" >     // ]]></script>      And it's driving me crazy... is there anyway to disable this from happening? I will be having other people edit these pages so to disable the "GUI EDITOR in the users profile" doesn't seem like a good solution. Any help is appreciated.


How can I migrate all of my custom field thumbnails to the built-in post featured image?

I am running a theme on my Wordpress install that was built for Wordpress 2.8, prior to the time that Wordpress started using featured images for posts. I am switching to a theme that was built for Wordpress 3.1 and it uses the featured image instead of looking for a custom field. I have a lot of old posts with the custom field for the image. Is there a tool I can use that takes the custom field image URL and turns it into the post's featured image? I Googled this and also searched here on Wordpress Answers to no avail. I did find a custom script on the Wordpress forums, but I didn't try it because some people had responded saying it didn't work correctly.


How can I limit WordPress editor roles to a specific category?

We're trying to use WordPress as a light CMS system and we need to be able to section off parts of WordPress so that editors for one product aren't able to edit other products. Seems like out of the box WP has 5 user levels but there isnt any thought around fine grain access (without using WP Network)


"more" tag doesn't appear when browsing category achives or search

Almost finished my website, but ran into one problem: When you view the archive of a category or do a search, the "more" (or "continue reading") link/ tag doesn't appear. It words fine on the homepage. Any help would be appreciated - mainly about the category post bit. Cheers, Will.


Getting Featured Image Caption to Only Show if Populated

Good evening! I'm trying to hide the featured image caption from showing. Currently, it'll show build the div (but not populate it because it's empty). What I'd like to do, ideally, is only show the div if someone has entered text in the Caption (`post_excerpt`) box in the Media Panel. This is the code I'm working off of:                   function the_post_thumbnail_caption() {           global $post;                $thumbnail_id    = get_post_thumbnail_id($post->ID);           $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));                if ($thumbnail_image && isset($thumbnail_image[0])) {             echo ''.$thumbnail_image[0]->post_excerpt.'';           }         }      This is what I've attempted on my own to try and hide the caption if it's empty:                   function the_post_thumbnail_caption() {           global $post;                $thumbnail_id    = get_post_thumbnail_id($post->ID);           $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));           $thumbnail_caption = $thumbnail_image[0]->post_excerpt;           $thumbnail_set = isset($thumbnail_image[0]);                  if (! empty($thumbnail_set)) {               if ($thumbnail_image && isset($thumbnail_image[0])) {                 echo '

'.$thumbnail_caption.'

';               } else return;           } else return;         }      This is the code in my page template:
             <?php if ( has_post_thumbnail() ) : ?>
                     <?php the_post_thumbnail('med_size'); ?>                     <?php the_post_thumbnail_caption(); ?>
             <?php endif; ?>           <?php the_content(); ?>
      When I delete the caption on the featured image. It goes away, but the div is still being created as well as the emtpy `h5` element. Here are screen captures of the two states: link to when a caption is left blank here is a link when a caption is filled in Thanks for the advice and help!


Add a preview to a Wordpress Control Panel

I'm trying to create a new wordpress template and inside it I added a Control Panel, inside this control panel there is an option that allows user to choose where he want's to place a on a map, I try to explain: user can set div's left and top attributes via control panel. Now I know how to add an iframe that can show a preview of the changes but it doesn't work as I would like (how to add the preview? read here: Modify CSS via Theme Control Panel) What I would like to add is a **real time** preview. As soon as the user modify TOP or LEFT attribute preview has to show what it is happening without showing it to "live" blog. Here is my function.php:               array( "name" => "Before we start",         "type" => "section"),     array( "type" => "open"),     array( "name" => "Where is the map?",         "desc" => "Insert map page url",         "id" => $shortname."_pama",         "type" => "text",         "std" => "http://examplepage.com"),     array( "type" => "close"),     array( "name" => "Zona 1",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Activate zona 1?",         "desc" => "Choose yes or no",         "id" => $shortname."_zona1c",         "type" => "checkbox",         "std" => "false"),     array( "name" => "Zona 1 X-Axis",         "desc" => "Where do you want it on x-axis?",         "id" => $shortname."_zona1x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 1 Y-Axis",         "desc" => "Where do you want it on y-axis?",         "id" => $shortname."_zona1y",         "type" => "text",         "std" => "Top:???"),     array( "type" => "close"),     array( "name" => "Zona 1",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Activate zona 2?",         "desc" => "Choose yes or no",         "id" => $shortname."_zona1c",         "type" => "checkbox",         "std" => "false"),     array( "name" => "Zona 2 X-Axis",         "desc" => "Choose where you want it on X-Axis",         "id" => $shortname."_zona2x",         "type" => "text",         "std" => "Left:???"),     array( "name" => "Zona 2 Y-Axis",         "desc" => "Choose where you want it on Y-Axis",         "id" => $shortname."_zona2y",         "type" => "text",         "std" => "Top:???"),     array( "type" => "close"),     array( "type" => "close"),     );      This is the iframe that I use to show the preview inside Control Panel:               <iframe src="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_option('appacqua_pama')))); ?>" width="100%" height="600" ></iframe>      Ok, now the big question is there a STEP TO STEP way to add a preview on real time (I don't know how to explain it better, I'm really sorry...), what do you think will it be possible to use ajax? (I heard about it but I'm not a programmer so please write in a Dummy Proof way!!!) Will I need to add also a PREVIEW button instead of only SAVE button? How to add it? Do you know Mystique theme by digitalnature? something like this will be GREAT! If you can't write it here why don't you write a very good, and step to step, tutorial on your website? There is a lack of good articles about how to create a very good Theme-Option panel with a lot of functionalities for wordpress 3.x maybe you'll be the next and you'll also help us...poor noobs :-) Thank you very much for your time and patience!


Is it ok to chop index.php and include files?

So in my `index.php` I called `get_header()`, `get_sidebar()` and `get_footer()`. My `index.php` is kind of huge. It is separated into 5 divs more. How do I make it cleaner? Is it safe to chop it to files and include the files?


Custom Loop and Standard Blog Loop Issue

I am working on a theme with a front page that will have two loop sections. The first will loop three posts from a Custom Post Type (ill-portfolio), the second will loop three blog posts. In both instances I want the posts to be generated in a `<ul>`. I am also using the Advanced Custom Fields plugin on the page. Can anyone tell me what I am doing wrong? Any help is appreciated!

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

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

             <?php                  query_posts('post_type=ill-portfolio&posts_per_page=3');                 if (have_posts()) : while (have_posts()) : the_post();?>             ?>
                 <?php the_post_thumbnail(); ?>
<?php the_title(); ?>
                 <?php the_excerpt(); ?>                 <a href="<?php echo get_permalink(); ?>">View Project
                  <?php endwhile; endif;?>

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

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

             <?php                  if (have_posts()) : while (have_posts()) : the_post();?>             ?>
                 <?php the_post_thumbnail(); ?>
<?php the_title(); ?>
                 <?php the_excerpt(); ?>                 <a href="<?php echo get_permalink(); ?>">View Project
                  <?php endwhile; endif;?>


Using TinyMCE in plugin?

I've successfully integrated DataTables Editor into WordPress as its own plugin. It loads successfully and I can edit a DataTables' table. What I'm trying to figure out is how to utilize WordPress' TinyMCE within DataTables Editor. DataTables Editor has its own TinyMCE plugin that allows usage of TinyMCE within Editor. What has me confused... **is how can I load WordPress' own TinyMCE alongside DataTables Editor so I don't have to load an external copy of TinyMCE?** This is the code I'm using to create the instance of DataTables Editor:               var editor = new $.fn.dataTable.Editor({         "ajaxUrl": "../dct-content/plugins/datatables-editor/php/table.qpidvulh_to-do_list.php",         "domTable": "#qpidvulh_to-do_list",         "fields": [             {                 "label": "Item",                 "name": "item",                 "type": "tinymce",             }         ]     });


Creating a sub folder inside a root installation?

Currently I have a root wordpress installation at www.mysite.com. I've added a new folder /store in the root and added in a blank html. However, I can't seem to access the folder by going to www.mysite.com/store. Any idea how I can do this? * ** _Update_ *** I realised when I'd encountered this issue there was no .htaccess file. It seems like after I've added the .htaccess with a rewriterule to index.php, it all works. How does wordpress exactly do it's rewrites without a .htaccess in the first place?


How do I display offsite database info on my wordpress site?

I host some online games from my personal computer which the game saves information to my Mysql database. I would like to display live data (if possible) on my hosted Wordpress site. I know the easiest way would to do a remote connection, but my host does not allow that. All I am trying to do is pull some data from a table (character health, humanity level, etc) and have it displayed on a page. I would appreciate any possible answers. Is there any possibility to display this info another way on my computer and pull it from my Wordpress site not using the remote database method? I do not know much about this topic so please explain any answers or give me topics I can Google.


Set Item Order with wp_nav_menu_{$menu->slug}_items

I have some code that adds a menu item to a menu using `wp_nav_menu_{$menu->slug}_items`. It's pretty easy to add a menu item as the first or last item of the menu, but I was wondering if there's any way to assign an order to the item, i.e. place it as the 3rd item in the menu. If there's no method for that built into the filter, is there another way to achieve the same result?


How to get from sql query page id and retrieve it url and title

_Conditions:_ Page have template, for example: **/* Template name: News */** Explaining: We have many pages, and one page with assigned template (/* Template name: News */). I want on main page (index.php) retrieve page(News) url and title.


How to make wordpress URLS google friendly for ajax driven sites?

Our wordpress site utilizes the wordpress cms to serve up json data that we ingest via ajax requests and serve up with javascript. I would like to create URLs for my regular wordpress pages/posts that follow google's recommended crawlable ?_escaped_fragment_= URL permalink structure: For more information on crawlable ajax, read this article. This article also goes into detail about making your ajax-driven site google friendly So, while the javascript driven content's link looks like this: http:// examplesite.com/#!about The regular post generated from wordpress should have a URL like this: http:// samplesite.com/?_escaped_fragment_=about I am wondering if there is any way to do this with all wordpress posts/pages through the wordpress system. One alternative, using a 302 redirect from the htaccess file back to the wordpress generated posts/pages, which I haven't confirmed is acceptable by google can be found here Still, since we are using wordpress as a CMS, it seems like it would be easy to use Wordpress engine (or a plugin) to serve up these alternate URLs, especially since it is becoming the standard method of having your javascript driven site's content indexable. I tried to modify the permalinks with this URL structure, but that was a no-go and did not work. Any and all suggestions welcome!


WordPress post tag & custom field

I have the site in WordPress where I used the custom fields, but now I want to use that custom field as post tag automatically. Can anyone have any idea? Thanks.