title: Efficient Taxonomy Intersection

text: I have many uses for this but I want to know the most performant way of doing what is going to be an expensive operation. As an example I will use a shop. Given:   * A product brand taxonomy   * A product group taxonomy   * A product post type   * Archive templates for the above taxonomies What is the most efficient, performant method, of showing a brand menu when in a product type archive, and a product type when in a brand archive, but, only show the terms that apply to the posts in that group. So for example, if I am in the product group 'womens', it would show brands on the left hand side, but only the brands that are specified for products in the 'womens' product group. E.g. the brand 'Fancy womens clothes Inc' would show, but not 'Manly mens Manly ltd'. I need a generic answer, though I'm happy for the clothing products example to be used, and I know how to do this with a greedy algorithm by brute force, but that's incredibly wasteful, and I'm not interested in a solution that would increase every page load by several seconds and load all the posts in full from the DB in the process edit: Example 2: Pikachu is a yellow pokemon, and is in the yellow tag, but Pikachu is also an electric pokemon, so it's in the electric tag of the type taxonomy. How would I show only the types of pokemon that are yellow when in the yellow tag archive? e.g. all grass pokemon being green means that there would not be a grass menu item when in the yellow archive but there would in the green ( yes I know there are grass pokemon that aren't green )


title: Check user logged in with JS

text: I use FaceBook JS SDK to check whether the user has permission to log in to my site or not. If user has permission I log him into the WP site. **It is possible to check with JS whether the user already logged in or not?** Possible to check existance of `wordpress_logged_in_` cookie, and how? I am trying with this code, but doesn't work:               if (document.cookie.search(/^wordpress_logged_in_\w*/) >= 0) {       // Cookei exsist.       alert("Cookie");     }      thanks,


title: Should I store my Facebook access tokens?

text: I've built a custom login page for a Wordpress site which uses Facebook for authentication. Is there any reason to store the Facebook access token in my WP database, or does it make more sense to use a PHP session? Are there any benefits to storing these values on my server?


title: How do I create predefined menus for my theme?

text: This is my code thus far:               function register_my_menus() {         register_nav_menus(             array(                  'header-menu' => __( 'Header Menu' ),                  'extra-menu' => __( 'Extra Menu' )             )         );     }     add_action( 'init', 'register_my_menus' );      But this seems to only register 'locations' in which to place custom menus. What I want is for all the custom menus (and menu items) to be fully setup on `after_theme_setup` or `init`. Thanks


title: Adminbar Missing "Edit Page"

text:
I'm encountering a problem that involves that my Admin bar doesn't show the "Edit Page" on pages I visit on my site. Instead for some odd reason it show "Edit Category" instead on supposed page. Does anyone know what might cause this? I checked on another thread about putting `<?php wp_reset_query(); ?>` in the `footer.php` but this didn't work for me. I did it like this:               <?php endif; ?>     <?php wp_footer(); ?>     <?php wp_reset_query(); ?>                Update: I forgot to mention, that I first created a template which was a copy of another one, the only change was that it called a different function. That function was a copy from another, basically what it did was how much text it showed in a post. I also created a different loop.php(named loop2.php) so it could work with this template. So the conclusion of this was that you could choose now a new different template for your page (imagine that the original name was: _template_ and I created _template2_. The changes in **query.php** for the function **wp_reset_query()** which I did after the bug emerged was: **from:**               function wp_reset_query() {              $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];         wp_reset_postdata();     }      **to:**               function wp_reset_query() {     unset($GLOBALS['wp_query']);     $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];     wp_reset_postdata();      } I read somewhere on a forum that `unset($GLOBALS['wp_query']);` would help me.. Update #2: The code for the original template:                  <?php          /*         Template Name: Blog List         */         <?php get_header(); ?>

             <?php tie_breadcrumbs() ?>                  <?php if ( ! have_posts() ) : ?>

<?php _e( 'Ej hittad', 'tie' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?>
                         <?php get_search_form(); ?>

             <?php endif; ?>

                     <?php the_title(); ?>

                  <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>             <?php $get_meta = get_post_custom($post->ID);  ?>             <?php tie_include( 'post-head' ); // Get Post Head template ?>
<?php the_content(); ?>
             <?php endwhile; ?>                  <?php //Above Post Banner             if( empty( $get_meta["tie_hide_above"][0] ) ){                 if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '
' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'
';                 else tie_banner('banner_above' , '
' , '
' );             }             ?>                  <?php $cat_query = '';             if ( !empty( $get_meta["tie_blog_cats"][0] ) ) $cat_query = '&cat=' . $get_meta["tie_blog_cats"][0] ; ?>             <?php query_posts('paged='.$paged.'&posts_per_page='. $cat_query); ?>             <?php get_template_part( 'loop', 'category' );  ?>             <?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>                  <?php //Below Post Banner             if( empty( $get_meta["tie_hide_below"][0] ) ){                 if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '
' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'
';                 else tie_banner('banner_below' , '
' , '
' );             }             ?>                  <?php comments_template( '', true ); ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>      As I mentioned in the text I did a copy of this one to create a second template.. The copy used a different function. So instead of `the_content();` it used `blog();` which was a copy of `the_content();` except that it had a different value, the value determined how much text it would show in a post in my site.


title: unexpected   added in HTML at each update

text:
I'm using the last update of Wordpress and I'm not using Tiny MCE. I found many posts about it, but each time it was a bug from a previous version (closed) or linked to Tiny MCE. I modify my pages only in HTML because I'm using complicated CSS and DIVs. Each time I update my code lots of `$nbsp;` are added everywhere even if I remove every spaces between my tags and even at the begining. Here is an example : **before** _(it's the beginning of the page, there's no space or line before`<aside>`)_:               [...]
[...]      **after** :               $nbsp;          [...]          $nbsp;
[...]      And next update each ` ` is duplicated, and next ones again (2,4,8,16...) I tried to add this to function.php, and it didn't work:               remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );


title: How to choose a sort order (for posts) per category? (ideally when creating a new category)

text: Assume I have a bunch of posts (articles) in two categories: "upcoming events" (cat=1) and "past events" (cat=2). When listing all posts of a specific category out of those two, category 1 shoud be listed in ascending order (first posts first, i.e. earlier upcoming events first), while category 2 should be listed descendingly (earlier previous posts for past events should appear further down the list). With menu entries for navigation, I can use URL parameters like mywordpressblog.example/?cat=1&order=asc However, since I have to add the second parameter "manually" it'll disappear when people just click on the category label that's shown for each post. Hence, I need to pick a sort order when creating or modifying a category, so that this sort order be used when showing all posts of that category. Is there a way to do this? * * * Several related questions don't help me out - since their either asking for defining completely custom sort orders, for sorting categories (not posts), or because they're not yet solved or involve some twinkering the the code which I'd like to avoid in order for plugin and wordpress updates to work well. Setting Custom Sort Order of Posts within a Category http://wordpress.stackexchange.com/questions/22021/different-post-sort-order- within-different-categories Ascending sort order for monthly & category view, i.e. ?m=201204, ?cat=4


title: Language selection for blog doesn't exist?

text: I've been installing and developing on Wordpress for a while with a focus on sites in Hebrew. Recently I moved a site from a multi-site installation I have for development to it's own hosting and domain (in the MU environment I used a third level domain for access). I used BackupBuddy to export and ImportBuddy to install in the new location. two different (but possibly related which is why I am combining them to a single question) appeared.   1. In the Settings->General in area there is no language selection dropdown, even when I add the Hebrew language files and check that the wp-config.php has the line: > define ('WPLANG', 'he_IL'); See also screenshot at http://screencast.com/t/9KgtF7e2v0   1. Hebrew text that was hardcoded into some of the templates (such as footer.php) is renderd as question marks ??? ??? instead of proper Hebrew glyphs while the Hebrew text that was stored in the DB (as part of post content etc.) appears just great. Page Encoding is set to UTF-8, the php files that are the templates are also UTf-8 encoded and appear just fine in a text editor (the hebrew characters) - all site uses the same font... Can anyone help me with this mistery? Site in question is: shanilasser.com


title: How to force <p> insertion in editor

text: # **EDIT 2** The following edit has some mis-information, see the selected answer and comments. # **EDIT** I am a fool. The editor **was** in fact adding `<p>` tags as expected. I was using a combination of `get_the_content()` and `the_content()`. Apparently the former will strip out these tags, just leaving a block of text _(which still leaves me in a predicament but im sure I'll figure something out)_ follow up question: should I delete this question? or is this kind of thing helpful to have in the search....? * * * When I paste text from different sources into the wordpress (tinyMCE) content visual editor I am getting different results. Ironically, it works how I want it to when pasting from MSWord, but not when going from notepad (or another website, or notepad++). Ideally I would want any pasted text to get wrapped in `<p>` tags (based on line breaks) and otherwise have minimal markup added. The big issue here is the `<p>` : linebreak issue. I want the client to be able to paste a few paragraphs of text in and be able to set the margins and padding so as to make it look nice. This must be a pretty normal expectation, and I am suprised that I am having difficulties with this, as I have built several WP sites before without noticing this issue.


title: Modifying .page-content background image

text: How can I implement it so that I switch per-post background images from the WP post-edit screen? A developer helped me built a custom WP theme, but can't help me out right now. On this page: http://vernisaj.ro/guetlinvelo/a-la-carte/litespeed/ there is a background image on the following CSS element:               .page-content { background-image: url('http://www.....' }      However in the WordPress editor, I can't seem to find this picture (I looked in all php files and css files, it's in there). Thanks for the help! EDIT: With the WordPress Editor I mean the one you'll get through Appearance -> Editor.


title: Creating author profiles with extra fields and exporting that data?

text: I'm trying to find a way to let my subscribers sign up to my site and enter details in their author pages to confirm their attendance at an event. In order to create the additional fields, I've been following this excellent tutorial by Justin Tadlock: http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user- profile-fields However, I need a way to export that information - is there a plugin that would let me do that? Or a useful resource for building something that would let me export that info as a csv file? Thanks for any pointers, Osu


Is there a way to use regular categories with custom post types? It seems like there is better functionality and options with regular categories (such as permalink options, etc.).


title: looking for wordpress action hook for new pending post?

text: Im looking for an action hook to link my function to when a completely new post is created with a **status of pending**? I'm aware of 'save_post' and others but want to target **specifically when a post is new**. Found this on a previous question:               add_action('new_to_publish', 'your_function');     add_action('draft_to_publish', 'your_function');     add_action('pending_to_publish', 'your_function');      but could do with something like `new_to_pending` or similar? any help would be great! Thanks


title: Is it advisable to use `add_rewrite_rule()` to serve a custom page?

text: I have a page called "dynamic" that's not stored in the post table at all (not a post, page or custom post type of any sort); the reason being is all the data is completely dynamic based on `$_GET` requests. This is a pretty close representation of how I've done it               add_action( 'init', array( $this, 'add_custom_rewrite' ) );     add_action( 'parse_request', array( $this, 'custom_requests' ) );     add_filter( 'query_vars', array( $this, 'custom_query_vars' ) );          function add_custom_rewrite() {         add_rewrite_rule(             'dynamic/?$',             'index.php?dynamic=true',             'top'         );     }          function custom_requests( $wp ) {         if( !empty( $wp->query_vars['dynamic'] ) ) {             dynamic( $_GET );         }     }          function dynamic( $get ) {         // ... do stuff with $get         load_template( get_template_directory() . '/dynamic.php' );         exit;     }      Now I ask this question as the page seems to finish early. It loads up the `wp_footer()` function and all the good stuff, but doesn't show an admin bar like all the other standard pages. Is there a better way to approach this issue; maybe using a real post type stored in the DB and referencing that?


title: Displaying comments with a walker: how to distinguish between parent and child comments

text:
I have defined a walker in function.php to display comments in a certain way. I use the following code:               function speld_comment($comment, $args, $depth) {     $GLOBALS['comment'] = $comment; ?>     <?php      global $comment_count;     $comment_count++;      ?>          <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">     <div id="comment-<?php comment_ID(); ?>">
             <?php echo get_avatar($comment,$size='48',$default='http://www.speld.nl/wp-content/themes/speld5/images/avatar.png' ); ?>
<?php echo $comment_count; ?>

             <?php if ($comment->comment_approved == '0') : ?>             <?php _e('Een moment geduld, uw reactie wordt beoordeeld door de Speld Waarheidscommissie.') ?>             <?php endif; ?>
                 <?php printf(__('%s'), get_comment_author_link()) ?> •                 <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s, %2$s'), get_comment_date(),  get_comment_time()) ?>                 <?php // we want to add 'Zie profiel' here.. comment_author_link()  ?>
             <?php comment_text() ?>
                 <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'reply_text'=>'Reageer', 'max_depth' => $args['max_depth']))) ?>

      I've also enabled reacting to a comment (1 level deep). The problem is in the comment_count variable. Whenever somebody replies to a comment, the numbering for all comments below the reply shifts one number down. I'd like to prevent that from happening. Is it possible to make an if statement in the walker that allows reactions to a comment to not contain the comment_count variable? Any help would be greatly appreciated!


title: How to display each level of taxonomy children on separated pages?

text: For the products page I've created custom taxonomy with 3 levels of subcategories. I have to display for each term the image and the title(i'm using a plugin which gives you the permission to add an image to a category). What I really want is to display the list of subcategories( title + image ), each level on separated pages(when you click on the parent category to display the first level of subcategories, when you click a subcategory to display the 2nd level of subcategories, and so on). Here's the code from the taxonomy file: http://pastebin.com/3HaK83Uk And here is the my_list_category function: http://pastebin.com/eSenz2qM Right now, when I click on the category parent it displays all levels of subcategories. Can someone help me with that?


