What's the difference between home_url() and site_url()

My understanding is that `site_url()` returns the location where the wordpress core files are. So, if my blog is hosted at `http://example.com/blog` then `site_url()` returns `http://example.com/blog` But then how does `home_url()` differ? For me, `home_url()` returns the same thing: `http://example.com/blog` If that's correct, then can I get wordpress to return `http://example.com/` ?


How does W3TC Auto Minify deals file file name

# Hi there, I am having problems with W3TC Minification of JS and CSS on automatic mode. Since I have alot of wordpress websites, auto mode would be the best way to go for me. It would take alot of time to feed script names to manual mode for each site. Minification is the ONLY resource I have active on W3TC, I do not need anything else fornow. Anyway, minification is generating files with filename too big. Too big that they cannot be created by debian (filename too long error). I do not understand, first of all, how W3TC comes up with those strings for file name? What is the logic? Files are getting minified and served on the fly and no cache is being saved on disk. Second, I do not understand the effect of the options "Disable minify automatic file name length test" and "Filename length:", since I change them and see no effect other then a slight change in the generated file name - but it is still too big. Also the generation seems to not respect the "Filename length:" option. Below are a generated filenames:               wp-content/cache/minify/000000/jZFrcoMwDIQvhO1Scp-OsBUjApZjmdD09DEJGToZ2sk_zbfrtR6N6c8TpmvVrIUaySfIqEcK1cHIfOS2R5ur2pwiWRBQHoahOI104Hhu-XurimuOyk6SecSkEl4IZ9ljxdljjmBP5ouCNZEljygCHl-lR2OawvLwD3FlJV3oZ0nwzH5AZWHA4CApvGDIYnp5znnOFP_1eYtKbKK4zN4r6Thlyw4fIXB9petalia3bzSCUPC61s17_kxlSaJq_fme_xdVjf64n60xEz31ibTlhHt8Jucx7ykZWtnjYEuWIw53cbvEyG4acLmzT9zxDQ.jss      Thats like 320 characters long. If I want filenames that can be created on disk by Debian, I need to tick "Disable minify automatic file name length test" and set Filename Lenght to 100. That way I get a bunch of files (soo much for combining), but the lenght is okay. If I seed filename lenght to 80, files are created and served from cache just fine.                |-- M9QvL9AtSk1OLChJzkjUh7MA.css     |-- M9QvL9BNLi0uyc9NLdItSi3LTC0vxiYGAA.js     |-- M9RPz89Pz0nVLcgpLdbNz0vVTSotKcnP002q1M3OLdZPL8iPB0kBZQA.css     |-- M9RPz89Pz0nVTU7MSc1LSSzSTS1LzSsp1s8CosLS1KJK3cKSzAIA.js     |-- M9TP0i3OyC8qSc5PSS3WT0_MyUktqizLTC3XzyrWzyosBfL0SjJzU4uKdQ31jAA.js     |-- M9TP0i3OyC8qSc5PSS3WTy4u1s8qLE0tqtQvzs3PL8nIS4WL6JZm6hrqWehZ6iWXFpfk5wIA.css     |-- M9TP0i3OyC8qSc5PSS3WTy4u1s9KrNQxRBVOT8zJSS2qLMtMLYcoKSwFcvWQhHWN9QwA.css     |-- M9TPSi0pSEzO1s_NTynNSS3WLy9IL8rPyAcA.js     |-- M9TPSi0pSEzO1s_NTynNSS3Wz8nMBpLFJZU5qQA.css     |-- M9YvzdTPKixNLarUK83US0xOzi9KyczP08vNzAMA.js     |-- M9bPKixNLarUMYYydHMz04sSS1L1cjPzdEz0i8vT8pOyUpNLdAz1swsykxOLE3XTE3NygCr1izMSU_LLk_IrECwA.js     |-- PcVBDoAwCATAD0lIn0TohqhYGkGNv_fmXKaxRZiDVByjy0m4MSpZM9kUlPU6lsYbaorufES_HMnP2g31_wE.css     |-- XYpbCoAgEEU3lIq0omG8TIpoOWa4-8LPPs_DO6lVMgxTRgnUDAZKV5fUCcMot3j2zbtk9Kitcw1YMdH8W6Gc0eaIeNZx3R9ZkMYi1tv9BQ.js     |-- bYpBDoAgEMQ-JEFfZFacKBGBsCsrv9eDxou3tmlvRRGlIaAiWpYW0A12y94Rk1koBJT2-vj4z8ErzUmndH50X5qNO1jSjmIKqofyX7sA.css     |-- bclBDoAgDADBD0mr4UUIDZagRAoSf68eSDxw3NkFg5It5WKTI0FvYqR8X0wNg2A461vwU6Vhhp2PSWPl_iuDTZlG3th5KqNTzCqfPw.js     |-- dclBCoAgEAXQC5kidJ8Q-cRYM5pjhZ2-Fm1atH3Pu4RWQlzcRBJdydoYqmGG8d9K247aLclBOH_ytaFC6YIZXczMkPZAWbtlkhs.js     `-- index.html      Can anyone point me to the right direction, please? The code is too big and complex to navigate. I would like to not have to go there. Any help is welcome. Best regards. Edit: It seems W3TC uses SHA-1 for file names, hence the long file names. Problem is my OS cant handle names larger than 250 chars.


How can i retrieve the username and password from my wordpress installation?

I had a developer working on a website. Now i learned a bit of wordpress and i would like to continue some of the work on my own. I asked the developer for the passwords and he only gave me the passwords of the hosting account and not from the wp-admin of the wordpress installation. When i asked about those passwords he told me that he never used the wp-admin panel to develop the website and he doesnt know about any passwords about it. He refused to tell me also how he developed the website if not from the panel. Is this even possible?!?! The only way to develop a website is from www.mysite.com/wp-admin right? Anyway i still have the passwords from the hosting account that means the ftp passwords and everything. Is the username and password of my website , stored in one of the files that are on the ftp account? For example in the wp- config.php file or somewhere else? I cant understand if the developer simply wants more money for it , or i am missing something here...


Integrating jQuery mobile page transitions with my theme

I'm trying to integrate jquery mobile page transitions using the advice on this site I have a functions.php file:               function theme_js()     {         wp_register_script( 'jquery.mobile', 'http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js', array('jquery'), '', false);         wp_enqueue_script( 'jquery.mobile' );         wp_enqueue_script( 'theme_js',  get_template_directory_uri() . '/js/theme.js', array('jquery'), '', false);          }          add_action( 'wp_enqueue_scripts', 'theme_js' );      My theme.js file:               jQuery(document).ready(function(){     ('#wrapper').live('pagecreate', function(){     jQuery('a').attr('data-transition','flip');     });     });      In header.php, just after the opening `<body>` tag, I created a wrapper div:               <div data-role="page" id="wrapper" class="wrapper">      And then closed it in footer.php right before the closing `</body>` tag. I'm obviously doing something wrong because when I test the site the page transitions aren't working. Any help is greatly appreciated.


Upload multiple images via theme options

