How to display second and third level menus

I am using the Arcade Theme and I have built a 3 level deep navigation menu as it is shown in the image below taken from the the Appearance > Menus section but then I do not see sub-menus. How can I display them? I am new of WP. Thanks ![enter image description here](http://i.stack.imgur.com/RbhtK.png)


Adding a post to a page

I would like to know how I can add a specific post to a specific page? It would be great if anyone can suggest a reference to this problem. Do I need to create a post category to relate with a page? Or should I add a category on menu widgets rather than page?


How do I query a table?

I am using Contact form 7 and the database extension, the db extension creates a table called wp_CF7DBPlugin_SUBMITS. I have 2 forms on my site, I need to know if the user has completed the 2nd form, so when they return they can skip the 1st form. I don't even know where to start with this, any help will be much appreciated.


How to display an archive with multiple authors

I have this coding challenge that's beating my head I built a site for an academic magazine, where some of the articles are written by two or more authors. This was easily acheived using either Co- Author or Co-Author Plus plugin, as shown in the following image. ![Multiple authors in a single post](http://i.stack.imgur.com/8GtFo.png) Then, using this code, I built an authors archive where I display all wordpress authors with posts published.               <?php     $authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts.' JOIN wp_usermeta ON user_id = post_author WHERE meta_key=\'last_name\' ORDER BY meta_value');          if($authors):     foreach($authors as $author):     ?>     <div class="author" id="author-<?php the_author_meta('user_login', $author->post_author); ?>">          <?php if(get_the_author_meta('description', $author->post_author)): ?>

<a href="<?php bloginfo('url'); ?>/author/<?php the_author_meta('user_nicename', $author->post_author); ?>"><?php the_author_meta('last_name', $author->post_author); ?>, <?php the_author_meta('first_name', $author->post_author); ?>

<?php the_author_meta('description', $author->post_author); ?>

     <?php else : ?>          <?php endif; ?>
     <?php endforeach; endif; ?>      But the code only displays "first" authors. i.e the first author assigned to a post, and not the second nor third. So, if the second or third author hasn't published another different post by himself, he won't appear on the authors list. So, the question is, how can I modify this code to show all authors associated with a post? Maybe a string where author_has_post >= 0, and then how to prevent the admin author from appearing on the list


Limit upload file type on one custom post type

Is there any way to limit the filetypes allowed for upload based on the current post type? For example, I have a custom post type called `documents`. I have a `File upload` custom field which calls the Media Uploader (media-upload.php) and I have the possibility to upload a file. I want to restrict the file to `pdf`, `doc` and `xls`. However, I also have a post type called `illustrations` in which I want to limit the upload file types to `jpeg`, `png` or `gif`. I am currently trying Mike Schinkel's answer from Limit image upload to one and disable audio, video and other document file types to upload to restrict the file types, but I don't know how to vary the array of permitted filetypes based on the current post type.                if ('image'!=$category || !in_array($type,array('jpg','jpeg','gif','png'))) {         $file['error'] = "Sorry, you can only upload a .GIF, a .JPG, or a .PNG image file.";     }      I tried using `get_current_screen()` but it returns the id of the media uploader itself. I also tried using `global $post` but I didn't get anything. Or would it be simpler to add a filter to `upload_mimes` based on the current post type? Any suggestions? **Answer:**               if( isset( $_REQUEST['post_id'] ) && $post_type = get_post_type( absint( $_REQUEST['post_id'] ) ) ) {              if( 'illustrations' === $post_type ){          $filetype = array('png', 'jpeg', 'gif', 'jpg');          $message = 'Only PNG, JPEG, JPG, and GIF allowed.';         }               elseif( 'documents' === $post_type ){           $filetype = array('doc','docx','pdf','xls', 'xlsx', 'zip');           $message = 'Only PDF, DOC, DOCX, XLS, XLSX, and ZIP allowed. ';         }            }


Upgrade Wordpress multisite to 3.5.1 problems

I'm upgrading multisite to 3.5.1 and it did not allow me to do automatic upgrading I see this message: > "To perform the requested action, WordPress needs to access your web server. > Please enter your FTP credentials to proceed. If you do not remember your > credentials, you should contact your web host." So I add the FTP credentials in `wp-config.php` but still does not work. I investigate and found out that Wordpress core files are owned by the root and not by my ssh username. Example of these files are the files in the `wp- includes` and `wp-admin`. Is there a way to perform automatic upgrade of Wordpress multisite without having a root access?


WooCommerce custom payment gateway