title: Wordpress: Keep order of query_posts list of post ID's using post__in

text: I need to request a certain list of posts in the order I want. I'm getting the posts using:               query_posts('category_name'=>'cases', 'posts_per_page'=>5, 'post__in'=>$_SESSION['sorting'], 'paged'=>$paged);      It works in that I get the posts in the array $_SESSION['sorting'] but the problem is that my sorting gets lost even if iI don't suggest a special orderby field. Can anyone help me?


title: Add additional data to a specific taxonomy term when used in a post

text: If I'm using a custom post type for a Movie or a TV show episode, I may use a taxonomy for "actors" and assign all the actors related to the work to it, but I'm not sure how, besides of that, I can also add **the character the actor is playing in said work**. The characters themselves may or may be not a taxonomy, as sometimes one also needs extra space for adding notes, like "John Doe (voice)" or "John Smith (via stock footage). I can figure something like a metabox with columns for each thing, yet I'm not sure how to make it harmonious (or do it at all).


title: How can i show all categories using wp query?

text: <?php $recent = new WP_Query(); ?>     <?php $recent->query('cat=1&showposts=2'); ?>      With what can i replace cat=1 to show posts from all the categories?


title: Posts & page twice display

text: I install a fresh blog and add some posts & pages. With normal template/theme the pages and posts are fine while showing twice when i changed the theme. The problem lies in the template but i don't have any idea, is there any problem in the loop or something else? ### Additional Info: Theme is Sahifa, a multi purpose magazine theme. If you need code sample of any file. i will show you.


title: Change labels on 'Nickname' and 'Biographical Info' in user-edit.php

text: For a project I'm working on, I want to change the labels of the 'Nickname' and 'Biographical Info' fields on edit profile (user-edit.php) page in the dashboard. I still want to use those fields as they are, I only want to change the labels. Anyone know of a function that can do this?


title: security issue in wordpress?

text: I have installed wordpress in `www.mysite.com/user` and now suppose if someone is familiare with wordpress he/she can easily access my stuffs through `www.mysite.com/user/members` `www.mysite.com/user/groups` etc even he can see all stuffs from `www.mysite.com/user` without logging in to my site.Is there any way to prevent this.something like access denied if he is not logged in or any kind of redirection to a specific url. or something like You don’t have permission to access `/members/` on this server .I am facing lots of problem because of this.I am using frisco for buddypress theme.


title: how to edit bbp_forum_freshness_link() format

text: I'm trying to find how to edit format of `bbp_forum_freshness_link()` function in bbpress plugin. E.g. currently it displays how many days ago there was last activity and I would like to display date. So if someone would like to share some thoughts or code snippets, that would be great.


title: Pushing to git from wordpress (not the other way around)

text: Is there any way to link the wordpress theme-editor to a git repository? So when a file is updated in the wordpress editor the change automatically gets pushed?


title: Display pictures instead of text in menus

text: I am working on a custom theme. In that theme, I am creating a menu called "social" for links to the social sites, such as twitter, facebook, ...etc. Now, Instead of text, I would like to display social media icons. How can I do that? Make every menu item an image? Thanks.


title: How do I display user name, role and site name using HTML tags inside a dashboard notification?

text:
Here's what I have so far as my notification, but I can't find any information around how to input the user's name, role and site name within those sections. You can see where they are supposed to go. Any help would be much appreciated as I've been stumped for a few days now...               function my_network_notice(){         global $pagenow;         if ( $pagenow == 'index.php') {                  echo '

[DISPLAYNAMEHERE]

[USERROLEHERE], [SITENAMEHERE]

     }         }         add_action('admin_notices', 'my_network_notice');


title: WordPress Caching - Transients API or "update_user_meta " Cronjob?

text: I'm trying to set user meta based on queries. Basically, things like IF the query returns true, set this or if not, set this (or don't set it, if it is true). This works great but the problem is I currently make the call EVERTYIME to check true or false which I know is bad and unnecessary especially for the types of queries I am making (if it is true, it will ALWAYS stay true after that). So, how should I cache these requests? Should I set it with the WordPress Transient API or should I do a cron job to run every X hours and then "update_user_meta" based on the result? I am just a bit lost on either approach and need some guidance on the right path for this. Thanks!


title: Is wp_reset_postdata always necessary?

text: After run a query               $posts = (array)new WP_Query($args);      I use this data to do some calculation on post meta. I didn't display the posts. Do I still need to use `wp_reset_postdata` after the query?


title: Second wp_query doesn't appear to be working

text:
I've set up this query in Wordpress to find all associated news for a company:
Related News
            <?php $link = get_the_title(); ?>         <?php $portfolioloop = new WP_Query( array( 'post_type' => 'news' ) ); ?>     <?php while ( $portfolioloop->have_posts() ) : $portfolioloop->the_post(); ?>           <?php $post_link = get_post_permalink(); ?>         <?php $post_title = get_the_title(); ?>                                 <?php  if (get_field('featured_companies') != "") { ?>
             <?php foreach(get_field('featured_companies') as $post): ?>                 <?php $company = get_the_title(); ?>                 <?php if ($company == $link) { ?>                     <a href="<?php echo $post_link; ?>"><?php echo $post_title; ?>
                 <?php } ?>              <?php endforeach;?>
         <?php } ?>     <?php endwhile; wp_reset_query(); ?>      I then wanted to create the same thing but find all events associated with the company. Even though news and events are setup exactly the same way it doesn't seem to work, what am I missing???
Related Events
         <?php $link_e = get_the_title(); ?>          <?php $portfolioloop_e = new WP_Query( array( 'post_type' => 'events' ) ); ?>     <?php while ( $portfolioloop_e->have_posts() ) : $portfolioloop_e->the_post(); ?>           <?php $post_link_e = get_post_permalink(); ?>         <?php $post_title_e = get_the_title(); ?>                                 <?php  if (get_field('featured_companies') != "") { ?>
             <?php foreach(get_field('featured_companies') as $post_e): ?>                 <?php $company_e = get_the_title(); ?>                 <?php if ($company_e == $link_e) { ?>                     <a href="<?php echo $post_link_e; ?>"><?php echo $post_title_e; ?>
                 <?php } ?>              <?php endforeach;?>
         <?php } ?>     <?php endwhile; wp_reset_query(); ?>      I tried wp_reset_query, but I don't have any real clue what to do!