Is there a simple script out there that would allow multiple images to be uploaded via my theme options page (Which is based on this script - http://buildinternet.com/2010/01/create-custom-option-panels-with- wordpress-2-9/ )? I need to be able to upload 6 images which will feature in a site-wide slideshow.


load_child_theme_textdomain doesn't work in function.php

I have a child theme which is not localized. So I added this in function.php               add_action( 'after_setup_theme', 'my_child_theme_setup' );     function my_child_theme_setup() {         load_child_theme_textdomain( 'mytheme', get_stylesheet_directory() . '/languages' );     }      It doesn't work. I searched for hours and I read somebody advised putting this to the top of header.php               load_child_theme_textdomain( 'mytheme', get_stylesheet_directory() . '/languages' );      Suddenly it started working. The problem is solved but I'm still curious why the legal way didn't work. Any of you have an explanation?


Categories show 404 error on multisite installation

I have a wp multisite installation with multiple blogs that are totally separated websites. I use a plugin for domain mapping. Right now I am configuring everything and I wanted to remove the /blog slug from the main blog, I did it by editing the settings as "network admin". I used /%POSTNAME%/ and / for category and tags base. The posts opens fine opening www.url.com/postname, but www.url.com/categoryname show 404, I tested changing the category base to anything (like /c) and www.url.com/c/categoryname works. But I don't want to have a category base I want the category post lists to open on www.url.com/categoryname. How can this be done?


Photo comment plugin

I'm searching for a plugin that is (for all logged-in persons of a group) showing one picture of a member/gallery and allow them to leave a short comment on this. Users shouldn't see comments posted by others and once they have seen a picture it shouldn't be shown again. They should also be allowed to skip a picture. Is there some plugin that is doing something near to that? I don't mind coding and changing it for my needs, so any plugin that is doing at least some parts of it is appreciated. Thank you!´in advance!


How to Use the Filter "sidebar_login_widget_form_args"

I need to rename some of the labels on the Sidebar Login form using the sidebar_login_widget_form_args" filter; I have been trying few days to do this without any success. I would very much appreciate it if someone could point me in the right directions. Specifically, I need to rename the "Login->" button to just "Log In", rename the "Username" to "Username:" and "Password" to "Password:" Here's my code which doesn't work:               /* Sidebar Login Plugin - Change Form Labels     add_filter( 'sidebar_login_widget_form_args','my_sidebar_login_widget_form_args', 10, 2);     function my_sidebar_login_widget_form_args() {          if ( 'label_username' === 'Username' ) { return 'Username:'; }// Change Username Label     if ( 'label_password' === 'Password' ) { return 'Password:'; }// Change Password Label     if ( 'label_log_in' === 'Login →' ) { return 'Log In'; } // Change Login Button Label     }      Thank you very much for your help in advance.


Search and replace special characters (å,ä,ö) for image attachments only in database

I need to replace the special characters å,ä,ö (with a or o) in my WP database for all image attachments. How can I apply this search and replace only to affect these links? Edit: Solved


Get User ID on registration form before submit

I am creating a registration page and not using the wp-register page. Is it possible to pre populate the username field with the user id the person will be assigned with? So the username field will look like this "user- _userid_ ". I am trying to get the $user id meta value before the registration form is submitted I have tried:               <input class="form-control" id="signup_username" name="signup_username" placeholder="Username" type="text" value="" />          value="user-<?php echo $user_id; ?>"          value="user-<?php echo $user->id; ?>"      Thanks! **_ UPDATE _** Now, this may be another solution I am considering though any input on this mehtod is greatly welcomed. I am generating a random username by the time, microtime, and a 5 digit random number using this code below:               <?php         $date = date('H:i:s');         $time = microtime();         $random_numbers = 2;         $random_digit = rand(pow(10, $random_numbers-1), pow(10, $random_numbers)-1);                            $date_time_number = $date . $time . $random_digit;                           $random_username = preg_replace('/[^a-zA-Z0-9\']/', '', $date_time_number);              value="user-<?php echo $random_username;"     ?>      This is how it looks: `user-033610045034900140703697021719` What do you think about pagespeed using this method to create a random user id? I hope it's not an overkill. Thanks!


Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?

I'm new to wordpress and I'm trying to make a field that either links to a page internally via a dropdown OR a text area for a URL. Obviously I don't want the button to have two destinations so I'd like to make them both required but only one can have a value at a given time. Is this possible in CPT UI?


How to create page with lots of dynamic content(AJAX?)

I am setting up a Wordpress-homepage which has a lot of toggled content(sort of like this: https://jqueryui.com/tabs/). So for example I have a list of links on the left side, and a content-container on the right, which dynamically shows the content for the current tab. I thought about loading the content through AJAX, but then I'd have to create hundreds of subpages just to store all the information. Also everything has to be maintainable by the client, so it should be as easy as possible. What would be the best way to achieve this? Also, is it possible to create 'templates' for sections of a page? I have several sections and subsections on a page, each with a specific markup and styling, which I want to be maintainable by the client without having to switch to HTML view. I'm thinking about something like WPs custom fields, only for pages instead of posts, and a bit more flexible.


Advanced Custom Fields Wordpress querying relationships

Having an issue using the `Advanced Custom Fields` `Wordpress` `plugin`. I've got 2 Custom Post Types   1. pa_supplier    2. pa_supplier_product There is a one to many relationship between a supplier and their products. (One supplier has multiple products). I've got a page displaying a list of my suppliers and when I click on a supplier I am taken to `single-pa_supplier` page where I would like to display a list of the products associated with that Supplier. I've successfully managed to make a query on this page and display products, but they are not the corresponding ones to the Supplier. This works: - It displays a list of products with a quantity of 10,000 as expected               <?php $products = get_posts(array(                     'post_type' => 'pa_supplier_product',                     'posts_per_page' => '100',                     'meta_key' => 'quantity_per_pallet',                     'meta_value' => '10000',                     'compare' => 'LIKE'                 ));?>      This does not work: - I was hoping it would display all products that have a supplier called "Cavan Box"               <?php $products = get_posts(array(                     'post_type' => 'pa_supplier_product',                     'posts_per_page' => '100',                     'meta_query' => array(                      array(                        'key' => 'supplier',                        'value' => 'Cavan Box',                        'compare' => 'LIKE'                       )                     )                 ));?>      I don't know why the second query is not working, I've a field called supplier and it is of type Relationship. when I create a product I assign it a supplier. Any help would be much appreciated.


Change Wordpress Shortcode added in to post

Problem: I am using a plugin that turns the wordpress gallery into a cool slide show. How ever, every time I make a gallery - Wordpress add this code to the post . [gallery ids="334,332"] I need it to be this - [wp-slideshow include="334,332"] * * * Might be helpful: I think this is the file controlling the output? http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/media.php#L745


Why Won't my jQuery Play Nice with Wordpress?

Code in question here: http://pastebin.com/PN29WKNq It worked on the HTML page I tested it on. Its supposed to add "display: none" to the content divs and then add "display: block" when the appropriate tab is clicked. But it just changes to "display: none" and never changes.


Using transients to store captchas

I was just wondering if something like this would work:   * The page displays a form, with a captcha code inside it.   * When this form is generated, a transient is set to store the captcha code.   * The vistor submits the form   * After submit `$_POST['captcha']` is compared to the transient from the database; if matched return success, otherwise fail   * Delete the transient What do you think? Is this secure?


Forum Software that Integrates with a WordPress Blog/Website?

If you wanted to add a user forum to your software site, and make it look and work like your WordPress blog, what forum software would you choose? Apparently bbPress has the same origins as WordPress, but is it best or are there other choices that are better?


Possible to create a permalink to sort with meta_key?

I feel like I've been all around the web and back again looking for an answer to this and it's really starting to grind my gears. Not sure if this is the correct way to do it, but I want to add a query_posts array to a URL in the form of a query_arg. This is our query:               query_posts( array( 'meta_key' => 'rank', 'orderby' => 'meta_value_num', 'order' => 'DESC' , 'paged' => $paged,      How do I use add_query_arg to pass that to the URL so as to re-order the posts with that meta_key/query_posts array? I tried this, it doesn't seem to change the order of the posts, there's something I'm missing here.               <a href="<?php echo $by_rank;?>">  Rank           <?php $by_rank= esc_url(add_query_arg(array('meta_key' => 'rank',  'orderby' => 'meta_value_num', 'order' => 'DESC'))); ?>      The reason I want to add the query vars to the URL string is so users can sort posts on category pages based on the meta_key/meta_value. Sort of in a similar way to doing ?orderby=date, except with a meta_key. This can be done, right? Because I'm seriously starting to think it's not possible. EDIT:- Tried this, this works to sort posts by ASC/DESC order, but not by the meta_key               <?php     $meta_key = (isset($_GET['meta_key'])) ?                 sanitize_text_field($_GET['meta_key']) : 'rank'; // use default value here ''          $orderby = (isset($_GET['orderby'])) ?                sanitize_text_field($_GET['orderby']) : 'meta_value_num'; // use default value here ''          $order = (isset($_GET['order'])) ?              sanitize_text_field($_GET['order']) : 'DESC'; // use default value here ''          $by_rank = esc_url(add_query_arg(array(         'meta_key' => $meta_key,         'orderby' => $orderby,         'order' => $order     )));     ?>     <a href="<?php echo $by_rank;?>">  Rank       I should add that if I add the query_posts array directly into the page template it works just fine.


Is there a plugin that will allow a tag cloud to be created from any mysql field?

I have run into a frustrating situation in the development of my site/store. I am using the Shopp plugin and there is a disconnect between the tags in WP and the tags in the store plugin. In my case I have both articles with tags and products with tags. I do not want them in the same tag cloud but I do want tag clouds of both categories. While this discrete issue is solvable with tools that already exist... It started me thinking that many situations would benefit from a tag cloud that was definable directly to a db field. This would allow rapid addition of tags and the ability to have multiple tag clouds on a site that perform radically different functions. Has this already been solved? For most users to use it would need to be an easily used plugin. If one could define a set of tags by the content of a mysql field you could have a tag cloud for about anything. I hope the editing of the question made the issue a bit clearer. Input appreciated! MM/RC


add capability to author role to be able to delete attachments

I need my authors to have the right to delete any of the attachments they uploaded in case they made some mistake. Currently if the author clicks on any thumbnail in media-library, he gets the `edit_image` link but not the `delete_permanently` link ( as it appears for higher roles ). So right now, the author gets to edit the text content and edit the image but _cannot delete the image-attachment_. I took a look at wordpress codex for roles and capabilities and found that there is nothing called delete_attachments. So is this possible, What am I missing ? I am trying to employ a bit of code something like the one suggested here for the add_cap filter. _example code :_               function add_author_caps() {             $role = get_role( 'author' );                  $role->add_cap( 'delete_attachments' ); //of course this wont work          }     add_action( 'admin_init', 'add_author_caps');      How do I get something like this to work. Again, basically I am just looking for a way for my site-authors to have a capability to delete the attachments they uploaded.


multiple wordpress installs w/shared user database but separate content databases

Is it possible to have two wordpress installs, one at the main address and one at a subdomain, with a shared user database but totally different/separate content databases? For example: http://www.maindomain.com and subdomain.maindomain.com I am trying to build a community website that will allow for admins only to make posts on the main domain but allow for a shared set of users to make posts on the subdomain. I want the content to be totally separate for each install (so content from both databases doesn't show up in a search on either site) but make it easy for users to jump back and forth between the two sites and comment on posts/message one another...etc. Any help would be greatly appreciated!


Ajax - Call to undefined function get_option()

So I've been working in Wordpress lately with Ajax and I managed to get some stock data into my site from my database. However, I am now trying to use Ajax to load Wordpress posts into my left sidebar, which requires the use of Wordpress functions and it seems as if I am not doing this properly. I have gone through the Wordpress Codex and several other threads/tutorials about this topic, however I am extremely confused about what I am doing wrong. **Javascript File**               function load_blog_posts_function()      {          jQuery.ajax({          url: "wp-content/themes/Divi/js/stockchart/blog-list-query.php",          data: ({action : 'load_blog_posts_sidebar'}),          success: function(data) {          alert(data);          }          });     }      **PHP File**               <?php      function load_blog_posts_sidebar()     {     $stockSymbol = $_GET['symbol'];     /* Set up the query arguments. */     $options = get_option("widget_rpwe_widget");     $args = array('fb' => $cat);     $default_args = apply_filters( 'rpwe_default_query_arguments', $args );     $rpwewidget = get_posts($default_args);     //echo $options;     echo("hello world");     }     ?>      I also read that some code was needed in my functions.php, so I have this:               $dirName = dirname(__FILE__);     $baseName = basename(realpath($dirName));     require_once ("$dirName/js/stockchart/blog-list-query.php");          add_action("wp_ajax_nopriv_load_blog_posts_sidebar", "load_blog_posts_sidebar");     add_action("wp_ajax_load_blog_posts_sidebar", "load_blog_posts_sidebar");      I currently get two errors when I try to run this, the more important one is > Call to undefined function get_option() which tells me that my php script is not recognizing Wordpress functions and I also get this one: > Warning: session_start(): Cannot send session cache limiter - headers > already sent (output started at .../www.3weekwebsites.com/wp- > content/themes/Divi/js/stockchart/blog-list-query.php:12) in > .../www.3weekwebsites.com/wp-content/themes/Divi/header.php on line 1 Could anyone please share some insight here? I would really appreciate it. :)


Custom Fields - Taller editing area

Don't know if this is possible, but can the custom fields be adjusted to be taller in the admin panel? It's a bit tedious to have to stretch the textbox every time you want to edit an existing field that contains a lot of text.


WP already installed is asking to install

Hey guys, i did a mistake on a wp site, i uploaded a wrong wp-config.php file on the server during a 3.1 update, saw the mistake, recreated a good one with the good infos, uploaded the file and didnt get back the site! Now wordpress askes me to install it! Which i dont want to, cos it's all already installed. I backuped the database and checked it online, it's all fine, with for exemple the good infos for 'home' and 'url' tables. If anyone knows what's going on (the install question) and i could get it back, it'd be more than welcome (am kinda stressed a lot now). Second question, if i do reinstall it, will it crash the existing datas in the database? EDIT: i checked the english version which is on the same database on the same server, site.com/en, it works fine.


Plugin for sortable posts in grid

I'm looking for a plugin that will emulate this current php page: ![Screenshot of flower grid](http://i.stack.imgur.com/GK35I.png)   1. Each flower to be a post with more info.    2. The dates to be sortable    3. Current blooming flowers to be featured in the widget sidebar (ok, this last one is probably a pipe dream).  Anyone have any clever ideas? Maybe a cart system of some sort?


Bulk User Deletion

I've created a WordPress 3.0 site w/ MultiSite enabled and the BuddyPress plugin installed (latest available versions of each). Initially, the site did not have a captcha enabled and now there are hundreds of spam accounts created. By default, the Super Admin panel for Users only shows 15 users at a time. I need to delete several hundred users and going through this page by page is monotonous. Is there plugin available which would assist with bulk user deletion? I'd like to be able to select and delete a few hundred users at a time (or even better do a regex search by username). Thanks.


Optimize Multiple Taxonomy Term MySQL Query?

_( **Moderator's note:** Title was originally: "query/database optimisation")_ I'm written a function for a custom "filter" search panel that allows users to select terms from up to four custom taxonomies. I'm running the queries directly against the database and the query is averaging half a second to execute (with terms for all four taxonomies and one result returned). This seems pretty slow to me. I was wondering if there's anything I can do to either optimise the query or even the database to make this more efficient/faster. Perhaps writing a view, even? I have experience with MS-SQL but not much with MySQL and I'm not sure how things are different. Here's my function code:                   function filter_resources($phase,$wa,$aus,$topics){         global $wpdb;         $querystr="         SELECT *              FROM $wpdb->posts A                 LEFT JOIN $wpdb->term_relationships B ON(A.ID = B.object_id)                 LEFT JOIN $wpdb->term_taxonomy C ON(B.term_taxonomy_id = C.term_taxonomy_id)                 LEFT JOIN $wpdb->terms D ON(C.term_id = D.term_id)                  LEFT JOIN $wpdb->term_relationships BB ON(A.ID = BB.object_id)                 LEFT JOIN $wpdb->term_taxonomy CC ON(BB.term_taxonomy_id = CC.term_taxonomy_id)                 LEFT JOIN $wpdb->terms DD ON(CC.term_id = DD.term_id)                  LEFT JOIN $wpdb->term_relationships BBB ON(A.ID = BBB.object_id)                 LEFT JOIN $wpdb->term_taxonomy CCC ON(BBB.term_taxonomy_id = CCC.term_taxonomy_id)                 LEFT JOIN $wpdb->terms DDD ON(CCC.term_id = DDD.term_id)                  LEFT JOIN $wpdb->term_relationships BBBB ON(A.ID = BBBB.object_id)                 LEFT JOIN $wpdb->term_taxonomy CCCC ON(BBBB.term_taxonomy_id = CCCC.term_taxonomy_id)                 LEFT JOIN $wpdb->terms DDDD ON(CCCC.term_id = DDDD.term_id)                  WHERE A.post_type = 'resources'                  AND A.post_status = 'publish'                 AND C.taxonomy = 'phase-of-learning'                 AND D.term_id = '$phase'                 AND CC.taxonomy = 'wa-curriculum'                 AND DD.term_id = '$wa'                 AND CCC.taxonomy = 'australian-curriculum'                 AND DDD.term_id = '$aus'                 AND CCCC.taxonomy = 'topics'                 AND DDDD.term_id = '$topics'             ORDER BY A.post_date DESC";         return $wpdb->get_results($querystr,OBJECT);     }      Thanks!


TEMPLATEPATH without the theme name? No THEMEPATH constant?

Is there a way to get a path to the themes directory without the current theme in the path? ie, in a standard WP install, I would want a reference to: > C:\xampplite\htdocs\sitename/wp-content/themes/ But the TEMPLATEPATH constant returns... > C:\xampplite\htdocs\sitename/wp-content/themes/currentActiveTheme


How to change what the post creation page looks like?

Is there a way (plugin, or something else) to set it where there is a drop down on the "New Post" page that allows you to choose a post type and the fields change allowing you to filter what content you are putting into a post without confusing a user by having 20 different custom fields on the "New Post" page. Also, is there a plugin or other that can make custom fields with different value types (textarea, list, file upload, etc)?


Disable a plugin from ever upgrading?

Is there a way to mark a plugin as "never upgrade this plugin" ? I can't upgrade my OpenID plugin, and this prevents me from clicking the otherwise convenient "Upgrade All Plugins" button.


How to form post thumb in Google's result page?

So, this is what kind of thumbs I'm talking about. ![salads](http://n-wp.ru/wp- content/uploads/2014/04/n-wp.ru_20140410193903.png) I know a method, where is possible to show authors' avatar (We just need to use G+ account), but this is another story, I want to have unique thumb for each post. How to do this? I tried               <?php         if ( has_post_thumbnail() ) {             $thumb_id = get_post_thumbnail_id( $post->ID );             $img = wp_get_attachment_image_src( $thumb_id, array(1500,1500) );             $width = $img[1];             $height = $img[2];             if($height>=$width){                 $thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id(), '160x160_thumb');             } else { //$height<$width                  $thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id(), '160x160_thumb-3-4');             }             $thumb_abs_url = $thumb_url[0];         } else {             $thumb_url = trailingslashit( get_stylesheet_directory_uri() ).'images/default-thumbnail.png';             $thumb_abs_url = $thumb_url;         }         if ( has_post_thumbnail() ) {     $thumb_abs_url = get_the_post_thumbnail($page->ID, 'thumbnail');          }     ?>     <meta name="thumbnail" content='<?php echo $thumb_abs_url; ?>'>      in header.php file. Like in the source code of these web-sites, but this doesn't work =(


Wordpress Localization and Templating

I'm using Smarty Templates for the back-end and Handlebars for the front-end for the plugin that I'm building. It's only now that I discovered that the localization doesn't work when I declare my labels this way:               $ecom_labels = array(         'product_details' => __( 'Details', 'ecom' ),         'technical_specs' => __( 'Specifications', 'ecom' ),         'images' => __( 'Images', 'ecom' ),         'customer_reviews' => __( 'Reviews', 'ecom' )     );      And then later on supply it on my templates:               $smarty->assign( 'label', $ecom_labels );      But it seems like its working on individual variables:               $var = __('Specifications', 'ecom');     echo $var; //especificaciones      And this leads me to a solution like this:               $details_label = __('Details', 'ecom');     $specs_label = __('Specifications', 'ecom');          $labels = array(         'product_details' => $details_label,         'technical_specs' => $specs_label,     );      But I'm declaring an extra variable for each item in the array just to make the localization work. **update** Playing with the code, I noticed that its actually working:               $labels = array(     'technical_specs' => __('Specifications', 'ecom'),     );          echo $labels['technical_specs']; //especificaciones      The variable I was using was declared globally. But when I tried to declare the variable directly inside the function for the ajax hook it echoed out the translated version of the text. So I guess the problem here is how I structured my plugin. Because what I'm currently doing is declared all the variables that I plan to use globally in the global scope and then just use `global` keyword to access them later on inside the functions. Any ideas?


How does add_action 'comment_post' work?

I found an example how to How To AJAX-ify WordPress Comments. I tweak it little bit and so far everything works fine but I want to understand the code.   1. Where did the arguments `$comment_ID, $comment_status` come from? I cannot find any reference about the arguments that are available. Can I use any other? More importantly do I have to use above names and what are the values for $comment_status?   2. Do I have to call `wp_notify_moderator()` and `wp_notify_postauthor()` functions or they would be called by WordPress when inserting the comment into database?   3. I don't understand syntax of these two lines `$commentdata=&get_comment($comment_ID, ARRAY_A); $post=&get_post($commentdata['comment_post_ID'])` what does the `&` does and what is `ARRAY_A` Could some one answer my questions about below function that is called from this action. I know that `2` means that `ajaxify_comments` can accept two arguments but where did they come from? What about the names? Values? Possible values?               add_action('comment_post', 'ajaxify_comments',20, 2);      and the function code is like               function ajaxify_comments($comment_ID, $comment_status){         if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){             //If AJAX Request Then                  switch($comment_status){                 case '0':                     echo "success1";                        // send a message to ajax                     wp_notify_moderator($comment_ID);       // notify moderator of unapproved comment                     break;                 case '1':                                   // approved comment                     echo "success2";                            // send a message to ajax                     $commentdata=&get_comment($comment_ID, ARRAY_A);                     $post=&get_post($commentdata['comment_post_ID']);                     wp_notify_postauthor($comment_ID, $commentdata['comment_type']);                     break;                 default:                     echo "error";                           // send a message to ajax              }              exit();           }     }


How does Cross Site Scripting (XSS) work exactly?

On WordCamp Europe I attended the talk by Brad Williams on Writing Secure WordPress Code and I would like to make sure that I implement these tips in my own code. In his presentation he gives the following example: BAD:               <?php          $title = "";     ?>
<?php echo $title; ?>
      GOOD:               <?php          $title = "";     ?>
<?php echo esc_html( $title ); ?>
      Although I realise that this is a very simple example, my question is _how_ \- or perhaps more important **when** \- would someone be able to add something like `<script> alert( 'Hello Europe!' );</script>` in the first place?


Editor hidden tags when switch Visual to Text tabs

From Wordpress 3.9, 3.9.1 versions was errors with showing on Editor. Here is problems: **Step 1: When create new page and paste this content:**
Allyson Ignazio rated       **Step 2: And click Update. Next step: I switch to Visual Tab and see result:**               Allyson Ignazio rated      **Step 3:When I switch back to Text Tab, content is:**
          Allyson Ignazio rated
      **Step 4: When I reload page (do not click update): and result same Step 1.** **_==> Here is problem with Wordpress 3.9, 3.9.1 version. Have anyone help me resolve this problems?_** Thanks and regards, Lai


Category count but only if category has at least one post

I need to display the number of categories which I can do with this...               <?php echo $num_cats  = wp_count_terms('category'); ?>      ...but I only want it to count categories that have at least one post. Thanks in advance.


Running a Development Copy of WordPress?

* Download a copy of development site (in wordpress) + the database into my local machine   * I reconfigured site_url & home in database   * The url is myhost/wordpress   * htaccess file:                    RewriteEngine On     RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]             * I use permalink link: myhost/wordpress/%category%/%postname%/   * Issue: the admin end seems working, but the non of the urls are working. It gives me 404 error. **Update:** I solved it by adding "AllowOverride All" to apache config. It was changed back to default after upgrade. The lesson for me is: I should look around myself, rather than go too far away from the problem.


How are these PHP functions applied to a specific page in WordPress?

I'm getting most of what's going on in the following code, with some help from http://www.php.net and http://codex.wordpress.org/Function_Reference/. In its current situation, only one page on the site triggers the popup form if no cookie is set. Is that functionality specified within this code? Here's the functions:               if (isset($_POST['confirm']) && isset($_POST['location'])) {          setcookie("Location", $_POST['location'], time()+3600);          }     elseif (!isset($_COOKIE["Location"])) {         setcookie("Location", "", 1);     }     elseif (isset($_POST['deny'])) {         setcookie("Location", "", 1);     }          // Popup confirmation      function show_popup($content) {         global $post;         $location = get_post_meta($post->ID, 'location', TRUE);         if (strtolower($l) == strtolower($location) || strlen($location) == 0            || (isset($_COOKIE["Location"]) && strtolower($_COOKIE["Location"])           == strtolower($location))) {             return $content;         } else {             ?>

Foo.

Yes/No?
         <form action="<?php echo $PHP_SELF ?>" method="post">         <input type="hidden" name="location" value="<?php echo $location; ?>" />         <input type="submit" name="confirm" value="Yes" />         <input type="submit" name="deny" value="No" />         </form>
             <?php         }     }     add_filter('the_content', 'show_popup');          // Adds content to the  tag     function add_meta_content() {     if(isset($_POST['deny'])) {     ?>     <meta http-equiv="refresh" content="0;url=<?php bloginfo ('wpurl') ?>">     <?php     }     if(isset($_POST['confirm'])) {     ?>     <meta http-equiv="refresh" content="0;url=<?php echo $PHP_SELF; ?>">     <?php     }          }     add_action('wp_head', 'add_meta_content');


Performance impact with inactive plugins?

> **Possible Duplicate:**   >  Do deactivated plugins slow down a WordPress site? Hi, Does having inactive plugins installed (but not active) impact the performance of your wordpress install? Is it always better to delete them rather than just leaving them installed but inactive? Thanks! -Adam


How do I add custom attributes to javascript tags in Wordpress?

I am looking to enable CloudFlare's RocketLoader feature that enables asynchronous loading of Javascript for my Wordpress site. The problem, however, is that there is one plugin for that I want to be loaded normally. From a technical point of view, according to https://www.cloudflare.com/wiki/Rocket_Loader, I simply need to change any script tag I want ignored to have the `data-cfasync="false"` attribute as follows: `<script data-cfasync="false" src="/javascript.js"></script>` Unfortunately, I can't seem to figure out how to do this for plugins that are automatically loaded by Wordpress. Any ideas?


Can I create a page template, use it once, then hide/remove the option to use it again?

I am working on a WP theme/project that includes several custom page templates that will only be used once each. For example, there is a page with a map and search form for finding things on the map. Clearly the map page needs a unique page template, but that template will never be used for any other pages. I would like to hide or remove this page template from the "Template" drop-down menu, so when the client is selecting page templates they only see options they should select from. Anyone know how to do that, or should I be approaching this from an entirely different angle? Thanks, Kirkland ++++++++++++++++ UPDATED - Solution: For each of the page templates that I wanted to use one time only (ie: during setup, before the client had access) I simply removed...               /*     Template Name: NAME_HERE     */      So that it wouldn't show as an option when adding a new page. Then I replaced everything in page.php with this...               if ( is_front_page() ) { include('page-home.php'); }     elseif ( is_page(22) ) { include('page-something.php'); }     elseif ( is_page(48) ) { include('page-whatever.php'); }     else{ include('page-default.php'); }      Everything that was in `page.php` gets moved to `page-default.php`. Or you could just put it all inside the `else` statement at the end. Either way. This works for me because I will be doing the setup for the client, so I will be creating the "one time only" pages before handing this project off to them - I will know the page IDs. BTW... You do not need to keep the naming scheme `page-XXX.php` for this to work. I just did that so I can group them more easily. I left the "Template Name" comment in the pages I do want the client to be able to select when adding pages (ex: "full width" `page-full.php`) and did not add a if condition or include to them in `page.php`.


Is There A WordPress Plugin That Produces PDFs of Posts Locally?

Most of the WordPress PDF plugins out there use services like Joliprint and Print Friendly to convert posts to PDFs. Is there a plugin that does this locally utilizing the power of PHP (and/or WordPress), I mean, without using an external service?


WP_Query orderby meta key/value suddely stopped working

I have code that has been working for a long time which when a user clicks a button to order database results by name/value, it gets the results via AJAX from a page that does all the querying. I have recently moved the entire site to a new dedicated server and changed some javascript files around, but for some reason the ordering has now stopped working. Here is my code:                   if($pageType == 'prize-home'){              if($orderby == 'pointsvalue'){ //Must have these if statements because if its ordered by pointsvalue, its orderby meta_value_num, but if its a srting (smalltitle) its orderby meta_value             $my_query = new WP_Query('post_type=prizes&showposts='.$per_page.'&meta_key='.$orderby.'&orderby=meta_value_num&order=asc&paged='.$page);         }elseif($orderby == 'smalltitle'){             $my_query = new WP_Query('post_type=prizes&showposts='.$per_page.'&meta_key='.$orderby.'&orderby=meta_value&order=asc&paged='.$page);         }else{             $my_query = new WP_Query('post_type=prizes&showposts='.$per_page.'&meta_key=smalltitle&orderby=meta_value&order=asc&paged='.$page);         }                  while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $my_meta = get_post_meta($post->ID,'_my_meta',TRUE);                   $pointsvalue = get_post_meta($post->ID,'pointsvalue',TRUE);             $bigtitle = get_post_meta($post->ID,'bigititle',TRUE);             $smalltitle = get_post_meta($post->ID,'smalltitle',TRUE);             $productUrl = get_post_meta($post->ID,'producturl',TRUE);             $imageUrl = get_post_meta($post->ID,'imageurl',TRUE);             include('profile/prize-style.php');                   endwhile;               $no_of_paginations = $my_query->max_num_pages;             wp_reset_query();      It now loads different pages (paginated results) fine, but when the order button is clicked it doesnt really do anything. Some things move about occasionally but it doesnt sort the results alphabetically. I really dont think I have changed anything but Ive been trying different things all day with this and its getting frustrating. Has anyone has a similar experience? All console firebug results seem fine - as in all the query parameters are being passed over properely etc...


Site not responding error - taking long to load

I have a wordpress website which gets around 20K visits a days and with around 7pages/visit and 62 hits per visit. My server is : > 8 processors --> Intel(R) Xeon(R) CPU E5405 @ 2.00GHz > > 8 GB RAM Now my users are complaining about that the site takes time to load sometimes and craches giving the taking too long to load and it also happened to me a couple of times wher i thought it was my connection. From previous issues I know that there is a query that sometimes take too long and the site was crashing from it. I then tweaked the server and changed the query_cach_size (because on days with traffic spike the site was stopping alot) in the `my.cnf` file into `256MB` and after that the site stopped the errors on busy days but started giving this kind of error. Any ideas ? How can I monitor my site and see when it goes down and what is causing it to troubleshoot this ? * * * **EDIT:**   1. I am using a dedicated server.   2. The `my.cnf` file looks like:              [mysqld]     max_connections = 250     safe-show-database     skip-locking     key_buffer = 128M     max_allowed_packet = 24M     table_cache = 700     sort_buffer_size = 16M     read_buffer_size = 8M     read_rnd_buffer_size = 16M     myisam_sort_buffer_size = 64M     query_cache_size = 128M     max_heap_table_size = 180M     tmp_table_size = 180M     thread_cache_size = 16     wait_timeout = 45     interactive_timeout = 600     skip-name-resolve     skip-innodb          [mysqldump]     quick     max_allowed_packet = 16M          [mysql]     no-auto-rehash          [isamchk]     key_buffer = 80M     sort_buffer_size = 64M     read_buffer = 2M     write_buffer = 2M          [myisamchk]     key_buffer = 80M     sort_buffer_size = 64M     read_buffer = 2M     write_buffer = 2M        3. The site will stop responding sometime when I click on any hyperlink (post, page just anything that requires action). Thank you


How to Change the path of a child page?

I am displaying the list of child pages of the current page. but at one child page i want to give a path to pdf. how can it be possible? Please help. Here is my code:               $args = array(             'child_of'     => get_the_ID(),             'date_format'  => get_option('date_format'),             'depth'        => 0,             'sort_column'  => 'ID',             'sort_order'   => 'ASC',             'title_li'     => ''             ); ?>        <?php wp_list_pages( $args ); ?>      output is-                **current page**         child page1         child page2         child page3 (..it should be link to pdf..)         child page4         child page5      Please help me to find out the solution?


Custom comment types. Are they a possibility?

I see everywhere this has been discussed, there still isn't a good answer out there. I don't want to create a custom post type and associate it that way. I want a custom comment type so editors in the backend can add comments on posts while they're in the editorial phase before it goes out and we need to display those comments in the backend as well but, also keep them separate to where those comment won't display on the front end.


Empty meta-box returns publishdate if no value is set?

I have no idea why this would/could happen. I have a custom metabox for an "event_end_date" set for a custom-post-type. If I leave this field blank it always puts out the publish-date of the post itself? I use the Custom-Metaboxes-and-Fields-for-WordPress library like this …               $meta_boxes[] = array(         'id'         => 'event_info_optional',         'title'      => 'Optional',         'pages'      => array( 'wr_event'),         'context'    => 'normal',         'show_names' => true,         'priority' => 'core',         'fields'     => array(                  array(                 'name' => 'End time of event',                 'id'   => $prefix . 'event_end_time',                 'type' => 'text_time',             )         ),     );      And I save the value like this …               $wr_event_end_date = isset($_POST['wr_event_end_date']) ? $_POST['wr_event_end_date'] : '';     $event_end_date = new DateTime($wr_event_end_date);     update_post_meta($post->ID, "event_end_date", $event_end_date->getTimestamp());      And I query the value like this …               function get_event_end_date($post) {        $date = get_post_meta($post->ID, 'event_end_date');        if ( !empty( $date[0] ) ) {            //only if a value is saved I return the value            return $date[0];        }     }      This works for all other custom fields. Just for my event-end-date it doesn't. If I leave the field empty in my backend and save the post, the post itself always shows the publish-date of the post as event-end-date. Why and how could this `get_event_end_date()` function return the publish-date of the post if I leave it empty. If I set a value to the field it works fine, but if I leave it empty I don't want the function to return anything. **UPDATE**                       // End-event-date             /*$wr_event_end_date = isset($_POST['wr_event_end_date']) ? $_POST['wr_event_end_date'] : '';             $event_end_date = new DateTime($wr_event_end_date);             update_post_meta($post->ID, "event_end_date", $event_end_date->getTimestamp());*/                  if ( isset($_POST['wr_event_end_date']) ) {                 die('this is getting called even though the field is submitted blank');                 $event_end_date = new DateTime($_POST['wr_event_end_date']);                 update_post_meta($post->ID, "event_end_date", $event_end_date->getTimestamp());             } else {                 update_post_meta($post->ID, "event_end_date", "");             }


Plugin or method of allowing user to rearrange custom post types with drag and drop?

I'm using a custom post type entry to represent each person in an About Us page. When going to the About Us page, it displays the people in a side menu and if the user clicks on a person's name, it goes to a page about that particular person. My client wants to be able to order the people in the side menu. Is there a good way to do this? I'd prefer to allow the client to drag and drop the posts around to the right order similar to how the Page Manager works, but alas it does not work for custom post types. Any ideas?


get_var result empty for query of custom table in plugin admin

(There are a lot of related questions to this but none I can find with answers that have worked.) get_var returns empty when I query a custom table from a custom plugin for multisite. What am I missing? (I have also tried get_row and get_results which also return empty.) This is for a publish/unpublish button in the subsite admin using jquery/ajax. The publish function works, creates a new post in the subsite user's blog, and inserts the post_id, blog_id and uniquecode in the custom table. The unpublish function also works in so far as I am able to delete the correct row from the custom table. What's not working is, within the unpublish function, before deleting the row from the custom table, I need to retrieve the post_id and delete the post from the subsite user's blog, but the get_var query for the post_id returns empty. Here is the relevant portion of the unpublish function, showing the get_var query and delete correct row, plus print_r checks at bottom:               global $wpdb;      $customtable = $wpdb->$table_prefix.'customtable'; // works for $wpdb->delete but not $wpdb->get_var     $user_blog_id = get_current_blog_id(); // works      $uniquecode = $_POST[uniquecode]; // works via jquery-ajax, value obtained from external database     $post_id = $wpdb->get_var($wpdb->prepare('SELECT post_id FROM '.$customtable.' WHERE uniquecode = '.$uniquecode.' AND blog_id = '.$user_blog_id.'')); // not working, returns empty     wp_delete_post ($post_id, true); // $post_id = $wpdb->get_var is empty, preventing wp_delete_post from working           $wpdb->delete( $customtable, array // works - deletes row from $customtable          (         'blog_id'=>$user_blog_id,           'uniquecode'=>$uniquecode          ),           array('%d','%s')         );           echo 'Post ID#';     print_r($post_id); // returns empty     ?>
<?         echo 'Unique code #';     print_r($uniquecode); // returns correct value     ?>
<?     echo 'Blog ID#';     print_r($user_blog_id); // returns correct value


How can I tell if I'm on a login page?

There are functions for `is_home()`, `is_blog()` `is_single()` etc... What's the best way to tell if I'm on a page that is requesting that I login? I guess that would just be the wp-login.php page.


output custom Posts on a Page

I'm trying to write a function that will output a set of posts on a page. Because I want to display more than just the post titles, `wp_get_archives()` won't do (I think). The function to add the post list parses the page meta to find out what kind of list it's supposed to output. Then it runs a query for those post types and outputs them using the same template fragment used for in `archive-{posttype}.php`. At least that's how it's supposed to work. Here's the function which lives in my `functions.php` file:               function ASH_archive(){         global $posts;         $postholder=posts;//so I can reset to original after archives done         if(!$ptype=get_post_meta('ASHarchivetype')) return;//no archive requested         $path="layouts/layout-blog.php";         $pt='post';         switch($ptype){             case 'equipment':             case 'dyeing':             case 'spinning':             case 'weaving':                 $pt='ash_'.$ptype;                 $path="layouts/{$ptype}/layout-blog.php";                 break;             case 'loomsong':                 $pt='ash_loomsong';                 break;         }         $posts=get_posts(array('post_type'=>$pt));         get_template_part($path);         $posts=$postholder; //reset to original value     }      I want to use the function in this template:               <?php     /*     Template Name: Archives with Content     */          get_header(); ?>
     <?php     suffusion_page_navigation();     suffusion_before_begin_content();     ?>
     <?php     global $post;     if (have_posts()) {         while (have_posts()) {             the_post();             $original_post = $post;     ?>             <div <?php post_class('fix'); ?> id="post-<?php the_ID(); ?>">     <?php suffusion_after_begin_post(); ?>

                         <?php suffusion_content(); ?>
                 <?php                     // Due to the inclusion of Ad Hoc Widgets the global variable $post might have got changed. We will reset it to the original value.                     $post = $original_post;                     suffusion_after_content();                 ?>
     <?php          ASH_archive(); //NOTHING HAPPENS. WHY????          comments_template();     ?>
     <?php         }     }      ?>

     <?php get_footer(); ?>      The function doesn't seem to do anything. I don't know if this is because the function is written improperly or if I need to attach it to a hook of some kind. I've read about filters and actions and I can't figure out which hook I should use for my function or even if that's the right direction. Help? ps, what might be even nicer, is a shortcode to call the function whereever I wanted to.


Help with add_filter('the_content', 'some_function') and multiple matches

I have a site where a user can insert slideshows into a post by entering the shortcode in the content box. He can also add videos by adding the video code in the same box. I need to separate these two shortcodes out from each other so that I can control when the slideshows are displayed and when the videos are displayed. I'm using add_filter and preg_match to match the correct shortcode and then echo each match out - however it's currently only displaying the first match from each one. Here's my code - I'm not sure I completely understand how add_filter works, so probably have my display methods wrong: Videos:               /* VIDEO SLICE */     function video_slice( $content ){         preg_match( '/\[video.*\]/' , $content , $matches );         if( isset( $matches ) && $matches !== "" ){             foreach( $matches as $match ){                 return $match;             }         }     }          if( !has_filter('the_content') ){       add_filter( 'the_content','video_slice');        }else{       remove_filter('the_content','slidedeck_slice');       add_filter( 'the_content', 'video_slice');       }     the_content();      I have a similar setup for the Slideshows, except my slideshow_slice function matches `[SlideDeck .*]` instead. How can I loop through an array of matches and print the output via `the_content()`? Thanks


Authentication from sub-folder non-wp cookie WordPress

I have a question about user authentication in my WordPress Multisite site. My site is http://www.drezzy.it that has its own user db with a login and logout system. This is a non-WP website. When you login, it gives a cookie which include the email and the password of the user. I created a WordPress Multisite website inside this one, http://www.drezzy.it/community/speciale/ that can have access to the cookie. My questions are:   1. How can I allow WordPress to log in users by using the main site's cookie, so that they don't have to register or log in again? A sort of bridge between the main site and WP that would enable to log in only once for all.   2. How can I create a new user in WP for each user logged in the main website? P.S. I'm sorry for my English, if you have some troubles with understand it, ask me, I will explain better! :D


add_rewrite_rule to search

Newbie WordPress developer here. I need to map a WordPress URL like this `www.example.com/user/Username` to a search result based on that Username I already have the page that makes the search with the url `www.example.com/search-results/?name=Username` In the `functions.php` I have               add_action( 'init', 'add_username_rules' );     function add_username_rules()     {         global $wp_rewrite;              add_rewrite_rule(         "user/([^/]*)",         "search-result/?name=$matches[0]",         "top"         );              $wp_rewrite->flush_rules();     }      But this is not working and the rule is going to `non_wp_rules`.


Cannot access subdirectory subpages

I am working on a wordpress site for a client, who has a 2nd install in a subdirectory. When I try to view a subpage on the 2nd install (domain.com/folder/subpage) I get the root directory install's 404 page. It is not a htaccess issue because I have a similar set up on my own server where my website is in the root and I host other client websites in subdirectories, have never had a problem viewing any page in any sub-install. Could it be that the hosting has got directory browsing disabled or another issue? Thanks


How can i change the name order in the admin?

When i go to wp-admin/users.php, in the second column i can see the users full name, however, its not in the right order. In Hungary, we use a different name order: http://en.wikipedia.org/wiki/Hungarian_names So i need to change the name from "First name - Last name" to "Last name - First name" How can i do this?


Search with multiple selects that include tags

I need to make custom search for specific house projects in my new wordpress site. ![enter image description here](http://i.stack.imgur.com/mnJbQ.jpg) It needs to have 4 dropdown lists - 1 [number 2] for categories and 3 [numbers 3,4,5] for tags. Tags need to be defined within the code because from 13 tags on whole site, 4 are for one dropdown, 5 are for second one a 4 are for third. Is there any option to do this? I made the dropdown for categories with this tutorial: http://www.webstutorial.com/wordpress-multiple-category-search/content- management-system-cms/wordpress-cms and by including only categories that i need to:
<?php wp_dropdown_categories('show_count=1&include=4,5,6,7'); ?>
      But WordPress doesn't have function like wp_dropdown_tags to make something like this with tags On Codex ( www.codex.wordpress.org/Function_Reference/get_the_tags ) there is something like: function drop_tags() but this only works within the_loop() and lists all tags. It needs to list defined tags, and search only by those that were chosen. Hope you understand what i mean and have any solutions. Thanks in advance.


get_terms() for custom taxonomy related to another taxonomy

I have this weird thing to do and I have no idea how to do it. Ok, so: I have two custom taxonomies: `collections` and `categories` (both are prefixed, but for the sake of simplicity, I'll use these short names). A post will have a category and will be added into a collection. What I have to do is to display all posts from a specific taxonomy - `categories` (already did this) and only show `collections` terms that have posts in the selected category. Some kind of `hide_empty` but based on another taxonomy. Make sense? Since I use WPML plugin (that is known for adding stuff into sql query), I would like a solution that not involve the rewrite of the whole query. So, any idea would be welcomed. Thanks!


get the username of a user in his author page

I've implemented this code inside my author.php file, in order to display the username of the author:               <?php printf( "
The blog of" . get_the_author() . "
" ); ?>      It displays correctly the username of a user who has posted articles, but unfortunately displays another username when the user hasn't published anything. Is there a way to solve that ? Thanks for your help !


Custom Taxonomy for an "advanced search"

Ive done some googling around and for what id like to do but i cant seem to find anything along them line that i can look at and learn from. That being said my knowledge of taxonomy isnt great, nor is my wordpress knowledge other then the very basics of functions and design in terms on theme layout. What id like to achieve is to create two drop down menu and the last the search bar. http://i.stack.imgur.com/86Fdr.png The first dropdown menu will display all the parent categories. The second then displays the parents child categories that will be populated when the parent is selected. And then able to search the selected child category using the search bar! But i have no idea how to go about doing any of this or if this is possible with taxonomy? Any help will be greatly appreciated ! Kind regards, Thank you in advance, Thomas


wordpress 3.6 media manager cropping timestamp

I am using wordpress 3.6 with its default media manager, I uploaded an image, and then every time i crop it, it create 3/4 new images in upload directory with different name (adding timestamp in file name), But I can't see those newely created(cropped) images in my media library. I can see them on upload folder using ftp. Why it is doing is? is there solution within wordpress without any code hack? I am expecting its behaviour after cropping. either it should overwrite exiting files(all sizes) or if it creates new files with timestamp, it should show those files in media library so i can choose them. UPDATE: Now If you look at the screenshot below, You see how cropping working. There are three types of colour coding,   1. Original Images (when Image uploaded first time, it generated 4 types of image sizes automatically)   2. First time crop (when I cropped the image first time using media manager, it created 4 sizes of images again)   3. second time crop ( when I cropped the same image second time it created another set of 3 images)   4. third time crop ( when I cropped the same image third time it created another set of 3 images)  And it will keep going on every time i crop image 3 new images will be added. which is totally redundancy. While in Media image library I will only see one image. I can't delete my previous cropped image, neither do it replace previous cropped sets. When I Set Feature Image of Post after all these cropping, somehow it still choose image A-604x270.jpg from Original Image to display it in Feature Image. I can I get most recent cropped image to display As Feature Image. Previously cropped image, as i can access them from admin area, means I can delete time. How can I delete perviously cropped image, otherwise it will be waste of space. Honestly It is very unusual way of cropping system in wordpress. ![enter image description here](http://i.stack.imgur.com/u7QKu.jpg)


archive page sidebar not working

i created a taxonomy page from archive.php , working based on thematic frame work. i tried a lot to make the sidebar working but it show nothing and even using firebug its not exist !               <?php     /**      * Template Name: MEDIT      *      * …      *       * @package Thematic      * @subpackage Templates      */              // calling the header.php         get_header();              // action hook for placing content above #container         thematic_abovecontainer();     ?>
                          <?php                     // action hook for placing content above #content                         thematic_abovecontent();                          // filter for manipulating the element that wraps the content                          echo apply_filters( 'thematic_open_id_content', '
' . "\n" );                         ?>                              <?php                         $term_slug = get_query_var( 'term' );                         $taxonomyName = get_query_var( 'taxonomy' );                         $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );                         $args = array( 'child_of' => $current_term->term_id, 'hide_empty'=>false);                         $terms = get_terms( 'tagportifolio', $args);                         $assoc = taxonomy_image_plugin_get_associations();                              if (!empty($terms)):                     ?>                         <?php /*?><?php                         // calling the standard sidebar                          dynamic_sidebar('cs-project-main-category');                         ?><?php */?>                         <?php foreach( $terms as $child ): ?>                             <?php thematic_abovepost(); ?>                             <div id="cat-<?php echo $child->term_id; ?>">                             <?php                                 if(array_key_exists( $child->term_taxonomy_id, $assoc )){                                      echo wp_get_attachment_image( $assoc[$child->term_taxonomy_id], array(), false, 'thumbnail');                                  }                             ?>
<a href="<?php echo get_term_link( $child->name, $taxonomyName );?>">                             <?php echo $child->name; ?>

                                  <?php thematic_belowpost();?>                                  <?php endforeach; ?>                                  <?php                                  else:                                  // start the loop                             ?>                             <?php /*?><?php                             // calling the standard sidebar                              dynamic_sidebar('cs-sub-cat-sidebar');                             ?><?php */?>                                       <?php                  endif;                 ?>                  <?php                     // action hook for placing content below #content                     thematic_belowcontent();                 ?>
          <?php          // action hook for placing content below #container         thematic_belowcontainer();              // calling the standard sidebar          thematic_sidebar();              // calling footer.php         get_footer();     ?>      any idea what is missing in my code please ?


Featured images loop for Orbit Slider

To integrate Zurb´s Orbit Slider in my theme, I´m trying to generate this HTML with WordPress:

     The post title 1     The post title 2     The post title 3      I managed to get a list of featured images in a div, but I´m not sure how to:   1. Add a unique data attribute to each image tag like this: `data-caption="#htmlCaption-1"` (I suppose I need to run the `preg_replace()` function to insert the custom HTML?)    2. ~~Run the second loop to generate the 3 span elements (should this be a new wp_query or can I use the same one?)~~ **Edit:** I just found out that by using `rewind_posts();` we can use the same query multiple times. This is the code I have now:               // Get the latest 5 sticky posts from the 'events' post type     $args = array(       'post_type'   =>  'event',       'posts_per_page' => 5,       'post__in'  => get_option( 'sticky_posts' )     );     $slider_query = new WP_Query( $args );          // Display the featured images in div      echo '
';            while ( $slider_query->have_posts() ) : $slider_query->the_post();         the_post_thumbnail();       endwhile;            $slider_query->rewind_posts();          echo '
';          // Print the captions        while ( $slider_query->have_posts() ) : $slider_query->the_post();            echo '';           the_title();        echo '';          endwhile;          // Reset Post Data     wp_reset_postdata();           ?>      Hope someone can help. Thanks!


Role that can edit only widgets, not other theme options

How could I make particular role access widgets administration menu ( _wp- admin/widgets.php_ ), but **not** access other theme administration menu elements. I have got that far as to display **Appearance** menu linking to _widgets.php_ by binding to **_admin_menu** event and modifying global variable _$submenu_. Although that clearly does not work, as I see this code in _wp- admin/widgets.php_ itself:                   if ( ! current_user_can('edit_theme_options') )                 wp_die( __( 'Cheatin’ uh?' ));      It is clear - you SHALL NOT be allowed to access this page, unless you clearly have **edit_theme_options** capability. But what to do, if I do not want other elements of this capability, apart of widgets, modifiable by current user (role)? It is easy to "hide" other options from menu. But that leaves user, who knows how WP works (understands addressing, at least), free to access them and that I would clearly like to avoid. Thanks for any help in advance.


Comments from vbulletin topic

I have a WordPress site and a forum that runs vBulletin. Each article I post on the website is automatically posted as a thread on a specific forum category (using the website RSS feed). Now, I have one questions for those that are far more knowledgeable in WP: Is there a simple solution that would allow me to list the thread replies on the forum as comments in the corresponding WordPress article?


Customizing Wordpress the_title with add_filter

I'm trying to create a custom wordpress title for a posts made under a custom post. Basically, its a version changelog for an application. I would like to only input the version number in the title field, and the output has to be standardized with a string accordingly. My custom post type is 'custom_version' and the title output that I'm looking for is "Application has been updated to version ". I've understood that this can be achieved using add_filter and I've tried playing with this code for days now, but I'm not really a PHP Pro so help is much appreciated :) Here's the code:               add_filter('the_title', 'new_title');     function new_title($title) {         global $post, $post_ID;         $title['custom_version'] = 'Application has been updated to v'.$title;         return $title;     }


Custom Template for wordpress cpt plugin

I am creating a wp custom post type plugin. Which supports the custom meta datas as well.Now my question is i have to create a archive page with custom template file. I have added the appropriate function for archive page and as well as single page. Single.php file work fine whereas archive.php is not working. here is my funcitons               add_filter('template_include', 'testimonial_archive');     function testimonial_archive( $template )     {          $post_types = array('astestimonial');      if ( is_post_type_archive( $post_types ) && ! file_exists( get_stylesheet_directory() . '/testimonial_archive.php' ) )         $template = dirname(__FILE__) . '/list-testimonial.php';      if ( is_singular( $post_types ) && ! file_exists( get_stylesheet_directory() . '/single-testimonial.php' ) )         $template = dirname(__FILE__) . '/single-testimonial.php';     return $template;          }


How to safely sanitize a textarea which takes full HTML input

I'm developing a plugin which enables the user to send HTML emails from within the WordPress admin. How should I sanitize the textarea input? It has to be able to contain the whole range of HTML tags that might appear in an HTML email. If I use `wp_kses()` then I would have to use a huge list of allowed tags. The textarea saves its content to the db via custom options.


If Posted After Date

I need to get a different "get_template_part" based on the date and category. I have changed the outlay of the category which means any post in that category before today's date wont be able to use the new template but needs to still use the old one.               if ( in_category( 'photographer-interviews' )) {      get_template_part( 'content', 'interview' );     } else {      get_template_part( 'content', 'blog' );     }      So i need to also check if the post inside the "photographer-interviews" was posted after today. If it was continue to the new template if not keep using the old one (blog).


How to fix 502 errors on my WordPress site hosted on Windows Azure that only occur when I update a post?

I have a Wordpress site that is hosted on Windows Azure, with the database hosted separately. Every time I try to update a post I get a 502 error, specifically: > 502 - Web server received an invalid response while acting as a gateway or > proxy server. The DB provider says everything is fine - does anyone know how I can troubleshoot this problem? Oddly enough - basic reads are fine - the error only occurs when I try to update a post.


How to get the content in my website

I'm trying to find out how to get content from my (sidebar, individual post etc) directly on my website without it loading the whole WordPress blog page. (http://www.volunteeringnews.com/wordpress/). If for example you click on the first post "test" it will direct you to my blog site but I need it to stay on my webpage and display the message where the blog is. (http://www.volunteeringnews.com). I have JavaScript running for the rest of the website where it loads the content in a div (mainC2) but I can't figure out how to do it with WordPress. I've been asking around and doing loads of research but it seems there is not really a clear answer. So I got some options. Create a theme myself and make it look like my own website. Delete all the href links (witch will disable the option of comments). Both of them are not really what I want so now I am trying to get some advice. What would be a good way for me to get what I want or at least close enough? Thank you for looking in to it! Roald


How to set custom cookies in Wordpress after a form is filled on a page

I have built a custom template for page in Wordpress: page-xyz.php This page has a some content. I want to check cookie. What I want to do is: If cookie is set: //show page content else //don't show the content. Instead show this form:               <form action="" method="post">     Name: <input type="text" name="name">     Email: <input type="text" name="email">     <input type="submit" name="submit">     </form>      After this form is submitted:   1. cookie must be set   2. do some mysql query   3. show the content I have tried but no success so far.


WordPress Rewrite rule is not working

I am trying to create a rewrite rule for one of my custom page and here is the rewrite rule               function add_my_rule() {         global $wp;         $wp->add_query_var('name_state');         $wp->add_query_var('arg_second');         add_rewrite_rule('state/([^/]+)/([^/]+)/page/([^/]+)','index.php?pagename=places-to-visit&name_state=$matches[1]&arg_second=$matches[2]&paged=$matches[3]','top');         add_rewrite_rule('state/([^/]+)/([^/]+)','index.php?pagename=places-to-visit&name_state=$matches[1]&arg_second=$matches[2]','top');              global $wp_rewrite;         $wp_rewrite->flush_rules();     }          add_action('init', 'add_my_rule');      Here is what i am trying to do. I have following URL               www.mydomain.com/state/state-name/places-to-visit      I have already created a custom page with name `places-to-visit.php`.My intentions are to redirect all such URL's to this custom page and want following information as query variable from the URL


How to filter or remove the "title" attribute from category links

I'm placing a list of category links with this code:

Categories List

         <?php                       function my_cat_title($category_description,$category){                 return '';             }                  $cat_args = array('orderby' => 'name');             $cat_args['title_li'] = '';             $cat_args['exclude_tree'] = 1;             $cat_args['use_desc_for_title'] = 1;             add_filter('category_description','my_cat_title');             wp_list_categories(apply_filters('widget_categories_args', $cat_args));             remove_filter('category_description','my_cat_title');                  ?>

      However, each of the links has a title attribute like 'title="View all posts filed under x"' How can I remove the title attribute altogether?


Custom Post Menu link reverting to Blog menu item

So I have a Custom Post Type setup and running with no issue. I also have a WordPress menu object as my primary navigation. I added my Custom Post to the main menu and when I click on to the landing page the correct menu item is highlighted. When I however click into an individual custom post, the "Blog" menu item is highlighted. Anyone got any idea as to what the frick is going on? Thanks, Ed


Getting custom-sized featured image's URL?

I'm adding additional image sizes to my theme: **functions.php**               add_image_size( 'my-thumbnails', 122, 122, true );        I used to get thumbnails URL like this:               wp_get_attachment_url(get_post_thumbnail_id($post->ID));       And it works like a charm, but I'm not sure how to display 'my-thumbnails' version of the thumbnail? This doesn't work:               wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),'my-thumbnails' );        What's wrong?


Date filter for post query not filtering results when variable outside the function

I am working on the following code which should display the most popular posts that are X days old ($days = 7;) (1) The main problem here is with my filter_where function. I want to pass the number of days from outside the function but it wont filter the results. The only way it filters them is to insert the variable inside the function. So, how can I use my variable from outsite the function? (2) Another question I have is, In my get_topposts function, what happens after I return the query? Will the remove_filter and wp_reset_postdata still get executed or not? If not, how can I do so?               function get_topposts($days) {     //$ago = 7; // days     //$timestamp = time() - ($ago * 86400);              function filter_where( $where = '' ) {                        $where .= " AND post_date > '" . date('Y-m-d', strtotime('-'.$days.' days')) . "'";                     // $where .= " AND post_date > '" . date('Y-m-d', $timestamp) . "'";                         return $where;         }         add_filter( 'posts_where', 'filter_where' );               //$args = array();               $the_query = new WP_Query( $args );         return $the_query;         remove_filter( 'posts_where', 'filter_where' );         wp_reset_postdata();     }      EDITED: This is how it looks now after applying comments made by Milo               function filter_where( $where = '' ) {     //$days = apply_filters('custom_where_clause', '-30days');     //if(!$time)                 //$days = '-30days';                 // posts in the last 30 days                  //  $where .= " AND post_date > '" . date('Y-m-d', strtotime('-'.$days.' days')) . "'";                   $where .= " AND post_date > '" . date('Y-m-d', strtotime('-7days')) . "'";                     return $where;     }     //add_filter('custom_where_clause', 'get_topposts');          function get_topposts($posts) {     $the_query = get_transient('get_topposts');     if (empty($the_query)) {         //$ago = 7; // days         //$timestamp = time() - ($ago * 86400);         //$days = 7;              add_filter( 'posts_where', 'filter_where' );         $args = array(             'posts_per_page' => $posts,             //'category_name' =>  'NAME OF CATEGORY',             'post_status'=>'publish',             'meta_key' => 'postviews',             'orderby' => 'meta_value_num',             'order' => 'DESC',         );          // The Query              $the_query = new WP_Query( $args );         set_transient('get_topposts', $the_query, 60*60*2);         remove_filter( 'posts_where', 'filter_where' );     }     return $the_query;     }


Customize WooCommerce Product Images (Placement and size)

so I'm having trouble trying to re-size my product thumbnail images. The site can be seen here : http://www.seekoften.com/eCommerce . I'd like the single-product page to have **square** thumbnails below the large featured image, but I also want the thumbnails that show in the cart (both on the page, and the sidebar cart widget ), to be vertically oriented, like the featured images, just a scaled down version of it. What files and which loops or lines of code should I look at, and how do I go about accomplishing this ? As a secondary question, how can I customize the output so that it shows the product images that you have in your cart, but on the checkout page ( again, preferably the large vertically oriented image ) ? For what it's worth, I have plugins like regenerate Thumbnails and Simple Image Sizes I would greatly appreciate any help that anybody is willing to offer, and would like to thank you all in advance for reading this at all :) Cheers, Sincerely, Chris "Fawkz" Coffin


Generate a nested list of all posts, sorted first by year, then by month

2011

January

Post 1

Post 2

February

etc

etc

        ![mockup](http://i.stack.imgur.com/elx7I.jpg)


Is it possible to add an action to the currently running action?

My question is very simple but I haven't found this answer yet. Here's an example:               class MyClass {       public function __construct(){         add_action('init', array($this, 'init'));         add_action('wp_footer', array($this, 'footer'));       }            public function init(){         add_action('init', array($this, 'register_scripts'));       }            public function register_scripts(){         wp_register_script('my-script', plugins_url('/script.js', __FILE__));       }            public function footer(){         echo('
Rawr this is my plugin.
');       }     }      This is how my code looks and it's failing. It displays the div but the javascript does not get applied. So I wondered if my problem was running the `init()` function in the init action and then adding `register_scripts()` to the init action but I'm already in that action. Is this possible?


How can I get this code to only output one link?

This is the code I'm using to output the child categories of my posts as links.               <?php     $mycats = array(106, 107);     foreach (get_the_category() as $childcat) {         foreach ($mycats as $mycat) {             if (cat_is_ancestor_of($mycat, $childcat)) {                 echo 'cat_ID).'">' . $childcat->cat_name . '';             }         }     }     ?>      My questions is, how can I get it to only output _one_ link, when the post is in more than one child category? I tried adding a break command after the last line, but that didn't work. Help appreciated.


How do you make the "Hover Text" plugin work?

I've been trying to make Hover Text work. It works with a single piece of code e.g. TOC => Table of Contents but when I have many lines of code, even though I follow all instructions (e.g. all text on one line, etc.) it does not render. I've tried checking the Hover Text homepage and FAQs and other links, I tired checking plugin and WordPress version compatibility, I've troubleshooted to see if other plugins are interfering (no), I've tried deleting the code/text and re-typing it in, or cutting and re-pasting, and refreshing multiple times, I've tried the same code on a new page, I searched different forums and people reported the same problem but I did not find any report of solutions. Any assistance would be VERY much appreciated. Our website launch is Wednesday. Thanks!!! Marilyn


Some informations about the use of statics pages in WordPress

I am pretty new in WordPress world (I came from Joomla) and I have some questions about the use of static pages in WordPress. I have to use WordPress to implement a mainly static site (maybe in the future I will add some dynamic behavior but at this time I only need some statics pages) So I have install a WordPress example intallation on my server: http://onofri.org/example/ and I have create a first static page, this one: http://onofri.org/example/?page_id=4 Now I have 3 doubts on how to proceed my work:   1. **How can I say to WordPress to use the previous static page as an HomePage? I would that when the user open my website this page is show as a lassic static homepage, can I do this thing? how?**   2. **As you can see in the top of the page (upon the header) there is a menù with the names of my statics page (sample page and my HomePage pages), how can I don't show this menù? Have I to delete it from the code of my template or can I disable it from the WordPress administration pannel?**   3. **Can I have a classic menù containing the list of my statics pages in the left column (something like in this site:http://www.saranistri.com/ where in the left column I have a menù with the links to my pages)** Thanks Andrea


Is there a 'rake routes' for wordpress?

Is there an equivalent to 'rake routes' in php/wordpress that would spit out all the available wordpress url paths available?


How to create a complete mulilanguage site using xili language plugin?

I am using xili language plugin for create a multi language site. Using this i can create posts and pages on different languages. But when i switch to other language the menus doesn't converted to other language. How can i convert the menus too. Any suggestions ?


Use Gravity Forms and a Shopping Cart for output to Freshbooks for an Estimate

I've been asked to develop a website pretty much like (but not the same as): http://www.yoursingapore.com/ basically we need to allow people to add Wordpress posts (custom post types) into a sort of shopping cart (people won't make any payment); the website won't have any checkout, but the resulting list of items (posts), each one carrying one cost and other details in meta fields and gravity form (http://www.gravityforms.com/) options, should be sent to Freshbooks (http://www.freshbooks.com/) to generate an estimate (or be used for other purposes as well, ie. sent as email, or other services, within our outside Wordpress) What would you use to combine Gravity Forms with? I don't think I can do the job myself unless there's a solution ready (which I doubt), I'd rather hire a developer for my project. Nevertheless, I would like to hear some opinion on what would be the best route to go. To recap   * we have a website with custom post types   * each custom post type has certain custom fields with prices and details   * users, through gravity forms, should be able to specify further details like dates (ie checkin/checkout) and options (price changes)   * by clicking "add to list" the item is sent to the shopping cart    * when the user has finished, he should be able to review and eventually edit the resulting list   * then send the quotation request, which will be deliered to Freshbooks as an Estimate, including Client contact creation within Freshbooks (using Freshbooks API)   * eventully the same data of the final "cart" form could be used also for other puroposes thanks for any opinion you will share with me


Create WordPress taxonomies based on theme settings

Is it possible to create taxonomies based on theme settings? That is, are theme settings actions run before taxonomies / post types are initialized?


How to save array of datas in option page by setting api?

I am trying to create my own first plugin but I am coding novice so please guide me to the right direction. This plugin is to set the post expiry date based on the user's role. Now I am stuck at the saving data phase. Since I don't want to create a new database table for the inputs. I using the settings api to do the work and saving the data in wp_options table. In my plugin setting page, I want the user able to add/edit/delete the rules. Each rule is defined by the user, with multiple inputs. To add a rule, the user to select the role, post_type, expired_action, and day_limits. I want these inputs to be stored in an array, how can I do that? For example :               array(1) {     role           => "" // get from the form input     post_type      => "" // get from the form input     expired_action => "" // get from the form input     day_limti      => "" // get from the form input              }          array(2) {         role           => ""      post_type      => ""      expired_action => ""       day_limti      => ""          }          array(3) {     role           => ""      post_type      => ""      expired_action => ""      day_limti      => ""             }     ......etc      How do I use the input name my html form so that they can saved in an array every time a user submit a rule? This is my html form in plugin option page for adding the rule:               <form action="options.php" id="apext_form" method="post" name="author_limit">                   <?php settings_fields('apext_Options'); ?>

                          <?php _e('User Role', 'apext') ?>             <select name="role" id="apext_role_id">              <option></option>                <?php global $wp_roles; if ( !isset( $wp_roles ) ) $wp_roles = new WP_Roles();                 foreach ( $wp_roles->role_names as $role => $name ) { ?>                 <option value="<?php echo $name; ?>"><?php echo $name; ?></option>                         <?php }                ?>             </select>
             	                               <?php _e('Post Type', 'apext') ?>               <select name="apext_pt" id="apext_pt_id">               <?php $post_types=get_post_types('','names');                     foreach ($post_types as $post_type ) {                 ?>                 <option value="<?php echo $post_type;?>"><?php echo $post_type;?></option>                 <?php }                 ?>             </select>
                  	                  <?php _e('Expired Action'); ?>              <select name="remove_to" id="re_to"><option value =''></option>                                                  <option value="pending">pending</option>                                  <option value="draft">draft</option>                                  <option value="trash">trash</option>                                  <option value="delete">delete</option>             	                                  <?php _e('Days Limit', 'apext') ?>                         <input type="text" id="apext_lim" name="apext_lim" id="lim" size="4" value="<?php echo get_option('apext_lim');?>"/>
              	                           <input class="button-primary" type="submit" name="Submit" value="<?php _e("Submit Rule", 'apext') ?>" />

      </form>      I know the form is not working, since it has no reference name from register_settings. It just help you to understand what I am trying to do. Again, my question: how can I saved those input values in an array?


Is there some way to provide the user a list of existing content in a CPT

I was looking at the way WordPress uses "Or Link to Existing Content" under the link button in the editor and I am wondering if there is any way I can use that code to allow users to select a page to link to when they create a new custom post. The context I am talking about is that of slides for a slider linking to content within the site.


WP Query and multiple pages

Can anyone tell me why this isn't working? Assuming two things here - 1. WP Query handles multiple page requests, and 2. doesn't need a reset because I'm creating a new WP Query. What happens is I only get the last page to be shown (389). Above this code on the same page there is another WP Query that only fetches one page. Could this be the reason, or is it the way I request the pages? I've tried applying all the reset handlers but they gave no effect. The code -               <?php $promo = new WP_Query( array( 'post_type' => 'page', 'post__in' => array(62,18,389) ) ); while ($promo->have_posts()) : $promo->the_post(); ?>     <?php the_permalink() ?>     <?php the_post_thumbnail() ?>     <?php the_title() ?>     <?php the_excerpt() ?>     <?php endwhile; ?>


How to create Loop code for Menu using Wordpress?

I have created a menu called "My Menu" in wordpress using Menus feature provided under Wordpress admin panel. I have added 3 pages into it named Page A, Page B, Page C. I have applied featured image to all these 3 pages. Now what I want to do is, I want to create a code that will loop through this "My Menu" and print all 3 featured images of these 3 pages. How can I do that ? Thanks in advance.


Accessing two databases wordpress

I'm trying to access a second database with my wordpress system. To do this, I've attempted to follow the advice found here which seems to have worked for a lot of people. In summary, I'm adding the following line to my functions.php:               global $newdb;     $newdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);     $newdb->show_errors();      Unfortunately, when I add this I come up with the following error: > Fatal error: Class 'wpdb' not found in /home/mine/www/wp- > includes/functions.php I'm sure I must be missing wrong (obviously, right?) but the instructions don't seem to have any extra steps that I've been leaving out. Thanks for any help


Get all first images of posts in same category

I am trying to build a list of thumbnail images linked to their associated single content pages within the same category. So, when I am in the category of 'x' the list returns all image attachments from every post in category 'x'. I have the following code in my sidebar which is brought into only the content-single pages. However this just returns the current posts image and not other posts in the same category. What am I doing wrong? EDIT: Or is this even possible?               <?php if ( is_single() ) { ?>
<?php $category = get_the_category(); echo $category[0]->cat_name; ?>

         <?php while ( have_posts() ) : the_post(); ?>
             <?php $size = 'thumbnail';             $attachments = get_children( array(                 'post_parent' => get_the_ID(),                  'post_status' => 'inherit',                  'post_type' => 'attachment',                  'post_mime_type' => 'image',                  'order' => 'ASC',                  'orderby' => 'menu_order ID',                  'numberposts' => -1             ));             foreach ( $attachments as $thumb_id => $attachment )                 ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php echo wp_get_attachment_image($thumb_id, $size); ?>
         <?php endwhile; ?>
     <?php } ?>


Plugin can not display in my custom theme

I have made my first theme. :) But I have a problem: plugins such as getsocial or dynamicwp-contact-form can not display in my custom theme. I tried using them in the twentyeleven theme, and they don't have that problem there. I think there is a problem with my theme but I don't know where..


How to create a template for Pages?

In Wordpress, when creating a page, it shows some options for Template under Attributes, such as: Default, Links, One column no sidebar, etc. Is there a way to add more custom templates to show up here? If so, how?


How to structure Multisite sites into categories?

When using WordPress Multisite with many sites, it would be nice to store them into categories. Site categories that is, not post categories. Maybe there is a way to use some kind of site meta / custom fields for sites? Is there one? How to use it? A plugin would be nice, or an example of a start, what hooks / functions to use.


How to show password fields on registration form w/o plugins

I want to show hidden password fields on registration form. I found that these fields are already present in /wp-admin/user-new.php               <?php if ( apply_filters('show_password_fields', true) ) : ?>
         <?php _e('Password'); ?> <?php /* translators: password input field */_e('(twice, required)'); ?>	         <input name="pass1" type="password" id="pass1" autocomplete="off" />
         <input name="pass2" type="password" id="pass2" autocomplete="off" />

<?php _e('Strength indicator'); ?>

<?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).'); ?>

         <?php _e('Send Password?') ?>	         <input type="checkbox" name="send_password" id="send_password" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?>
      <?php endif; ?>      I assumed that show_password_fields is a function, that returns some value, so I can change its behavior with filters. Then I add following to my functions.php:               add_filter( 'show_password_fields', function(){return true} );      but nothing happend. Is it possible to do it with one or two lines? Thanks in advance!


Make tag cloud links consistent

I'm using this code: ` <?php wp_tag_cloud( array( 'taxonomy' => 'channels') );?>` To display custom taxonomy as a cloud tag. How can display with all links being the same size? I can't seem to override the inline styles.


how to convert XML from URL to HTML

I would like to know how can I, in Wordpress, convert XML URL (for example http://www.baligam.co.il/products/rss) to HTML and show it in actual. Maybe there is a plugin for this purpose? Thanks,