I'm trying to write a WooCommerce plugin for a client's website that they're going to be selling subscriptions to customers. I've been exploring my options and the best one I can come up with is to roll my own payment gateway module to handle this. (Other advice appreciated if anyone's ever tackled something like this). However, I'm trying to add a custom payment gateway, but it doesn't seem to be working up. It's not showing up under `WooCommerce -> Settings -> Payment Gateways`. The plugin is installed and activated in WordPress, and I've followed a couple guides from their docs pages.   * WooCommerce version: 2.0.18 (via plugin installer)   * gist code I really don't know why or what would cause my payment gateway isn't showing up. Thanks for the future help.


Animate like Stack exchange frequently asked questions

http://graphicdesign.stackexchange.com/about As you scroll down the page, images and text slowly fading. Is there a plug-in origin jquery like string that I should be looking for?


How do I get a post (page or CPT) ID from a title or slug?

I've scoured the Codex, failed to get get_page_by_title() to work and am quite surprised that there doesn't seem to be a standard WP function for this task. I need to get the ID of any given post/ cpt or page using either the slug of the post/ page title. Ideally I'm looking for the following: `get_post_ID_by_title('My post title', 'customposttype');` What should I be doing?


Exact image sizes

I am trying to define an image size of exactly 290 height x 180 width for all images uploaded to my WP site. I tried updating image sizes under Settings->Media->Image Sizes but these are only max values and some images end up coming out at 290 x 155 etc, is there a way to force WP to create an image at my desired size? I am not using post thumbnails, I have built a plugin that uses wp_get_attachment_image() to retrieve images.


What does Wordpress media uploader do to image files on upload?

This question is specifically for images and what optimisation happens to these files when they are uploaded via Wordpress Media Library?                   Images         .jpg         .jpeg         .png         .gif      And how is it possible to change these settings? I also know you can change the image sizes in `Settings > Media`


Add Category Descriptions to Montezuma Theme

Ok, a Quick Question: I´m using the montezuma theme and would like to add category descriptions above my category pages. How can I do that? I found descriptions on how to do that with other themes but not with Montezuma because it doesn´t use archive.php or category.php. If you know how, let me know.


Multisite plugin development and wp_enqueue_script

I have a plugin I'm developing. It works fine on a single site version of WordPress. It installs on a multisite version of WordPress, it appears to work on the admin pages, but when the plugin attempts to add javascript and css, it's not added. The display portion of the code is as follows...                  add_action('init', array(&$this, 'init'));             function init() {             // Gather gallery and template variables             $url = explode('?', 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);             $ID = url_to_postid($url[0]);             load_plugin_textdomain('ngTemplateCreator', ngTemplateCreator_DIR . '/lang', basename(dirname(__FILE__)) . '/lang');             $t = get_post($ID);             $c = 0;             $regex_pattern = get_shortcode_regex();             preg_match_all('/' . $regex_pattern . '/s', $t->post_content, $regex_matches);                  // loop thru shortcode             foreach ($regex_matches[3] as $key => $value) {                 if ($regex_matches[2][$key] == 'nggtc') {                     $c = $c + 1;                     //  Found a NextGEN gallery find out what ID                     //  Turn the attributes into a URL parm string                     $attribureStr = str_replace(" ", "&", trim($value));                     $attribureStr = str_replace('"', '', $attribureStr);                          //  Parse the attributes                     $defaults = array(                         'id' => 0,                         'template' => ''                     );                     $attributes = wp_parse_args($attribureStr, $defaults);                          if (isset($attributes["id"])) {                         $this->gid = $attributes["id"];                     }                     if (isset($attributes["template"])) {                         $this->tcname = $attributes["template"];                     }                          $wrapper = "nggtc_gallery_" . $this->gid . "_" . $c;                          if (!empty($this->gid) && !empty($this->tcname)) {                         $images = get_ngg_gallery($this->gid);                         $templates = get_custom_template($this->tcname);                              if ($templates && $images) {                             foreach ($templates as $template) {                                 if ($template->bottom_javascript) {                                     $this->bottom_javascript = $this->bottom_javascript . process_script_shortcode($template->bottom_javascript, $wrapper, $panelid, $panelcss, $filmstripid, $filmstripcss) . "\r\n\r\n";                                 }                             }                         }                     }                 }             }             $this->count = $c;             if ($this->bottom_javascript) {                 add_action('wp_footer', array(&$this, 'footerScripts'), 200);             }             wp_reset_query();         }              function process_script_shortcode($script, $wrapper, $panelid, $panelcss, $filmstripid, $filmstripcss) {             $out = remove_php($script);                  // Swap shortcode             if($out) {                 // strip html from filmstrip variables                 $filmstripi = str_replace(" id=\"", "", $filmstripid);                 $filmstrip = str_replace("\"", "", $filmstripi);                 $filmstripcs = str_replace(" class=\"", "", $filmstripcss);                 $filmstripc = str_replace("\"", "", $filmstripcs);                 $out = str_replace("[wrapper]", $wrapper, $out);                 $out = str_replace("[panel_id]", $panelid, $out);                 $out = str_replace("[panel_css]", $panelcss, $out);                 $out = str_replace("[filmstrip_id]", $filmstrip, $out);                 $out = str_replace("[filmstrip_css]", $filmstripc, $out);             }             return $out;         }              function footerScripts() {             if (wp_script_is('jquery', 'done')) {                 echo "<script type=\"text/javascript\" defer=\"defer\">" . $this->bottom_javascript . "</script>";             }         }      I'm only showing the function for my footer scripts, but none of the scripts and css are being shown, so I'm fairly certain the source of the error is the same. Can anyone tell me where I'm going wrong here?


Why Can't wp_editor Be Used in a Custom Widget?

I've been working on developing a plugin that adds a widget that allows you to edit the content with a wysiwyg editor. I want to use the default wordpress editor by calling `wp_editor()`. I've seen people say you can't do this, and sure enough, it crashes when you try to update the widget content. Can anyone explain why `wp_editor()` can't be used in widgets? I'm hoping to figure out how to get around that once I know why it doesn't work. However, Chrome doesn't spit out any errors in the console, so I'm not sure what's happening that it bugs out. Thanks, goldentoa11


AJAX request not routing through proxy

I've built a plugin that uses AJAX to post a URL to the URL2PNG API and bring back a screenshot into WordPress via wp_remote_get. It works beautifully in my development environment. In production, though, it needs to go through a proxy. Here's where it got sticky. We defined the proxy via wp-config and it worked beautifully. In my testing I was able to successfully connect to the URL2PNG API via the proxy and return results.. ..but.. When the request originated via AJAX, no success. I've gone through extensive testing and here's what I've found:   * Requests originating directly in plugin (e.g. on page load) are routed properly through the proxy without trouble.   * Requests that start in the browser (e.g. via AJAX) fail to connect.   * Closer inspection by server support showed that the request was attempting to go direct and _not_ making use of the proxy.  Have any of you run into this before? Any ideas what may be going on?


Disable sticky option for specific categories

Is there a way to disable the sticky option on posts in specific categories?


Appropriate hook for filtering the posts from the admin page

I am currently developing a custom post type and I would like to know which hook I should use in order to filter posts by category. ![The filter selection box](http://i.stack.imgur.com/ixQu9.png) Can anyone please tell me how to do this?


What are "best practices" for wp-config.php

Just started reading _Professional WordPress®: Design and Development_ I'm reading the section on **"Advanced wp-config Options"**. I see many options which I think are pretty cool/useful, but before I **_go crazy_** using "Advanced wp-config Options" I thought I'd **inquire about "Best Practices"** from the veterans in this area. I'm still a noob and a little knowledge is a _"dangerous thing"_ :-} For example book states: > To set your WordPress address and blog address, use the following two > options: > > define('WP_SITEURL', ‘http://example.com/wordpress'); > > define('WP_HOME', ‘http://example.com/wordpress'); > > The WP_SITEURL option allows you to temporarily change the WordPress site > URL.... I read this and think, **best use** is for taking site offline temporarily (for maintentance, etc.). Otherwise, why use this? But there are some options which read like they **SHOULD** be used (at least as a best practice). So I thought I would ask how the vets approach these config options (or for general advice to noobs). I know what these options (below) do, question is should I (do you) use them and why/not?   * WP_POST_REVISIONS   * AUTOSAVE_INTERVAL   * WP_DEBUG SAVEQUERIES   * WP_MEMORY_LIMIT    * FTP_USER    * FTP_PASS    * FTP_HOST    * WP_CACHE    * FORCE_SSL_LOGIN    * FORCE_SSL_ADMIN Thanks In Advance! sleeper


How to save multiple metaboxes?

I read a tutorial about metaboxes, most of things are clear but I have a question about multiple metaboxes. My question is about saving, in the tutorial:               <?php       add_action( 'save_post', 'cd_meta_box_save' );       function cd_meta_box_save( $post_id )       {           // Bail if we're doing an auto save           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // if our nonce isn't there, or we can't verify it, bail          if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;               // if our current user can't edit this post, bail           if( !current_user_can( 'edit_post' ) ) return;       }       ?>       Do I need to make for example two save functions if I have 2 metaboxes, or can I put the values in same save function? What is the best method? If I render the fields with two different function how to deal with the `wp_nonce_field` ? What is the best method?


Weird html output of single_cat_title - is not inside of the html element?

I'm displaying a single "featured" post at the top of the blog index page, and category pages. I'm using this conditional to display the category name of the category page if it is a category page, or to display one category title of the featured post if it is on the blog index page:               if( is_category() ):         $category = strip_tags( single_cat_title() );       echo '
' . $category .'
';     else:         $category = get_the_category();       echo '
' . $category[0]->cat_name .'
';     endif;      This conditional works fine for the blog index page. However, when on a category page, the html result places the category title outside of the `<div class="title main fs-45"></div>`. For example, on "My Current Category" category page the html result looks like:
     My Current Category

                  ... some other html …

      And on the blog index page, the html result is correct like this:

Featured Post Category Name

                  ... some other html …

      Any ideas why this would be happening? Thanks for any help with this!


What kind of object type is WP_Query?

I am getting this error when I try to return the post_title value from my WP_Query:               **Fatal error:** Cannot use object of type WP_Query as array      Here is the code:               $query = new WP_Query( array( 'meta_key' => 'Old ID', 'meta_value' => $atts['oldid'] ) );     return $query['post_title'];      How can I show the elements of the post after this query? I am using WP_Query because I am making a shortcode to be used within Posts and Pages.


How to create a custom WordPress navigation menu?

I hired a designer to create a custom website for my startup home business. Two years later the site is uploaded onto WP but I can't do a thing with it. The site is password protected as it is still not completed. I would want to add new pages (and tabs) to the site, however after reading up on WP I've learned that in order to this I would need to add a "Menu" to the "Appearance" option on my dashboard, further reading suggest that I may need to know HTML. Needless to say I am very frustrated as I do not know the first thing about WP let alone HTML. The site is utilizing wordpress 3.4.2. Can someone please help me with this issue. Thank you Maria


Enabling Default Widgets in a Custom Theme

In custom theme development, how does one enable default built-in widgets? Note I mean default built-in widgets, not custom ones. I tried the following example for a WP 3.12 blog by placing it in my theme's functions.php file, trying to activate Pages by default. It didn't work, but I don't know why.               function mytheme_widget_init(){       $asOps = array(         'classname' => 'widget_pages',         'description' => __( "")       );       wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $asOps);     }          add_action('widgets_init','mytheme_widget_init');      What am I doing wrong? **EDIT: THE SOLUTION** In my theme, I needed to re-edit sidebar.php and use this markup instead.               <?php ?>

          <?php if ( !dynamic_sidebar(1) ) : ?>     <?php endif; ?>          <?php if ( !is_active_sidebar(1) ) : ?>
             <?php get_search_form(); ?>

             <?php wp_list_categories('show_option_none=&title_li=
' . __('Categories') . '
' ); ?>

Archives

                 <?php wp_get_archives( 'type=monthly' ); ?>

                 <?php wp_list_pages('title_li=
' . __('Pages') . '
'); ?>

          <?php endif; ?>


How do I remove featured images and captions from a wordpress RSS feed?

I'm trying to remove featured images and captions from my feed and struggling to do it. As another question has identified it is very difficult to format captions and so as a newsletter feed I want to remove them. I have added the below to functions.php having found it on WordPress forums but it dosn't seem to change anything               /** removes caption from RSS feed Denis 15/08/2014 */     function notags_content_rss($content='')     {      $content = preg_replace("/\[caption.*\[\/caption\]/", '',$content);      $content = preg_replace("/\[googlevideo.*\[\/googlevideo\]/", '',$content);      return $content;     }     add_filter('the_content_rss', 'notags_content_rss');      I have also added the following code to remove the featured image as we use the featured image as the main blog images and this means that we have a duplicate image in the feed.               /** removes featured image from RSS feed Denis 25/08/2014 */     remove_filter('the_content', 'featureimage_for_feeds');      Never touched any PHP before so would appreciate any help or advice that can be given. Finally I am not 100% sure that I am refreshing the feed correctly after each change to the code. This is what I am doing:   * Clearing website page cache, CDN etc   * Changing the number of feed items on settings/Reading to force feed refresh   * Clearing browser cache   * Going back to campaign monitor with a new email campaign and reloading the template (which calls the feed) to check results


Fantastico pros and cons

I am working with someone that has a host (internetplanners.com) that uses fantastico to install WordPress. Basically, my question is has anyone had bad experiences with fantastico or webhost internetplanners.com? _Note, I have installed Wordpress on my local machine (Windows) and didn't have any trouble. I don't have experience installing on a hosting service manually but think I could do it needed._ Since I wasn't familiar with fantastico one-click install, I did a search and found 2 links about reasons not to use fantastico: http://www.howtospoter.com/web-20/wordpress/3-reasons-not-to-use-fantastico- for-wordpress 1) simplicity = false security (if upgrade breaks, it can be difficult to fix); 2) upgrade doesn't put in maintenance mode or back up database, 3) upgrade doesn't deactivate plug ins. from http://wordpress.org/support/topic/installing-from-justhost : I agree with ZGani. Fantastico doesn't upgrade the third party scripts version frequently. So you have to wait for Fantastico upgrade to get latest version of WordPress. Thanks.


How to rearrange a pool of posts joined using two queries?

I need to select posts for two different months (current, past). As far as i know, it is not possible to pass `m` date parameter as an array of integer instead of an integer, so I am performing two different queries and getting all posts returned into the same array. The question is, how do i reorder the result pool of posts? Just pushing the second pool into the array returned by the first query isn't enough, as the `orderby` argument finds a _discontinuity_ in the joint of the two arrays. I tried using `usort` but I get an error saying that `You can't use WP_Post object as an array`. Any ideas? Thanks,


How much will mounting wp-content on a separate NFS server impact performance?

I'm thinking of using multiple web servers with a load balancer in a big WP install. The database will be on a separate server and that's the easy part. Trickier is files in blogs.dir, and to a lesser extent, the themes and plugins folders. So I plan to use a separate NFS server, either for all of wp_content or just for blogs.dir. But I'm worried about the performance impact of having these files available over the local network. If you have done this I would love to hear your thoughts on...   * Is it wise to share all of wp-content in this way? If not, how about just blogs.dir?   * How much of a performance trade-off was it?    * Do you have any suggestions based on your experience? Thanks.


Display agents (custom post type) alphabetically, except one who always shows last

I would like to display all agents a-z, except there is one agent who should always show up last. Ideally I'd like the ordering to be done from the value of a custom field, dName. I was looking around it seemed that meta_query was the new best way to do this but haven't figured it out yet. Current code that shows 10 last agents created.               <?php $loop = new WP_Query( array( 'post_type' => 'agents', 'posts_per_page' => 10 ) ); ?>      Thanks for looking. edit 3/27/2011, working code               <?php      $loop = new WP_Query( array(          'post_type' => 'agents',         'orderby' => 'meta_value',     'meta_key' => 'rw_dname',         'order'=>'ASC',         'meta_query' => array(             array( 'key' => 'rw_dName' )             ),         'post__not_in' => array( '98' ),         'posts_per_page' => -1 ) );          $loop2 = new WP_Query( array(          'post_type' => 'agents',         'post__in' => array( '98' ) ) );?>     <?php     if($loop->have_posts() || $loop2->have_posts()) {          if($loop->have_posts()) { while($loop->have_posts()) { $loop->the_post();?>

             <?php              if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.             the_post_thumbnail();     }?>

              <?php     $meta = get_post_meta(get_the_ID(), 'rw_dname', true);     echo $meta; // if you want to show     ?>

     <?php             } //endwhile         }     ?>     <?php     if($loop2->have_posts()) { while($loop2->have_posts()) { $loop2->the_post();?>

         <?php      if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.     the_post_thumbnail();     }      ?>

          <?php     $meta = get_post_meta(get_the_ID(), 'rw_dname', true);     echo $meta; // if you want to show     ?>

     <?php             } //endwhile         }     ?>     <?php     } else {         echo 'No Agents.';     }     ?>


Why is ?doing_wp_cron being appended to my URLs

I'm finding this string appended to the end of my URLs sometimes:               /?doing_wp_cron      Does anyone know what it for? How can I remove it?


Hide reply button after moveForm is called

When user clicks on Reply button for a specific comment, how can I then hide the reply button under said comment? Do I have any access to the javascript onclick function that it calls?


Creating Job Tickets

I work in a small print shop and I want to digitize our workflow. I have found many plugins that are for support tickets, but I want to be able to create job tickets for printing jobs. I have found several of form plugins (Gravity, Formidable Pro) that make the form portion easy, but I need a way to create reports and view the data that is being stored in the db. I need the ability to create relational databases. Is this possible within wordpress?


How do I create a page for users to invite their facebook friends?

Do I need to use the Simple Facebook Connect plugin? or can I just use some facebook api code? Any help appreciated. The example i'm trying to replicate is the interface at lookbook.nu. Once you login with facebook, there is a nice page to invite your FB friends.


Export entries and multiple custom field meta to .csv?

First time poster. I'm trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I've ran the native export to xml, but it's not the correct format I need. I need a column based format (ie. name, height, weight, etc.). I have a custom post that has several custom fields. I'm having issues combining them all down to one single row, rather than a new row for each meta type. Is there a way to write a sql query that has numerous selects for each meta type and combines them into one row with multiple columns? Here is what I have so far, which gives me one column and a new row for each meta type for the same Name               SELECT p.post_title AS Name     FROM wp_posts AS p     INNER JOIN wp_postmeta AS pm      ON p.ID = pm.post_id     WHERE p.post_type = 'prospects'     ORDER BY p.post_date DESC      Now how would I start adding columns (selects) for each meta type and combine them on one row:               AND (       SELECT m1.meta_value AS Height       WHERE m1.meta_key = '_height'     )     AND (       SELECT m2.meta_value AS Weight       WHERE m2.meta_key = '_weight'     )


How to change the Admin-bar's link target?

I'd like to change the admin bar's link target to "_blank". where what should I do? thanks.


How to attach Links into page/post or custom post type?

I need to create or use an existing 3rd party plugin to attach any links (one or more) to a page, post or post-type from the WP link manager:   **`http://example.com/wp-admin/link-manager.php`** I need a metabox with a dropdown or multiple select form element, and I have to link that Blogroll-Link with postmeta or something similar. Is there any plugin, snippet or solution for my task?


Alternate loop output every three posts (within the same original loop)

I have a (relatively) tricky situation where my code requires changing the loop output every three posts, and within those three posts there are divs around two of the posts. The code below displays 6 posts and I would want to loop though a total of 24 posts, repeating this four times. Can anyone help? Thanks! **FIRST THREE**

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>

      **SECOND THREE**

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>


Dynamic Menu drops pages?

I've created a Dynamic Menu that highlights the selected page and colors for example the blog page "red" while the other links (home, about, contanct) remain white. My question is how can I make the Dynamic Menu work when say the blog goes to /blog/page/2/ and have the blog remain red instead of dropping the highlight? Here's the code for my menu.               < nav id="menu" class="mid" role="navigation">       < ?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>     < /nav>      ` Then, I register the menu inside the functions.php               add_action( 'init', 'register_my_menu' );         function register_my_menu() {             register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );         }      ` Here's the CSS that highlights the .current-menu-item ` #menu .current-menu-item a { opacity: 1.0; } ` This is when the Menu is Active on example.com/work ![menu active](http://f.cl.ly/items/2U3g1m141x09151F3V2K/menu-active.png) This is when the Menu is Active on the example.com/blog *just the first blog page though ![menu active blog](http://f.cl.ly/items/0X0g3c3I0n0K3V1H0Z1u/menu-active-blog.png) This is the menu when it switches to example.com/blog/page/2, example.com/work/showcase/website1337 ![menu not active](http://f.cl.ly/items/2N3j3R0K2d1e2g042B2P/menu-notactive.png) How, can I make it so that the Dynamic Menu detects that /page/2 is still associated with the parent page "/blog/, /work/" and is still highlighted like images 1 and 2? Thanks :3


How to reverse pagination for archive pages?

I would like to reverse the pagination order for the category archives and am wondering if anyone can offer any help. Basically what I am looking for is pagination to start with the oldest post first, but browsing to start with the newest post, in effect reverse pagination and then browsing starting with the highest numbered page first. I have tried reversing the sort order but does not work for 2 reasons   1. Displays page 1 first.   2. The posts _in_ the pages are in reverse order as well, oldest first. I tried the code offered here: Help With A Reverse Pagination Plugin I don't know if I was missing something but it appeared to just give the same results as reversing sort order. I also tried messing with modifying the `get_next_posts_link()` function, but came to the realization that would just effect browsing, not the actual pagination. A similar question is outlined here: How to implement pagination in backward way eg. first - 20 - 19 - 18 - ... - 3 - 2 - 1 - last This thread in a Drupal forum seems to illustrate additional reasons why this would be useful: http://drupal.org/node/143719 Another reason why I thought this would be useful would be because it would allow the user to see how much content is available without having to find the end, like having a reverse counter on a video so you know how long it is before beginning to watch. Does the solution to the problem require messing with rewrite rules? Any input would be appreciated.


What is user_trailingslashit() for?

What does the `user_trailingslashit()` function do, and when should I use it? How is it different from the `trailingslashit()` function?


Paginated WP_Query doesn't return 404's, even when posts don't exist

I'm currently building a theme for a client, and one of their requirements is endless scrolling on a "Charts" page. They want this to be paginated, and the endless scroll to load the next page below the first, displaying the most popular 40 tracks posted on the site. To achieve this, I used a new WP_Query, which is running inside a custom page template. The endless scroll works by fetching the next page, and ending when it hits a 404. The problem is, extra pages continue to be loaded, even when there are no posts to display. The script never hits a 404 so it continues to load. Here is my query:               <?php     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();      $wp_query->query('posts_per_page=8&meta_key=_count-views_all&orderby=meta_value_num&order=DESC'.'&paged='.$paged);           $count = 1; while ($wp_query->have_posts()) : $wp_query->the_post();      ?>
<?php echo $count; ?>
          //loop here          <?php $count++; endwhile; ?>               <?php content_nav( 'nav-below' ); ?>          <?php else : ?>          <?php get_template_part( 'no-results' ); ?>          <?php endif; ?>          <?php $wp_query = null; $wp_query = $temp;?>      The exact same query works without any issue on the index page and archive pages. It only seems to happen when its in a page template. I've been stumped by this for the last day or so, and I'm not sure as to why it's happening. Any ideas would be greatly appreciated :)


Adding Second Plugin Author

**Background:** I have a few plugins in the WordPress directory and have recently made the decision to team up with another individual to grow one plugin faster. I'm planning on adding him as a plugin author, but I want to be sure that if I do so there's no risk of me "losing control" of my plugin. **Question:** If I add another author, is there any way that the new author can remove me as plugin author? Can they upload the plugin with their username and password, or am I still the only one that can upload changes? I couldn't find anything on this topic, and I'd really hate to have my plugin stolen as I've become somewhat attached to it.


CPT's archive and single page not working

I created a custom post type               function faq_func() {          $labels = array(         'name'                => _x( 'FAQs', 'Post Type General Name', 'rrrrr' ),         'singular_name'       => _x( 'FAQ', 'Post Type Singular Name', 'rrrrr' ),         'menu_name'           => __( 'FAQ', 'rrrrr' ),         'parent_item_colon'   => __( 'Parent Item:', 'rrrrr' ),         'all_items'           => __( 'All Items', 'rrrrr' ),         'view_item'           => __( 'View Items', 'rrrrr' ),         'add_new_item'        => __( 'Add New', 'rrrrr' ),         'add_new'             => __( 'New Item', 'rrrrr' ),         'edit_item'           => __( 'Edit Item', 'rrrrr' ),         'update_item'         => __( 'Update Item', 'rrrrr' ),         'search_items'        => __( 'Search Item', 'rrrrr' ),         'not_found'           => __( 'No items found', 'rrrrr' ),         'not_found_in_trash'  => __( 'No items found in Trash', 'rrrrr' ),     );     $rewrite = array(         'slug'                => 'faq',         'with_front'          => true,         'pages'               => false,         'feeds'               => false,     );     $args = array(         'label'               => __( 'faqs', 'rrrrr' ),         'description'         => __( 'FAQ Page', 'rrrrr' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => get_bloginfo('template_directory').'/images/faq-icon.png',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => true,         'publicly_queryable'  => true,         'query_var'           => 'faq',         'rewrite'             => $rewrite,         'capability_type'     => 'page',     );     register_post_type( 'faqs', $args );          }          add_action( 'init', 'faq_func', 0 );      And a archive-faqs.php file:               <?php get_header(); ?>          <?php     $args = array( 'post_type' => 'faqs' );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();         the_title();         echo '
';         the_content();         echo '
';     endwhile;     ?>          <?php get_footer(); ?>      The problem is that my items not visible on the page. Where is the problem? UPDATE: I found the solution on wordpress.org: Note: In some cases, the permalink structure must be updated in order for the new template files to be accessed when viewing posts of a custom post type. To do this, go to Administration Panels > Settings > Permalinks, change the permalink structure to a different structure, save the changes, and change it back to the desired structure.


Frontend Image Upload

I have the following code used at the top of my front end user profile page, everything works and displays fine except for the following problem .... If I upload an image and submit the form usermeta 'profile-image' updates correctly, however if I update the form without uploading this meta is deleted and looks like the update_usermeta call is still firing and making empty. Not sure what I am doing quite wrong, driving me nuts                               <?php                 global $current_user, $wp_roles;                 get_currentuserinfo();                      require_once( ABSPATH . WPINC . '/registration.php' );                 $error = array();                          if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {                          if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {                         if ( $_POST['pass1'] == $_POST['pass2'] )                             wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );                         else                             $error[] = __('The passwords you entered do not match.  Your password was not updated.', 'profile');                     }                          update_usermeta( $current_user->ID, $_POST['country'] );                     update_usermeta( $current_user->ID, $_POST['identity'] );                     update_usermeta( $current_user->ID, $_POST['workplace'] );                     update_usermeta( $current_user->ID, $_POST['public_email'] );                          $bio_summary = sanitize_text_field($_POST['bio-summary']);                     update_usermeta( $current_user->ID, 'bio_summary', $bio_summary );                          $web_link = esc_url_raw($_POST['web-link'], array('http', 'https'));                     update_usermeta( $current_user->ID, 'web_link', $web_link );                          $bio_longer = sanitize_text_field($_POST['bio-longer']);                     update_usermeta( $current_user->ID, 'bio_longer', $bio_longer );                          if ( count($error) == 0 ) {                         do_action('edit_user_profile_update', $current_user->ID);                         //wp_redirect( get_permalink() );                     }                 }                                    ?>                 <?php                  if ($_FILES['profile-image']['error'] ==0 ){                     $attach_id = ap_apply_online_image_handler();                     $attach_url = wp_get_attachment_url( $attach_id );                     update_usermeta( $current_user->ID, 'profile_image', $attach_url );                 } else {                     echo 'Upload error';                 }                 ?>      This the form ....                                               <form action="" method="post" enctype="multipart/form-data" >

                                             Profile Image:	                                                                               <input type="file" id="profile-image" name="profile-image" />                                                 <input type="text" id="profile-image-set" name="profile-image-set" value="<?php echo esc_url( get_the_author_meta( 'profile_image', $current_user->ID ) ); ?>" class="regular-text" />

                                             Country	                                                                               <?php $country = get_the_author_meta( 'country', $current_user->ID ); ?>                                             <select name="country" id="country">                                                 <option value="not specified" <?php echo ($country == "not specified")?  'selected="selected"' : '' ?>>Not Specified</option>                                                 <option value="australia" <?php echo ($country == "australia")?  'selected="selected"' : '' ?>>Australia</option>                                                 <option value="bangladesh" <?php echo ($country == "bangladesh")?  'selected="selected"' : '' ?>>Bangladesh</option>                                                 <option value="bhutan" <?php echo ($country == "bhutan")?  'selected="selected"' : '' ?>>Bhutan</option>                                                 <option value="brunei" <?php echo ($country == "brunei")?  'selected="selected"' : '' ?>>Brunei</option>                                                 <option value="cambodia" <?php echo ($country == "cambodia")?  'selected="selected"' : '' ?>>Cambodia</option>                                                 <option value="canada" <?php echo ($country == "canada")?  'selected="selected"' : '' ?>>Canada</option>                                                 <option value="china" <?php echo ($country == "china")?  'selected="selected"' : '' ?>>China</option>                                                 <option value="fiji" <?php echo ($country == "fiji")?  'selected="selected"' : '' ?>>Fiji</option>                                                 <option value="hong kong" <?php echo ($country == "hong kong")?  'selected="selected"' : '' ?>>Hong Kong</option>                                                 <option value="india" <?php echo ($country == "india")?  'selected="selected"' : '' ?>>India</option>                                                 <option value="indonesia" <?php echo ($country == "indonesia")?  'selected="selected"' : '' ?>>Indonesia</option>                                                 <option value="japan" <?php echo ($country == "japan")?  'selected="selected"' : '' ?>>Japan</option>                                                 <option value="korea" <?php echo ($country == "korea")?  'selected="selected"' : '' ?>>Korea</option>                                                 <option value="laos" <?php echo ($country == "laos")?  'selected="selected"' : '' ?>>Laos</option>                                                 <option value="malaysia" <?php echo ($country == "malaysia")?  'selected="selected"' : '' ?>>Malaysia</option>                                                 <option value="nepal" <?php echo ($country == "nepal")?  'selected="selected"' : '' ?>>Nepal</option>                                                 <option value="new zealand" <?php echo ($country == "new zealand")?  'selected="selected"' : '' ?>>New Zealand</option>                                                 <option value="myanmar" <?php echo ($country == "myanmar")?  'selected="selected"' : '' ?>>Myanmar</option>                                                 <option value="singapore" <?php echo ($country == "singapore")?  'selected="selected"' : '' ?>>Singapore</option>                                                 <option value="philippines" <?php echo ($country == "philippines")?  'selected="selected"' : '' ?>>Philippines</option>                                                 <option value="sri lanka" <?php echo ($country == "sri lanka")?  'selected="selected"' : '' ?>>Sri Lanka</option>                                                 <option value="taiwan" <?php echo ($country == "taiwan")?  'selected="selected"' : '' ?>>Taiwan</option>                                                 <option value="thailand" <?php echo ($country == "thailand")?  'selected="selected"' : '' ?>>Thailand</option>                                                 <option value="tibet" <?php echo ($country == "tibet")?  'selected="selected"' : '' ?>>Tibet</option>                                                 <option value="vietnam" <?php echo ($country == "vietnam")?  'selected="selected"' : '' ?>>Vietnam</option>                                                 <option value="united kingdom" <?php echo ($country == "united kingdom")?  'selected="selected"' : '' ?>>United Kingdom</option>                                                 <option value="united states" <?php echo ($country == "united states")?  'selected="selected"' : '' ?>>United States</option>                                                 <option value="other" <?php echo ($country == "other")?  'selected="selected"' : '' ?>>Other</option>                                             </select>

                                             How do you identify yourself?:	                                                                               <?php $identity = get_the_author_meta( 'identity', $current_user->ID ); ?>                                             <select name="identity" id="identity">                                                 <option value="not specified" <?php echo ($identity == "not specified")?  'selected="selected"' : '' ?>>Not Specified</option>                                                 <option value="writer" <?php echo ($identity == "writer")?  'selected="selected"' : '' ?>>Writer</option>                                                 <option value="translator" <?php echo ($identity == "translator")?  'selected="selected"' : '' ?>>Translator</option>                                                 <option value="publisher" <?php echo ($identity == "publisher")?  'selected="selected"' : '' ?>>Publisher</option>                                                 <option value="festival organiser" <?php echo ($identity == "festival organiser")?  'selected="selected"' : '' ?>>Festival Organiser</option>                                                 <option value="student" <?php echo ($identity == "student")?  'selected="selected"' : '' ?>>Student</option>                                                 <option value="literary agent" <?php echo ($identity == "literary agent")?  'selected="selected"' : '' ?>>Literary Agent</option>                                                 <option value="academic" <?php echo ($identity == "academic")?  'selected="selected"' : '' ?>>Academic</option>                                                 <option value="other" <?php echo ($identity == "other")?  'selected="selected"' : '' ?>>Other</option>                                             </select>

                                             Workplace:	                                                                               <?php $workplace = get_the_author_meta( 'workplace', $current_user->ID ); ?>                                             <select name="workplace" id="workplace">                                                 <option value="not specified" <?php echo ($workplace == "not specified")?  'selected="selected"' : '' ?>>Not Specified</option>                                                 <option value="university" <?php echo ($workplace == "university")?  'selected="selected"' : '' ?>>University</option>                                                 <option value="school" <?php echo ($workplace == "school")?  'selected="selected"' : '' ?>>School</option>                                                 <option value="literary organisation" <?php echo ($workplace == "literary organisation")?  'selected="selected"' : '' ?>>Literary Organisation</option>                                                 <option value="writers circle" <?php echo ($workplace == "writers circle")?  'selected="selected"' : '' ?>>Writers' Circle</option>                                                 <option value="other" <?php echo ($workplace == "other")?  'selected="selected"' : '' ?>>Other</option>                                             </select>

                                             BIO Summary (circa 300 words):	                                                                               <textarea name="bio-summary" id="bio-summary" rows="5" cols="30"><?php echo esc_textarea( get_the_author_meta( 'bio_summary', $current_user->ID ) ); ?></textarea>

                                             Your Web Link:	                                                                               <input type="text" name="web-link" id="web-link" value="<?php echo esc_url( get_the_author_meta( 'web_link', $current_user->ID ) ); ?>" class="regular-text" />

                                             Longer BIO CV including publications
(optional):	                                                                               <textarea name="bio-longer" id="bio-longer" rows="5" cols="30"><?php echo esc_textarea( get_the_author_meta( 'bio_longer', $current_user->ID ) ); ?></textarea>

                                             Email Display:	                                             <?php $public_email = get_the_author_meta( 'public_email', $current_user->ID ); ?>                                                                                <input type="checkbox" name="public_email" id="public_email" value="yes" <?php echo ($public_email == "yes") ? 'checked="checked"' : '' ?> /><?php _e(' I agree to my email being publically displayed.') ?>

                                          <?php //do_action('edit_user_profile',$current_user); ?>
                                         <?php echo $referer; ?>                                         <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />                                         <?php wp_nonce_field( 'update-user' ) ?>                                         <input name="action" type="hidden" id="action" value="update-user" />
                                      </form>      Thanks John


How to automatically add and show(open) all the product attributes?

Is there a way when adding a new product that all available Attributes would automatically be added to this product and oppened/expanded so that when I'm adding new product I don't have to first add them and then click on the headers to expand them? Hope this image clears what I want to achieve: ![enter image description here](http://i.stack.imgur.com/D0W4I.jpg) Sure, I can manually trigger the click on "Expand all" button with jQuery, but am having trouble finding the place where to add this piece of jQ code. More important to me is the former question though, so any push in the right direction is much appreciated. **edit:** I managed to do the open(show) part of the problem by adding the line:               jQuery('.expand_all').trigger("click");      in the themes/mytheme/admin/admin-functions.php file in siteoptions_admin_head function. But the first qq still remains. I did find a work around though - I could first add one product and add every existing attribute to it, and when making new products I would make a copy of this product and them add/remove attributes I don't need. This however would not work dynamically if attributes change, so its not much of an improvement.


Define WP_DEBUG conditionally / for admins only / log errors (append query arg for all links?)

I'm developing a site on a server that the client has access to as well and what I'd like to do is show `WP_DEBUG` only for administrators. Referencing Yoast's article on a way around this:               if ( isset($_GET['debug']) && $_GET['debug'] == 'true')         define('WP_DEBUG', true);      would show `WP_DEBUG` only for URLs that have `?debug=true` attached to them, like `http://domain.com/?debug=true` I was thinking that the Debug Bar might hold some of this information in there by default (whether or not `WP_DEBUG` is turned on), but I was thinkin craziness as I don't believe that is the case. So, what I was thinking would be useful, would be a check for the current user (having the `manage_options` capability and then run links through `add_query_arg()`:               function zs_admin_debug() {         if (!current_user_can('manage_options')) {             add_query_arg('debug','true');         }     }      but what I'm unsure about is - is there a hook I can use to effect all links on a site with this? This way, admins always see debug which I thought would be extremely useful. Thanks for any help as always!


Automatic connect wordpress to facebook with featured image?

i want when i publish any post then it show my facebook with feature image. because most of plugin don't show feature image. it's show other image. please tell me how i can do it except - simple connect facebook and add link to facebook.plugin.i already use sample connect facebook plugin but it's not publish automatically. i also use dlvr.it and twitterfeed.com . it's post automatically but don't show featured image. it's show previous post featured image. how i can solve this problem. my site http://www.desyfun.tk


avatar displays outside of targeted area

I use this micro message system script and I want to add an avatar to it, however, my lack of PHP knowledge is making this difficult. The code I use to display an avatar is:               userphoto_thumbnail($user_info, $before = '', $after = '', $attributes = array(width => '40', height => '40'), $default_src = '')      And I want to inject this avatar to this part of the message script (inside a loop):               $r = $r . '
post_ID . '-' . $count . '" ' . $style . '>';     $r = $r . 'display_name . ' (' . $user_info->user_login . ')">' . userphoto_thumbnail($user_info, $before = '', $after = '', $attributes = array(width => '40', height => '40'), $default_src = '') . '	';     $r = $r . '' . wpam_get_message($reply, $user_info, $options, 2) . '	';     $r = $r . '
';      If you look at the second line, you will see how I added it there. However, this does not return the avatar where it should be. It appears outside everything else. Maybe because it returns a string rather than data? I am not sure as I am only just familiarising myself with PHP terminology. **EDIT:** Just to clarify, on the HTML output, the avatar images appear outside of the table, when they should be inside the `<td style="padding:10px 0 10px 10px; width:40px;">` tag. **EDIT 2:** Someone pointed out that `userphoto_thumbnails prints out the image, while I am trying to concatenate it. Its being printed out when I'm creating the string, so it's appearing in the wrong place. So I tested:               echo '
post_ID . '-' . $count . '" ' . $style . '>';     echo 'display_name . ' (' . $user_info->user_login . ')">' . userphoto_thumbnail($user_info, $before = '', $after = '', $attributes = array(width => '40', height => '40'), $default_src = '') . '	';     echo '' . wpam_get_message($reply, $user_info, $options, 2) . '	';     echo '
';      But this did not work either. I am certain that I have not added the avatar code to the script correctly, can you assist?


slideshow is not showing in a post call with ajax

this is the code I use to call ajax posts in the same page. It's works fine but when the post is load the slideshow in the post (add via short code) is not showing.... the ajax call                 jQuery('#menu-profilo > li > a').click(function(event){                      //This keeps the href from reloading the page                 event.preventDefault();                      //grab the page link                      var page = jQuery(this).attr('href');                      jQuery('#slideshow').html ('

loading

')                 //use the grabbed link in the load function                 .load(page+' .post_content').fadeIn(2000)                         });      This is the post load in ajax : https://www.dropbox.com/s/za0jwx7sdm2z6zx/post.jpg the post load normally (no ajax call) works fine. The problem is the jquery plugin royalslider ( or other plugin, is the same) that seems not working. here firebug image: https://www.dropbox.com/s/iui14sxqm4xwa1d/post2.jpg the white space is the the royal slider section.... How Can I fix this? I mean when I load a post via ajax call to show the post and the jquery plugin...


Searching Custom Fields

I would like to know how I can set up a form (separate from the normal search form), that will allow me to search through a particular custom post type. Within my defined custom post type I have 2 fields. In the search the user should be able to fill in any of them, in order to narrow down his search. Any examples of code that could accomplish this? This is what I've tried to do till now. The house name is stored as the custom post's title, while city and state are two custom fields. This search form is not working as it is.

                  <?php                  global $wp_query;                  $housename=mysql_real_escape_string($_GET['housename']);                  $city=mysql_real_escape_string($_GET['city']);                  $state=mysql_real_escape_string($_GET['state']);                          $args = array(                     'post_type' => 'house',                     'post_title' => $housename,                     'meta_query' => array(                             array(                                 'key' => 'house_city',                                                   'value' => $city                                                         ),                             array(                                 'key' => 'house_state',                                                   'value' => $state                                                        )                       )                                   );                  $houses_found = new WP_Query( $args );                    if ( $houses_found->have_posts() ) :                 while ( $houses_found->have_posts() ) : $houses_found->the_post();                     echo '
'.get_the_title().'
';                      endwhile;             endif;                  wp_reset_postdata();                  ?>                  <form method="get" id="searchform" >                 <?php _e( 'Name' ); ?>                 <input type="text" class="field" name="housename" id="housename" />                 <?php _e( 'City' ); ?>                 <input type="text" class="field" name="city" id="city" />                 <?php _e( 'State' ); ?>                 <input type="text" class="field" name="state" id="state" />                              <input type="submit" class="submit-2" name="submit" id="searchsubmit-2" value="<?php esc_attr_e( 'Search' ); ?>" />             </form>                           <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                      <?php endwhile; // end of the loop. ?>


How can I remove <br /> line breaks from manually formatted HTML?

I see a lot of posts here and elsewhere having trouble adding line breaks for some reason, but I'm trying to remove them. I'm new to WP, and I see that when editing in "HTML" mode the text is rendered in paragraph tags for double line breaks, and `<br>` for single line breaks, without the need to write the HTML. This is nice, but when I format the code manually by adding the `<p>` tags myself, I still get `<br>`s in the output. Example input in the editor:
     I don't want     HTML line breaks.
      My output:
     I don’t want
     HTML line breaks.
      I could remove all the line breaks in the source input, but that's really quite tedious and makes things harder to read in the editor. Is there any way to make WP ignore line breaks (not create `<br>`) when the content is already wrapped in `<p>` tags? I'm using the defaults for everything on a new installation.


wpdb prepare sql problem

I have problem with wpdb prepare and sql query. If i run the query directly thru wpdb->get_results it's working fine. Here it is:               $alabala_sql = $wpdb->prepare(         "         SELECT *          FROM $wpdb->posts p          INNER JOIN $wpdb->term_relationships tr            ON p.ID = tr.object_id         INNER JOIN $wpdb->term_taxonomy tt            ON tr.term_taxonomy_id=tt.term_taxonomy_id          inner join  $wpdb->terms t            on t.term_id=tt.term_id and t.slug='$curPageId'         WHERE            p.post_title LIKE '$getChar%'                   AND p.post_type = 'filmi-i-serialii'            AND p.post_status = 'publish';         "     );     /*Make sql query to take posts*/     $eventsPosts = $wpdb->get_results($alabala_sql);      But it doesn't work. Also i tried that way:               $alabala_sql = $wpdb->prepare(         "         SELECT *          FROM $wpdb->posts p          INNER JOIN $wpdb->term_relationships tr            ON p.ID = tr.object_id         INNER JOIN $wpdb->term_taxonomy tt            ON tr.term_taxonomy_id=tt.term_taxonomy_id          inner join  $wpdb->terms t            on t.term_id=tt.term_id and t.slug=$s         WHERE            p.post_title LIKE $s%                   AND p.post_type = 'filmi-i-serialii'            AND p.post_status = 'publish';         ", $curPageId, $getChar     );     /*Make sql query to take posts*/     $eventsPosts = $wpdb->get_results($alabala_sql);      But again it didn't worked. Please tell me where is my mistake ? Both vars are strings. Regards.


How to use search_columns in WP_User_Query?

I am using `WP_User_Query` to search use by name, ID, email etc... In that case I need to use `search_columns` field to pass ID or email of user. What i am doing is               $my_users = new WP_User_Query(                          array(                              'role' => $role,                             'offset' => $offset ,                             'number' => $number,                             'fields' => 'all',                             'search_columns'=> array( '5','', 'johndoe_dd@yahoo1.com','',''),                             //'search_columns'=> $search_columns_array,                             'meta_query' => $meta_query_array,                         ));      For reference http://wpsmith.net/2012/wp/an-introduction-to-wp_user_query- class/


How to get a localized version of WordPress from a repository?

I'm setting up my basic skeleton / boilerplate I want to use for all wordpress projects. I follow Mark Jaquiths approach and include WP as a submodule. He gets it from https://github.com/WordPress/WordPress. Many of my clients are from Germany and require German language files for administration. Is there a way I can include the localized files into my skeleton git repository?


get_the_post_thumbnail() doesn't taking style attribute

This seems to be an easy one but its giving me quite a hard time. get_the_post_thumbnail() suppose to take attribute as an array. Well, everything working right but when i pass style attr its doesn't work.               $attr = array(                                     'title' => get_the_title(),                                     'alt' => get_the_title(),                                     'style' => 'float:left'                                 );          $thumb = get_the_post_thumbnail($post->ID, 'large-thumb', $attr);      The title and the alt attribute is set up nicely though but style attribute is missing in images. FYI: I am showing the thumbnail in rss feed.


How to order posts in wp_query by the user role (2 roles in array)

I'm using the following code from this answer: How can I get the last posts by user role ?               <?php     $friends = get_users( array( 'role' => 'friends' ) );     $friend_ids = array();          foreach( $friends as $friend )          $friend_ids[] = $friend->ID;          $news = new WP_Query( array( 'author' => implode( ',', $friend_ids ), 'post_type' => 'news', 'paged' => get_query_var('paged') ) ); ?>      I've added another WP role to the array so it grabs both. For example:               $friends = get_users( array( 'role' => 'friends, enemies' ) );      Is it possible to now order the posts somehow by the role? so it displays all the friends first, followed by all the enemies etc. At the moment, it lists them all mumbo jumbo as expected. EDIT: sorry, probably shouldn't have set up another question, not sure why I did that. Is it possible to do this without using custom fields? The problem I've found with custom fields is that If a user changed roles (due to membership levels) then the posts would not be ordered correctly until the post (from the author who changed) was saved with it's new custom field value.


When would you use $_post instead of $post?

I've seen some examples that use $_post instead of $post. What's the difference and when would you use $_post instead of $post? Example:               if (have_posts()) :     while (have_posts()) : the_post();     if(!in_category("some-category", $_post )) { do_something(); }


plugin suggestion for barcode

I am having vendor address field for each post using custom field plugin. In single post page.I want to generate bar code.When its scanned by mobile phone.It should display the address of the vendor in text format. Is there any existing plugin.Or any gold suggestions are appreciated. Thanks in advance !


4 single sites VS multisite wordpress

We're currently running a multisite wordpress install for 4 sites. Running into problems with pretty much every plugin ever made (mostly issues with user account creation etc), I'd really like to switch over to 4 single installs. However, I'm wondering if the server resource usage will be significantly affected. As far as I see it, the overhead of running the multisite management on top of these blogs outweighs any losses we would see from running them separately, especially when we're only talking about 4 sites. Can anyone offer some more insight here? Thanks in advance


Archives for Custom Post Types (without Pages)

I'm basically looking to extend the default archives widget so that it not only displays a {month : year} list of the default Posts but also includes my new custom Post Type. From this example I was able get the new {month : year} items appearing in the archive list but not clicking through to anything. Then this example showed how to include items from Custom Post Types in the loop and allow them to click through and return the actual results. However, the last problem I have is that when clicking on the {month : year} item in the list it also returns results from Page entries too. I need to know how to filter out Pages from my results so it is just Post Types. The code I have in functions.php is:               /**      * Add custom Post Types to the Archives.      */     add_filter( 'getarchives_where' , 'ucc_getarchives_where_filter' , 10 , 2 );     function ucc_getarchives_where_filter( $where , $r ) {       $args = array(         'public' => true ,         '_builtin' => false       );       $output = 'names';       $operator = 'and';            $post_types = get_post_types( $args , $output , $operator );       $post_types = array_merge( $post_types , array( 'post' ) );       $post_types = "'" . implode( "' , '" , $post_types ) . "'";            return str_replace( "post_type = 'post'" , "post_type IN ( $post_types )" , $where );     }          /**      * Add Custom Post Types to The Loop results.      */     add_filter( 'request' , 'ucc_request_filter' );     function ucc_request_filter( $query ) {        // Preview does not like having post_type set; feed is my personal preference.       if ( empty( $query['preview'] ) && empty( $query['feed'] ) ) {         $my_post_type = $query['post_type'];         if ( empty( $my_post_type ) ) {           $query['post_type'] = 'any';         }       }       return $query;     }


Delete sites in wordpress multisite (not suspend)

When you delete a site in your wordpress network, it apear like suspend: ![Suspend sites](http://i.stack.imgur.com/TqVY3.jpg) For delete a site, user have to click a link that wp send to his email, when he checked the site be suspended, but it doesn't deleted. I want to do that the user can delete his site.


Remove 'portfolio' from URL

I was trying to remove **portfolio-view** from url and followed instructions to remove its name from highlighted section. This works but has left me with ' **portfolio** ' now even though field is blank. What is wrong with this code or need changing in breadcrumbs please? It is now grabbing 'portfolio' from somewhere and i want this hidden in url. I'm trying to get: `http://www.sitename.com/post` instead of `http//www.sitename.com/portfolio/post`.               /* Portfolio */           function my_post_type_portfolio() {           register_post_type( 'portfolio',           array(           'label' => __('Portfolio'),           'singular_label' => __('Porfolio Item', 'theme'),           '_builtin' => false,           'public' => true,           'show_ui' => true,           'show_in_nav_menus' => true,           'capability_type' => 'page',           'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',          **'rewrite' => array(      'slug' => ' ',      'with_front' =>false,**      ),           'supports' => array(           'title',           'editor',           'thumbnail',           'excerpt',           'custom-fields',           'comments')           )      );      register_taxonomy('portfoliocat', 'portfolio', array('hierarchical' => true, 'label' => 'Portfolio Categories', 'singular_name' => 'Category', "rewrite" => true, "query_var" => true));      }               add_action('init', 'my_post_type_portfolio');       Breadcrumb setting is: `<a title="Go to %title%." href="%link%">%htitle%</a>` Permalinks: `/%postname%/`


I'm think I've found a bug with JetPack 1.7

There are dozens of other WP installs on the same server, subject to the same ModSec rules, and none of them has a problem. This is the only WP install that has jetpack installed and it only occurs when JetPack is active. The problem is as follows: Some actions on the post/page edit screen (so far it **seems** to be the ones that don't refresh the URL, like UPDATE or configure featured image) show me the following alert: http://i.imgur.com/ULPiX.png The logs show:               Received From: kvm1->/var/log/httpd/error_log     Rule: 1002 fired (level 2) -> "Unknown problem somewhere in the system."     Portion of the log(s):     body.xml:1: parser error : Document is empty          ModSecurity: XML parser error: XML: Failed parsing document. [hostname "www.mydomain.org"] [uri "/wp-admin/admin-ajax.php"] [unique_id "blablah"]          ModSecurity:  [file "/etc/httpd/modsecurity.d/00_asl_z_antievasion.conf"] [line "36"] [id "330791"] [msg "Failed to parse request body.  This may be an impedence mismatch attack, a broken application or a broken connection.  This is not a false positive.  Check your application or client for errors."] [data "XML parser error: XML: Failed parsing document."] [severity "CRITICAL"] Access denied with code 403 (phase 2). Match of "eq 0" against "REQBODY_ERROR" required. [hostname "www.mydomain.org"] [uri "/wp-admin/admin-ajax.php"] [unique_id "blablah"]      Jetpack is 1.7 WP is 3.4.1 Apache 2.2.15 PHP fCGId 5.3.3 Any ideas? The WP forum has been unresponsive so far. I've sent an email to JetPack support.


WordPress Search

I'm trying to write a search feature on a website of mine, and it seems like it's not pulling in any of the pages, only posts. Below is the code. Search Form:                         <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">                     <input type="text" value="Search" onblur="if (this.value == '') {this.value = 'Search';}" onfocus="if (this.value == 'Search') {this.value = '';}" name="s" id="messagesSearch" />                     <input type="hidden" name="post_type" value="postpage" />                     <img src="<?php bloginfo('template_directory'); ?>/includes/images/icons/search-light.svg" alt="">               </form>      Search:                 <?php            if(isset($_GET['post_type'])) {                $type = $_GET['post_type'];                if($type == 'postpage') {?>                      <?php if (have_posts()) : ?>                         <?php /* Start the Loop */ ?>                         <?php while ( have_posts() ) : the_post(); ?>                 <?php if ((get_post_type( $post ) == 'post') || (get_post_type( $post ) == 'page')) : ?>                      <?php the_title(); ?>                      <?php endwhile; endif; ?>                  <?php } } ?>      Thanks!


Wordpress query string rewrite .htaccess

At the minute my .htaccess looks like:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /testdirectory/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      I want to be able to turn this page:               /car-details/?make=Ford&model=Focus      in to:               /car-details/car-info/Ford/Focus      including the extra "/car-info/". I've tried quite a few combinations but I'm getting nowhere... any ideas? Thank you!


Blog posts are not appearing as subs of Blog Page

I'm trying to set up a new blog on my company website and blog posts are not showing up as subpages to the blog page. I would like for the url to all blog posts to read: techmdinc.com/blog/post-title How do I go about making this happen? Do I need to do it manually?


Archive-custome_post.php template not working

I have a site on WordPress 3.6.1 and I created a custom post type for recipes with the code:                add_action( 'init', 'register_cpt_my_recipes' );         function register_cpt_my_recipes() {         $args = array(         'hierarchical' => false,         'supports' => array( 'title', 'editor', 'custom-fields' ,'tag' , 'excerpt', 'thumbnail'),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,         'show_in_nav_menus' => false,         'publicly_queryable' => true,         'exclude_from_search' => false,         'has_archive' => true,         'query_var' => true,         'can_export' => true,          /* Not necessary but added as a solution */         'rewrite'=> array( 'slug' => 'my_recipes', 'with_front' => true ),         'capability_type' => 'post'         );         register_post_type( 'my_recipes', $args );         /* Not necessary but added as a solution */         flush_rewrite_rules( false );         }       I created `archive-my_recipes.php` custom template file but whenever I navigate to `mysite/my_recipes/` I end up with code from `archive.php` with all my posts not just posts form my custom post type. I tried `taxonomy- my_recipes.php` but also didn't work . also `single-my_recipes.php` is working fine. I read about the subject on the WordPress documentation site here and here This is the `body_class` output:               [ archive post-type-archive post-type-archive-Array logged-in admin-bar custom-font-enabled single-author customize-support ]       I added :               add_action( 'pre_get_posts', 'add_my_post_types_to_query' );          function add_my_post_types_to_query( $query ) {         if ( !is_admin() && $query->is_main_query() )             $query->set( 'post_type', array( 'post', 'page', 'recipes' ) );         return $query;     }      to function.php to include my custom post types in the main query.


wordpress register nav menu not showing in admin

I am using the following code to register a menu for my theme. In functions.php I have written the following:               register_nav_menu( 'header-menu', __( 'Header Menu' ) );      When going into wp-admin >appearance > menus, the menu is not showing up. Can anyone telll me what I am doing wrong?


Theme: Twenty Thirteen Mobile Sliding Menu Doesn't Bump Content Down

I have created a child theme for Twenty-Thirteen and somewhere while editing it I broke the mobile menu slider as it no longer pushes the content down and instead displays behind the content. I've changed the CSS in someway to cause this issue but I cannot find what has caused it. I am hoping that the cause will be more apparent to someone more familiar with CSS than I. To view this issue you must resize your browser to width of less than 700px or so and click the menu button revealing the slider menu and the content overlap issue. Note how the H1 tag "Quad Cities, Chicago, Des Moines Photographer Brian Barkley" is over top menu. Here is a link to the site: http://barkleyphoto.com/_wedding/ and here's a copy of the stock twenty thirteen to help compare http://twentythirteendemo.wordpress.com/ Here's an image to see for yourself what I am speaking of. ![enter image description here](http://i.stack.imgur.com/cE3jB.png)


Split loop into columns

I'm trying to split my loop into 4 columns. My logic is very flawed here and my layout is breaking. Such a simple problem, but I'm struggling with it. I essentially need each group of four posts to be wrapped in a container "row" div. And, of course, whatever remaining posts are left over, even if less than four, to be wrapped as well.
             <?php           $i = 0;           if (have_posts() ) : while ( have_posts() ) : the_post();              if ($i == 0) { echo '
'; }             if ($i%4== 0) { echo '

'; } ?>
                 <?php the_post_thumbnail(); ?>
Title

                  <?php               if ( $i%4 == 0) {                 echo '
';               }               $i++;                   endwhile; endif; ?>
      I posted this over at stackoverflow as well, but no replies. Any suggestions to solve my problem here?


How to keep track of user logins?

I have a client with a private Wordpress blog - that is to say, you need to log in to read it. We are using Counterize to keep track of visits to the site and to find the most popular pages. But now he wants to know which users are logging in, and perhaps how often they are logging in to read this blog. I checked to see if there was any info in wp_usermeta ( like last-login-date ) but there doesn't seem to be. Any suggestions how to keep track of user's activities? Thanks


Get Widget Instance inside Widget

I'm trying to access the $instance variable from a custom function I've written inside my Widget, but I keep getting a "variable is undefined" error. How can I re-create the $instance variable?               public function __construct() {              parent::__construct(             'cst_twitter_widget',             __( 'CST Twitter Tweets', 'chicagosuntimes' ),             array(                 'description' => __( 'Displays Tweets from a given list url.', 'mythemename' ),             )         );              add_action( 'wp_head', array( $this, 'cst_twitter_feed_ajaxurl' ) );         add_action( 'wp_ajax_refresh_tweets', array( $this, 'refresh_tweets' ) );          }          /**      * Set the AJAX URL for the Twitter Feed Widget      */     public function cst_twitter_feed_ajaxurl() {     ?>         <script type="text/javascript">         var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';         </script>     <?php     }          /**      * Display the updated Twitter Feed      */     public function refresh_tweets() {              //my custom function, where i'm trying to re-create the $instance and access the values         $instance = self::$instance;         echo $instance['cst_twitter_screen_name']; //the variable i'm trying to access         die();     }          public function widget( $args, $instance ) {         //the widget instance     }          public function form( $instance ) {              //the form     }          public function update( $new_instance, $old_instance ) {              $instance = $old_instance;         $instance['cst_twitter_screen_name'] = $new_instance['cst_twitter_screen_name'];              return $instance;          }


Get Terms from Custom Taxonomy and Current Post

I'm working with the WooCommerce plugin. I've got three products (called "Kits") and each kit contains several items. The "items" are a custom post type which are linked to each kit via a relationship field. Each item has a custom taxonomy attached to it ("departments"). The departments have no direct link to the products (or "kits"), except via the items. When I display the products, I want them to show a `<ul>` that loops through each term found in "departments". Then within that `<li>`, have a nested `<ul>` that lists each item that is found in the current department AND in the current product. I've got a loop that's working to display the items associated with each product:               <a href="#details<?php the_ID(); ?>" class="details button" data-id = "<?php the_ID() ?>">Details     <div class="items" id="details<?php the_ID(); ?>">       <?php  $items = get_field('kit_items');?>     <?php if( $items ): ?>
         <?php foreach( $items as $item ): ?>             <?php $ident = $item->ID ?>
                 <a href="#overlay<?php echo $ident ?>" class="item item<?php echo $ident ?>" data-id ="<?php echo $ident ?>">                     <?php echo get_the_title( $item->ID ); ?>
         <?php endforeach; ?>
     <?php endif; ?>      But I'm not sure how to query the custom taxonomy, print out the terms and then print the items that are associated with the department and the current product.


Advanced Custom Fields - Relationship post foreach query

I've created a post type, called Package (for news packages), and want to be able to link to specific blog posts and display them on the single-package.php page. I'm using ACF relationship fields, and using the post ID (tried with post object as well, but had the same problem) The issue is that the title and permalink calls within my foreach statement aren't working. They're using the Package's title and permalink, instead of the posts title and permalink, despite using $item->ID in each call. Here's the code:               <?php while (have_posts()) : the_post(); ?>

Package: <?php the_title(); ?>

         <?php the_content(); ?>
         <?php              $items = get_field('package_items');             ?>             <?php if( $items ): ?>
                 <?php foreach( $items as $item ): ?>                 <?php setup_postdata($item); ?>
                         <a href="<?php echo get_permalink( $item->ID ); ?>">                             <?php echo get_the_title( $item->ID ); ?>
                 <?php endforeach; ?>
             <?php endif; ?>              <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>     <?php endwhile; ?>      You can see the resulting output of the above code here. Any thoughts?


Echo out element to another page.

I have a small plugin that displays how many submissions are left on current ninja form. And writes it out as so               <p id="submissions-left">hurry only 25 submission left. <\p>      And tacks it onto the end of the form. How can I get that p tag to another page? Anyway to target the id and echo it out on another page? Say have a shortcode to use? Thanks


wp_list_categories output /defaultcategory+category2/

I need output this /default_category+ and add after that comes all site categories and then list those. I need to list this so I can make ready list, so user can search post that are in under default category. Example: www.mydomain.com/categories/defaultcategory+category1/ www.mydomain.com/categories/defaultcategory+category2/


filter title from shortcode

Just wondering how to filter to change the current page title from a shortcode, Since shortocodes are rendering after $post. any idea to archieve something like : `do_shortcode(['mytitle="newtitle"']);`


Wordpress to use Drupal users' credentials

I have both Wordpress and Drupal installed on two domains. I want the users that register via Wordpress to be stored in Drupal's user table. Also, any login attempts should be checked against Drupal's database. I don't have a lot of experience with either (though I'm fairly confident in my PHP skills). I am not looking for a way to mirror the users, but to actually tell Wordpress to use Drupal's database. I think I have to rewrite the login and register methods on Wordpress. Am I wrong? And what's the best way to do this? (what files do I need to go into)?


Using in_category for non standard loops

Im using wp favorite posts to show a list of favorited post by a user on a page. It creates a loop of posts but I can't figure out how to use conditional tags for posts in the loop. Specifically for posts in a certain category I need to show the image inside the loop below. So in the regular loop on my index page I just use `in_category'. But that isn't working with how the favorites loop is setup. Any suggestions on how to do this? Here's the loop.               <?php     echo "
";     if (!empty($user)):         if (!wpfp_is_user_favlist_public($user)):             echo "$user's Favorite Posts.";         else:             echo "$user's list is not public.";         endif;     endif;          if ($wpfp_before):         echo "
".$wpfp_before."
";     endif;          if ($favorite_post_ids):         $favorite_post_ids = array_reverse($favorite_post_ids);         foreach ($favorite_post_ids as $post_id) {             $p = get_post($post_id);             $video_code = get_post_meta($post_id,'video_code',true);             ?>

              <a href="<?php echo get_permalink($post_id); ?>" rel="<?php echo $post_id; ?>" class="postpopup">               //HERE I NEED TO USE IN_CATEGORY TO ONLY SHOW THIS IMAGE WHEN THE  POST IS IN CATEGORY "8".//               <img src="<?php $thumb = get_youtube_screen_link( $video_code, 'default' ); ?>" width="176" height="126">               <?php echo get_the_title($post_id); ?>               <?php wpfp_remove_favorite_link($post_id); ?>

        <?php }     else:         echo "
";         echo $wpfp_options['favorites_empty'];         echo "
";     endif;     wpfp_clear_list_link();     echo "
";     wpfp_cookie_warning();     ?>


Front-end image upload from TinyME

I'm trying to edit the Q&A Plugin (which for those of you that don't know it is a StackExchange-style plugin with Custom Post Types of Questions and Answers) to incorporate image uploads. It seems to use the built-in TinyMCE editor that came bundled with recent versions of WP. This comes with the "Media Library" buttons. Unfortunately, these only appear to be accessible to users with author privileges. If I can, I'd like to open this up to registered users. I can use the answer provided here to limit this to "upload" rather than for users to be able to access the Media Library, but **I can't find what to change in the Q &A plugin to allow this**. Alternatively, I'd be happy to install a TinyMCE plugin to allow basic image uploads. I tried the jbimages plugin for TinyMCE and wrote my own simple function to incorporate it with WordPress. The icon displayed, but the plugin itself seemed broken - it was listing strings like `{variables}` instead of the actual variables. Does anyone have a viable solution for this?


Is it possible to run javascript on plugin deactivated?

Is it possible to run javascript on plugin deactivated and if yes then, how should I achieve that. I have developing one plugin in which two new tables are created in wp database and on deactivation I want to confirm from users if he/she wants to delete those table before deactivating.


cutsom posts 404ing

I can't stop my custom post types from sporadically 404ing. It doesn't always happen and I can't predictably replicate the problem - as in sometimes it happens, sometimes it doesn't. However, once I clear the cache, the 404 always goes away and the URL works. I have tried resetting and re-saving the permalinks, which are currently category/postname. I have also tried playing around with the flush rewrite rules, setting them to blank and false, but nothing seems to cure the issue. Here is my current code:               add_action('init', 'create_raceresults_post_type');           function create_raceresults_post_type() {      register_post_type('raceresults', array(          'labels' => array(              'name' => 'Race Results',              'singular_name' => 'Race Results',              'add_new' => 'Add New Race Result',          'add_new_item' => 'Add New Race Result',          'edit' => 'Edit Race Result',              'edit_item' => 'Edit Race Result',              'new_item' => 'New Race Result',              'view_item' => 'View Race Result',              'search_items' => 'Search Race Result',              'not_found' => 'No Race Result found',              'not_found_in_trash' => 'No Race Result found in Trash'          ),          'public' => true,      'exclude_from_search'=> false,      'rewrite' => array('slug' => 'best-running-training-program', 'with_front' => true),      'supports' => array(              'title',              'excerpt',              'title',              'excerpt',          'editor',          'custom-fields',          'revisions',          'thumbnail',          'author',          'page-attributes'               ),          'taxonomies' => array('category', 'post_tag') // this is IMPORTANT      ));      flush_rewrite_rules();      }       Is there something I am missing or not trying? Here is an example of that custom post: http://runnersconnect.net/best-running-training-program/race- results-march-24-march-25/. I just tried it and it worked when I first published 60 minutes ago but just 404ed when I tried to check it. Thanks in advance!


Get value in custom field with taxonomy

I have custom field `my_cf` for Taxonomy/Term. How can I get and output value with custom field for taxonomy/term? I've tried using:               $variable = get_field('my_cf', 'basic');        echo $variable;       where basic - name for my taxonomy. But this doesn't work. Any suggestions?


I am officially missing something about transient posts

I have no issue creating transients. What I have an issue with is pagination - and I have made posts on it before and every one sates that the query must look like, for example:                       $queried_post = array(                 'post_type' => 'post',                 'paged' => get_query_var( 'paged' )             );       Which is then:               $query = new WP_Query($queried_post);      and stored:               set_transient('posts', $query, 60); // For testing purposes, we reset every 60 seconds.      So then I do:                   gloabl $wp_query;              $original = $wp_query;         // Obviously you would do checks to see if the transient         // exists. But lets assume it always exists.         $wp_query = get_transient('posts');              if($wp_query->have_posts()){             while ($wp_query->have_posts()) {                 $wp_query->the_post();                 // display content ...              }                  var_dump($wp_query->max_num_pages); // Shows me: float 4             echo get_next_posts_link( __( 'Next', 'textdomain'), $wp_query->max_num_pages );             echo get_previous_posts_link( __( 'Previous', 'textdomain'), $wp_query->max_num_pages );         }              $wp_query = $original;      I have even attempted everything I know, including testing the original query and the pagination on that works just fine, I can paginated back to 4 pages and forward to the latest. So the query **not set in a transient** works. But setting it up in a transient causes pagination to fail... Why? I cant figure out. Can some one tell me?


Filter to remove the default password on "Your Profile" page

Whenever I go to my "Your Profile" page to edit any of the settings other than the password, I have to manually empty out the password field to avoid errors/nags. Is there a filter I can place in functions.php that will empty the password field by default?


using wp_query to return posts w/ comment count > 0

I've looked at numerous examples of wp_query and can't figure this out. If the thing I was comparing were a meta value then I could to a meta query, but apparently you can't do a compare with a non-meta value? This is what I thought it would work:               $commentpost = new WP_Query( array( 'key' => 'comment_count',                                     'value' => '0',                                     'compare' => '>',                                                                                'orderby' => 'comment_count',                                     'order' => 'DESC',                                     ) );      Any help would be appreciated.


Login to wp-admin "redirect_to" points to wrong URL after migration

I have a WordPress site hosted on GoDaddy, it's a Windows server, (i have the `web.config` set up). and `.htaccess` correctly configured. The site was working on `example.com/wordpress` , as it was a development test. I moved the site to `example.com` . I changed the site url and wordpress URL to `example.com` on the database through PhpMyAdmin, and updated the permalink structure. I also updated all the wp_post 'content' field to change the URL's. ## Issue When I try to Log In to the admin panel through `example.com/wp-admin`, the URL shows as               example.com/wp-login.php?redirect_to=http://example.com/wordpress/wp-admin/reauth=1      Why could this be happening if both the site url and wordpress url match, and match with the database. ## Additional Notes This isn't a cache issue (At least not on the browser's side), I have tried different browsers, and I do most of the testing on incognito chrome windows. I have tried setting `update_option`for both `siteurl` and `home` in `functions.php` and:               //wp-config.php     define('WP_HOME','http://example.com');     define('WP_SITEURL','http://example.com');      I also tried the Relocate Method explained on the Codex http://codex.wordpress.org/Changing_The_Site_URL


How To Make Iris Color Picker Showed Up Over Form and Text?

Is there a way to make wordpress default color picker (iris) showed up over form and text using wordpress api? Its inline display messing up the administration page of my plugin each time the color picker box showed up.


Excerpt filter is adding '</p>' in incorrect place

I'm using the following code from this question in order to limit the excerpt length to 2 paragraphs.               if ( ! function_exists( 'wpse0001_custom_wp_trim_excerpt' ) ) :           function wpse0001_custom_wp_trim_excerpt($wpse0001_excerpt) {     global $post;     $raw_excerpt = $wpse0001_excerpt;     if ( '' == $wpse0001_excerpt ) {          $wpse0001_excerpt = get_the_content('');     $wpse0001_excerpt = strip_shortcodes( $wpse0001_excerpt );     $wpse0001_excerpt = apply_filters('the_content', $wpse0001_excerpt);     // Here we choose how many paragraphs do we want to cutthe excerpt at, This part thanks to Clément Malet     $wpse0001_excerpt = "
$wpse0001_excerpt
";         $wanted_number_of_paragraph = 1;         $tmp = explode ('
', $wpse0001_excerpt);         for ($i = 0; $i < $wanted_number_of_paragraph; ++$i) {            if (isset($tmp[$i]) && $tmp[$i] != '') {                $tmp_to_add[$i] = $tmp[$i];            }         }     $wpse0001_excerpt = implode('
', $tmp_to_add) . '
';          $wpse0001_excerpt = str_replace(']]>', ']]>', $wpse0001_excerpt);          $excerpt_end = ' ' . ' » ' . sprintf(__( 'Read more about: %s  »', 'pietergoosen' ), get_the_title()) . '';      $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);           //$pos = strrpos($wpse0001_excerpt, '</');     //if ($pos !== false)     // Inside last HTML tag     //$wpse0001_excerpt = substr_replace($wpse0001_excerpt, $excerpt_end, $pos, 0);     //else     // After the content     $wpse0001_excerpt .= $excerpt_end;          return $wpse0001_excerpt;          }     return apply_filters('wpse0001_custom_wp_trim_excerpt', $wpse0001_excerpt, $raw_excerpt);     }          endif;           remove_filter('get_the_excerpt', 'wp_trim_excerpt');     add_filter('get_the_excerpt', 'wpse0001_custom_wp_trim_excerpt');      I have set `$wanted_number_of_paragraph` to `2`. If found more than one paragraph in a post the result is correct:

Text

Text

      If found only one paragraph in a post the result is incorrect:

Text

      I tried to modify a bit the above code but none of my modifications works. Any ideas why this happens?