title: List taxonomy term "Last Name" + "First Name" (taxonomy custom field) in a post loop

text: I have a few custom fields for a taxonomy "Author". The term title is the Author's last name, and one of the custom fields is his first_name. Now I need, in a post loop, to list all "Authors" of that post by their full name. How can I do this? I'm using Ultimate CMS plugin to manage taxonomy custom fields.   Just to be clear this is a post type "Academic Article" with the authors as a taxonomy. Thank you.


title: Wordpress multisite with same content

text: Trying to accomplish the following. Any help / advice is greatly appreciated. 1) I have multiple domain names (e.g., site1.com, site2.com, site3.com). 2) I need each domain to display the same content BUT 3) Show a different wordpress theme.Plugins are same...etc Thank you


title: How would one go about adding a category name to the url of multisite subsite?

text: How would one go about adding a "category" name to the url of multisite subsite? eg. http://mainsite.com/categoryname/subsite Simply editing site info settings doesnt help. I am trying to make a collection of subsites look and feel as though they are a category in the main site.


title: Arrange BBpress topics by created

text: The default setting in the bbpress forum topics is that the most active topic automatically gets on top (sorted by freshness). However, I wish to change this setting in descending order of topics created or by topic id. I have tried to locate the template file to make these changes but could not get. Any help is appreciated.


title: Creating a shortcode in a plugin that includes JS

text: I use a lot of embedded tweets on my site. The script always gets stripped out. I added Twitter's code to my theme, but it doesn't work with infinite scroll. So I'd like to make a shortcode that will import the needed script from Twitter. Please take a look at what I've got below. I can't get it to work and I'm not sure what's wrong. Thanks.               <?php     /*     Plugin Name: Tweet Shortcode     Description: Use [tweet] to insert the Twitter embed javascript so it won't be stripped from your post.     Author: Nate Hill     Version: 0.1     */          add_shortcode( 'tweet', 'tweets' );     function tweet_code( $atts ) {     $tweet_text = <<<'EOD'     <!-- Tweet JS. Do not edit. -->     <script LANGUAGE="JavaScript"  TYPE="text/javascript" async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>     <!-- end  Tweet JS tag -->     EOD;     return $tweet_text;     }


title: Moving from development while pulling production database without overwriting, to production

text: I am involved in a redesign of a client's website and during development the client has been adding posts/pages and working with existing plugins that were on the site. I have made a new theme and added new plugins including plugin settings to the new design. My question is how can I pull the current production database to my development without overwriting what I've developed. I was looking at the wp-db-migrate-pro plugin to migrate only certain tables but there are some complications. the wp-posts tables includes navigation menus and pages and if I were to pull that table I would destroy the pages and menus I have created. In addition there are plugin settings I need from the production site but pulling the wp-options table would overwrite the plugins and their settings I have on development. Is there an easy deployment strategy I could follow to grab data while not overwriting my own? This article https://deliciousbrains.com/avoiding- wordpress-database-merging/ talks about it but the two strategies suggested aren't really viable for me as they are difficult to write and manage.


title: Registration and Profile custom field

text: How to add custom field in wordpress registration form and view it in user profile in the backend? I've already google it but just find how to add it in user profile but not in registration process.


title: CSS not loading correctly

text: I have made a website, and am hosting it on my Raspberry Pi. It works really well on the LAN, but when I look at it through a proxy, or shoot the link to a friend, all I/they see is plaintext. Since I use Firefox, I pulled up Firebug. Oddly, it seems to indicate that the page has loaded the CSS (Stylesheets appear to be there, but not in use). Or at least that's what I believe to be happening. Any help appreciated. **I guess I should have clarified that I created a WP webpage.


title: Frontend file upload works, but I get error "Constant ABSPATH already defined"

text: I am uploading files from the frontend. It works perfectly, yet I am getting the error: > Constant ABSPATH already defined This is at the top of my file upload script:               require ($_SERVER['DOCUMENT_ROOT'] . "/wp-load.php");     // require two files that are included in the wp-admin but not on the front end.  These give you access to some special functions below.     require ($_SERVER['DOCUMENT_ROOT'] . "/wp-admin/includes/file.php");     require ($_SERVER['DOCUMENT_ROOT'] . "/wp-admin/includes/image.php");      `wp-load.php` is not being loaded anywhere else manually, only here. The file upload works as expected, the only issue is the Notice that PHP is spitting out. If I use `require_once` then I get more errors (though it does still upload as expected?). Any ideas? **Edit: more information** A search through /wp-content/* shows the term wp-load only once - that is from the above code. Maybe there is a way to autoload wp-load.php without including the phrase wp- load?? The code requiring wp-load is within a theme template (not a plugin). Specifically, within a page-template that allows a custom post to be added/edited from the frontend. If I remove the line that requires wp-load.php, then the image upload still works. However, I get the following errors (sensitive info in directory structure has been omitted):               Notice: Undefined offset: 1 in /<Path to file>/file_upload.php on line 25          Notice: Undefined offset: 1 in /<Path to file>/file_upload.php on line 26          Notice: Undefined offset: 1 in /<Path to file>/file_upload.php on line 27          Notice: Undefined offset: 1 in /<Path to file>/file_upload.php on line 28          Notice: Undefined offset: 1 in /<Path to file>/file_upload.php on line 29          Notice: Undefined offset: 2 in /<Path to file>/file_upload.php on line 25          Notice: Undefined offset: 2 in /<Path to file>/file_upload.php on line 26          Notice: Undefined offset: 2 in /<Path to file>/file_upload.php on line 27          Notice: Undefined offset: 2 in /<Path to file>/file_upload.php on line 28          Notice: Undefined offset: 2 in /<Path to file>/file_upload.php on line 29          Notice: Undefined offset: 3 in /<Path to file>/file_upload.php on line 25          Notice: Undefined offset: 3 in /<Path to file>/file_upload.php on line 26          Notice: Undefined offset: 3 in /<Path to file>/file_upload.php on line 27          Notice: Undefined offset: 3 in /<Path to file>/file_upload.php on line 28          Notice: Undefined offset: 3 in /<Path to file>/file_upload.php on line 29          Notice: Undefined offset: 4 in /<Path to file>/file_upload.php on line 25          Notice: Undefined offset: 4 in /<Path to file>/file_upload.php on line 26          Notice: Undefined offset: 4 in /<Path to file>/file_upload.php on line 27          Notice: Undefined offset: 4 in /<Path to file>/file_upload.php on line 28          Notice: Undefined offset: 4 in /<Path to file>/file_upload.php on line 29          Notice: Undefined offset: 5 in /<Path to file>/file_upload.php on line 25          Notice: Undefined offset: 5 in /<Path to file>/file_upload.php on line 26          Notice: Undefined offset: 5 in /<Path to file>/file_upload.php on line 27          Notice: Undefined offset: 5 in /<Path to file>/file_upload.php on line 28          Notice: Undefined offset: 5 in /<Path to file>/file_upload.php on line 29      This error is referencing the $file_array array from here:               if ($count_files > 0) {         foreach ( range( 0, $count_files ) as $i ) {                  // create an array of the $_FILES for each file             $file_array = array(                 'name'      => urlencode($_FILES['logo']['name'][$i]),                 'type'      => $_FILES['logo']['type'][$i],                 'tmp_name'  => $_FILES['logo']['tmp_name'][$i],                 'error'     => $_FILES['logo']['error'][$i],                 'size'      => $_FILES['logo']['size'][$i],             );                  if ( !empty( $file_array['name'] ) ) {                      $uploaded_file = wp_handle_upload( $file_array, $upload_overrides );                      $wp_filetype = wp_check_filetype( basename( $uploaded_file['file'] ), null );                         $attachment = array(                     'post_mime_type' => $wp_filetype['type'],                     'post_title' => preg_replace('/\.[^.]+$/', '', basename( $uploaded_file['file'] ) ),                     'post_content' => 'logo',                     'post_author' => $logged_in_user,                     'post_status' => 'inherit',                     'post_type' => 'attachment',                     'post_parent' => $_POST['post_id'],                     'guid' => $uploads['baseurl'] . '/' . date( 'Y/m' ) . '/' . $file_array['name'],                     'post_date' => date( 'Y-m-d H:i:s' ),                     'post_date_gmt' => date( 'Y-m-d H:i:s' )                 );                           $attach_id = wp_insert_attachment( $attachment, '/' . date( 'Y/m' ) . '/' . $file_array['name'], $_POST['post_id'] );                      $attach_data = wp_generate_attachment_metadata( $attachment_id, $uploaded_file['file'] );                      wp_update_attachment_metadata( $attachment_id,  $attach_data );                      set_post_thumbnail( $_POST['post_id'], $attach_id );                  }         }     }


title: wp_editor content not being saved when used in a theme customizer option

