How to: wordpress job listing and candidates details

I am developing a wordpress site (http://new.saffronresourcing.com/candidates/) where candidates who wants to apply for jobs will be able to upload their cv along with their personal details. I already created custom content type for job list which will be used for job listing. it working fine. Now there is a "apply now" button attached to all job listing. Problem is when user clicks apply button, it goes to another page named uploadcv.php. Question is when I'm in uploadcv.page, I have no way to find which job listing page user came from. So I need a reference variable which will hold the current page job list ref. number and when user clicks apply now button it will carry out that variable and move to uploadcv.php page so I can save the details to the database along with that job reference number. Is there any idea how to get the current page URL and pass to the next page? Now as I said earlier candidates will upload their cv, I'm not sure whether how I am gonna add this CV (type .doc, .pdf) into mysql database. Is their any special code to insert the .pdf or .doc file to the database ? And when the information will be added to the database , I also need to retrieve those details and display in wordpress dashboard so the admin of the site can view which candidates applied for which jobs. So i'm looking for some kind of options panel or candidates lists page where the data will come from database. So in a nutshell, Please let me know if you guys know how to get the current page URL and pass to next page insert the values from details entry form to database and retrieve the values and display into dashboard, somewhere in dashboard so admin can view the candidates list. I'm aware there is a plugin exists wp job manager, but I have no clue how to use this plugin, couldn't find a proper documentation. So I decided I will not use this plugin and write code by myself. If you guys know about this plugin, let me know how did you use this for job listing purpose. Thanx in advance.


WordPress Twenty Fourteen Theme Sidebar

The Twenty Fourteen theme was used to create the basis of my own child theme. It's been pretty easy to override, but the left sidebar is proving difficult. I don't want to remove the sidebar completely, but nothing I do in the CSS file allows me to get rid of the black bar. Even removing the sidebar from a template file leaves an empty black strip where the sidebar used to be. Has anyone found a way to peacefully override this without throwing out the whole system?


Capitalize Shortcode Value on Output

I wrote this shortcode to take a filename I specify and output it as an image with title and alt tags:               function cwc_pkmn($atts) {         extract(shortcode_atts(array(             "name" => 'http://',         ), $atts));         return '';     }     add_shortcode("pkmn", "cwc_pkmn");      All of my filenames are lowercase with a "-" between words. Is it possible to have the output capitalize each letter following a - and replace the - with spaces? So right now, when I do the shortcode above like this:               [pkmn name="mr.-deeds"]      I get this as the output:                     But is it possible to have the output do this instead with the title and alt tags?:                     Thank you so much!


Cant login, Password MUST be reset error, after reset

I recently forgot login to my wordpress, I changed password in mysql to md5 and can now login... But when i do i get: "Please enter your username or email address. You will receive a link to create a new password via email. Your password must be reset. Please submit this form to reset it." and the Problem is my server cant send emails.... so now what are my options ? Edit: I thought i made it clear that i did manually what that script does below. If i didn't well now you know.


Navbar list items changing place

I am using wp-bootstrap-navwalker to create easy menus with Twitter Bootstrap. Everything works fine when setting menu up and everything is displayed. But when I enter the pages on the site the navbar list items swop places with eachother which make the navbar feel messy. Why is that?


2 custom post-type and 1 taxonomy

I have 2 post types (job, resume) and sharing 1 custom taxonomy (cities) it's for jobs in "New york" and it's also for jobseekers in "New york" (resume is the post-type for jobseeker)                register_taxonomy(       'city',       array( 'job_listing', 'resume' ),       array( 'hierarchical' => true,             //'label' => 'Location',                  'label' => __('Locations1', 'Locations2'),   // both of them shows "locations1" there is no "locations2" on resume                 //'query_var' => true,               'query_var' => 'location',             //'rewrite' => true              'rewrite' => array( 'slug' => 'locations' )       )      ); It works ok but I need to know how to get them to displayed. On backend, it shows ok but it's all total posts amounts.                domain.com/wp-admin/edit-tags.php?taxonomy=city&post_type=job      domain.com/wp-admin/edit-tags.php?taxonomy=city&post_type=resume      problem : these display all amount of posts. not each post_types. On front-end, I need to show 2 lists                "jobs in Newyork", "resumes in Newyork"      How can I get them?


How to restrict attachment download to a specific user?

I have a very specific use case where the site built for a lawyer and each of his clients can login to their own 'specific page/portal' (custom post type) without the ability to access wp-admin etc. (I created all the login/register/profile-editing pages in the front end). In this page/portal the lawyer will leave messages and **files for the client to download** , now theoretically speaking, one client can guess (or if has knowledge of another client's files) other file names and download then thus creating an issue with privacy/security/confidential material etc. I'm looking for ideas/concepts for a solution, my initial thought was to have the download link point to some download.php sending the attachment id, user id, page/portal id and nonce and the on the other end processing that.. what do you think? am I on the right track or this approach is flawed? Thanks!


Get taxonomy slug from url

Sorry I'm new to taxonomies & trying to learn quickly. I've set up sectors and assigned a post to it. If I go to the post, I can see the URL has www.mydomain.com/sectors/auto/ How can I get auto from the URL? Thanks


How to modify the action attribute of the wp-login.php?action=register form?

I'm trying to create a reference registration system in Wordpress. The idea is that the user will click a link which will contain wp- login.php?action=register&ref=12345 I'm hooking into the 'register_form' action hook and adding a reference number hidden input and on registration use that reference number to do whatever i need to do with it. The issue appears when the user gets something wrong in the registration form. The problem is that he will be taken to wherever the action attribute of the register form states which is "wp-login.php?action=register" without the ref parameter. I'm looking for a way to modify that action attribute. I've looked in the wp-login.php file and it seems that there's no filter there. I know there's always javascript, but is there another wordpressy way to do this?


WordPress RSS feed - filter RSS content by custom field value

I can have the RSS feed url like:               http://www.mydomain.com/?post_type=job_listing&job_cat=value#1&job_type=value#2&geo_country=value#3&feed=rss2      `job_cat` & `job_type` are taxonomies for the `job_listing` post type and they are considered / generated in the RSS feeds correctly. Recently I've added a custom field parameter in te RSS feed url's called `geo_country`. If a value is returned for this in the RSS feed url (not empty), then the RSS content should be filtered also by the custom field's value. Which is not happening currently, of course. Using the `Jobbroller` theme, but I haven't found in them any RSS related code, function(s). Is there any way to write a hook in the described scenario?


Language of errors in WordPress admin

How can I change the Wordpress error message language? The language of my WordPress installation is set to Russian. The entire site and the admin panels are in Russian, but the error messages (bad login, etc.) are in English. How can I make sure the error messages are translated as well?


CPT unsaved draft gives error 404 - when Post Formats support enabled

I've a plugin for Portfolio CPT (can be downloaded from here: http://bit.ly/1tEj5bC), using this plugin, every thing works fine. But when i edit any portfolio entry and click on 'Preview Changes' BEFORE saving the edited entry, instead of showing edited content, it gives me error 404. The url which gives 404 error is something like this ...               http://www.example.com/portfolio/post-name/?preview=true&preview_id=192&preview_nonce=2d14ae4815&post_format=gallery      Now, if i remove `post_format=gallery` parameter from this URL, it shows the portfolio post. So, If i remove post-format support in the plugin, it does not append this parameter when viewing the draft but i need this plugin to support post-formats. How to resolve the issue? **Update:** I've tested two more third party plugin for portfolio CPT, adding post formats support in those plugin also leads to same error. It means, most probably, there is nothing wrong with the plugin code. JFYI, post formats support is being added by passing following args through `register_post_type()` ...               'supports'          => array( 'title', 'editor', 'thumbnail', 'post-formats'),


How to display only one post on first category page and rest on next pages?

My question is as above. I am going to use a category template specific for this category and would like to show the first, if possible the sticky post for this category, post on the first page and 5 posts of the category on the next pages. I have searched a lot but didn't find a working example. Thanks in advance.


Load different template file when condition met?

If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy. If I'm doing some logic checking in the hook `init` and say my conditions are met, how do I tell WordPress to load a template file of my choosing, not the one WordPress would normally dish up?


Can taxonomies of custom post types be used with category actions?

I need to create a hook after the creation, edit and deletion of a taxonomy organizing a custom post type I have. I've noticed though that I can't use the following actions with those taxonomies:               add_action( 'create_category', 'some_function' );     add_action( 'delete_category', 'some_function' );     add_action( 'edit_category', 'some_function' );      It would be ideal if I could use these because I only really need the ID of the category to do the process I had in mind. Is there some argument I can pass in with register_taxonomy() that will allow those actions to be associated with taxonomies of custom post types? Or is there some way to simulate these hooks in another way? Any help is greatly appreciated.


Auto Filled Custom Menus for Custom Post Types?

Is there anyway to have custom menus that fill out automatically, specifically for custom post types? You can do it for default pages but nothing else it seems... For example you have a page which needs to list a range of projects in a navigation. You could do it with a query for that specific custom post type so all new posts are added automatically but what about the wp_menu class's that are added? So basically can you have a list navigation which populates automatically with the wp_menu classes e.g current-menu-item Because having to add them in the menu area in the admin is a bit clunky. This possible, or not yet?


Accessing Media/Files outside the_content

I'm building a site and each post has a PDF file attachment. Is there a way I can access that file outside `the_content()` on a single post page? I'd like to put the file attachment in a sidebar and not in the body of the post.


Save page data to an xml file

Is it possible to continually update an xml file on the server with data from a wordpress page? If so, how could I do it? I use this plugin http://plugins.elliotcondon.com/advanced-custom-fields/ to create the custom data. Would I be able to save this to an xml file? It's important that this xml file is updated every time a new page is created or edited.


Mediaelement.js feature doesn't work

I am trying to add new feature to mediaelement.js. Here's one example http://mediaelementjs.com/examples/?name=loop Another example which I am trying to implement now is this- http://stackoverflow.com/questions/17276590/media-element-js-remaining-time- in-video All of these works pretty well when I try to add it in html file. But inside wordpress, these scripts doesn't seem to have any effect. I have added the script via wp_enqueue_scripts hook. What's more if I try to add features, the video player break down. Here's my code:               define( 'SP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );     Class test_me{         function __construct()         {                                add_action('wp_enqueue_scripts', array(&$this, 'script_enquer') );         }              function script_enquer()         {              wp_register_script('time_left', SP_PLUGIN_URL . 'js/time-left.js', array('jquery', 'mediaelement', 'wp-mediaelement'), '1.0' );              wp_enqueue_script( 'time_left' );              wp_register_script( 'add_feature', SP_PLUGIN_URL . 'js/add_feature.js', false, '1.0', true);              wp_enqueue_script( 'add_feature');         }     }     $test = new test_me();      Here's the content of `time-left.js`               (function ($) {     // loop toggle     MediaElementPlayer.prototype.buildtimeleft = function (player, controls, layers, media){         var t = this;              $('
' +             '-' + // use − for a wider sign             (t.options.duration > 0 ?                 mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :                 ((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount ? '00:00:00' : '00:00'))                 ) +             '' +             '
')             // append it to the toolbar             .appendTo(controls);              //attach element we want to update to t (this) for easier access         t.timeLeft = t.controls.find('.mejs-timeLeft');              // add a timeupdate event         media.addEventListener('timeupdate', function () {             if (t.timeLeft && t.media.duration) {                 //replace with whatever time you want to insert here                 t.timeLeft.html('-' + mejs.Utility.secondsToTimeCode(t.media.duration - t.media.currentTime, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));             }         }, false);     }     })(jQuery);      `add_feature.js`               $('video').mediaelementplayer({         features['playpause','progress','current','duration','timeleft','tracks','volume','fullscren']     });      But the video isn't even shown now. Adding features seems to break the player. I have also tried de-regestering mediaelement and enqueue it manually. But the same result. I just can't figure out the problem.


Exclude some categories from the post page

I have created a page called "videos", this is set as the post page where all post should show up. That´s fine, but I want to exclude all posts from two of the sites categories. I tried this code, but it´s not working it´s the right page id and the right category id´s.                   function exclude_category($query) {         if(is_page(41)){         $query->set('cat', '-42, -43');         }         return $query;         }         add_filter('pre_get_posts', 'exclude_category');


Wordpress daily cron is executing more frequently than once a day

I have a wp cron job scheduled based on what's in the options. In this case its schedule daily.               add_action('init', function(){       if( !wp_next_scheduled('product_posting_cron') ){         wp_schedule_event(time() + 700, 'timely', 'product_posting_cron' );       }     });               add_filter( 'cron_schedules', function( $schedules ) {       global $frequency;       $interval = $frequency['interval']; //daily       $display = $frequency['display'];            $schedules['timely'] = array(        'interval' => $interval,        'display' => $display       );     });      ![enter image description here](http://i.stack.imgur.com/LQRMS.png) But I don't know why its executing more than once a day depending on the number of times I access a page in the site. Did I miss something here?


What languages were used to build Wordpress?

Which programming languages were used to create WordPress?


Change from blogger to wordpress

I would like to change my blog platform from blogger to wordpress. My website is: http://www.hdpeak.net I would like to keep a similar template and all the posts. What are the necessary steps I need to take? Please be specific since I do not want to lose any content of my site. Thank you very much!


Wanted to collapse all the widgets in sidebar by default via jQuery

I already applied jQuery on footer to Slide them up but i noticed that when the page is completely loaded the widget slides up properly but dont know how this again slides down automatically. I m not getting what is the problem. Check left sidebar which contain Gender, Item condition etc Here Any help would be appreciated. Thanks


Only Show an Author Their Custom Post Types

I have a site with 3 different custom post types (Listings, Contacts, Events) and about 1600 'authors'. What I"m looking to do is only show that author their posts in the backend. So when authorA logs in, and clicks on 'Listings' then they only see their own. I have this code running in Functions.php to control the first post type, but am not sure how to control the other two. The issue i'm seeing is that when authorA clicks on 'Events', their post that is in 'Listings' show up.                   function __set_all_posts_for_author( &$query )     {         if ( $query->is_author )             $query->set( 'post_type', 'listings' );         remove_action( 'pre_get_posts', '__set_all_posts_for_author' ); // run once!     }     add_action( 'pre_get_posts', '__set_all_posts_for_author' );      So, i think i just need to change 'listings' to all three post types show up but i'm not sure how.... Any thoughts?


after moving images to subdomain... they've disappeared!

I've tried to fix this up, but no good results. I've created a subdomain images.mydomain.com to store images. After that, used the original path plugin to define path(images) and full url(images.mydomain.com) in Media settings, for future uploads. copied /public_html/wp-content/uploads folder to /public_html/images/ after that, used the search and replace plugin... (and this is where it didn't go well, i believe) i've replaced all http://mydomain.com/wp-content/uploads/ with http://images.mydomain.com/ After that... went to media library... and there are no images. findout-macau.com Pleaseee help.


Front page should display only one category of posts including sticky post with custom featured post box

I need code to get one category - including its sticky post and a custom featured post box on my front page. I am using twenty twelve. I have created a child theme. I have wordpress 3.6 on a wordpress.org site. I selected "your latest posts" under Static Page in the theme customize tab for my front page. I want posts from only one category (vacation) to appear on my front page. I want them to include the sticky post in that category along with my custom featured post box. Getting the featured post box is important. I changed the style.css - in my child theme - to modify the appearance of the featured post box:               /*  change Featured Post box appearance */     article.sticky .featured-post {         border-top: 4px double #4275b1;         border-bottom: 4px double #4275b1;         color: #08b8c3;         font-size: 13px;         font-size: 1.25rem;         line-height: 3.692307692;         margin-bottom: 24px;         margin-bottom: 1.714285714rem;         text-align: center;     }      Then I changed the wording that appears in the featured post box in my (child theme) content.php. The combination of these two files with my "latest posts" selection and the standard index.php makes the front page look the way I want design wise...but I only want one category of posts (vacation) to appear on the front page **and** I want the sticky post in that category to display the featured post box. I get the sticky post (with the box) plus all other posts (from every category) when I use the standard index.php file. So I tested (changing the index.php) and was able to show both posts from the vacation category. And none from other categories. However, although the sticky post (from the "vacation" category) shows, I lost the "featured post box" part. (The "vacation" category is the only category where I have a sticky post.) So I think that instead of using just a category, I need to somehow incorporate the "is sticky" part to get the featured post box to show. Can anyone help me with 1. what code to modify and 2. in what template I can do this? I have been searching and testing for 3 days. So I stopped and I just put the original index code which populates the front page with the right sticky and featured post box but multiple categories. Thank you for any assistance or suggestions- hopefully at a level for someone who is just technical enough to be dangerous :) I think that this post may have part of the answer I need, but I just want one category of post(s)on the front page - including the one I set as sticky which should show up with the featured post box.


How to disable plupload completely from latest wordpress 3.6 and make browser upload default

How can I disable plupload completely from latest wordpress 3.6 and make browser upload default? Thanks in advance.


is_archive() content being shown instead of is_category()

## My Issue: If I browse to `http://mysite/category/mycategory`, the `if (is_category())` content isn't displayed, **the`if(is_archive())` is shown instead.** ## My code: `archive.php`:               <?php include('includes/resultlist.php')?>      `search.php`:               <?php include('includes/resultlist.php')?>      `includes/resultlist.php`:               <?php get_header(); ?>
          <?php if (is_archive()) { ?>
Artigos publicados em <?php single_month_title(' '); ?>
          <?php } else if (is_search()) { ?>
Resultados para "<?php the_search_query(); ?>"
          <?php } else if (is_category()) { ?>
Resultados para categoria "<?php the_category(); ?>"
          <?php }          if ( have_posts() ) while (have_posts()) { the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     por <?php the_author(); ?> em                      <?php the_date(); ?>
<?php echo get_the_excerpt(); ?> <a href="<?php the_permalink(); ?>">Leia mais
                       <?php }           else {?>
Nada encontrado

Desculpe, não encontramos o que você procurava!
          <?php }          include('pagination.php');          ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>      ## What I tried: Created a `category.php` file with the contents: `<?php include('includes/resultlist.php')?>` but the issue persits. I included some garbage text on the end of category.php and it shows on the end of the rendered page, so the file is being called, I suppose. ## My environment: LAMP Ubuntu 64 bit with apache, mysql and php installed with default options via apt-get.


How to keep Wordpress from re-formatting my code posts?

![enter image description here](http://i.stack.imgur.com/eVznI.png) As you can see from the image above, it's changing               '{print $5}'      to               '{print $&;5}'      I tried the following article about "stop changing my quotes" And then even installed the "Advanced Settings" Wordpress plugin and disabled all the texturize filters but no change.


If no featured image, add one of the default images into DB

I'm trying to set multiple images (image A,B and C) from one folder (folder X) at random into the database as a default featured image when there's none one set. So on the main page I have all posts with different featured images from folder X. After clicking on read later the featured image needs to be the same as the main page. So, when posting something it needs to get one of the images from folder X as featured image if none was added.. Does anyone know how to get this working? I'm a newb PHP person myself (don't shoot the designer)..


How to add nofollow on all external links without plugin?

I have tried many plugins, which are doing the thing I want, but they are blocking my other plugins (1 in particular, which is indispensable for my site). Anyhow; how can I add a nofollow on all my outgoing anchors? Can someone help me out please?


Function to wrap the_content in a div

Whenever I've developing a new theme I always wrap `the_content` in a div, like so;               <div class="entry-content">         <?php the_content();?>     </div>      Is there a way I can streamline this process and automatically wrap `the_content` in a div via a function so I don't always have to manually code it and, more importantly, so if my client ever feels like flexing their coding muscles there wont be a problem if they forget to do it...


Different layout based on post amount?

Is it possible to change the layout of the query posts depending on how many there are? So simple query page listing posts... Up to 4 posts show them in a list. If there are 4 posts and over show them as float blocks for example.


How to use Facebox in WordPress theme?

I am trying to add Facebox (a lightbox type image viewer) to my WordPress theme at but presently the images are not loading. I have tried hard coding this and also using the Facebox WP Gallery plugin with no success with either method yet. I currently have it hard coded using this code in `header.php` and on my custom home page template (I put the facebox files in `facebox1.3` folder in my WP theme folder).               <link href="<?php bloginfo('stylesheet_url'); ?>facebox1.3/src/facebox.css" media="screen" rel="stylesheet" type="text/css" />     <link href="<?php bloginfo('stylesheet_url'); ?>facebox1.3/css/example.css" media="screen" rel="stylesheet" type="text/css" />     <script src="<?php bloginfo('template_directory'); ?>/facebox1.3/lib/jquery.js" type="text/javascript"></script>     <script src="<?php bloginfo('template_directory'); ?>/facebox1.3/src/facebox.js" type="text/javascript"></script>     <script type="text/javascript">         jQuery(document).ready(function($) {             $('a[rel*=facebox]').facebox({                 loadingImage : 'facebox1.3/src/loading.gif',                 closeImage   : 'facebox1.3/src/closelabel.png'             })         })     </script>      At the moment with this even the loading gif does not display. What am I doing wrong?


How to get permalinks with category base working with sub-categories

I ran into an issue with a site that needs the category base also included in the custom permalink structure. I know this is an issue and I have read many posts like this that gave me some insight... I need to get the permalinks to work like this:               http://www.new1450.dev/industries/ {Main blog post only showing category selection}     http://www.new1450.dev/industries/development/ {a parent category}     http://www.new1450.dev/industries/development/parent-category-i/ {child of parent}     http://www.new1450.dev/industries/development/parent-category-i/child-category-i/ {child of child}     http://www.new1450.dev/industries/development/parent-category-i/child-category-i/some-cool-post/ {actual post}      My permalink settings are: Custom Structure:               /industries/%category%/%postname%/      Category Base:               industries/.      This gets me working with:               http://www.new1450.dev/industries/ {Main blog post only showing category selection}     http://www.new1450.dev/industries/development/ {a parent category}     http://www.new1450.dev/industries/development/parent-category-i/child-category-i/some-cool-post/ {actual post}      So it appears it's just the child categories that pose a problem..               http://www.new1450.dev/industries/development/parent-category-i/ {child of parent}     http://www.new1450.dev/industries/development/parent-category-i/child-category-i/ {child of child}      I am able to get the category ID by intercepting the 404 but I cannot see how to load the categories page with the proper category ID. _So my question is:_ Is there a way to load the categories page by calling some internal command or will I have to write my own way of loading the categories page? I was hoping that I could use a WP function as this would be ideal. if this is the latter, is there anything special I need to be aware of? I do know I have to set: `status_header(200);` but wanted to know if there are any other headers or important steps that need to be taken. Also, a redirect will not work for my purpose. I need to load the categories page with the new ID. If it helps, the hook I am using in WP to catch the 404 is: `template_redirect` Thanks for any information you can provide on this subject.


Distinguish profile user and admin user IDs / get ID of user being edited

On the user-profile page of my site I want to allow admin role users to be able to edit specific user-meta fields of subscriber role users. How can I distinguish between the two user IDs. The current logged in user is the admin user               get_current_user(); // returns the admin role user id      but I need to be able to access the subscriber ID to set the meta-data               update_user_meta($subscriber_user_id,"name","value");      How can i populate the `$subscriber_user_id` value correctly?


What's the point on gettext syntax?

So far I've been handling some translations in Wordpress and tried to read the official gettext documentation but won't get the point of one maybe simple thing: What's the differences between those startings like __(, _e(, etc.? And even more: which others are there beside? Thanks in advance! Frank


Date comparison : which date format?

I have a CPT for events. I need to display future events for people to register, while hiding past events. What is the easiest date format for both (1) entering date when creating new event and (2) comparing event dates with current date ?


Display Latest Post from all Categories

I am trying to loop all the latest post from all the categories but it is displaying only a post from single category. Below is the code that I am using.               <?php while (have_posts()) : the_post(); ?>     <li <?php post_class() ?> id="post-<?php the_ID(); ?>">         <a class="wpn_title" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
             <?php echo get_avatar( get_the_author_email(), '40' ); ?>             by <?php the_author_posts_link() ?>
             Posted <?php the_time('F jS, Y \a\t g:i a') ?>

             <?php wpn_content_limit(get_the_content(),500); ?>

             <a class="wpn_comments" href="<?php the_permalink() ?>#comments"><?php comments_number(__('0'), __('1'), __('%')); ?> Comments             <a class="wpn_continue" href="<?php the_permalink() ?>">Continue Reading

     <?php endwhile; ?>      PS: It looks like the issue is caused by the following code which I have placed on top of index.php. Is there something I missed?
                         <?php query_posts('r_sortby=highest_rated&r_orderby=DESC&showposts=4&cat=9') ?>                             <?php while (have_posts()) : the_post(); ?>
                                     <?php $key="ratings_users"; echo get_post_meta($post->ID, $key, true); ?>                                     <a class="img" href="<?php echo get_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'top-score-thumb' ); } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_titlesmall('', '...', true, '20') ?>

                         <?php endwhile; ?>


wordpress custom post type remove duplicate menu item

I've registered a new content type with following -               register_post_type('news', array(         'labels' => array(             'name' => __( 'News'),             'singular_name' => __( 'News'),                  'add_new' => _x( 'Add New News', 'News'),             'add_new_item' => __( 'Add New News'),             'edit_item' => __( 'Edit News'),             'new_item' => __( 'New News'),             'view_item' => __( 'View News Details'),             'search_items' => __('Search News')                    ),         'public' => true,         'show_ui' => true,         'menu_position' => 6,         'has_archive' => false,         'rewrite' => array('slug'=>'news'),         'supports' => array('title', 'editor' ),         'taxonomies' => array('category'),         'menu_icon' => plugins_url('icons/news.png', __FILE__),         )     );      This does generate admin menu item as follows -- ![enter image description here](http://i.stack.imgur.com/b1xpW.png) or ![enter image description here](http://i.stack.imgur.com/Po6xw.png) Is it possbile to remove repeated link for menu item **News** that comes on `hover` of main menu item. Because, the main menu item **News** ( in bold letter ) takes admin to same page as sub-menu item news does. In short- i want to have only two options as sub menus .. those are _Add New News_ and _Categories_. Is this possbile ?? I tried using following--               add_action('admin_menu', 'remove_news_subitem');     function remove_news_subitem() {         global $submenu;         unset($submenu['edit.php?post_type=news']);     }      But this removes all submenus. I believe no such _hook_ is present to do this. And only option I could imagine is to edit core files. But that I **strongly** don't want to do. Possible way to do this using jQuery when menu items render on domReady. But this is ugly. Can it be done from php itself??


Remove custom posts that match taxonomy value

I have a custom post type 'listings' and within that a taxonomy called 'status' where the posts are either 'standard' or 'premium'. What SQL query (or other method), could I use to delete all custom posts where the taxonomy 'status' has the value 'standard' ? Thank you.


Changed Wordress Address URL Accidently

Accidently, I have changed my wordpress address url from my dashboard. Now I am not able to sign in to get it changed. This is where I have installed wordpress - http://www.abc.com/folder, but accidently, I changed the wordpress address URL to http://www.abc.com Please help me...


Wordpress Membership Login not working

I recently tried to set up a membership plugin to my self hosted wordpress site. Problem is, that when I try to login with a test user account it simple doesn't work (of course the login input was correct). I just see the "loading" icon in the middle and it never stops. I'm pretty sure that the problem comes NOT from the plugin, because I had the same issue with the function already integrated in wordpress (password-safe site/article): After trying to login there just happened nothing (no "loading" icon, just the same login page). Maybe it has something to do with the .htaccess file(s) in the host directory (just guessing, no clue how it works exactly)? If relevant I can tell you more about it. I just have a little techy background ("advanced amateur"), so maybe you can help me: Where can this problem come from and how do I fix it? What you also should know: When I go to the admin-login page from wordpress it all works finde with the test user login data! So just the implemented "login forms" on the page don't work.


How to have syntax highlighting in wordpress.com blogs?

Is there a way I could install some plugin or have syntax highlighting for my wordpress.com blog or do I need to install WP on my own server to be able to install a plugin to do that?


wp_nav_menu not displaying the right way

I'm creating a theme using bootstrap and now I want to display the menu adapting it to bootstrap... so I'm using the Upbootwp_Walker_Nav_Menu to achieve this, and also sending some args to the wp_nav_menu but the result is not what I expected. This is the method which I'm calling on header.php               <?php wp_nav_menu(array( 'theme_location' => 'primary',                                                 'container' => 'nav',                                                 'container_class' => 'collapse navbar-collapse bs-navbar-collapse',                                                 'items_wrap'=>'
%3$s
',                                                 'walker' => new Upbootwp_Walker_Nav_Menu()                                         )); ?>      also I had to add a method to the filter on the functions.php               add_filter('wp_nav_menu_args','specialist_nav_menu_args');          function specialist_nav_menu_args($args){         if($args['theme_location']=='primary'){             $args['container'] = 'nav';             $args['container_class'] = 'collapse navbar-collapse bs-navbar-collapse';             $args['items_wrap'] = '
%3$s
';             $args['container_id'] = 'menu_primary';         }         return $args;     }      I was supposed after adding this changes, the menu will display correctly but if I see the html generated... this is what I see:

              Home

              Sample Page

      So first: as I declare thar the container will be a `<nav>`, then that will have the class `collapse navbar-collapse`. So what am I doing wrong? I've read the documentation of this method here but it seems like not recognizing the parameters I am sending


exclude page element from specific pages

I'm using a specific navigation menu that should be present on all but two pages. How can I exclude `<div class="portfolio-nav">` from the specified pages(About & Contact)?               <?php get_header();?>

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

                     <?php previous_posts_link(); ?>

                     <?php next_posts_link(); ?>

                  <?php endif; ?>

COLLECTIONS

          <?php get_footer();?>      ETA - live site


Parse error syntax error unexpected t_string

I'm getting the following error: > PHP Syntax Check: Parse error: syntax error, unexpected 'qtip' (T_STRING), > expecting ')' in your code on line 14 in this code:               <?php     // Always use wp_enqueue_scripts action hook to both enqueue and register scripts     add_action( 'wp_enqueue_scripts', 'enqueue_and_register_qtip_scripts_and_style' );          function enqueue_and_register_qtip_scripts_and_style(){              // Use `get_stylesheet_directoy_uri() if your script is inside your theme or child theme.         wp_register_style( 'qtip', get_stylesheet_directory_uri() . '/qtip-js/jquery.qtip.min.css', 'all' );         wp_register_script( 'imagesloaded', get_stylesheet_directory_uri() . '/qtip-js/imagesloaded.pkg.min.js', true );             wp_register_script( 'qtip', get_stylesheet_directory_uri() . '/qtip-js/jquery.qtip.min.js', array('jquery', 'imagesloaded'), false, true );         wp_register_script( 'tooltip', get_stylesheet_directory_uri() . '/qtip-js/tooltip.js', array('jquery', 'imagesloaded', 'jquery-qtip-min), false, true );          // Add the styles first, in the <head> (last parameter false, true = bottom of page!)        wp_enqueue_style( 'qtip', null, false, false );          // Using imagesLoaded? Do this.     wp_enqueue_script( 'imagesloaded', null, false, true );     wp_enqueue_script( 'qtip', false, true );     wp_enqueue_script( 'tooltip', false, true );     }     ?>      The 14 line says: `wp_enqueue_style( 'qtip', null, false, false );` Your help is much appreciated.


Network wide post count (WP Multisite)

I'm trying to show the total amount of posts of my WordPress Multisite. For that I'm using the following code, which worked at the beginning. So I guess that there's something wrong with the `set_site_transient` which should cache the output for a time. Maybe someone has an idea what my mistake is. I can't find the solution. Cheers and thanks a lot!                   function posts_count_func( $args ){              global $wpdb;         $blogs = $wpdb->get_results( $wpdb->prepare(                 "SELECT * FROM {$wpdb->blogs} WHERE  spam = '0'                  AND deleted = '0' AND archived = '0'                  ORDER BY registered DESC, 2", ARRAY_A ) );              $original_blog_id = get_current_blog_id();               $args = array(             'numberposts'     => -1,             'post_type'       => 'post',             'post_status'     => 'publish' );         $total_network = $draft_network = 0;         $total_sites = 0;              foreach ($blogs as $blog)         {             wp_cache_flush();             switch_to_blog( $blog->blog_id );             $args['post_status'] = 'publish';             if (count(get_posts($args))<2) { continue; }             $total_posts = count( get_posts( $args ) );             $total_network += $total_posts;             $total_sites += 1;                  $args['post_status'] = 'draft';                  }                  set_site_transient ( 'total_posts_cache', $total_network, 24 * HOUR_IN_SECONDS );                     switch_to_blog( $original_blog_id );     }          function posts_shortcode_count_func( $atts ){      return get_site_transient( 'total_posts_cache' );     }     add_shortcode( 'posts', 'posts_shortcode_count_func' );


Unable to get Preview of Uploaded image within a Custom Meta box

I first followed the steps in this tutorial. Added the Image Uploader, tried it out but I realized it's an older version of the WP Uploader... So I then found this post, and now my uploader is updated. The issue, is that I can't get the preview image working... First off this is the Image section for the Meta Box details//               case 'image':     $image = get_template_directory_uri().'/images/image.png';       echo ''.$image.'';      if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; }           echo '     <input id="upload_image" name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />                  <input id="upload_image_button" class="custom_upload_image_button button" type="button" value="Upload Image"  /]            Remove Image      ';          break;        This is the code used for the uploader//               jQuery(document).ready(function($){         var custom_uploader;         $('#upload_image_button').click(function(e) {             e.preventDefault();             //If the uploader object has already been created, reopen the dialog             if (custom_uploader) {                 custom_uploader.open();                 return;             }                  //Extend the wp.media object             custom_uploader = wp.media.frames.file_frame = wp.media({                 title: 'Choose Image',                 button: {                     text: 'Choose Image'                 },                 multiple: false             });                  //When a file is selected, grab the URL and set it as the text field's value             custom_uploader.on('select', function() {                 attachment = custom_uploader.state().get('selection').first().toJSON();                 $('#upload_image').val(attachment.url);             });                  //Open the uploader dialog             custom_uploader.open();              });             jQuery('.custom_clear_image_button').click(function() {               var defaultImage = jQuery(this).parent().siblings('.custom_default_image').text();               jQuery(this).parent().siblings('.custom_upload_image').val('');               jQuery(this).parent().siblings('.custom_preview_image').attr('src', defaultImage);               return false;           });            }); My attempt to add the preview was using these lines for JS//                    preview = jQuery(this).siblings('.custom_preview_image');               window.send_to_editor = function(html) {                   imgurl = jQuery('img',html).attr('src');                   classes = jQuery('img', html).attr('class');                   id = classes.replace(/(.*?)wp-image-/, '');                   formfield.val(id);                   preview.attr('src', imgurl);                   tb_remove();               }               return false;  So my question would be, how can I get a preview working for my Image Uploader inside of a Custom Meta Box? All help appreciated, Thanks.


How to make 3 boxes like this screenshot has?

I am trying to create the 3 boxes that appear right below navigation and the email sign-up form. Is there a plugin to create something like that? Or what is a possible way to accomplish this sort of thing? ![enter image description here](http://i.stack.imgur.com/38snZ.jpg) Here is what I tried to do for posting the meta box, but it didn't show up. ![enter image description here](http://i.stack.imgur.com/JEF3C.png) Also there is a calendar widget. But that isn't showing up either. Would you know why?


Why is there a status message "302 Found" on top of the site?

I'm confused about current state of my website. Whole website is working fine but on the top of the site it shows a weird message. Please see the image below: ![enter image description here](http://i.stack.imgur.com/pUjJ0.png) Why this message shows up? Is my site has been hacked or is this a virus? My wordpress version is 3.9. Please help.


Custom metabox not displaying multiselect data in edit mode

I have a custom metabox in a custom post type that records system outages across the campus that I work at. One of the fields in the metabox is a multiselect box listing all the buildings on campus. When I save the post, I am able to retrieve the array of buildings on the front-end. However, if I go back to edit the post, the multiselect does not highlight the list of buildings that were previously selected. Therefore, if I update the post, I have to remember to also re-highlight the buildings that are affected by the outage. All other (non-array) fields successfully retain their data. **Adding the custom MetaBox:**               function add_custom_meta_box() {         add_meta_box('system_outage','System Outage','show_system_outage','outage','normal','high');         }     add_action('add_meta_boxes', 'add_custom_meta_box');      **Create Field Array:**               $prefix = 'sysout_';     $outage_meta_fields = array(         array(             'label' => 'Buildings Affected',             'desc' => 'Select the buildings affected',             'id' => $prefix.'buildings',             'type' => 'multiselect',             'options' => array(                 'building1' => array(                     'label' => 'Building 1',                     'value' => 'building1'                 ),                 'building2' => array(                     'label' => 'Building 2',                     'value' => 'building2' //This continues for a while                 )             )         );     );      **The Callback:**               function show_system_outage() {         global $outage_meta_fields, $post;         echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';         echo '
';             foreach ($outage_meta_fields as $field) {                 $meta = get_post_meta($post->ID, $field['id'], true);                 echo '
';                     echo ''.$field['label'].'	';                     echo '';                         switch($field['type']) {                                  case 'multiselect':                                 echo '<select data-placeholder="Choose a building..." multiple="true" class="chosen" name="'.$field['id'].'[]" id="'.$field['id'].'">';                                 foreach ($field['options'] as $option) {                                     echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';                                 }                                 echo '</select>
'.$field['desc'].'';                             break;                              }                     echo '	';                 echo '
';             }         echo '
';     }      **And Then I Save the Data:**               function save_custom_meta($post_id) {         global $outage_meta_fields;              if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))             return $post_id;         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id))                 return $post_id;         }         elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($outage_meta_fields as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];             if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             }             elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }          }     add_action('save_post', 'save_custom_meta');      I hope I have formatted it so that it's vaguely readable. Any guidance on this would be gratefully received. Thanks!


wp_enqueuescript won't load in footer even with true value set?

Below is my code for enqueue my scripts and css. I am trying to get the JavaScripts to load in the footer of my site, but when I view source I see them loading in the header. I suppose the "true" value isn't working properly or I have sequenced the code incorrectly?               // Enque CSS and JavaScript     if (!is_admin()) {          // CSS Reset     wp_register_style( 'reset', get_template_directory_uri() . '/css/reset.css');     wp_enqueue_style( 'reset' );          // 960 GS     wp_register_style( 'grid', get_template_directory_uri() . '/css/960.css');     wp_enqueue_style( 'grid' );          // Style     wp_register_style( 'style', get_template_directory_uri() . '/style.css');     wp_enqueue_style( 'style' );          // jQuery     wp_deregister_script('jquery');     wp_register_script('jquery',("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"), true);     wp_enqueue_script('jquery');          // jQuery UI     wp_deregister_script('jquery-ui-core');     wp_register_script('jquery-ui-core',("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"), true);     wp_enqueue_script('jquery-ui-core');          // Easy Slider     wp_register_script('easy-slider',get_bloginfo('template_directory') . "/js/easySlider1.7.js", true);     wp_enqueue_script('easy-slider');          // Scripts     wp_register_script('myscript',get_bloginfo('template_directory') . "/js/scripts.js", true);     wp_enqueue_script('myscript');          // Facebook API     wp_register_script('facebook-loader',("http://static.ak.fbcdn.net/connect.php/js/FB.Loader"), true);     wp_enqueue_script('facebook-loader');     wp_register_script('facebook-sharer',("http://static.ak.fbcdn.net/connect.php/js/FB.Share"), true);     wp_enqueue_script('facebook-sharer');          // Twitter API     wp_register_script('twitter',("//platform.twitter.com/widgets.js"), true);     wp_enqueue_script('twitter');          }


Front end post or photo or both

I need a help in correcting my code that can front end post or attach image or post&attach image ;) Now I can send a 'post' and 'post with photo' **_but can't send just a photo_** , How can I do that? who can help in this please. Here is the code               <?php     if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'post') {          // Do some minor form validation to make sure there is content          if ($_POST['post_content'] != '') {         $post_content = $_POST['post_content'];          }  else {              wp_redirect(get_bloginfo('url') . '/');              exit ;     }          check_admin_referer('new-post');          $user_id = $current_user -> user_id;     $post_content = $_POST['post_content'];     $char_limit = 40;     $post_title = strip_tags($post_content);     if (strlen($post_title) > $char_limit) {         $post_title = substr($post_title, 0, $char_limit) . ' ... ';     }     $tags = $_POST['post_tags'];          //Cas as array     $terms = isset($_POST['category']) ? (array)$_POST['category'] : array();          //Cast array values as integers if $_POST['offer'] contains IDs     $terms = array_map('intval', $terms);          $post_id = wp_insert_post(array('post_author' => $user_id, 'post_title' => $post_title, 'post_content' => $post_content, 'post_category' => array($_POST['cat']), // Usable for custom taxonomies too     'tags_input' => array($tags), 'post_type' => $_POST['post_type'], // Use a custom post type if you want to,     'post_status' => 'publish', ));          if (!function_exists('wp_generate_attachment_metadata')) {         require_once (ABSPATH . "wp-admin" . '/includes/image.php');         require_once (ABSPATH . "wp-admin" . '/includes/file.php');         require_once (ABSPATH . "wp-admin" . '/includes/media.php');     }          if ($_FILES) {         foreach ($_FILES as $file => $array) {             if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                 return "upload error : " . $_FILES[$file]['error'];             }             $attach_id = media_handle_upload($file, $post_id);         }          }     if ($attach_id > 0) {         //and if you want to set that image as Post  then use:         update_post_meta($post_id, '_thumbnail_id', $attach_id);         echo "uploaded the new Thumbnail";          }          wp_redirect(get_bloginfo('url') . '/');          exit ;     }     ?>      And my html post form is               <form id="new_post" name="new_post" method="post" enctype="multipart/form-data" action="<?php bloginfo('url'); ?>" style="width:95%; margin:auto;">     <input type="hidden" name="action" value="post" >     <?php wp_nonce_field('new-post'); ?>     <div>         <input type="hidden" name="post_type" id="post_type"/>         <?php   wp_editor('', 'post_content', $settings = array('tinymce' => false, 'wpautop' => true, 'teeny' => true, 'media_buttons' => false, 'quicktags' => false, 'strip_tags' => false, 'textarea_name' => 'post_content',; ?>     </div>     <input type="file" name="attachment" id="attachment" style="display: none;" >


Bootstrap Modal as login page

I'm considering building a modal login page for my wordpress blog. I have a static link on my menu linking to custom /login page. Else, I have a redirect from private pages, where user needs to be logged in to proceed: `if ( !is_user_logged_in()) { wp_redirect( '/login/' ); }` Any ideas how I can build this modal to popup whenever a user is not logged? And if he refuses to log or register to be redirect to home page for example?


Get a list of all links on a page?

Is there someway to get a list of all links on a page, including links in theme files, header, footer, sidebar, posts, etc? It is possible to do this in JavaScript, but I'm hoping for a server-side solution.


Settings page above CPT page in admin section

I'm creating a plugin which generates a handfull or custom post types (CPT). I've create a top level menu in the admin left sidebar using `add_menu_page()`. I then added all CPTs to this menu using `register_post_type()`'s `show_in_menu` option. I also created a plugin settings page using `add_submenu_page()`, which I also added to the top menu. My problem is that I can't get the settings page to appear above the CPT pages in the submenu. I make the `register_post_type()` call in an "init" action, and I make the `add_submenu_page()` call in a "admin_menu" action (which happens after "init"). So, it makes sense that the CPT pages come first. I can't move the `register_post_type()` calls to later in the process (it's too late to register a CPT, and I can't move the `add_submenu_page()` earlier (it's not defined earlier). Do I just have to live with it?


Dynamically adjust single-posttype.php query, based on current taxonomies

I have a single-teamphoto.php template loading data from a Team Photo - Custom Post Type, showing team photos with team member names below, one photo at a time, with a navigation list of available years below, for choosing the year of the team photo. Above this navigation would be a selection for toggling between Men's or Women's photos, within that same sport. (This template will load after a search is performed for a player name.) Each of the CPT posts contain a photo, team member names, and taxonomies for both gender and sport. I'm storing those variables using:               <?php     $team_gender = strip_tags( get_the_term_list($post->ID, 'teamgender') );     $currentGender = $team_gender;     ?>     <?php     $term_sport = strip_tags( get_the_term_list($post->ID, 'teamsport') );     $currentSport = $term_sport;     ?>      The query I'm currently using for the navigation list of years at the bottom is:               <?php     $teamposts = get_posts('post_type=teamphoto&teamsport=' . $currentSport . '&teamgender=' . $currentGender . '&numberposts=-1&orderby=title&order=asc');     foreach($teamposts as $post) :     setup_postdata($post); ?>          <li<?php if ( $post->ID == $wp_query->post->ID ) { echo ' class="current"'; } else {} ?>>                                    <a href="<?php the_permalink() ?>"><?php the_field('team_year'); ?>
     <?php endforeach; ?>      **Men's / Women's Toggle** : I need to introduce the two buttons - to toggle between **Men's** and **Women's** team photos being displayed - still within the current sport being viewed. _(Altering the initial page query)._ which is currently the standard:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>      * * * I'm not sure how to best accomplish the toggle between Men's / Women's photos, while still remaining inside of the current sport? Would jQuery be a good option for loading an alternate query? My tabs for choosing men's vs women's is currently void right now:

      Any recommendations how to best accomplish this? Thank you, Jonathon


Custom Admin Pagination links

I am talking about the wordpress admin area where all the posts reside. I would like to ask if there is a way to show not only the first and the last pagination links but also the links in the middle.eg 1,2,3 .... 6,7 last page.. I am trying to manipulate `wp_list_table` class with no success.


Twenty Eleven theme- have custom landing page, change nav "home" link

Live site. I have a custom landing page on the Twenty Eleven theme. Currently, the "Home" nav link is set to the landing page, but I would like to change it to go to /home when clicked on. How do I do this? Thank you.


Display random posts from custom posty type

I am trying to display my posts in a random order and selection using the following code with no luck. Any ideas whats going wrong?                <?php $args = array( 'post_type' => 'publicity', 'posts_per_page' => 8, 'orderby' => 'rand');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();              echo '
';             echo ''.get_the_post_thumbnail( ).'';             echo '
 '.get_the_title().'
';         echo '
';          endwhile;?>


Admin user getting redirected to /wp-admin/user

I recently added a network to my multi-network wordpress install (that is, a single install with multiple subdomain networks, each with multiple subdirectory sites). Although everything appears normal on the new site from the front end and network admin view, any users I add to the site automatically get redirected to `/wp-admin/user` upon login. This shows only the WordPress news widget and the Profile menu. If I manually navigate back to `/wp-admin`, the full dashboard becomes available, but the redirect is unacceptably inconvenient and hard to diagnose. A few details that are unique and likely relevant:   * When creating the new subdomain, I first created a blog on an existing network, then manually went in and modified `wp_sites` and `wp_blogs` to promote it to its own subdomain   * I recently upgraded to 3.9.2   * This only affects the new subdomain. All existing sites and networks are fine (ruling out plugin conflicts or a botched upgrade in my eyes) I am relatively certain this problem is probably just one or two database rows away from a fix, but laboriously comparing the values of `wp_sitemeta` and `wp_*_options` for a working network to this one reveals nothing different.


Querying multiple values from a single key

Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the **same key** the query fails. Is there a way to use an array in the value?Something similar to.               'value' => array( 'Install Manual', 'User Manual' ),      I've searched quite a bit with no results. This is where I'm at so far.               $documents = array(         'post_type' => 'documents',         'meta_query' => array(         'relation' => 'AND',             array(                 'key' => 'document-type',                 'value' => array( 'Install Manual', 'User Manual' ),             ),            array(                 'key' => 'document-status',                 'value' => 'current',             )         )     );     query_posts( $documents );     get_template_part( 'loop', 'documents' );     wp_reset_query();


Unable to browser posts in categories

Hoping someone can help with this. Clicking on a category either returns a "not found" error, or opens a random post in the category. Verified that the issue is independent of a plugin or theme. Have also messed with .htaccess to no avail. Only works if I use the default permalink structure, which I do not want. See these links to see the problem firsthand: http://www.linuxbsdos.com/category/tutorialstips/ http://linuxbsdos.com/category/mandriva/ TIA


How to make open/closed and hidden/shown metaboxes status saved on a per-post basis?

My real problem is a bit complex, so I'll try here to abstract it and keep it simple. I'm working on a custom app based on WordPress. I registered a custom post type, let's call it "people" where I store information about... people. The CPT supports only post title and post content default fields, but there are some metaboxes to store person informations (think my app as an address book). So there is a metabox to store personal info, one to store social networks info, another to store work-related info, i.e. if that person is to me a customer, a supplier, if we have credits or debits... I simplified here, but there are a consistent amount of metaboxes, let's say 12. My problem is that, some people for which I want to store info are just random contacts, and I want to store only personal info, other are friends and I want to store personal info and social networks info, other are customers or suppliers and I want to store work-related info. If when editing a post I hide (via screen option menu) or close any metabox I don't need, when I open another post where I need them I have to show or open them again. That **because metaboxes position/status/order are saved on per- user basis as user metadata**. If you imagine in some posts I need 2 metaboxes, in some 10 and in some 5, you understand that's annoying because keeping all them shown/open make the edit screen low accessible (scrollbar seems endless), and sometimes the info I look for is at the end of the page after a bunch of metaboxes with no info... **Question:** Is possible to save metaboxes position/status/order on a per-post basis for a specific post type? * * * _PS: I know some js/jQuery can solve the issue, but if possible I would avoid javascript solutions._


Querying posts by latitude and longitude to build a Google Maps with several markers

I have 4 different post types and 4 differey taxonomies Each term for each taxonomy stores a marker (url to a png icon). Each post has coordinates attached with Advanced Custom Fields and I'll probably use Geo Data Store to optimise scalability.   * a) how would you ideally query for the posts which fall under a specified km radius by lat and lng with Wordpress? I'd like to avoid, if possible, direct db queries.    * b) I'm going to store coordinates in a different table with Geo Data Store. But how about markers? Is it a good idea to store the icon/marker url of each term in a meta field for these terms?   * c) in general, what do you think would be the best practice to approach the project outlined above? I'd like to avoid to use further plugins (except for ACF) Thanks in advance for all your advices.


**Can't get options with $data['variable'].** _(I'm use SMOF - Slightly Modded Options Framework)_ For example in the header.php (index.php, footer.php, etc.):               global $data;     $logo_type = stripslashes( $data['type_logo'] );      and nothing happens, variable `$logo_type` contains nothing. But if I use the same code in the \css\styles.php - all works fine. Code from \css\styles.php:               <?php           /* Background Body */      $bg_color = stripslashes ( $data['ct_bg_color'] );          ?>          /* Body BG Color */      body, .body-class { background-color: <?php echo $bg_color; ?>      }      Function as part of framework :               /*-----------------------------------------------------------------------------------*/     /* Generate a static css file from the defined options     /*-----------------------------------------------------------------------------------*/     // This function will generate a static css file which you can use in your theme.     // Some examples of the dynamically generated options has been defined in css/styles.php     function generate_options_css($newdata) {              $data = $newdata;            $css_dir = get_stylesheet_directory() . '/css/'; // Shorten code, save 1 call         ob_start(); // Capture all output (output buffering)              require($css_dir . 'styles.php'); // Generate CSS              $css = ob_get_clean(); // Get generated CSS (output buffering)         file_put_contents($css_dir . 'options.css', $css, LOCK_EX); // Save it          }      Link to Framework files: https://github.com/sy4mil/Options- Framework/tree/master/admin/functions First encountered this problem... And can not understand what could be the problem (php, web hosting, etc.) Anyone else encountered this problem?


Customize Wordpress Media Upload and New Media Manager Menu in add post Metabox

I am using Wordpress Media Upload (< 3.5) and Media Manager (>=3.5) in metabox as an upload field, and need to customize the menu so that they only have upload and media library functionality without "From URL"/"Insert From URL" and "Create Gallery". So I need to remove them. I can't use Wordpress filter such as mentioned in this solution, since I am using it in metabox, which is exists in Wordpress new post page that already has "add media" functionality and will be broken if I use such filter. Is there any solutions via Javascript or any other methods? Thanks in advance.


Allow admin roles to add images to comment replies

this may be a step too far but I publish occasional tutorials on my personal blog and sometimes in comments get asked questions where an image would be very helpful to include as the answer. I've done a plug-in search and also looked for code but come up with nothing. Is there any way I can allow those with Admin role to upload an image as part of their reply to a comment? I don't want to allow readers to upload images really. Also I'm not really looking to add a link to an image in the reply, I'd ideally like it in the comment reply itself. Just a 'too difficult' or 'can't be done' response would put me out of my misery :-)


wp enqueue inline script due to dependancies

Is there a way to use wp_enqueue_script() for inline scripts? I'm doing this because my inline script depends on another script and i would like the flexibility of inserting it after it's loaded. Also, It's an inline script because i'm passing php variables into the javascript (like theme path, etc) Thanks in advance.


Is there a way to check which template file is being loaded, if it is not a page template file?

I don't see any way of testing which template file is being loaded, if the template file is not a page template. Otherwise I would use is_page_template(). For instance, I am using a home.php template file to pull in the content from multiple pages(don't ask), how would I check that home.php is the template file being used when viewing the sites root url?


change standrad postformat metabox

i add meta box to my theme (wordpress admin) for video , image , gallery , chat but i cant add meta box for standard post when i create post format support standard then i see in admin standard post format is duplicated and when select standard 2 i see meta box is added i want to add meta xob please help me thank you ! ![enter image description here](http://i.stack.imgur.com/dqRRf.png)


user_can() not working for comment authors

I'm trying to do some capability checks on comment authors using the user_can() function, but for some reason it isn't working at all. I have a custom capability setup with the Role Manager plugin called "read_citizen". My check looks like this:               if(user_can($commentAuthor->user_id, 'read_citizen') {        //do stuff here     }      I have confirmed that the $commentAuthor object is set correctly. Ideas?


Can you host WordPress using Amazon Web Services such as EC2, RDS, EBS etc?

I've been looking into the feasibility of using something like Amazon Web Services for hosting WordPress sites. I was wondering if it was possible and if so what are people's experiences of having done so and what aspects of AWS did you use?


How much should I charge for creating a WordPress plugin?

How much should I charge for creating a custom WordPress plugin? (working as a freelancer)


Thesis -style Navigation

I am working on a theme where I would like users to be able to select pages to show in the theme options page much like Thesis. I've been Googling / reverse engineering Thesis for a couple hours but haven't found a great solution. I am wondering if anyone has done this or has seen a tutorial. ![alt text](http://i.stack.imgur.com/5Fu7o.png)


Disable dragging of meta boxes?

Anyone know how to disable this functionality so the meta boxes can't be repositioned?


Commentform input area issue

This is probably really simple, but I just can't figure it out. So I change the input form on my comment form php. The changed snipped looks like this: http://pastebin.com/3Mj1XHGJ Yet when somebody doesn't click on "Website" at all, still a "http://Website" link will be generated for some. Is there any way to make it so that there won't be any url display if they haven't inserted a website url at all? Right now only when I click on the "Website input" textarea and make the "Website" text actually disappear it works. (The following is just a side question and I'm also not sure if it's okay to ask this, so you might as well ignore this): I also wanted to insert little icons in front of the text (before Website, Mail etc.) I know how to do it (just as background image using the stylesheet), but I'm already using a background image and I was wondering if there's another way round as using two background images won't work. Probably I have to rewrite the comment.php a bit instead, but I don't think it's possible to insert a "img src" into the input command? My website is here. Thanks a lot in advance! :D


set a chosen image-file-input as a featured image from wp frontend

**SCENARIO** : I allow to create posts from front-end. The form also has four image upload fields. I use the code pasted below for image attachments and setting the post thumbnail.               //insert attachments         if ($_FILES) {         foreach ($_FILES as $file => $array) {             $newupload = insert_attachment($file,$pid);             }             }                 //attachment helper function         function insert_attachment($file_handler,$post_id,$setthumb='false') {         if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK){ return __return_false();              }              require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');                  $attach_id = media_handle_upload( $file_handler, $post_id );             //set post thumbnail             if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);             return $attach_id;                 }      The post-thumbnail/featured image that is set through this code is the **LAST** image that is uploaded. I tried a google search for "set post thumbnail from frontend wordpress" and grazed through a lot of articles but none came close to what I am asking here. Majority of threads I came across at SE in regards to front-end posting, either talks about setting the featured image or about multiple uploads. I have also checked all the suggested questions which were prompted, while I was writing this question just to make sure if it has been asked before.' If it matters, here is the html that is used in the form, pretty standard.               <input type="file" name="image-one" id="image-one"/>     <input type="file" name="image-two" id="image-two"/>     <input type="file" name="image-three" id="image-three"/>      **REQUEST** : It would be great if I could get a solution that helps to assign any chosen image-input-field as a featured-image but at this moment, at least what I need to set the **FIRST** image input to be set as a featured- image/post-thumbnail. Kindly suggest a solution. > Bottomline here is that I do not have an issue with setting post-thumbnail > but question is about having a choice to choose any of the uploaded images > as post-thumbnail or at least the first image, instead of the last image as > set by the current code. Footnote : I have just put here what came to my mind as necessary. If you want some more information, please let me know. Thanks in advance.


How to get_queried_object on multiple objects?

**My Setup** I have a custom post type "zap_apartments" with 2 custom taxonomies "zap_audience" & "zap_cities". I wrote some RewriteRules to access all "zap_apartments" for a "zap_audience" + "zap_cities" assigned. It is to filter the results with seo-friendly URLs: it makes a request like `my-url.de/holiday/cologne/` internally an url like `my- url.de/index.php?post_type=zap_apartments&zap_audience=holiday&zap_cities=cologne` **My Problem** When I try to access the taxonomy information on the custom archive page I only get 1 taxonomy returned:               print_r( get_queried_object() );      prints:               stdClass Object     (         [term_id] => 17         [name] => Cologne         [slug] => cologne         [term_group] => 0         [term_taxonomy_id] => 17         [taxonomy] => zap_cities         [description] =>          [parent] => 0         [count] => 2         [filter] => raw     )      Is there any way I can get the other assigned taxonomy "zap_audience" too? I already asked google, but couldn't find anything useful. I also tried to access any value by `$_GET['zap_audience']` but it's empty. Please help! Thank you!


How does printf( __( ) ); work?

Today I work through a theme to get a better understanding of WordPress and templating. I discovered this:               <?php      printf(          __('Designed by %s', 'Anyword'),          'Blub'     );      ?>      I know it shows "Designed by Blub" (Where Blub is linked) But what does the `__()` mean or why is there a string insert? What for is the Anyword? Can someone exactly explain this line for me?


Strange widget behavior

I've created widget by simple copying one of the default widgets class and modifying it.   The strange thing is in the widgets admin area, this widget is not shown. When I searched the page source code the widget was there but it had inline style `display:none;`.   The other weird thing is that the title filed is not shown either!   Here is my widget code:               /**      * Mood widget class      *     **/     class WP_Widget_Mood extends WP_Widget {              function __construct() {             $widget_ops = array('classname' => 'widget_mood', 'description' => __( "Mood widget") );             parent::__construct('mood', __('Mood'), $widget_ops);         }              function widget($args, $instance){             extract($args);             $title = apply_filters('widget_title', empty($instance['title']) ? 'Mood' : $instance['title'], $instance, $this->id_base );                   $user_id = get_current_user_id();                  $table_name = $wpdb->prefix . "mood";                  $get_same=$wpdb->get_row("SELECT * FROM $table_name where user_id='".$user_id."' order by id desc");             $get_mood_row = mysql_query("select * from wp_mood where user_id='".$user_id."' and mood='".$get_same->mood."'");             $pathredirect = get_bloginfo('url').'/m/'.$current_user->user_nicename.'/settings/mood/';             global $current_user;             $current_user = wp_get_current_user();                  ?>
<?php echo $title; ?>

Make

<a href="<?php echo $pathredirect;?>">Setting

                         <?php                             //echo "select * from wp_mood where user_id!='".$user_id."' and mood='".$get_same->mood."'";                             $res_mood = mysql_query("select * from wp_mood where user_id='".$user_id."' and mood='".$get_same->mood."'");                             $ii=0;                             while($result_mood = mysql_fetch_array($res_mood)){                                 $ii++;                                 $uuserid = $result_mood['user_id'];                                 $user_info = get_userdata($uuserid);                                 ?>
                                     <a href="<?php echo bloginfo('url');?>/m/<?php echo $current_user->user_nicename; ?>/profile">                                         <img title="<?php echo $result_mood['nikename'];?>" src="<?php echo bloginfo('url').'/wp-content/uploads/mood/'.$result_mood['image'];?>" /><?php echo $result_mood['nikename'];?>
                              <?php } ?>

             <?php         }              function form( $instance ) {             $instance = wp_parse_args( (array) $instance, array( 'title' => '') );             $title = $instance['title'];     ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
     <?php         }              function update( $new_instance, $old_instance ) {             $instance = $old_instance;             $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));             $instance['title'] = strip_tags($new_instance['title']);             return $instance;         }          }     function mytheme_register_widgets()         register_widget( 'WP_Widget_Mood' );     }          add_action( 'widgets_init', 'mytheme_register_widgets' );


Is it safe to use 'date_default_timezone_set' in plugin file?

I am using a sitemaps plugin which in very complex ways sets the timezone of `<lastmod>` (i.e. last modified time) for posts to GMT. Temporarily, until the plugin developer fixes it, I need to enforce a custom timezone _on the plugin_. The simple and straightforward way that I've found is to add something like `date_default_timezone_set( 'America/New_York');` right after the first `<?php` in the file responsible for outputting the sitemaps. It works, and it doesn't seem to affect timestamps displayed on the rest of the site. So, can I go with this? or is there a better solution?


get post by nav id

I am trying to get the post id by the navigation id to use in a loop. I made a new query to get posts. I am using multiple queries on a page because I need to. one of the queries gets page templates that have categories that you make a post to and it gets displayed by that template. My problem is that if I put in the query to get posts, then I end up with the data in the theme twice. So I want to make it so that only a post that has a navigation link will be displayed. It will still be able to link to the post but I only want the query to get a post that has a nav item. Every time I try, all I end up with is a bunch of this                bool(true)      The functions I have read about, some from this site aren't working the way I understand they should. I have taken code straight out of the codex and it comes up empty http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items                               $menu_name = 'primary';          if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {     $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );          $menu_items = wp_get_nav_menu_items($menu->term_id);     echo $menu_items->ID;      My attempts have returned nothing.


Trying to Display wp_nav_menu(); dynamically in WordPress?

I am trying to display / show WordPress Menu dynamically like this image ![enter image description here](http://i.stack.imgur.com/nP8sg.jpg) try this code. it shows result but not exactly what i want. i need exactly like image, in image i have Menu name ABOUT US and right below it has WHO WE ARE, i am stuck to call WHO WE ARE and also DROPDOWN help needed. THANKS               $defaults = array(         'theme_location'  => '',         'menu'            => '',         'container'       => 'div',         'container_class' => 'top-menu',         'container_id'    => '',         'menu_class'      => 'sf-menu sf-js-enabled',         'menu_id'         => '',         'echo'            => true,         'fallback_cb'     => 'wp_page_menu',         'before'          => '',         'after'           => '',         'link_before'     => '',         'link_after'      => '',         'items_wrap'      => '
%3$s
',         'depth'           => 0,         'walker'          => ''     );          wp_nav_menu( $defaults );          ?>      here is my HTML code

HomeMain Homepage

About UsWho We Are

Alternate Homepage

Full Width Page

Blog Single Page

ServicesWhat We do

Web Designing

HTML / CSS Coding

Designing

Graphics

SEO Marketing

 PortfolioOur Works

Websites

Logos

Prints

 BlogOur Community

Blog Single Page

 Contact UsLocation Info

      i need menus like image thanks.


Retrieve New user's ID

I'm trying to retrieve the user id of a new user as soon as they're created. I tried using the hook "user_register" but there appears to be no id in there...maybe it grabs the data before a userID is created? Anyway, if anyone could recommend a hook that would serve this purpose, I'd appreciated. Many thanks!


Sell one unique item with Woocommerce?

I would like to sell drawings and paintings using Woocommerce. Woocommerce is expecting that there are more copies of each product, but the problem is there is only one (1) of each drawing/painting. How can I create in Woocommerce a unique product? So after this product is sold, processed and completed it is shown as 'sold out'. Can this be solved with a piece of code? Or does anyone know about a plugin? I wasn’t able to find anything. Please help an artist!


How to change default image rename?

When i upload image with same name Wordpress automatically adds the number before the extension like `some_name1.jpg`. Is it possible to change this process that id also added a bottom line like `soma_name_1.jpg`


Filter EVERY category link with my plugin

Im writing a plugin to let users customize the colors of their category links. But in order to make this work, Ive gotta figure out a way to target all category links regardless of theme. So clearly I can't go after classes so I was thinking I could write a filter to het all category links. I was thinking this would work:               add_filter('category_link ','kjd_filter_category_links');     function kjd_filter_category_links($id){         die();     }      But it doenst look like the function is ever called. I just tried dropping that into my functions file as well but its not working there either.


Custom Post Conditional for Parent & Child Single.php?

Following on from previous question but needs to be more specific so thought a new topic would be best... Conditional tag for custom post parent and children on their corresponding single.php, currently i have the following..                   <?php if ( is_home() || is_page( 'overview' ) || is_page( 'about' )  ) : ?>             Home Page         <?php elseif ( 'artists' == get_post_type() ): ?>             artist parent                        <?php elseif ( $post->post_parent > 0 ): ?>           artist   child         <?php else : ?>          empty other pages etc             <?php endif; ?>      The issue being the parent shows up on all the single-artists.php pages. I need to specifically target the parent single and the child single, is it possible as i don’t think it is...? Thank you.


Target edit post content with plugin

I am writing a plugin that adds an extra metabox onto the edit post dashboard page. In this metabox is a button which when clicked will scan the content of the post to check for certain words and then display an icon in the metabox to indicate the result. I have the scanning routine itself doen bu how would I go about targeting the content to be scanned? I am aware that the content may not have even been saved yet either which could present further issues Can anyone help or have an example they can point me in the right direction of?


Including file or library from other plugin

I'm creating a plugin I would like to use from other different plugins. This plugin declares classes and functions. So, I am thinking about the best way to include, from one plugin, a php file present in _another_ plugin. I think this should work:               require_once WP_PLUGIN_DIR . "/the-other-plugin/required-file.php";      But I am not sure; is it a good solution? I think this would work even if `the-other-plugin` is not enabled, and probably that is not a good idea. This can be done also by using Must Use Plugins. Is this a best practice, or is the other solution better?


Transients API conditional

I have the following transient, but if the user changes the value of $url the transient should not be used. I want to know what is the most appropriate way to use this variable with the transient. Should I save the value of $url with Options API to compare it with the new value?               if ( false === ( $videos_result = get_transient( 'html' ) )){         //HTTP API         $videos_result = wp_remote_get( $url );              $response_code = wp_remote_retrieve_response_code( $videos_result );         $response_message = wp_remote_retrieve_response_message( $videos_result );         set_transient('html', $videos_result, HOUR_IN_SECONDS );     } else{         $response_code = 200;     }


How to save data of an input field to an array

I'm writing a plugin to edit my profile page. How can I save data of an input field to the database and then display it? This is my code. The first part is the display in HTML:               <form method ="POST">
             <input type='text' name='group[]' id='group[]' class="regular-text"                 value="<?php echo esc_attr( get_the_author_meta( 'group', $user->ID ) ); ?>" />                  <input type="button" class="button-primary" value="Add"                 onClick="addInput('dynamic_input_groups');">
     </form>      And the second part is the script for the button click and the input field:                     And the final part saves the data to the database:               update_usermeta( $user_id, 'group', $_POST['group'] );


The offset option breaks the pagination

I have a problem with a website of mine, I was hoping you can help me. I added the offset option to ignore the first couple of posts in the main loop. It does its job, but the navigation got broken. When navigating through older pages (2nd page, 3rd page etc), no matter what page I am on, I always get the first page posts. This is the code I edited:               <?php query_posts("cat=-27,-28&paged=$page&posts_per_page=10&offset=5"); ?>      Can you please let me know how to fix this? Thanks a lot!


How to disable 3.1 "Admin Bar" via script for the admin user?

Every time I create a new site under 3.1, my first trip is to the Users > Admin User profile page to uncheck the "admin bar" checkbox. I'd like to place a script in my theme's functions.php to do this automatically. Anyone know what that would be?


WordPress CSS doesn't update

I've got a new WordPress website that I'm testing that hasn't been updating properly when CSS styles are updated over FTP. I haven't got a cache plugin and I have cleared my browser cache and have tried a different browser. The changes I make are definitely being uploaded to style.css as I have downloaded it and checked it on a web FTP site. I can tell the code is not wrong because I have copied it to a new file, included it in header.php and it has changed. Also, when I delete style.css, the styles on the page do not change. I've checked my HTML a hundred times and I'm not including other stylesheets and making huge obvious changes to styles doesn't do anything either.


Installing multisite network admin on sub-domain

I was searching the Net and also playing around Wordpress to achieve my desired multisite installation, but I wasn't successful yet. What I want to do is to have the network admin site installed on a sub-domain like `www.example.com` (not `example.com`) and other sites in the network on sub- domains like `client.example.com` (not `client.www.example.com`). Is there any way to make it possible!? Important Note: I want to map `example.com` to a different server with different IP than `www.example.com` and the rest of sites. Also, I don't want to map each sub site address by hand. I want it to be automatic. Server specification: I use nginx + php-fpm + fastcgi + centos 5.9.


How to pull in photos from an RSS feed on another wordpress.com site

I'm creating a "portal" (wordpress.org) site and I want to pull in some photos from a related wordpress.com blog site. There is a cartoon on each blog post and I want to display the latest one in my portal site. I've tried using using wordpress's standard RSS widget but it only pulls in the article title, no image. I don't want to have to go to the other site to see the image. How can this be done? Thanks! Corinne


different post-class when template is loaded via ajax

my **event-item.php**               <?php     /**      * The event template      */      ?>
         <article id="event-<?php the_ID(); ?>" <?php echo event_canceled($post) ? post_class('wrapper canceled') : post_class('wrapper'); ?>>      This leads to this …
      However when loading this event-item.php template via ajax the custom-post- type class of `wr_event` is not added. Anyone an idea why that could happen or what could lead to it? **Update:** Ajax:               $.get(         ajax.url,          {             'action': 'get_event_list',             'order' : 'DSC',         },          function( response, status ) {             $('ul.event-items').append(response);             }     );      **functions.php**               add_action('wp_enqueue_scripts', 'theme_name_scripts');          function theme_name_scripts() {              wp_enqueue_script( 'script-name', get_bloginfo('stylesheet_directory') . '/js/min.js', array(), '1.0.0', false );         wp_localize_script( 'script-name', 'ajax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );     }          add_action('wp_ajax_get_event_list', 'get_event_list');     add_action('wp_ajax_nopriv_get_event_list', 'get_event_list');          function get_event_list( $latest = true, $order = 'ASC', $return = false, $year = NULL, $cat = '' ) {      Now I got rid of my tag that embeds my script in the header.php file. The admin-ajax and the embeded script works however doesn't change anything at the behaviour, still no `wr_event` in the post-class.


Implement phpunit testing on a plugin

I've just finished writing a WordPress plugin implementing shortcode tag based autocompletion based on values retrieved from a database given an id set on a cookie. The plugin has a variety of combinations of possible scenarios, based on parameters such as: whether or not to display matched fields whether to limit (matched or not) fields to be displayed to a certain maximum whether to show a particular set of fields under any circumstances, if matched As simple as it seems it's giving me a considerable headache (and taking a considerable amount of time) to test all scenarios after every revision. My contractor is also a little pissed off of the constant regressions and missed bugs he is finding on my code as the project gets bigger. So, my question is quite simple: What would be the best approach for designing PHP unit tests for a plugin implementing shortcode tags in WordPress? My best idea is to write a set of posts containing the test cases and use file_get_contents($posturl) to compare the expected content output with the actual output but there has to be a better way. Any ideas?


wordpress shortcode A executing code from shortcode B

I am having a problem with wordpress. I have created some shortcodes in wordpress. None of them use hyphens as suggested by the wordpress codex. One is for validating a user email (just a success or fail) in which in case of success, I add this e-mail address to a mailchimp mailing list. Antother is just to test mailchimp subscription functionality. Problem is that when the user validation page is executed it always fires the mail no matter what. If I remove the shortcode in the test page, this stops. I am really puzzled. Here is the full code: http://pastebin.com/7wHwxc5q


Developing plugin, where to place action hooks etc?

I am dividing my plugin code into multiple files and functions. When I have a function and straight after it an action hook, or for example add_shortcode, should that line go straight after the function or in a plugin init function? As an example, should I have something like this:               // Shortcodes.php file            function myplugin_shortcode( $atts ) {             if ( !empty ($atts) ) {             foreach ( $atts as $key => &$val ) {                 $val = html_entity_decode($val);             }         }         myplugin_display_items( $atts );            }          // Register shortcodes     add_shortcode( 'output-items', 'myplugin_shortcode');      OR a combination of the following two:               // Shortcodes.php file            function myplugin_shortcode( $atts ) {             if ( !empty ($atts) ) {             foreach ( $atts as $key => &$val ) {                 $val = html_entity_decode($val);             }         }         myplugin_display_items( $atts );            }      and               // Myplugin.php file     myplugin_init() {                // other initialisation code           add_shortcode( 'output-items', 'myplugin_shortcode');     }


How to get the post id from a permalink?

How can I get the post id from a permalink like "http://localhost/wordpress/animals/cat" in functions.php, I have tried url_to_postid() and get_page_by_path() but none seem to work.


Selecting New & Edit Page for Custom Post Types

I'm probably missing something unless it's really not possible, for some reason I can't get my function to only execute on the **new** and **edit** page of a custom post type (the new not being a problem): I'm currently using:               if ((isset($_GET['post_type']) && $_GET['post_type'] == 'events') || (isset($post_type) && $post_type == 'tf_events')) {         add_action('admin_init', "admin_head");     }      However this only works for **adding a new post** where the URL is:               /post-new.php?post_type=events      But for editing a post it doesn't work, where the URL is:               /post.php?post=12&action=edit      (although the post type isn't added to the link attribute) **WORKING CODE (See Mark's response below):**               // 7. JS Datepicker UI          function events_styles() {         global $post_type;         if( 'tf_events' != $post_type )             return;         wp_enqueue_style('ui-datepicker', get_bloginfo('template_url') . '/css/jquery-ui-1.8.9.custom.css');     }          function events_scripts() {         global $post_type;         if( 'tf_events' != $post_type )             return;         wp_deregister_script('jquery-ui-core');         wp_enqueue_script('jquery-ui', get_bloginfo('template_url') . '/js/jquery-ui-1.8.9.custom.min.js', array('jquery'));         wp_enqueue_script('ui-datepicker', get_bloginfo('template_url') . '/js/jquery.ui.datepicker.min.js');         wp_enqueue_script('custom_script', get_bloginfo('template_url').'/js/pubforce-admin.js', array('jquery'));     }          add_action( 'admin_print_styles-post.php', 'events_styles', 1000 );     add_action( 'admin_print_styles-post-new.php', 'events_styles', 1000 );          add_action( 'admin_print_scripts-post.php', 'events_scripts', 1000 );     add_action( 'admin_print_scripts-post-new.php', 'events_scripts', 1000 );