text: I am replacing one of the default Customize options for the Formation theme (https://wordpress.org/themes/formation) in order to add the WYSIWYG content editor to it. I've succeeded in removing the parent theme's option and adding the one from my child theme instead. The content editor shows up and functions mostly as expected. The problem I'm having is when I type in the content editor, the "Saved" button stays grayed out and will not change to "Save & Publish." Even if I edit another option that causes the button to change, the content is not saved. However, the corresponding "featured_button_url_child" option is still saved. Here is the relevant code from my child theme's function.php file: http://pastebin.com/et1ZirW3 The method I'm using is mostly based off the information in the following link, along with the theme's existing customize options: https://github.com/paulund/wordpress-theme-customizer-custom-controls I'm new to setting up Customize options, so maybe I'm missing something fundamental when it comes to saving or handling the values? I appreciate any help!


title: $args Orderby The number

text: I have this code               $cat_args=array(     'include' => '42,210,21',     'orderby' => '42,210,21',     'order' => 'asc'      );     $categories=get_categories($cat_args);       foreach($categories as $category) {         $args=array(          'showposts' => 1,          'category__in' => array($category->term_id),          'caller_get_posts'=>1      );      I want the `orderby` to be the same order of `include`, not by name or id


title: Can I use widgets & shortcode if I need to return an array?

text: I'm trying to achieve the following functionality. I have several widget 'areas' that I can place widgets into. I programmed these widget areas into the theme of my site and I can turn them on and off in the admin panel. The widget areas are basically sections on my site and I place text widgets into them and ads into those text widgets. The widget areas are also filled with other assorted content (newsletter sign up form, most popular posts, ect..). I am using a plugin to do my ad management ( http://wordpress.org/plugins/ads- by-datafeedrcom/ ) and it has very nice functionality. I place the shortcode into my text widgets and the ads show up as expected. I need to be able to exclude ads from the db queries that this plugin makes. I can pass in the ads to be excluded as attributes in the shortcode - this is not an issue. My problem is I need to get the ID of the ad being displayed by the shortcode. I want the shortcode to return both the shortcode textual content and an array of excluded ads containing the current ad along with any previous ads (this would prevent duplicate ads from appearing on the site). I would then pass this array of excluded IDs into the next shortcode via attributes and a global variable. My question is this: Can shortcodes return anything other than strings? Is my setup (shortcodes to call ads, text widgets, managing ad placement by enabling widget areas) untenable? I've gotten as far as this `[dfads params='groups=1234&ad_class=sidebar- ad&limit=1&orderby=random&excluded_ads=1,4,6']` which calls this `function dfads_shortcode( $atts ) { return dfads( $atts['params'] ); }` `dfads` returns `get_ads` and `get_ads` returns this `return array($this->output( $ads, $this->args ), $excluded_ads);` So I am returning an array containing a string ($this->output) & array ($excluded_ads) and I want to display the string and capture the array to pass on to the next shortcode. Should I be doing this all in code in the loop? Is it possible to get this functionality out of widgets & shortcode? -- Update 1 I noticed there are [methods]http://www.emanueleferonato.com/2011/04/11/executing-php-inside-a- wordpress-widget-without-any-plugin/ for running php code inside widgets. Is this a safe if it's an admin only feature? Do I still have access to global variables? Is the execution flow basically the same as if I had the php code in my page flow where the widget appears instead of in the widget? I could execute all this within the page being displayed but it seems a lot cleaner for administration by having this stuff in the widgets/dashboard.


title: Change order of posts

text: I made a post recently that did not explained myself right! Come again, but with better explanations. I need the "Select Option" change the order of query_posts. My current code is:               <select>         <option selected="selected">Select order of posts</option>         <option>Highest price</option><!-- hypercart_meta_price  "order=DESC" -->         <option>lowest price</option><!-- hypercart_meta_price  "order=ASC" -->         <option>Discount in%</option><!-- hypercart_meta_discount  "order=DESC" -->         <option>Release Date</option><!-- date  "order=DESC" -->     </select>     <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>     <?php query_posts( 'post_type=products&orderby=meta_value_num&order=DESC&meta_key=hypercart_meta_discount&key=price&cat=' .get_query_var('cat')."&paged=".$paged); ?>     <?php get_template_part("loop-products"); ?>      I just need to know how to change the query_posts using the "Select box" Thank you for understanding. Hug! **UPDATED MY ISSUE** , sorry for the inconvenience.


title: How do I make my function add variables/values to the $post object?

text:
How do I add `$tzDesc` and `$tzEmbed` (and other variables) to the `$post` object in the following function so that I can display the values in my theme files by inserting `<?php echo $tzDesc; ?>`?               add_action( 'the_post', 'paginate_slide' );          function paginate_slide( $post ) {              global $pages, $multipage, $numpages;              if( is_single() && get_post_type() == 'post' ) {              $multipage = 1;         $id = get_the_ID();         $custom = array();         $pages = array();         $i = 1;              foreach( get_post_custom_keys() as $key )             if ( false !== strpos( $key, 'slide' ) )                 $custom[$key] = get_post_meta( $id, $key, true);              while( isset( $custom["slide{$i}-title"] ) ) {                  $page = '';             $tzTitle = $custom["slide{$i}-title"];             $tzImage = $custom["slide{$i}-image"];             $tzDesc = $custom["slide{$i}-desc"];             $tzEmbed = $custom["slide{$i}-embed"];                  $page = "
{$tzTitle}
";             $pages[] = $page;             $i++;         }              $numpages = count( $pages );         }     }      If you know and can provide an answer can you please be very detailed in how the code should be structured because my knowledge of php is very minimal and I have tried to do this numerous already without any success. Thanks.


title: Custom SQL Query for Wordpress page

text: I'm quite new to wordpress. I'm trying to build a tableview within a wordpress page. Therfore I need a custom SQL Query to my MySQL Database.   1. Query data from my MySQL Database   2. Get the result somehow in a HTML format in order to display it in a table view within a wordpress page. My question is: How can I use the wpdb_class in a wordpress page when it is not an option to put php code in a page?


title: Integrate Facebook comments with native comments

text: I've finally installed the Facebook Comments plugin to allow readers to comment using their Facebook identity. After the installation, I got two different comment sections, with two separate comment chronologies, two comment counters and two comment text boxes. Is there a way to integrate the two comment sections?


title: Include custom post type in "all posts"

text: (Working of off an existing team that the client already purchase.) I have a WordPress install with a couple of custom post types:   * portfolio   * testimonials I've set the taxonomy to `hierarchical' => false,`, the tagging options are available in the backend and I can display them on the front-end. However, when I click one of the tags, I go to the list of standard posts with that tag, not to the list of custom posts (portfolio or testimonials) with that tag. Is it possible to display both regular and custom posts in the same taxonomy?


title: Replace a word with a word in the URL string

text: I'm trying to replace a word on every page for example "Denver" with a word from a URL string, so I'll have like `?city=Atlanta` in the URL. So I was thinking of using PHP's GET to just get the city from the URL string and `str_replace` to replace it, but which action/hook in WordPress do I have to attach it to? The word will appear throughout the entire page, including title, logo description, content, footer, etc... so it can't just replace content only.


title: Minimum Word Count Before A Post Can Be Made Pending Review

text: I'm looking for a way to check that a post has a minimum word count before allowing it to be sent for review (added to the pending post status). Below is the code I have:               if (current_user_can('contributor')) {     function minWord($content){             global $post;             $num = 150; //set this to the minimum number of words             $content = $post->post_content;             if (str_word_count($content) <  $num)                 wp_die( __('Error: your post is below the minimum word count.') );     }     add_action('draft_to_pending', 'minWord');     }      This appears to "work", in that it brings up an error message when the word count is indeed below 150. However, the post is still saved as a "pending". Is there any way to prevent the post from being made pending, but instead keep it saved as "draft". Cheers Peter


title: Website Broken on Activating Child Theme!

text: My website (at http://japanaddicts.org) breaks down in a rudimentary pro-HTML form when I try to activate the child theme. My parent theme is Codilight. Just explain to me why is this happening. I am not looking for Codilight-specific premium support, but a reason that any knowledgeable person will know. I have prepared my child theme with nothing but this:               /*           Theme Name:   Codilight Child         Theme URI:             Description:  A modified and more specific version of Codilight.         Author:       Prince         Author URI:   http://japanaddicts.org/         Template:     codilight         Version:      1.0.0         Tags:         pink, lesser social buttons         Text Domain:       */     @import url("../codilight/style.css");      I've uploaded it to a new directory wp-content/themes/codilight-child. When I activate it and open my website, it opens in a broken format (not fully HTML neither fully Codilight style). I had to revert back to the original/parent Codilight. I've read the guide at WordPress Codex and it doesn't help. Here's a screenshot of how my website looks under the child theme: ![Screenshot of the website under the child theme](http://i.stack.imgur.com/315I4.png)


title: How do display gallery embedded to the custom post type

text: I have a custom post 'events'. For each post there is a gallery attached. On a main galley page i am displaying featured images from each post . Now i want that when person clicks on this featured image , he should be taken to a new template where images from the embedded gallery of the post are displayed using get_post_gallery(). I can't use permalink because it will take me to the 'single-event'. How can i do it ? Please help me out.


title: How to create a WP theme that use BootStrap?

text:
I am pretty new in WordPress and totally new in BootStrap development (I have beginning to study BootStrap yesterday) and I have the following doubt about how create a custom WP template that use BootStrap from 0. For example I have the source of this page made using BootStrap: http://www.html.it/guide/img/bootstrap/demo/home.html and I want try to create a WP template starting by it. Some time ago I have realized a standard HTML\CSS template for WP, can I use the same tecnique dividing the previous page into (header, footer, content, etcetc) and the put in these section the WP php code to show articles and other WP functions? Is it the right way? The other doubts is related to the upper slideshow, in this slideshow the immage are fixed and definied in a static way:

        Lorem ipsum
        sit dolor
        adipiscing elitur

        Lorem ipsum
        sit dolor
        adipiscing elitur

        Lorem ipsum
        sit dolor
        adipiscing elitur

      And what can I do if I want that the administrator can choose the immages that should be displayed from the backend (I think in the theme configuration panel) Can you give me some ideas about how do these things? Tnx Andrea


title: How to add a new variable to blog creation form?

text: I'm trying to add a new INPUT field to the blog creation form on Buddypress. Adding the front-end element is the easy part. I'm having some hard time trying to save it. The variable is a string, and I've added `wpmu_new_blog` a function that adds the variable as an `option` (`add_option('name','value');`). Despite the fact I've specified `global $variable` in the function, the variable won't pass. Ideas? Thanks!


title: a better search?

text: hi how to create advanced search with out plugin, create with form * Support for "+" (must have) and "-" (must not have) * Search title, content, excerpt, taxonomies or comments (or any combination thereof) * Search within a date * Search for at least one word in phrase * Search exact phrase * Search for combinations of exact phrase and any words


title: Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )

text: I have updated my permalink structure to `/archive/%post_id%`, but if someone uses a URL like `/archive/456857` instead of the full URL of `/blog-test`, WordPress shows the post without giving a 301 to the full URL. Isn't this poor SEO? Sites like tumblr and stackexchange automatically send a 301 to the full URL. Any hacks/code/plugins/settings/etc to fix this? `/archive/456857` does get a 301 to `/blog-test` but `/archive/456857` does not and ends up in two separate URLs to the same content. My permalink structure is `/archive/%post_id%`.


title: Need help cleaning up a wordpress site after being hacked

text: _Off Topic? Maybe, point me to where this would be On Topic!_ Hi All, My daughter attends a private school. Recently their wordpress website was hacked and they need some help cleaning it up. I don't have the experience with wordpress to help. Are there services or websites that they could use to find the expertise to help with this? Of course they would be compensated. Here is a description of the problem: Thanks! -DF5 > Thank you for getting back to me. We are trying to detect any possible back > door vulnerabilities in our Wordpress installation that may be allowing > scripts or bots to place malicious code on our website. We have been hit by > a specific drug company. This code seems to turn up in our pHp files. The > original problem was that people who clicked twice on any page of our site > were redirected to this drug website!! > > We have cleaned the installation manually, but there may still be scripts > running in the database or remaining vulnerabilities because we did not want > a re-installation of a clean version of Wordpress. We have scanned the > database and there appear to be no known rogue files, but we are concerned > that there may still be scripts running that are very well hidden. We > basically need someone to start by looking through our files to see if there > is something we and the scan missed. > > There is a lot of customization we did on our website and are trying to > avoid a clean install. We are also in contact with Dream Host (our hosting > company) to see if it is a server issue as we are uncertain if this is a > Wordpress vulnerability via a plugin or a server issue that Dream Host can > resolve. > > The website seems to be functioning well now, we are mainly trying to > prevent another problem and to eradicate any malicious code so we are not > penalized in the search engines.


title: Can anyone recommend a wordpress based CRM/Project Management system or plugin?

text: Hello I am wandering if anyone can recommend, from first hand experience, a reasonably simple CRM or project management plugin for wordpress. I have read this question on the topic. But am looking for slightly more detail and if possible someone who has actually used one of these. The functionality I am looking for is to be able to store contacts, share files, have a forum/message board or even chat type area and some simple task/project management functions such as assigning cases to team members. One more thing, if possible users should be able to select their preferred language, preferably at least with English and Simplified Chinese, although I accept this may not be possible or may require manual translation. I have used both sugarcrm and vtiger, but have found that them to be a bit bloated and was wondering if any of the wordpress option available would be suitable for our needs. Thanks.


title: if statement on database query

text: Part of a voting script I'm working on: I'm checking a custom table in my WP database to see if a user already voted for a post by checking the IP address and the post id. If the user's IP already exists for the post they voted, I want to echo "Already voted!" otherwise add the IP. This is what I came up with..               global $wpdb;     $voter_ip = $_SERVER['REMOTE_ADDR'];      $post_id = $_POST['post_id'];          if (!($wpdb->get_row("SELECT voter_ip FROM wp_voter_ips WHERE post_id = $post_id AND voter_ip = $voter_ip") ) ) { //if IP address for matching post id not found in wp_voter_ips table     $wpdb->insert( $wpdb->prefix . 'voter_ips', array( 'post_id' => $post_id, 'voter_ip' => $voter_ip ) ); //add IP and post_id     echo "voted!";     }     else //if IP already exists     {     echo "Already voted!";     }      I triple checked to make sure the variables and column names are correct. Regardless of the if statement, it inserts the voters IP even when it already exists.


title: Grouping related postmeta data via SQL query

text: I am using someone else's WP plugin which stores lots of related data in `wp_postmeta` using an "artificial key". So effectively we hijack `wp_postmeta` to create a nested relational database. So one row will have                meta_id = 999        post_id = 130        meta_key = 'event_id'        meta_value = '19'        Then 4 other actual wp_postmeta rows that share that post_id contain the rest of the information for that virtual "row" of data. For example                meta_id = 989      post_id = 130      meta_key = 'Name'      meta_value = 'Fred'      And we will have lots of "virtual rows" (hundreds) that all share that `event_id` of 19 (and of course lots of others with different `event_id`s of their own. I have tried many SQL queries, but I am stumped. How can I get a table that has grouped info for a common event_id? It doesn't have to have _all_ the data, just one piece, such as the 'Name' field. I tried a subquery like this:               SELECT meta_value from wp_postmeta      WHERE meta_key='name' AND      post_id IN      (SELECT post_id FROM wp_postmeta      WHERE meta_key='event_id' AND meta_value='19');      That probably looks laughably stupid - it also doesn't work. I also tried JOIN. This seems like something that would come up a lot in WP coding, but I have searched and come up pretty much empty.


title: How to place an image after Nth number of posts in query_posts

text:
I am using the following code to print out the last 8 published post in columns of 3 so 3 column and 3 rows :               <?php       $args = array(                    'post_type' => 'post',                    'posts_per_page' => 8,                    'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)                    );       query_posts($args);       $x = 0;       while (have_posts()) : the_post(); ?>                  <?php if($x == 2) { ?>
         <?php } else { ?>
         <?php } ?>           <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('featured-home-portfolio'); ?>           <a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
           <?php the_excerpt(); ?>
                <?php if($x == 2) { echo '

'; $x = -1; } ?>            <?php $x++; ?>       <?php endwhile; ?>       <?php wp_reset_query(); ?>       now I want to place an image after 5th post . which is row 2 column 3. I modified this code for so many times but I can not get that image to show up after post 5 only. I added this :               <?php if($x == 2) { ?>
         <?php } elseif($x == 5) { ?>      // image      <?php } else { ?>      but does not work . I really appreciate if someone help me to figure out this. thanks


title: How can I locate the single buddypress forum post template?

text: I have been trying for ages to locate the template that shows a single forum post template and I cannot find it. Does anyone know where this is located? Thanks


title: Why isn't my rewrite rule working when there is no second parameter?

text: Here is my rewrite rule code:               add_rewrite_rule('tides/([^/]+)/([^/]*)', 'index.php?page_id=4348&location=$matches[1]&month=$matches[2]', 'top');     add_rewrite_tag('%location%', '([^&]+)');     add_rewrite_tag('%month%', '([^&]*)');      This works great for the following URL:               /tides/mylocation/mymonth/      but 404's on the following:               /tides/mylocation/      I'm flushing the rewrite rules every time I change the code. I tried changing `*` to `+` but no help there. Any ideas? **Edit:** Some answers were suggesting adding another rewrite rule so I added:               add_rewrite_rule('tides/([^/]+)/$', 'index.php?page_id=4348&location=$matches[1]', 'top');      before my other rule, but still no luck.


I'm running into issues on my localhost where when I navigate to my registration page I get the following error message _User registration is currently not allowed._ What I've tried so far:   1. I've checked my settings menu under `wp-admin/network/site-settings.php?id=1` and under _Users can register_ I have a `1` entered.   2. I've tried turning my plugins on and off.   3. I've checked `wp-admin/admin.php?page=bp-page-settings` and all necessary pages exist and are listed.   4. I've tried echoing `wp_register('','',false);` to see if that lends any clues and it just turns up blank. This isn't the case on my other server (which I had thought was configured identically to my localhost). Registration is allowed and the echo above provides the link. No idea what's going on here and am working against a deadline (aren't we all, right?) so any ideas would be greatly appreciated.


title: Plugin allowing for artists, events and venues

text: I'm working on a music festival website and up until now have used WordTour. I really like WordTour's artists > events > venues content hierarchy, but am having difficulties transitioning from last year's festival to this year's. Ultimately, I'm finding I may need to move on to something else. I need to ultimately do two things: a. Create a listing for each artist playing at the festival b. Assign each artist timeslots at the festival's three stages. Some artists play more than one stage. With WordTour, I did this by assigning an Artist to an Event (i.e., a specific time), which was then assigned a Venue (i.e., a specific stage). ## Is there any way I could do something similar to WordTour with custom post types? If so, any suggestions how? It seems like I could create a custom post type — Artists — which would have a meta box allowing me to pick multiple timeslots (how, I'm not at all sure) and a custom taxonomy for festival year. I could create a second post type for Stages, but how would I reference the second post type from the hypothetical date picker meta box? Any help at all with this would be very much appreciated. Many thanks!


title: Cache previous versions of website?

text: I'm working on a new site for a charity. They publish a printed magazine & we would like the website to always reflect the current issue of the magazine. So far I have a front page (home page) with excerpts from 3 most recent lead articles (wp posts). For layout purposes, the articles are categorized as frontpage-left, frontpage-right-top & frontpage-right-bottom. We also have a sidebar with a menu to all the articles in the current issue (posts list). Now looking for advice on the best way to store old/previous "issues" of the website as a complete, working archive so visitors can view them?


title: Pagination: /tags/tag_name/?paged=2 gives a 404 error

text: I need to paginate an archive page. Pagination works perfectly fine for everything except tag/category archives. Basically if I use /tags/tag_name/?paged=2 it gives me a 404 error. But if I use /tags/tag_name/?page=2 it works fine. Unfortunately I need to use /tags/tag_name/?paged=2 I reckon it has to do with rewriting. These are the existing rules WP has:               tags/([^/]+)/page/?([0-9]{1,})/?$   index.php?tag=$matches[1]&paged=$matches[2] post_tag     tags/([^/]+)/?$ index.php?tag=$matches[1]   post_tag      I have tried all the combinations of rewrite rules I could think of to make /tags/tag_name/?paged=2 work. No success. How can I make it work? === What I found out it is only ?paged=2 that gives me trouble. /tags/tag_name/?abc=2 doesn't give a 404. Makes no sense to me. === ok, so what I decided to do is unset $_GET['paged'] in functions.php and set it's value back in header.php. Then I changed all the code to avoid using WP's get_query_var. Works for now.


title: Tag Posts showing in wrong places

text:
Am using a custom template (tag.php) to show posts related to tag. So when someone clicks on say tag ‘A’ then he/she gets redirected to my tag.php layout instead of default template for archives. I did this by making a tag.pho in my child theme. Now the problem is some of my posts are marked with multiple tags. for example - Tag ‘A’ – 15 posts Tag ‘B’ – 5 posts Tag ‘A’ & ‘B’ – 20 posts. Now when someone clicks on Tag ‘A’ from sidebar tag list, then it gets the list of 15 posts which is right. But when someone clicks on Tag ‘B’ then also the user gets the list of same 15 posts. The problem do not ends here, am also using ‘paged’ option, so when user (while seing Tag ‘A’ posts) clicks on next page, then it is shown as blank. But when user sees posts of Tag ‘B’ then also there is pagination visible (but it should not be because there are only 5 posts) and when user clicks next page, then it shows 404 error. Here is the code -               <?php           function uttt_custom_loop()       {         global $post;         $tags = wp_get_post_tags($post->ID);         $first_tag = $tags[0]->term_id;         // arguments, adjust as needed         $args = array(             'post_type'      => 'post',             'tag__in' => array($first_tag),             'post_status'    => 'publish',             'paged'          => get_query_var( 'paged' )         );              global $wp_query;         $wp_query = new WP_Query( $args );             $cnt=1;         if ( have_posts() ) : while ( have_posts() ) : the_post();          ?>             <div id="post_page_grid" style="<?php echo (isset($cnt) && $cnt==7)?'clear:both':'';?>">                  <?php $link_to_pic = post_custom('restro-pic'); ?>

                             <?php                             if ($link_to_pic !='')                              { ?>                                 <img src="<?php echo $link_to_pic; ?>" alt="restaurant-pic"/>                                 <?php                              }                              else if ($link_to_pic =='')                                  { ?>                                  <?php                                  } ?>

                             <?php echo do_shortcode('[starrater tpl=10 read_only=1]'); ?>

                         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                         <?php the_excerpt(); ?>

              <?php     $cnt=$cnt+1;         endwhile;             do_action( 'genesis_after_endwhile' );         endif;         wp_reset_postdata();     }     remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'uttt_custom_loop' );          genesis();


title: Display Custom Taxonomy in Sidebar in Two Columns

text:
I have a custom post type (photos) with a custom taxonomy (categories) and I'd like to display the taxonomy list in my sidebar in two columns. I have a modified snippet that I found elsewhere to do this, but it doesn't generate the current class for the particular category it is on. Maybe it is not the best way to list the taxonomy to begin with, so I hope someone will suggest a better solution. Here's what I have now:               <?php $term = get_term_by( 'name', 'categories', 'photos' );           $cat_term_id = $term->term_id;          $cats = explode("
",wp_list_categories("title_li=&echo=0&child_of=$cat_term_id&depth=1&style=none&taxonomy=categories"));     $cat_n = count($cats) - 1;     for ($i=0;$i<$cat_n;$i++):     if ($i<$cat_n/2):     $cat_left = $cat_left.'
'.$cats[$i].'
';     elseif ($i>=$cat_n/2):     $cat_right = $cat_right.'
'.$cats[$i].'
';     endif;     endfor;     ?>
     <?php echo $cat_left;?>

     <?php echo $cat_right;?>
      Thanks!


title: Single post - display list of all posts + specific post

text: my single post looks like that: http://pastebin.com/KdEbs82P I want to display on single post two things:   * list of ALL posts in general   * single post title    * content What I achieved right now is not satisfing because I AM displaying all posts (and it works ok) but the second part (connected with showing only specific post title and content) don't work. By don't work I mean - it shows only the newest one;/ So giving it into real example: I have 2 posts called "News about IT" and "TV series". Post about TV is the newest one. After clicking on News about IT i will see all posts in the top and as a main part - title and content of NEWS ABOUT IT. Right now using my solution it shows TV series as a newest post.. how to achieve my solution?


title: Load js/css files only on specific admin UI pages

text: How do I adapt this solution to work with my plugin? (Please see the link). I enqueue my css and js script as follows:               function my_plugin_init() {      wp_enqueue_script('my_plugin_script', plugins_url('js/the_filepath.js', __FILE__), array('jquery'));      wp_enqueue_style( 'my_plugin_css', plugins_url( '/css/the_filepath.css', __FILE__ ) );     }          add_action('init', 'my_plugin_init');      I tried putting this in the theme's functions.php, but it didn't work:               function remove_my_plugin_extras() {         remove_action('init', 'my_plugin_init');     }          if( !is_page('My_Page') ) {         add_action('wp_head', 'remove_my_plugin_extras');     }      The script and css still loaded. How do I adapt the solution in this case?


title: How to display sorted posts in the 'All Posts' page

text: I've been following this tutorial to build a sorting page for my posts: http://soulsizzle.com/jquery/create-an-ajax-sorter-for-wordpress-custom-post- types/ The sorting works fine, but the new sorting is not reflected back in the 'All Posts' section under 'Posts', it only displays sorted under the 'Sort Posts' submenu created by this code in the tutorial. How would I extend this further to also sort the posts correctly under 'All Posts', as it is a bit confusing for the user as it is? Also, does anybody know why there is no functionality for sorting, especially for pages and custom post types (I can imagine posts being more date- oriented), built into the WP Core?


title: Permalinks: custom post type -> custom taxonomy -> post

text: I am having trouble working with wordpress' rewrite rules, and could use some help. I have a custom post type called _shows_. All _shows_ have a single custom taxonomy category _show-category_. A _show_ will never have more than one _show-category_. I would like my urls to route in this manner: www.mysite.com/shows/ => archive-shows.php www.mysite.com/shows/%category%/ => taxonomy-show-category.php www.mysite.com/shows/%category%/%postname%/ => single-shows.php So as a real world example, lets say we have a _show-category_ "Foo" and a _show_ post titled "Bar" that has "Foo" as it's _show-category_. I would expect my wordpress app to look like this: www.mysite.com/shows/foo/ => shows all posts under the foo category www.mysite.com/shows/foo/bar => shows the indivual post I try to avoid plugins when possible, but am open to any solution. Thanks.


title: Translation for plugin

text: I modified a .po file, basically I opened as txt file and made the changes, however I uploaded it and is changes are not working. I wonder if I need an special software for doing and generate a new .mo each time I make a change, or what am I missing? Thank in advanced


title: How to prefill the username/password fields on the login page

text: For a demo environment, I would like to pre-fill the username and password fields of the wp-login form with respectively "demo" and "demo" string. Thus users will just need to click on the "Log-in" button to connect to the admin area. There is a way to do that ? Maybe with a hook ? Thanks for your advises


title: How to add .htaccess code through a function?

text: I need to add the following .htaccess code through a function                   <IfModule mod_deflate.c>     # Insert filters     AddOutputFilterByType DEFLATE text/plain     AddOutputFilterByType DEFLATE text/html     AddOutputFilterByType DEFLATE text/xml     AddOutputFilterByType DEFLATE text/css     AddOutputFilterByType DEFLATE application/xml     AddOutputFilterByType DEFLATE application/xhtml+xml     AddOutputFilterByType DEFLATE application/rss+xml     AddOutputFilterByType DEFLATE application/javascript     AddOutputFilterByType DEFLATE application/x-javascript     AddOutputFilterByType DEFLATE application/x-httpd-php     AddOutputFilterByType DEFLATE application/x-httpd-fastphp     AddOutputFilterByType DEFLATE image/svg+xml          # Drop problematic browsers     BrowserMatch ^Mozilla/4 gzip-only-text/html     BrowserMatch ^Mozilla/4\.0[678] no-gzip     BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html          # Make sure proxies don't deliver the wrong content     Header append Vary User-Agent env=!dont-vary     </IfModule>          ## Expires Caching ##          <IfModule mod_expires.c>     ExpiresActive On     ExpiresByType image/jpg "access 2 week"     ExpiresByType image/jpeg "access 2 week"     ExpiresByType image/gif "access 2 week"     ExpiresByType image/png "access 2 week"     ExpiresByType text/css "access 2 week"     ExpiresByType application/pdf "access 2 week"     ExpiresByType text/x-javascript "access 2 week"     ExpiresByType application/x-shockwave-flash "access 2 week"     ExpiresByType image/x-icon "access 2 week"     ExpiresDefault "access 2 week"     </IfModule>          ## Expires Caching ##       In my themes function.php               function add_htaccess     {     //the above code to add     }      I just don't want to add it manually.


title: Gettext for custom field checkbox values

text:
I have a custom field (created with ACF) that allows the author to choose from several options (in admin) and where these choices are displayed on the front- end. The code producing the custom field is :               array (     'key' => 'field_52dcf154e272e',     'label' => __('Selling Points', 'mytheme' ),     'name' => 'selling_points',     'type' => 'checkbox',     'instructions' => __('Check 4 items', 'mytheme' ),     'choices' => array (         'Bed linens included key' => __('Bed linens included value', 'mytheme'),         'Full bed linens included' =>__('Full bed linens included', 'mytheme'),         'Free WIFI and Internet Access' => __('Free WIFI and Internet Access', 'mytheme' ),         'Free (in-room) WIFI' =>__('Free (in-room) WIFI', 'mytheme' ),          'Breakfast included' => __('Breakfast included', 'mytheme' ),         'Safe provided in room' => __('Safe provided in room', 'mytheme' ),         'Individual room key' => __('Individual room key', 'mytheme' ),         ),     'layout' => 'vertical',     ),      The problem is that the value is displayed in the admin choices and the key is currently displayed on the front-end. In teh page template I have the following code:               $count= 0;     $points = get_field_object('selling_points');          foreach ( $points['value'] as $point ){         if($count < 4 ){             printf(__('
%s
', 'mytheme' ), $point);             $count++;         }     }      when I `var_dump($points)` I get:               Array     (         [key] => field_52dcf154e272e         [label] => Selling Points         [name] => selling_points         [_name] => selling_points         [type] => checkbox         [order_no] => 1         [instructions] => Check 4 items         [required] => 0         [id] => acf-field-selling_points         [class] => checkbox         [conditional_logic] => Array             (                 [status] => 0                 [allorany] => all                 [rules] => 0             )              [choices] => Array             (                 [Bed linens included key:] => Bed linens included value                 [Full bed linens included] => Full bed linens included                 [Free WIFI and Internet Access] => Free WIFI and Internet Access                 [Free (in-room) WIFI] => Free (in-room) WIFI                 [Breakfast included] => Breakfast included                 [Safe provided in room] => Safe provided in room                 [Individual room key] => Individual room key             )              [layout] => vertical         [default_value] =>          [value] => Array             (                 [0] => Bed linens included key:                 [1] => Free WIFI and Internet Access                 [2] => Petit déjeuner inclus                 [3] => Safe provided in room             )          )      So apparently AFC is getting the value based on the key. How can I then take the values in the array `[value]` and convert them into a gettext calls?


title: Make taxonomy terms appear in the order they were made

text: IS it possible to make taxonomy terms appear in the order they were made, in the backend? They keep appearing in alphabetical order. I tried using `sort` but it doesn't seem to be working. This is my code for creating custom taxonomies:               $taxonomies['size'] = array(                 'hierarchical' => true,                 'query_var' => 'size',                 'sort' => true,                 'rewrite' => array(                     'slug' => 'size',                 ),                 'labels' => array(                     'name' => 'Size',                     'singular_name' => 'Size',                     'update_item' => 'Update Color',                     'edit_item' => 'Edit Size',                     'add_new_item' => 'Add Size',                     'new_item_name' => 'Add New Size',                     'all_items' => 'All Sizes',                     'search_items' => 'Search Sizes',                     'popular_items' => 'Popular Sizes',                     'popular_items_with_comments' => 'Separate sizes with commas',                     'add_or_remove_items' => 'Add or remove sizes',                     'choose_from_most_used' => 'Choose from most used sizes'                 )             );


title: Pulling Twitter RSS feed not working as expected (fatal error)

text:
I'm trying to get some of the latest posts from a Twitter account, without a plugin. According to Botcrawl.com's tutorial, this should be enough:
     <?php     include_once(ABSPATH . WPINC . '/feed.php');     $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BarackObama');     $maxitems = $rss->get_item_quantity(4);     $rss_items = $rss->get_items(0, $maxitems);     ?>
     <?php if ($maxitems == 0) echo '
No items.
';     else     // Loop through each feed item and display each item as a hyperlink.     foreach ( $rss_items as $item ) : ?>
     <a href='<?php echo $item->get_permalink(); ?>'>     <?php echo $item->get_title(); ?>
     <?php endforeach; ?>
      However, I get the following error:               Fatal error: Call to undefined method WP_Error::get_item_quantity() in /Users/username/Desktop/journal_wp/wp-content/themes/Journal_theme/index.php on line 155      Has anyone had any experience with this, and know _why_ it is calling a fatal error?


title: XML-RPC Response from server does not contain valid XML

text: I have previously succeeded in making 200 post via XMLRPC, but strangely 3 days ago I got the error message "Response from server does not contain a valid XML". I've been looking for solutions of various site for 3 days but no result. I was reinstalling my wordpress site and the problem is still same. I think my code is right because I'm using it for 1 month. I used vb.net to post, see below:                   Public Structure category         Public categoryId As Object         Public parentId As Object         Public description As Object         Public categoryName As Object         Public htmlUrl As Object         Public rssUrl As Object     End Structure     <XmlRpcUrl("http://nullgames.com/xmlrpc.php")> _        Public Interface IWP         Inherits IXmlRpcProxy              <XmlRpcMethod("wp.getCategories")> _         Function getCategories(ByVal args() As String) As category()     End Interface     Public Structure blogInfo              Public title As String         Public description As String         Public mt_keywords As String()         Public categories As String()          End Structure              Public Interface IgetCatList             <CookComputing.XmlRpc.XmlRpcMethod("metaWeblog.newPost")> _             Function NewPage(ByVal blogId As Integer, ByVal strUserName As String, ByVal strPassword As String, ByVal content As blogInfo, ByVal publish As Integer) As String         End Interface          Sub SendPost(ByVal titlepost_ As String, ByVal bodypost_ As String, ByVal categorypost_ As String)         Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()         Dim args() As String = {"http://nullgames.com", "Admin", "xxxxxxxxx"}          Dim categories2() As category         categories2 = proxy.getCategories(args)         For Each category In categories2             Debug.Print(category.categoryId)             Debug.Print(category.categoryName)             Debug.Print(category.description)             Debug.Print(category.htmlUrl)             Debug.Print(category.rssUrl)         Next         Dim result As String = Nothing         Dim newBlogPost As blogInfo = Nothing         Dim categories = CType(XmlRpcProxyGen.Create(GetType(IgetCatList)), IgetCatList)         Dim clientProtocol = CType(categories, XmlRpcClientProtocol)         clientProtocol.Url = "http://nullgames.com/xmlrpc.php"              newBlogPost.title = titlepost_         newBlogPost.description = bodypost_         newBlogPost.mt_keywords = New String() {p_tags}         newBlogPost.categories = New String() {categorypost_}         result = ""         Try             result = categories.NewPage(1, "Admin", "xxxxxxxxx", newBlogPost, 1)             idPost = result         Catch ex As Exception             MessageBox.Show(ex.Message)          End Try     End Sub      When I use the same code to post via xmlrpc in my other wordpress site, it works... Any Idea?


title: Make posts automatically from an Online XML file through wp cron job

text: I want to import posts from a RSS feed using the WP Cron API. Here is the link to the XML Feed. I activated different Feed Aggregator wordpress plugin but it gives error.               Problem:     FeedWordPress encountered the following error when trying to retrieve this feed:     A feed could not be found at http://www.propspace.com/feed/xml.php?cl=1371&pid=8245&acc=8807. This does not appear to be a valid RSS or Atom feed.     If you think this is a temporary problem, you can still force FeedWordPress to add the subscription. FeedWordPress will not be able to find any syndicated posts until this problem is resolved.      A guy told me to write a php code to update the values in MySQL and then call in WP. I have no clue with this.


title: Multiple Categories under one URL, where 'Front Page' is used already

text: I couldn't find an answer relating to this, maybe I just didn't come across it yet. So the setup of the site I am working on at the moment: The Front Page is not set, is default. I can't change this because of the way the template functions, it would be too much work for me to change it. The site already has categories setup, but none are called 'Blog'. The client wants there now to be a 'Blog' category which see can assign posts to as her personal 'Blog' - away from the rest of the site's categories. The thing is she also wants to have a number of other categories' posts show up when navigating to that '/blog/ URL. How would I go about doing this?   1. Would I duplicate the existing 'archive.php' file and make modifications, and somehow point the /blog/ URL to it?    2. Do I have to modify the 'archive.php' file to pick up the URL and modify the query?   3. Create a filter/action for his purpose. The page would display like any other archive, as in posts are listed in date order back. **Note:** I can't move the existing categories, they must stay where they are. I'm wondering by doing this at all will it have repercussions i.e. will it cause other issues? Thanks for your time, much appreciated.


title: How to get postname in custom page?

text: I'm adding custom pages in WordPress and trying to handle WordPress with my own CMS. I'm using all WordPress' hooks to manage all these things. Now, I can make a custom post saying "a new album" but I don't know how to give a post name to it. The database entry of `post_name` in the `wp_posts` table remains blank now as I don't know what to put there.


title: WP-e-commerce (getshopped) - Annoying permalink issue

text: i’m using wp-ecommerce (getshopped) and WPML on a website, all pages display correctly when i use the default (/ugly…) permalink structure, but when i try to use the much desired permalink structure /%category%/%postname%/ something weird happens:   1. product categories list page displays the homepage   2. single category and single product pages show the main blog page (list of post) This prevents me from using my desired permalink structure, which is a major issue for me. I tried updating WPEC to the latest beta version (didn’t help) and i tried switching to twenty ten to see if the problem is related to my theme (and it isn’t) Questions: 1. Could this be related to the fact that i use hebrew words in my slugs? 2. Is there any known issues related to WPEC and permalinks that i should be aware of? 3. Can anyone point out the solution? Thanks in advance


title: How to get WordPress term attached to the Post?

text: How to retrieve all WordPress terms attached to the Post and Other Post type? Assumed I don't know/don't care about the taxonomy, term name/term id etc, the only thing I know is post_id. Thank you.


title: Custom Post type - how to get checkbox to update meta field to null

text:
I have 7 meta fields for a custom post type in Wordpress. These 7 in particular are days of the week (Sunday thru Saturday) and have checkboxes for each. I've successfully gotten the checkbox to POST when the value is "On", however when I return to the edit page and try to deselect, the value stays the same in the database. Here is what I have for each item input:
<input type="checkbox" name="sunday" <?php if( $meta_sunday == true ) { ?>checked="checked"<?php } ?>" /> Sunday

      And my update lines:               if(!isset($_POST["sunday"])):         return $post;         endif;         update_post_meta($post->ID, "sunday", $_POST["sunday"] );


title: Rich Custom Field for Custom Post type not saving

text: I am new to creating meta boxes and I am trying to create a custom field meta box that is connected to a custom post type which is created by WooTheme Sensei (Post type = lesson). I am trying to use wp_editor, but the issue is I can't seem to get the field to save. I have checked many similar questions here and Google a lot, trying different solutions but nothing seems to work, I must be missing something! These are the 3 functions I am using, I tried to turn debugging on but nothing seems to stand out. Any help is appreciated!               add_action( 'add_meta_boxes', 'add_educadme_related_resources_metabox' );     add_action('save_post', 'save_educadme_related_resources', 10, 2);          // Add the Custom Fields Meta Boxe     function add_educadme_related_resources_metabox() {         add_meta_box('educadme_related_resources', 'Related Resources', 'display_educadme_related_resources', 'lesson', 'normal', 'high');     }               // The Custom Fields Meta Metabox     function display_educadme_related_resources() {         global $post;         // Get the resources data if its already been entered         $educadme_resources = get_post_meta($post->ID, 'Related_Resources', true);         wp_editor( $educadme_resources, 'related-editor', array( 'textarea_name' => 'related_resources', 'media_buttons' => false ));     }          function save_educadme_related_resources(){         // Is the user allowed to edit the post or page?         global $post;         if ( !current_user_can( 'edit_post', $post->ID ))             return;         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return;         }         // OK, authenticated: we need to find and save the data         update_post_meta($post->ID, "Related_Resources", $_POST["Related_Resources"]);          }


title: Multisite: use media from one site vs. copying the same media to all language sites?

text: This is a business site with product images. I have a multisite installation with 3 languages in 3 directories which will later be mapped to completely separate domains by the host when it's finished. The media (EDIT: in one of the sites) currently consists almost completely of large images (EDIT: total 1.8GB) that are not language-dependent, and editors will need to add the same images when creating pages with the texts in their language. However, their media library is currently empty. Do you recommend the language sites somehow using media from just one of the sites since the content is virtually identical, or do you recommend copying the same media to all the language sites? I have languages as separate sites because they will differ in structure, but they will use the same images. If you recommend using one site's media library, how is it achieved? Network Shared Media plugin doesn't work for me because its tab doesn't appear for the Add Image button of a plugin that I must use. If you recommend copying images, can you recommend the most efficient way of doing this that won't cause a PHP timeout?


title: Developing a Wordpress plugin like a component in Joomla

text: My mission:   I have a system that could have been a standalone website, but I would like to be a part of an existing CMS so that I can avoid writing my own user management system, forum, blog system, etc. I could have made it as a component in Joomla! as I have been working with that before, but unfortunately I do not like Joomla! and have therefore chosen Wordpress. My problem:   My system should both have admin pages and front end pages available inside my Wordpress page. I have been able to create a plug-in and add admin pages, but I have yet to find out how to make the front end. One solution could be to create a page-template in my chosen theme, but as I want to seperate my component from Wordpress as much as possible, and also want it to be theme- independent this is a bad solution. How can you help:   Please provide me with a simple example or guide me towards either a tutorials or an existing Wordpress plug-ins for me to look at to be able to make my plug-in. Bear in mind that this plug-in should only be used on my page and that I only want to use Wordpress as a shell for the plug-in.


title: jquery conflict with widget page

text: I'm trying to create a widget plugin that uses a jQuery code to show/hide divs in the widget form based on the selected option of a select drop menu. The jQuery code I'm trying to implement is working fine everywhere else, but in the widgets page it makes the widgets not working (not expandable or dragable). This is my code on jsfiddle: http://jsfiddle.net/fj63g/111/ /* update */ The full plugin code can be found here: http://jsfiddle.net/qNc62/


title: Collaborate on wordpress local website, share files via dropbox?

text: How can one share and sync files of a WordPress website with users that can edit (collaborate on) the website locally on their own instance? Can Dropbox be used to share the WordPress website files and database data? If so which directories should be shared? Or should one use a Distributed version control system like Mercurial to do this? I think if the files are shared than there will be a copy of WordPress database files for each user. The website is under local development and is not hosted with WordPress . Can multiple user accounts be used on the shared WordPress files or just a single user account is allowed to edit the WordPress website? Also what about plugins, can they be shared with its contents for a WordPress website?


Is there any way I can get the search results to a variable in search.php file? Now I have the following code in my search.php file.               <?php if (have_posts()) : ?>
<?php _e( 'Search Results', 'buddypress' ) ?>
             <?php while (have_posts()) : the_post(); ?>             ......      I know the while loop uses some variable that contains the search results. Now I want to use this variable before the loop. I need this variable to do some processing before displaying the results.


title: How to validate a user from ouside wordpress/php?

text: I'm working on an ajax application that will be embedded in a wordpress page. The ajax app exchanges data with servlets running on tomcat. Now the servlets need a way to determine if a request comes from a user that is logged in to wordpress. And if the user is logged in, the servlets also must be able to determine the users id in order to be able to query the database. If the user is not logged it, the request will be denied. So in other words, I need to let a servlet perform a request only if the user who caused the request is logged in to wordpress (version 3.3.x). Both, the servlet (tomcat) and wordpress (apache2) run on the same physical machine and share the same database. In theory this could easily be solved by doing the following:   1. During wordpress logon, some user token gets stored in a javascript variable.   2. The ajax app forwards the user token to the servlets on every call.   3. The servlets use the token to query wordpress if it is valid (i.e. if the user is logged in) and perform or deny the request. The question is how can this be implemented on the wordpress side?   Because, what makes the theory so complicated is the fact that i have not yet done any php programming. First I was thinking of transmitting the wordpress_logged_in (auth) cookie to the servlet and let the servlet query wordpress if the auth cookie is still valid. But as it seems, this can't be done, as wp_validate_auth_cookie() always fails, even if cookie-data of a logged on user is passed. An other solution could be to develop a plugin that stores the sessionid and userid in a table, which could easily be queried by the servlets. Or maybe there's an other solution...


title: help with rewrite_tag and rewrite_rule for custom page GET variables

text: > **Possible Duplicate:**   >  custom htaccess rewrite rule for page ok i made another post and i got pointed to the Rewrite API however, when i do print_r($_GET) on the page, it echos an empty array heres my code in my themes function.php file using the Rewrite API:               function add_video_rewrite() {         add_rewrite_tag("%video_id%", '([^/]*)');         add_rewrite_tag("%video_src%", '([^/]*)');         add_rewrite_tag("%video_title%", '([^/]*)');         add_rewrite_rule('^video/([^/]*)/([^/]*)/([^/]*)', 'video/?video_id=$matches[1]&video_src=$matches[2]&video_title=$matches[3]', 'bottom');     }     add_action( 'init', 'add_video_rewrite' );      im trying to get this to work for an url like this: mysite.com/video/102230/MTAyMjMw/FC+Emmen+v+AGOVV+ApeldoornAyMjEx/ but when i visit that URL, my GET variables are coming up empty it works perfect when i visit this url: mysite.com/video/?video_id=102230&video_title=FC+Emmen+v+AGOVV+Apeldoorn&video_src=MTAyMjMw


title: Post editor loads empty

text: I am running WordPress 3.8 and I recently switched server, so didn't realize when the problem creep in but most likely its the server change and I need some help figuring it out. When I open post edit screen, the editor is empty. Switching context in Visual / Text happens but as if the editor is totally empty. There are no JS errors either. ![enter image description here](http://i.stack.imgur.com/gVhkE.png) Two things that I see happening: 1) The edit page screen always show this message when moving away from it or closing it, as if there is some pending request awaiting completion. ![enter image description here](http://i.stack.imgur.com/AHuXy.png) 2) There are weird characters in a post output now. This is happening for a lot of posts. ![enter image description here](http://i.stack.imgur.com/HIuaZ.png) If I dump the post content using `get_post()`, its shows up fine without any weird characters. Also if I dump the database and import on my local, everything works just fine. So I think there is some issue with the server only, perhaps a charset encoding issue? Ruled out any plugin causing it by disabling all plugins. Also not sure if its related, but there was some issue with concatenation of scripts and I had to add `define('CONCATENATE_SCRIPTS', false );` to make scripts load correctly. I am not sure where to look. Any ideas?


title: Migrating site, only header shows

text: I have copied my file structure to a new server, and exported the relevant tables to an SQL file. I have imported the tables to the new database. When I visit the new URL, only the header of the site is showing. If I log in I can see all pages and posts. I have tried turning php error reporting on in `wp-config.php` and `php.ini`, but nothing shows up when visiting the pages. Any idea what could be wrong or how to troubleshoot this? This is the latest error in the site log:               2012/11/01 23:17:06 [error] 23354#0: *309 FastCGI sent in stderr: "PHP Fatal error:  Call to undefined function dropdown_menu() in /home/nginx/domains/haz-ed.com.au/public/wordpress/wp-content/themes/uber/header.php on line 63" while reading upstream, client: 220.233.123.171, server: haz-ed.com.au, request: "GET /wordpress/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "haz-ed.com.au"      Could that be the source of the problem? What would cause this function to not be found?


title: Convert this relative path to absolute

text: In the .js script below, the ajaxPath reference breaks when the containing page is off the root directory of the site. Is there a workaround to make this path absolute?               jQuery(document).ready(function($){         initContentEditable();              var dir = ContentEditableSettings.content_editable_url;         var ajaxPath = 'wp-admin/admin-ajax.php'; //THIS RELATIVE PATH BREAKS OUTSIDE ROOT DIRECTORY              function initContentEditable(){                              $('.contenteditable.furniture').blur(updateContentEditable);             $('.contenteditable.custom').blur(updateContentEditableCustom);             $('.contenteditable.title').blur(updateContentEditableTitle);             $('.contenteditable').each(function(){                 var parent = $(this).parent();                 var display = parent.css('display');                 $(this).css('display', display);             });         }                 function updateContentEditableTitle(e){             e.preventDefault();             var span = $(this);             var data = new Object();             data.pid = span.attr('data-pid');             data.title = span.find('.saver').text();             data.action = 'ce_update_title';             data.security = ContentEditableSettings.nonce;             $.post(ajaxPath, data, onContentSaved); //AJAXPATH BREAKS AS RELATIVE REF         }


title: Why would changing a child theme to a normal theme pass a Template is missing. error

text: I have what used to be a child theme but I added to it to the point where its a theme on its own. I pulled out the Template line in the style.css and now I get the: This theme is broken. Template is missing. error. Why is this happening?