Shortcode in AJAX popup

I am trying to use a shortcode from Ultimate Facebook plugin to display a FB connect button in an AJAX popup and can't seem to get it work properly. I searched and used the solution given by djb in this question - Why might a plugin's 'do_shortcode' not work in an AJAX request?, but it worked only partially. Ideally, I want a user to be able to sign in using FB and then save the list to her account. I want to use the plugin instead of embedding direct code because creates a new user in wordpress too when someone uses FB connect. Procedure to reproduce issue -   * Go to http://www.ajaymreddy.com/stg/country/india/#   * Click on Start   * Select any of checboxes - take care to not click on the text against the checkboxes    * Click on Save button in the popup If you are not logged in, the fb connect button should show up. However, only the shortcode text is currently showing up. **Code in functions.php** -               //From http://wordpress.stackexchange.com/questions/53309/why-might-a-plugins-do-shortcode-not-work-in-an-ajax-request     add_action( 'init', function() {       ps_register_shortcode_ajax( 'show_fblogin', 'show_fblogin' );     } );          function ps_register_shortcode_ajax( $callable, $action ) {       if ( empty( $_POST['action'] ) || $_POST['action'] != $action )         return;       call_user_func( $callable );     }          function show_fblogin(){             if (!is_user_logged_in())               echo do_shortcode('[wdfb_connect]');             die ();     }     add_action( 'wp_ajax_show_fblogin', 'show_fblogin' );     add_action( 'wp_ajax_nopriv_show_fblogin', 'show_fblogin' );      **Code in ajax file** -               $(document).on( 'click', '#saveBtn', function (){                 if (myAjax.loggedin==1)                 {                         jQuery.ajax({                         type: 'POST',                         url: myAjax.ajaxurl,                              data: {                                 action: 'save_whslist',                                 selected: selected.toString(),                                 whsNonce: myAjax.selectNonce,                         },                         success: function(data, textStatus, XMLHttpRequest){                                 selected = [];                                 modal.close();                                 $("input.whsites").prop('disabled', true);                                 $("input.whsites").prop('checked', false);                         },                         error: function(MLHttpRequest, textStatus, errorThrown){                                 alert(errorThrown+' fail');                         }                         });                 }                 else                 {                         jQuery.ajax({                         type: 'POST',                         url: myAjax.ajaxurl,                              data: {                                 action: 'show_fblogin',                                 selected: selected.toString(),                                 whsNonce: myAjax.selectNonce,                         },                         success: function(data, textStatus, XMLHttpRequest){                                 modal.open({content: "
Please login to save your travel list
No auto posts on your wall!
"+data});                         },                         error: function(MLHttpRequest, textStatus, errorThrown){                                 alert(errorThrown+' fail');                         }                         });                 }         });


What is the advantage of the wp_options design pattern?

As we all know, a design pattern that is used frequently in Wordpress' DB code is the idea of persisting data for a particular object (blog/post/comment), indexed with a particular name or key. We see this pattern used in the following standard tables:   * wp_options   * wp_commentmeta   * wp_postmeta As far as I can tell, the motivation for this design decision was to enable plugin/theme authors to persist data easily (e.g. by using custom fields) without having to modify the database schema. It would seem to me that there are few other advantages to this approach, since it is significantly slower and makes it harder to implement complex queries. What are the other advantages to this approach, if any? * * * UPDATE: Reading info on the drawbacks of this approach:   * http://stackoverflow.com/questions/126271/key-value-pairs-in-relational-database   * http://geekswithblogs.net/darrengosbell/archive/2006/03/12/KVPsInDatabaseDesign.aspx


Custom registration URL lost when user makes signup mistake

I've followed instructions found on this site and elsewhere on the internet intended to let me give certain people a registration link that will let them sign up with a specific user role. The user role I want to give to **some** , but not all people, is a custom one called "unmonitored". I have it working by adding this code to my functions.php file:                   // signup stuff         add_action('register_form','show_role_field');         function show_role_field(){ ?>         <input id="role" type="hidden" tabindex="20" size="25" value= "<?php if (isset($_GET['role'])) {echo $_GET['role'];} ?>"  name="role"/>         <?php         }              add_action('user_register', 'register_role');              function register_role($user_id, $password="", $meta=array()) {                 $userdata = array();            $userdata['ID'] = $user_id;            $userdata['role'] = $_POST['role'];                 //only allow if user role is my_role                 if ($userdata['role'] == "unmonitored"){               wp_update_user($userdata);            }         }      This means that if someone registers at **www.[mywebsiteurl].com/wp- login.php?action=register &role=unmonitored** they are given the user role "unmonitored" - which is perfect. But the problem is that if they mess up their registration by entering an email address that has already been taken or mis-typing their invitation code (I'm using a plugin called Easy Invitation Codes http://wordpress.org/plugins/baw-invitation-codes/) they are presented with an error on **www.[mywebsiteurl].com/wp-login.php?action=register** - the crucial **& role=unmonitored** disappears from the URL, the user completes their registration and they get assigned the default user role instead of the "unmonitored" one I need them to have. Can anyone help me stop the error page stripping &role=unmonitored from the URL? Happy to give any code needed, apologies if I've omitted any info - not yet hugely familiar with this side of Wordpress.


list first post of Child Category on Category page

This may be a bit overcomplicated but this is exactly what my client is asking for and if there is anyway to accomplish this task it would be much appreciated. I've found lots of examples of just listing the name of the subcategory, but we need to be able to actually output the content of the first post in each category. We have several Parent Categories, each with several subCategories. On the parent Category page we would like to list the first post (only) of each subCategory. We would also like to achieve this with some sort of "current category" code to avoid having to create a new template file each time a new category is added. Please let me know if this is not clear enough or if you need more information!


Set posts per page for parent category and it's all children

I am trying to use the following function to set the number of posts per page for a specific category and all it's children:               function hbg_category_query( $query ) {     if( $query->is_main_query() && $query->is_category()) {         if (is_category( '14' ) || cat_is_ancestor_of( 14, get_query_var('cat'))) {         $query->set( 'posts_per_page', 32 );         }     }     return $query;     }      It works for the parent category and it works if I specify the ID(s) of the child categories, but I am trying to catch all the child categories (even new ones). Can anyone clarify what I am misunderstanding about how this works? Thank you, Greg


Default featured image set as background image

I'm using the following code to set my post featured image as a `background- image`…               <?php if (has_post_thumbnail( $post->ID ) ):           $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );           endif; ?>      How can I add an else statement so if the post doesn't have a featured image it will use a specific image `/images/featured.jpg` for example.


How Can I Automatically Post Wordpress Posts to 2 Domains

I am setting up a travel website on both a .com and .uk domain using wordpress. I want to be able to share the posts across two domains, i.e. publish a post on domain.com and have it appear on domain.co.uk. The domains are localised for American and British English. On the American site the category page is for vacation rentals and on the British site (.co.uk) the posts are categorized as holiday rentals. How can I post on one blog and synchronize between the two while still keeping unique categories?


Save voting stats with Posts 2 Posts

I am working on a website where I make connections from posts to posts with the Wordpress Posts 2 Posts plugin. Now I want my website users can vote whether they think the 2 connected posts are a good combination. Normally I save this data in a custom field. But one post can be connected to several other posts and with all these posts I need to save the vote stats, so I cannot save it in one custom field. Does anyone have an idea how I can tackle this best. Using a custom database table, make a custom field for every connection with one post? Other suggestions? Please let me know. Thanks!


Custom query AFTER rss fetch_feed not working

I'm trying to do a custom query after an rss `fetch_feed` but for some reason nothing shows up. The code I'm using to fetch the feed is:               <?php // Get RSS Feed(s)           include_once( ABSPATH . WPINC . '/feed.php' );                // Get a SimplePie feed object from the specified feed source.           $rss = fetch_feed( 'http://seko.se/feed.rss?rssId=97' );                if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly                    // Figure out how many total items there are, but limit it to 3.                $maxitems = $rss->get_item_quantity( 3 );                     // Build an array of all the items, starting with element 0 (first element).               $rss_items = $rss->get_items( 0, $maxitems );                endif;         ?>
             <?php if ( $maxitems == 0 ) : ?>
<?php _e( 'No items', 'my-text-domain' ); ?>
             <?php else : ?>                 <?php // Loop through each feed item and display each item as a hyperlink. ?>                 <?php foreach ( $rss_items as $item ) : ?>
                         <a href="<?php echo esc_url( $item->get_permalink() ); ?>"                             title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">                             <?php echo esc_html( $item->get_title() ); ?>
                           <time datetime="<?php the_date('Y-m-d'); ?>"><?php the_time(get_option('date_format')); ?></time>

                 <?php endforeach; ?>                 <?php wp_reset_query(); ?>             <?php endif; ?>
      And the query I'm trying to do after this is:               <?php       global $post;       $args = array(          'numberposts' => 2,         'post_type' => 'nyheter_cpt',         'category__not_in' => array( 157, 150 ),         );       $myposts = get_posts( $args );       foreach( $myposts as $post ) :  setup_postdata($post);     ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
           <?php the_excerpt(); ?>           <a href="<?php the_permalink(); ?>">Läs mer »

<time datetime="<?php the_date('Y-m-d'); ?>"><?php the_time(get_option('date_format')); ?></time>

<?php the_author(); ?>

            <?php endforeach; ?>     <?php wp_reset_query(); ?>      The query works just fine if I place it above the rss fetch_feed request, but as soon as I place it beneath it nothing shows up. Does anyone have a clue why?


Upload path/URL weirdness for the main blog of a multisite/network setup

We have a WP network (with domain mapping) that was started pre WP 3.5, so it was using `ms-files.php` and `wp-content/blogs.dir/` to store media files. I wanted to remove `ms-files.php` dependency and after doing some research started the process: I first tried not _moving_ any files from `blogs.dir/#/files` to `uploads/sites/#`, but to setup symlinks for that. Then I had some permissions issues so I just copied everything from `blogs.dir/#/files` to `uploads/sites/#`. Then I cleared the values for `upload_path`, `upload_url_path` and `fileupload_url` on each site. And finally updated/inserted `ms_files_rewriting = 0` in the `wp_sitemeta` table. Also added some rewrite rules to the `.htaccess` file to not have to deal with updating all URLs in DB. The main blog id in our setup is 2 and not the default which is 1: `define('BLOG_ID_CURRENT_SITE', 2);` As far as I know, and based on what I see in `wp_upload_dir()`, WP uses the root of the `uploads` folder for the main blog contents and `uploads/sites/#` for other blogs. So I have copied the content from `blogs.dir/2/files` to the root of the `uploads` folder and NOT to `uploads/sites/2`. Now here is the issue for media files on the MAIN BLOG: in the back-end, WP loads files from the `uploads` folder which is fine, but on the front-end it tries to load files from `uploads/sites/2` which doesn't exist and is weird! PS: I can just add another rewrite rule to have this fixed, but I really want to know what the reason is for `/sites/2` being added for the main blog.


Custom fields won't display on my blog page

I created a custom field called 'Page Description' which I use to create a custom title for each static page of my wordpress site. I use the code:               <?php echo get_post_meta(get_the_ID(),'Page Description',true); ?>      in my header.php. it displays in all of my pages except for my blog page. Can someone please help me figure this out? thanks. you can view the website here if it helps. www.tenspeedgreens.com


Post restoration

I backed up a version of my wordpress site which contains several posts. Lets call this website website A. I have a different website which also contains several posts. Lets call this one website B. Lets say I have a recent backup of website A, and I restore the contents of website A using a backup of website B. Is it possible to restore the posts contained in the backup of website A to the current state of website A (current state meaning restored with the backup of website B).


wordpress permalinks error 404

i am new to word-press, i have made my own theme in wordpress but the problem that i am facing is the permalinks which are not working and showing me error 404 when my permalinks settings are at default it gives "The requested URL /wordpress/wordpress/about/ was not found on this server." else if any other it gives "Page not found. Perhaps try searching?" and with this the Post URL in the address bar is localhost/wordpress/wordpress/about/%E2%80%9Dhttp:/localhost/wordpress/wordpress/2014/07/23/added- second-post/ i have searched a lot on Google searched for different forums but no such help that could be useful kindly help me in solving this issue,               <?php $the_query = new WP_Query( ‘showposts′ ); ?>             <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
             <a href=”<?php the_permalink() ?>”><img src="<?php bloginfo('template_directory'); ?>/img/post-images/Adithi_Dinner_blog.jpg" class="border" alt="image" />
<?php the_title(); ?>

<?php echo substr(strip_tags($post->post_content), 0, 100);?>

             <?php endwhile;?>      this is the code that i am using to retrieve posts, it works fine but the link doesn't when i click on it, it shows page Page not found. Perhaps try searching? and the url in the address bar is localhost/wordpress/wordpress/blog/%E2%80%9Dhttp:/localhost/wordpress/wordpress/added- second-post/%E2%80%9D


Custom Link Not Registered as Nav Menu Parent

My issue is that I have a horizontal menu, with a few hashed - '#' - custom menu links to prevent users from going to empty pages (the main categories were just made pages for the link structure). Now the issue further is that in my attempt to create a select dropdown menu for mobile, I am using logic to see if a nav item is a child to another nav item, but my custom nav items are not being registered as parents. Is there a work around to this? To be specific: I need to find out which nav items are children and add dashes to them for a better user experience: ex:   parent   - child   -- 2 child


How to configure a child-post of a parent-post to have hierarchical sub-posts?

**Question** : What plugin or coding configuration needs to be implemented to create this child-post to parent-post hierarchical, many-to-many post relationship? **Goal** : To be able to create sub-posts of a post. To have ability to create child posts of the parent post. This would consist of a non-hierarchical (the parent) post type to hierarchical (child-posts) post types to have multiple parent-to-child relationships. **Concept** : Below is the concept that I am trying to achieve When I create 1 post, I can then attach/link that post to a parent post. Producing the same concept as “Child Pages”.   1. **Parent Post** : theme.dev/parent-post   2. **First Child Post** : theme.dev/parent-post/first-child-post   3. **Second Child Post** : theme.dev/parent-post/second-child-post   4. **Third Child Post** : theme.dev/parent-post/third-child-post **Research** : The following links list my current findings & what I have learned along the way. However, I have yet to find a concrete solution, or definitive answer:   1. **Post relationships** : Parent-to-child: justintadlock.com/archives/2013/10/07/post-relationships-parent-to-child   2. **Post to Post plugin** : wordpress.org/plugins/posts-to-posts/   3. **Custom Post Types as Taxonomies** : wordpress.org/plugins/cpt-onomies/   4. **Advanced Permalink Structures** : wordpress.tv/2013/08/24/matt-boynes-rewrite-recipes-exploring-advanced-permalink-structures-by-example/   5. **Source** : boyn.es/2013/08/10/wcpdx/   6. **Live Concept** : qualityforinnovation.com/    7. **Live Concept** : Many “wall paper” style websites Here’s what I know: List of my findings of what I have found may “seem” like it might work, however, is NOT a solution:   1. Post Connector: yoast.com/new-plugin-post-connector - This is simply a “manual related posts” plugin. The selling of this product seems like it does more than what it really is about.  **Example** : This is an example of the concept I hope to achieve. However, this example was done by customizing the “ **Attachment Page** ”. This site utilizes the original image in the “parent post,” thereby, creating a navigable attachment page as a child post, which is based on the attached image of the parent post.   1. **Home:** qualityforinnovation.com/   2. **Parent Post** : qualityforinnovation.com/small-home-floor-plans   3. **Attachment Page Child Post 1** : qualityforinnovation.com/small-home-floor-plans/small-house-flo or-plans-contemporary-home-designs-61248-4/   4. **Attachment Page Child Post 2** : qualityforinnovation.com/small-home-floor-plans/open-floorplans-large-house-find-plans-90117-4/ I'm looking for actual solutions that can be implemented. If anyone has actually done this successfully would be helpful, or point me to the right direction to be able to implement this solution based on the knowledge they have, combined w/ the information I have already provided. I've already been running in circles for 3 months.


Shortcode not showing $content in correct place

I asked this elsewhere but I'm not getting very far with the answers, so thought I'd try here as it's specific to Wordpress. I have this shortcode:               function reytab($atts, $content = null) {         extract(shortcode_atts(array('title' => '#'), $atts));         return '
'.             '
'.                 $title.             '
'.             '
'.                 do_shortcode($content).             '
'.         '
';     }     add_shortcode('reytab', 'reytab');      And I'm calling it in my wysiwyg editor in Wordpress like this: ![Shortcode in wysiwyg editor](http://i.stack.imgur.com/Iqy0x.png) This is the markup that's generated from my shortcode and as you can see the `$content` is being rendered outside of the `.tab-content div`:

Title

     ...content appears here...[\reytab]      You can see that `[/reytab]` is being rendered as part of the `$content`, so I'm assuming my issue is something to do with either the shortcode, a conflict with a plugin (which it's not as I've deactivated all of them to test that) or a conflict in my theme (which I'm also assuming it's not as I tried this with TwentyEleven - although, as I'm using a child theme that relies on TwentyEleven, it's still possible it's a conflict I guess). Can anyone offer some advice on what I can try? I'm really lost as to what I can check. Thanks Osu


Do I have to use a Wordpress specific CSS reset, or is a normal, Eric Meyer style CSS reset fine?

The great starter theme _S for Wordpress has the following CSS reset included, which works pretty well I find: https://gist.github.com/4173728 But I prefer the Eric Meyer one, which I'm sure you're all familiar with. I find I run into problems with the _S one because I'll be wondering why something isn't reacting as it should do my styling, and I look, and the reset file has a 1.5em adjustment on something, or a float:left on another thing. Dealing with style I didn't input myself is the main reason I use CSS resets in the first place. BUT, my question stems from the fact that the _S reset CSS has these seemingly Wordpress specific aspects to it, like:               #searchsubmit {         display: none;     }      and               .assistive-text {         clip: rect(1px 1px 1px 1px); /* IE6, IE7 */         clip: rect(1px, 1px, 1px, 1px);         position: absolute !important;     }      So am I missing out on things by using on a non-Wordpress-specific CSS reset? Would I be better off just tailoring it to be more close to what I want?


Wordpress multisite subdirectory redirect infinite loop issue

Any time I create a new site on my multisite install, I get an infinite loop redirect when navigating to that site's admin. I'm using the default htaccess supplied by WP for my subdirectory install. Here's what I have:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) site/$2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ site/$2 [L]     RewriteRule . index.php [L]      FYI - My wp install is within a folder named 'site', and the issue is happening both on my local mamp install and on my hosting server. Here's the multisite info from my config file:               define( 'WP_ALLOW_MULTISITE', true );     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     define('DOMAIN_CURRENT_SITE', APP_URL);     define('PATH_CURRENT_SITE', '/site/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      I've spent the past 2 days googling, but to no avail. Here are a couple of solutions I've tried that didn't help:   * http://tommcfarlin.com/resolving-the-wordpress-multisite-redirect-loop/   * http://wordpress.org/support/topic/fresh-install-subfolder-multisite-infinite-redirect-loop-sub-blog-login Any help would be appreciated. I'm starting to get desperate :-/


The excerpt suffix won't go away

I want to show the post content until the more tag, or if there's no more tag than just first n words. Something really basic, right? Obviously I need to use get_the_excerpt function. But the problem is that this function is behaving strangely. It adds a suffix to the end, that nobody wants. And you can't remove it! You could in the past: http://www.wprecipes.com/how-to-remove-the-from-the- excerpt But this no longer works, because Wordpress decided to give us even more bad time with this by changing [...] to something like […] Now you can't even str_replace or rtrim that […]. Trust me I tried. The solution from here works, but this only cuts text after n words. It ignores the more tag. http://stackoverflow.com/questions/21340007/3-dots-at- the-end-of-the-excerpt-in-wordpress Another way would be to use get_the_content, but that just shows the full post content even if I select Summary in the Settings -> Reading. So please what am I missing here?


get_post_meta just returns Array

Here's what I am trying to do: I am trying to get one page in wordpress to pull data from custom fields in other pages. So that when a user creates a page and uses a particular custom field (in this case multiedit_Info), it will populate in the "target" page. Here's my code that I am working with:               <?php $item = get_post_meta($post->ID, 'multiedit_Info', false); ?>     <div id="info-col">     <?php echo $item; ?>     </div>      I am currently using a plugin that create content blocks by using custom fields. And I want to get it so that a user can just create a new page with the custom fields and then have it display in an array on another page. Not too sure if I am setting this up correctly or not. This is the first time I've ever used it so any help is appreciated. Thanks!


Restrict Capability of Administrator to Create, Edit and Delete Pages in Multisite

In my multisite installation, I need to restrict administrators from being able to create, edit, and delete pages. That is, I need all pages to be created/edited/deleted by superadmins while administrators continue to have all other default administrator capabilities except those three. The plugin User Role Scoper is not working for me and while I have seen this Q&A about removing an administrator capability, I am too new to coding to know how to modify this advice for this situation. Any guidance about how to proceed here would be most appreciated!


How to make nested custom post type slugs work

I'll try to explain how I want this to work, rather than what I've done so far, as nothing seems to work. I want 3 custom post types:   * Products   * Consumables   * Accessories with the following slugs:   * example.com/products/post-name   * example.com/products/consumables/post-name   * example.com/products/accessories/post-name Each of the post types will need a custom archive page, ie. actual page that can be edited by the user. Both accessories and consumables would need to be hierarhial, as I have sub- categories for both. I have considered using taxonomies for this, but that presents the same problem: I need an overview page that can be edited by the user (in the WYSIWYG editor), on the apropriate URL. I have currently done the overview pages as such example.com/products - is a regular page with name and slug: "products" example.com/products/consumables - is a product with name and slug: "consumables" ie. every overview page is situated in the root just above the appropriate post type, which is just so counterintuitive. To edit the consumables page, you go in to "products", not "consumables". My biggest problem is that if I just define the rewrite slugs as above, only one of the post types will actually work, seemingly a random one, but I guess it has something to do with rewrite priorities. For example, all Products pages will work, but none of the Consumables or Accessories pages will. Here's an example of the CPT code for the Product CPT:               register_post_type('product', array(         'label' => 'Products',         'description' => 'Product',         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'capability_type' => 'page',         'map_meta_cap' => true,         'hierarchical' => true,         'rewrite' => array('slug' => 'products', 'with_front' => 0),         'query_var' => true,         'supports' => array('title', 'editor', 'custom-fields', 'revisions', 'thumbnail', 'page-attributes'),         'labels' => array(             'name' => 'Products',             'singular_name' => 'Product',             'menu_name' => 'Products',             'add_new' => 'Add Product',             'add_new_item' => 'Add New Product',             'edit' => 'Edit',             'edit_item' => 'Edit Product',             'new_item' => 'New Product',             'view' => 'View Product',             'view_item' => 'View Product',             'search_items' => 'Search Products',             'not_found' => 'No Products Found',             'not_found_in_trash' => 'No Products Found in Trash',             'parent' => 'Parent Product',         )     ));      The two others, Consumables and Accessories, would be similar with the rewrite slug being 'products/consumables', or 'products/accessories' My hope is that I can fix this by making some custom rewrite rules that will override whatever is messing this up, but I have never tried that before, and I'm not sure that would be the solution. Thanks, Infernosaint


How to show permalink auto when type text in post tiltle?

My website when type text in post title, it's not auto show the permalink. It only show when me publish this post.How to do it ? Thanks everyone ![enter image description here](http://i.stack.imgur.com/idede.jpg) ![enter image description here](http://i.stack.imgur.com/pnC80.jpg)


How does WordPress generate URL slugs?

Is there a page somewhere that details exactly how WordPress generates slugs for URLs? I'm writing a script that needs to generate URL slugs identical to the ones WordPress generates.


Get video src array rtmedia BuddyPress plugin

I am using rtmedia plugin to upload media files in my BuddyPress site. I need to get the array of all the video file source in home page. How to achieve this?


How to copy [gallery] shortcode between posts using polylang

We're using the excellent polylang to translate our website content and themes , there are a range of options about which fields and settings are duplicated between paired pages. We've selected to duplicate all custom fields, featured images etc, but clearly not the main page title, excerpt or content , as this is the real textual content that needs to be translated. We have a lot of content to add, and most pages have a large gallery , which we're adding using the native WP `[gallery]` shortcode and the gallery builder , nothing special. I imagined that the shortcodes in the post_content would be easy to simply copy and paste to the connected posts - however, while the `[gallery]` shortcode can be copied and appears correctly in the new post editor screen, it is not recognised , it appears as an empty gallery. So, my next guess was that WP was adding a gallery post type or adding some post_meta when each gallery was saved , but I can't see anything being added to either table when a new gallery is created and saved. So , my questions is where and how are galleries saved and connected to the post - and how can I hook it this action to also build a connection to another post, or to make the gallery more portable between posts? **Update:** I've checked the post_type attachment and post_meta added to each image uploaded , this only contains the path to the image and the information about the various `image_sizes` and additional exit data from the image...


Quotation marks disappearing from custom field

I need to sometimes show a field value with quotation marks at the beginning and end. The custom field has been created using the (latest) Custom Content Types Management plugin, and my WordPress version is 3.6.1. When I type the field, which includes quotes in a (custom) post at the beginning and end, it accepts it, and displays it correctly. However, when I relook at the "edit post" screen, the quote marks have disappeared - and therefore don't show on the public side if I add smomething else and update the post. I've tried 'escaping' the quotes by preceding them with a slash - but the result is the same. Is this a new behaviour in 3.6.1? Or has it been happening before and I've only just noticed? Can anyone suggest a solution? (I don't always need the field to start and end with quote marks, so I can't include them in the template instead, as I've done with other fields.) An example is here - the field in question is the text listed as "Highlights". In the case of this example, I DON'T need quote marks. In the fields above and below, which have them, they always have them so they're embedded in the template. Any suggestions / advice?


Get attachment id from thumbnail url

> **Possible Duplicate:**   >  Turn a URL into an Attachment / Post ID I got a thumbnail url, for example http://www.mysite.com/wp- content/uploads/blume-beispielbild-300x225.jpg   I know I can find the attachment id of the main image(without dimensions) by doing               $my_img_src = "http://www.mysite.com/wp-content/uploads/blume-beispielbild-300x225.jpg";     $query = "SELECT ID FROM {$wpdb->posts} WHERE guid = '".$my_img_src."'";     $image_ID = $wpdb->get_var($query);      But how can I do this if I only got the thumbnail url? Is there a clean way to do this with wordpress?


one page wordpress theme

I'm trying to create an one page template [ w/out infinite scroll ]. The two problems I'm running into are adding a class to the list pages function [ or finding some other way to target the menu for smooth page scrolling ] && dynamically loading each page inside of a section or div all on one page. Any thoughts?


Changing permalink changes stylesheet path?

I have changed my permalink structure to `/%category%/%postname%/`.The links are working, but the problem is that my `style.css` is not working in some of the posts which are inside the category.


my own SVN for a plugin/theme

If I develop a theme or plugin and don't submit it to the wordpress plugin repository is it possible to have my own SVN to roll out updates? How is this done?


Change content before writing to database

I've searched around but I can't quite pin down the answer for this. I am attempting to use the content of a custom field as post_data and save it to the database as such when a post is created or updated. I need to do this in order to make a frontend posting solution work out using the plugin Advanced Custom Fields. I think I need something like this:               function tsv_content_save_pre( $post_id ){                 global $post;                 $tsvpost = get_post($post_id);                 $tsvifempty = $tsvpost->post_content; //The "real" post_content                 $tsvcontent = get_field('article_content'); //The custom content                      if ($tsvifempty == NULL) { //Check if the "real" post content has anything in it first.                  $tsvargs = array('post_content' => $tsvcontent);             wp_update_post ($tsvargs);                      }                }             add_filter('content_save_pre'  , 'tsv_content_save_pre'  );      But I'm stuck there. I'm not a plugin developer so filters and such are hard for me to navigate. Can anyone help get me pointed in the right direction? Thanks in advance.


CHMOD 0777, but Wordpress still not able to write files/folders

The day before yesterday I ordered my own VPS. But now I have problems with Wordpress, Wordpress is not able to create a .htaccess by itself, not able to write to it and plugins aren't able to create files/folders. Support hadn't the time for me, so since yesterday I'm looking for a solution by myself, with no luck. If I change the CHMOD of all folders and files to 777 or 755, I still cannot write files/folders. So I looked further, the owner/group of my www folder on the vps is webapps:apache. I tried to change webapps to the user "root", "nobody", "apache" and "admin". But nothing worked. When I activate the debug plugin I get these errors on the front-end: Warning: parse_ini_file() [function.parse-ini-file]: open_basedir restriction in effect. File(/usr/local/lib/php.ini) is not within the allowed path(s): (/home/admin/:.../php/) in .../class.krumo.php on line 284 Does somebody else has another possible solution?


Get Wordpress Category ID from a URL string

How can you get the category ID of "category-name" from a nice URL (e.g. http://www.example.com/category/category-name/)? I need to retrieve the category ID from a URL of wordpress because this function will be used in wp_nav_menu() since the design of the site is to have a dropdown of latest post under the category, so if it is not a category of wordpress (link to home page or about page), then there should be on dropdown. I found this site(http://ditlo.com/) to be an example of the problem :)


Create and Assign Page on Signup

I would like users to be able to have a personal page that they can edit when they sign up for an account. I know of WP-MU, but I don't want a blog for each user, just a page of a specific post-type. Only they and site admins would have access to edit it, and everyone could view it. Is this possible with the current permissions and access controls in WordPress, or is it outside the scope?


How to show one post different from the rest?

Hi the code i am using below will show the last 5 post in whatever catergory i choose, but i was wondering, How can i get it so that the first post shows different from the other 4. I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on here but it's closed so i couldn't comment and ask questions. Here is the code I'm using               <?php     $queryObject = new  Wp_Query( array(         'showposts' => 5,         'post_type' => array('post'),         'category_name' => videos,             'orderby' => 1,         ));          // The Loop     if ( $queryObject->have_posts() ) :       $i = 0;       while ( $queryObject->have_posts() ) :           $queryObject->the_post();           ?>           <?php if ( $i == 0 ) : ?>
           <?php endif; ?>           <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">               <?php the_post_thumbnail('sidethumbs'); ?>                           <a href="<?php the_permalink(); ?>"><?php the_title(); ?>           <?php if ( $i == 0 ) : ?>
           <?php endif; ?>               <?php $i++; ?>       <?php endwhile; ?>      It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to to explain, can anyone help me. post found here ---> Make First post different from rest?


Pages not using permalink

I recently changed my theme from one custom theme to another custom theme. There were previously pages that used template files (i.e., "Blog" page uses Blog template) and now that I've changed themes the pages are not redirecting as usual. I tried importing the old data and then each page was created twice (i.e., Blog (with permalink blog) and Blog (with permalink blog-2)). I've tried deleting both pages and choosing to deleted them permanently. I also tried re-creating the page using the template file (naming it "Blog" with permalink blog), but I continue to get the error: Index of /blog   Apache Server Port 80 It seems that WP is directing to the folder /blog instead of the page with the permalink blog. If I change the title of the page (i.e., "Test" with permalink test) and apply the template file the issue resolves. But I would like to keep the same links as the previous design. .htaccess issue or WordPress issue?


https and wordpress breaks posts

I have a wordpress http site which still works just fine. I added https and the first page works but none of the post pages do. server: Ubuntu 10.04.4 LTS (lucid) running Apache 2.2.14 SSL through RapidSSL ** EDIT ** Here's the 404 I see instead of a post (make note, on the exact url but with `https` I'm able to see my content) * * * **Not Found** The requested URL /shortcuts/ was not found on this server. _Apache/2.2.14 (Ubuntu) Server at www.mydomain.com Port 443_ * * *


Organizing Custom Post Type Archive Template

Because in all my attempts to get a Custom Post Type Archive I only get a `404` Trying to organize different post-types in archive.php I'm trying to do this, in `archive.php`               <?php     /*===== Start Conditionals for Categories =====*/               $post = $wp_query->post;     $post_type = get_post_type($post);                 if($post_type == 'mysuper_post_type')  {        load_template( trailingslashit( get_template_directory() ) . 'layouts/archive-super_posttype.php' );     } else {         load_template( trailingslashit( get_template_directory() ) . 'layouts/category-default.php' );     }          }          /*===== End Conditionals for Categories =====*/          ?>      Here is the code to register my CPT               // BrandVoice     function brand_voice() {              $section = 'brand_voice';         $slug = 'brand-voice';         $names = 'Brands Voice';         $name = 'Brand Voice';         $desc = 'Adding Brand Voice';         $key = $section;         $taxonomy = 'brand';         $slug{$taxonomy} = $taxonomy;         $names{$taxonomy} = 'Brands';         $name{$taxonomy} = 'Brand';              $labels = array(             'name'                => _x( $name, $desc, $section),             'singular_name'       => _x( $name, $desc, $section),             'menu_name'           => __( $names, $section ),             'parent_item_colon'   => __( 'Parent '.$name.':', $section ),             'all_items'           => __( 'All '.$names.'', $section ),             'view_item'           => __( 'View '.$names.'', $section ),             'add_new_item'        => __( 'Add New '.$name.'', $section ),             'add_new'             => __( 'Add New '.$name.'', $section ),             'edit_item'           => __( 'Edit '.$name.'', $section ),             'update_item'         => __( 'Update '.$name.'', $section ),             'search_items'        => __( 'Search '.$names.'', $section ),             'not_found'           => __( 'Not found', $section ),             'not_found_in_trash'  => __( 'Not found in Trash', $section ),             );              $rewrite = array(             'slug'                => $slug,             'with_front'          => true,             'pages'               => true,             'feeds'               => true,             );              $supports = array(             'title',             'editor',             'excerpt',             'author',             'thumbnail',             'comments',             'revisions',             'post_formats',             );              $taxonomies = array(             'category',             'post_tag',             );              $args = array(             'label'               => __( $key, $section ),             'description'         => __( $desc, $section ),             'menu_icon'           => 'dashicons-'.$slug.'',             'labels'              => $labels,             'supports'            => $supports,             'taxonomies'          => $taxonomies,             'hierarchical'        => true,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'query_var'           => $key,             'rewrite'             => $rewrite,             'capability_type'     => 'page'             );                   register_post_type( $key, $args );          }


Advanced Custom Fields google map

If anyone ever tried to work with advanced custom fields - google map fields and make a big map with lot of markers like this exmple: http://www.advancedcustomfields.com/resources/field-types/google-map#wpshdo_3 its work great, but if you need to make the addres in another place like links or text and not like a markers and want the map to focus and zoom to this addres when click - you got no instruction in the documentation how to do this.


Drag'n'drop / simple plugin for inexperienced users to create fancy posts / pages?

I am looking for a plugin that can perform the following task: say we use bootstrap with 6 columns, but bootstrap is not a requirement. This is just an example, any Technic would be fine. It can be drag and drop but a simpler UI is fine as well. The user should be able to insert text and pictures in a row that spans 2 columns. Then text in the same row that spans 1 column. Then on the next row the user should insert a picture that spans 4 columns. Is there a plugin that would help the user in doing so, without the user having to leave the visual block in the post section. E.g. he does not need to know what classes to add and what html elements to insert.


Formatting get_post content doesn't allow JS content to function properly

I am currently pulling in the latest post on a category page based on which category you click on. When you click on the category "Code Examples" you see this: ![enter image description here](http://i.stack.imgur.com/obRwK.png) I am using the Crayon syntax highlighter plugin, which works fine, but when I use the following code to pull in the above content, it doesn't look the same as it does on the actual post page (below): ![enter image description here](http://i.stack.imgur.com/yA4rd.png)               $post_content = get_post($post->ID);         // format the raw data         $content = sanitize_post_field('post_content', $post_content->post_content, $post->ID, 'display');     ?>

<?php echo get_the_title($post->ID); ?>
                 <?php echo $content; ?>
      I have looked up apply filters, etc, but since Crayon plugin uses JS for its functionality, the data from get posts doesn't look the same... Need a remedy and fast! Thanks!


Email stats at Ma.tt contact form

Curious to know if there is a handy solution for showing cool email stats like Ma.tt's contact page http://ma.tt/contact/ > Inbox: 157. Low priority: 1,461. Unknown: 155. I’ve sent out 920 emails to > 357 people in the past month.


Role based permission edit for plugins

I have TheThe Fly Image slider installed on my website which has multiple users. I wish to hide the settings from contributors and authors, but allow editors and admin roles to be able to amend the content within the slider. I've installed a plugin to modify the capabilities of each role, but for some reason, options for TheThe Fly aren't available. I also have nextgen gallery installed and there are specific capabilities shown to edit for each role. Any help would be appreciated! Thanks http://wordpress.org/extend/plugins/thethe-image-slider/


The use of get_template_part() returns 'invalid argument' loading options

I would like to avoid the `include_once()` in order to remove one INFO using Theme Check, and when I try to load my Options page using `get_template_part('custom-options');` it returns the message: > «Invalid argument supplied for foreach() in [...]/custom-options.php on line > 83». Where the code is the typical:               //[...]     <?php foreach ($options as $value) { //#83       switch ($value['type']) { case "open": ?>     <?php break; case "close": ?>     <?php break; case "title": ?>
<?php echo $value['name']; ?>
     //[...]      I'm not sure, but perhaps it's not allowed for loading options. Then I tried `load_template( trailingslashit( get_template_directory() ) . 'custom-options.php' );` with the same result. **My questions are:** Is that possible to load the options file by using `get_template_part()`? If not, is there a way to load the options file and, at the same time, being it valid with the Theme Check plugin?


Pagination in pages (not posts) with the twentythirteen theme?

I wrote a very long page with a lot of content and would like to add a pagination to make it more readable. I added in the texteditor several `<!–-nextpage–->` but it doesn't create any pagination, although in the default twentythirteen page template the `wp_link_pages` function is called               <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentythirteen' ) . '', 'after' => '
', 'link_before' => '', 'link_after' => '' ) ); ?>      I'm using a child theme with little customizations but I also can't get it to work with the default twentythirteen theme with no child theme and customizations. How can I get a pagination on my page?


How to change user`s avatar?

Is there a way o changing user's avatar without plugins? Why there's no "Avatar Upload" section in Users > Your Profile? I can't use a plugin. Am I blind or being forced to use Gravatar? ;/


WordPress Core - Optimizing meta_query generated SQL?

I have a problem in a plugin of mine which uses post meta to store ownership of a post. Basically, my issue is that the `WP_Meta_Query` class generates one JOIN per meta_query query. I don't understand why we cannot us the same JOIN for **all** queries. Of course, when using more than 5 or 6 queries, the query takes way too much time to complete and plugin fails to get the posts. E.g.: this is what I would do to get the posts that belong to either users 5, 6, 8 and 10 (In the real plugin, the compare is always LIKE and value looks like '%|usr_5|%' to solve some cases for advanced ownership control):               'meta_query' => array(        'relation' => 'OR',       array(         'key'      => 'owner',         'value'    => 5,         'compare'  => '='       ),       array(         'key'      => 'owner',         'value'    => 6,         'compare'  => '='       ),       array(         'key'      => 'owner',         'value'    => 8,         'compare'  => '='       ),       array(         'key'      => 'owner',         'value'    => 10,         'compare'  => '='       )     )      That above generates a SQL query that has 4 JOIN statements (mt1 to mt4) and in the WHERE clause, is using each JOIN for a comparison. Something like:               mt1.meta_key = 5 OR mt2.meta_key = 6 OR mt3.meta_key = 8 OR mt4.meta_key = 10      What is the point of that??! All of this could be done using a single JOIN and a WHERE clause like:               mt1.meta_key = 5 OR mt1.meta_key = 6 OR mt1.meta_key = 8 OR mt1.meta_key = 10      Is there something I am missing? Is that multiple JOIN there to take care of some comparison types?


Add a Settings Section to the Middle of an Existing Page (add_settings_section)?

I am wondering if it is possible to add a settings section (add_settings_section) to an existing page but to have it in the middle of the existing sections. For example on the existing "Discussion" page is there be anyway way to insert my new section after the initial settings but before the "Avatars" section? Thanks for any ideas or approaches.


approval of posts via email

**Update** : Ok, not sure how much all that makes sense, so will try and write a brief explaining the problem a bit better. I have my code working so via email using 'post status transitions' the user clicks a link and it changes the status of the given post from 'pending' to 'published'. The problem is with already published posts that are edited. Using 'Revisionary' Plugin I can save a draft page as a revision and keeps the old version live, and it even sends it still. The problem I think comes is the revision ID is different to the published ID and it won't replace the revision with the published version when I click the link in the email. **Problem in Detail:** I have been working on a plugin that allows page approval via email. An editor can submit a page for review. This triggers an email to be sent to a given email address with the page info (title, content, featured image, author details, etc.). There is then a link that can accept the changes. When the link is clicked it allows the page to go live. It uses post status transactions. I modified the following code to include pending_to_pending, changed who it emails to so it's a option in settings for admins to choose and added in the rest of the page info, and put it in a html template, but the basics of it are as follows: When a user creates a post (pending), send a confirmation link that allows them to publish All works exactly as I want. The problem is (which seems to be somewhat a limitation of Wordpress) is once a page is created an editor can just come in and update a page and bypass the approval plugin I have created. The major problem seems to be you can't save a draft and keep the previous version published. Either it is a draft, pending or published. Now I have come across a plugin called Revisionary which does allow you to submit updates as reviews. It even triggers the plugin I setup and sends an email with the revisied version rather then what is live. The problem comes that when I click the accept in the email it doesn't then push that version live, just keeps what was already live, live. I assume because the plugin creates a revision of it like an older version so Wordpress doesn't see it as pending. So what I am wondering is, is there a way of marrying the two together. As it sends the version i want to push live in the email I assume there must be a way of telling WordPress to push this live with the post status transactions?


Is get_posts() more efficient than The Loop?

In `category.php`, I want to get list of posts in that category. I found two ways: using `get_posts($args)` and `The Loop`. **get_posts()** way               $args = array (       "category" => ID );     $posts = get_posts($args);     // then use foreach to loop the $posts      **The Loop** way               <?php if (have_posts() ): ?>       <?php while (have_posts() ): the_post(); ?>         ...       <?php endwhile; ?>     <?php endif; ?>      **So which one more efficient?** From what I searched, `get_posts()` is for custom template while `The Loop` is used inside the template that follows Wordpress naming convention. I prefer `get_posts()` but if there's a big overhead compared to The Loop, I should re-think it again.


How to setup a wordpress backup in localhost?

I have a database backup and entire site folder backup of a wordpress site. I want to setup it in my localhost. These are the steps I followed.   1. Create a database   2. Import the database_backup.sql   3. Open the wp-config.php and edit the following details > define( 'DB_NAME', 'contents_wp' ); > > define( 'DB_USER', 'root' ); > > define( 'DB_PASSWORD', '' ); > > define( 'DB_HOST', '127.0.0.1' ); But I cannot log in to the admin panel. It redirects to the live site. How to solve this? What I am doing wrong here? Any suggestions will be appreciated.


Settings API repeater fields

I'm new to the WP settings API, and a fairly novice PHP developer. To get started I followed this great tutorial   * Using Settings API - part 1 -- Create a Theme Options Page and customized it to my needs. and all is working nice and neat. Unfortunately I could not find online reference to creating user dynamically repeating fields, such as an "add new slide" to a slideshow. I feel like I'm really close, but I can't figure how to register new content. I'll be thankful for suggestions or pointer in the right direction.


Displaying Slider in Front Page (home) using Customizr Theme

I am using Customizr Theme on my website, and rendering its' front page, using a Static Page. Also I have two sidebars (left and right). I used the static page, because when I put the slider it will appear above the sidebars. And I'm trying to put it in between the sidebars. I added a **PHP snippet** in my child theme which would make it appear where I want it to.               function move_my_slider() {              //we unhook the slider        remove_action( '__after_header' ,              array( TC_slider::$instance , 'tc_slider_display' ));              //we re-hook the slider. Check the priority here : set to 0 to be the first in the list of different actions hooked to this hook         add_action( '__before_loop' ,              array( TC_slider::$instance , 'tc_slider_display' ), 0);     }      This works fine as you can see where I tested it here. But when I tried using the _test-page_ as front page, the slider does not appear? How can I include the slider in the front page?


What action is triggered when the plugin is installed? "wp_setup_theme" is other action :-(


Same date post in one box

I would like to ask for a little help. I wish you the same date is a Post;, you just enter the time of the WP. The twist, however, is that it is all in a box. I'll show it to be understood:               +------------------------+     | 2014.Április. 14.      |     |      -15:25-           |     | Lourem hauld huanc.    |     |  --------------------  |     |      -12:34-           |     | Lorem iatecb uaxn.     |     +------------------------+          +------------------------+     | 2014.Április. 13.      |     |      -11:34-           |     | Lourem hauld huanc.    |     |  --------------------  |     |      -07:14-           |     | Lorem iatecb uaxn.     |     +------------------------+


Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory

I have a bunch of old posts on a blog that I would like to assign a featured image to. I have retrieved all the images I would like to use for each post. I saved each image file name after the slug of each post. I would like to retrieve all posts, grab the slug name from each post, search the specified directory where the image files are uploaded, when the post slug matches the image file name, set that image as the featured image for that particular post, and iterate through all posts. I am not sure how to go about doing this, but I have provided some example code I found, along with a few useful (hopefully) links. **The following code is used to retrieve all posts and update a particular post:**               $allPosts = get_posts(array('numberposts' => -1, 'post_type' => 'post'));     foreach($allPosts as $thePost){         $my_post = array();         $my_post['post_type'] = $thePost->post_type;         $my_post['ID'] = $thePost->ID;         $my_post['post_name'] = autoSlug($thePost->post_title);         wp_update_post($my_post);     }      **Note:** I have a special function for generating post slugs based off the post_title. (I don't use the WP default slug.) **Useful links:**   1. get_posts   2. wp_update_post   3. Post_Thumbnails   4. wp_upload_dir   5. wp_insert_attachment


List Categories in Custom Order

I'm using this code:               <?php wp_list_categories('include=19,20,21,22,23,24&orderby=date&title_li=<h4>' . __('Prices') . '</h2>' ); ?>       But it's not displaying categories in the order by date, and I'd like to custom order the list anyway. Any leads would be appreciated.


When editing, my post titles and permalinks revert to the title and permalink used for static homepage

Whenever I add a new post or edit an old post, the post title automatically switches to the same title that's used on my static homepage page. The permalink also changes to the same link, with a number appended to the end, and the date changes to the date that the static homepage page was originally posted. If I change the title or permalink to what I want it to say, it reverts back to that home page title as soon as I click to another form field. The correct title I want to use is actually saved, but the permalink always reverts to that old link that I don't want to use. I hope I'm being clear explaining this problem. Has anyone seen this behavior? Any ideas how to fix it?


Developing a plugin, ran it through P3 Profiler, shows up slow, but I don't know why

I am having an issue with my plugin I'm developing. After using the GoDaddy P3 Plugin profiler, it shows that is taking up a large amount of runtime, but the plugin itself is very minimal. It just provides a few shortcodes and sanitizes the data entered into them. It basically takes a url, pulls an ID from it, uses an API to get an array of values in JSON format, then takes several of those values from the array and displays them in a div. I'm not making any queries against the WP database, so I know that's not the issue. It may be the amount of time the API is taking (High School Cube) to return the call, but I'm not sure. I've made sure to follow all of the plugin documentation to the dot and have a very clean, organized file structure with a strict style guide. Can anyone explain to me why this may be showing up as slow?


Making Quote Plugin more efficient

I've been working on this plugin the past couple of nights and have been jotting down idea's of how to improve it. My knowledge of php isn't the strongest and I'm learning as I go along most of the time. Questions:   1. Is there more efficient ways to validate the quotes using the wordpress api?    2. What steps would I take to display the quote via a shortcode?   3. What would be the best way to delete selected quotes? idea to develop further would be to pass the quote into a shortcode and display on a website via the shortcode.*/                       /*             Plugin Name: Random Quotes             Plugin URI: xxx             Description: This Plugin randomly generates Quotes input by the user.             Version: 0.0.3             Author: xxx             Author URI: xxx             License: GPL2             */                  /*             Function Reference              array_rand($array) - Randomises an array can be used with shuffle().             ucfirst($string) - replaces the first character of the string as uppercase.             substr($string, $start, int $length) - Returns the portion of string specified by the start and length parameters.             strtolower($string) - converts all characters in the string to lowercase.                       */                  // call the functions             add_action('admin_menu', 'dw_quotes_create_menu');             add_action('init', 'validate_dw_quote');             add_action('init', 'dw_get_random_quote');              add_action('init', 'grammer_dw_quote');                   function dw_quotes_create_menu() {             //create custom top-level menu                 add_menu_page('Quotes Settings', 'Quotes Styling', 'manage_options', 'dw_quotes', 'dw_styling_quotes_settings');             }                  //generating the random quote             function dw_get_random_quote() {             //call the quote from the database                 $quote = get_option('list_of_quotes');                  //randomise the quote                 $random_quote = array_rand($quote);                  //call a value and add it to $output                 $output = $quote[$random_quote];                  //return the result                 return $output;             }                  function grammer_dw_quote() {             //call the quote from the previous func                 $grammer = dw_get_random_quote();                  //add a capital letter to the first letter - make the rest lowercase                 ucfirst(strtolower($grammer));                  //if the last character is not a period then append one to the string                 if(substr($grammer, -1) != '.') {                     $grammer.= '.';                 }             //return the result                 return $grammer;             }                  function validate_dw_quote() {             //validation here                 if (isset($_POST['submit'] ) ) {                  //checking that $_POST['adding_quote'] is set                     if( isset( $_POST['adding_quote'] ) ) {                  //retrieve the stored values                         if( get_option( 'list_of_quotes' ) )                             $list_of_quotes = get_option('list_of_quotes');                         else                              $list_of_quotes = array();                  //add the new quote to the end of the array                          $list_of_quotes[] = $_POST['adding_quote'];                  //store the updated quote                         if ( update_option( 'list_of_quotes', $list_of_quotes ) ) {                             echo "
Success your quote was added!
";                          } else {                             echo "
Failed to add quote!
";                         }                      }                         }             }                  //styling the admin menu             function dw_styling_quotes_settings() { ?>
Quote Setting
                  <form action="admin.php?page=dw_quotes" method="post">                 Enter your quote                 <input type="textarea"  name="adding_quote" />                 <input type="submit" name="submit" value="add the new quote" />                  <?php //test the output              //var_dump($list_of_quotes);             ?>
Current Quote displayed
              <?php echo grammer_dw_quote(); ?>                  <?php } ?>


.htaccess browser caching and user login

I have a site that involves user logins for certain content. I am leveraging browser caching in the .htaccess file. When a user logs in, they are redirected to a profile page. The problem I'm having is that when the user navigates back to the homepage, they are getting a cached version, which behaves as if they are not logged in. If they refresh the home page, they see the proper content, but I need to figure out how to make sure they get the proper content in the first place. Here is the code I put in my .htacces:               # compress text, html, javascript, css, xml:     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          # Or, compress certain file types by extension:     <files *.html>     SetOutputFilter DEFLATE     </files>          ## EXPIRES CACHING ##     <IfModule mod_expires.c>     ExpiresActive On     ExpiresByType image/jpg "access 1 year"     ExpiresByType image/jpeg "access 1 year"     ExpiresByType image/gif "access 1 year"     ExpiresByType image/png "access 1 year"     ExpiresByType text/css "access 1 month"     ExpiresByType application/pdf "access 1 month"     ExpiresByType text/x-javascript "access 1 month"     ExpiresByType application/x-shockwave-flash "access 1 month"     ExpiresByType image/x-icon "access 1 year"     ExpiresDefault "access 2 days"     </IfModule>     ## EXPIRES CACHING ##


How can I get a traceback on function calls?

I've been trying to make a search page, but I keep getting redirected back to the main site. I can't find anything useful in the log about why this might be happening. Is there a way I can enable some sort of traceback so that I can figure out what is causing this? What I'd like to do is see some sort of list that tells me the names of the functions being called, and the php files where those functions reside.


Query post names based on tags of current post

I have a custom post type called 'employer'. In some of my normal posts, I use the slug of an employer as a tag to link the two together. For example POST A mentions "Adidas" and therefore I add "Adidas" as a tag so that the tag is "adidas" and the slug of the Employer is "adidas". I want to add a little bit of information from the custom post type at the bottom of POST A. Initially, I used the following code to get the tags from the post and put them into a string. Now, I want to pass the string to the query so that any posts with a slug that matches a tag is returned:               $posttags = get_the_tags();     if ($posttags) {     $tagoutput = '';       foreach($posttags as $tag) {         $tagoutput = $tagoutput.','.$tag->name;        }     }          $args = array(         'post_type'=> 'employer',         'posts_per_page' => 3,         // QUERY POST NAME HERE      );      Unfortunately I don't know how to query by post name/slug. Thanks


Best Practice for Changing Custom Fields

I'm using the Advanced Custom Fields plugin for a project I'm currently working on. From what I understand, ACF stores its values into WordPress' Custom Fields. What I wanted to know is what's the best way to go about editing and changing these Custom Fields after I've already defined them?? Obviously, I'd like to get my naming conventions right the first time, but sometimes I'm forced to make a change. P.S. Is there a way to flush the Custom Fields that are no longer being used by Advanced Custom Fields. An easier way to delete them instead of going into every post type and deleting the Custom Fields manually, perhaps? Any help is appreciated. Thanks in advance!


Mobile User Registration

I am writing an android (and eventually iphone) app that is proposing to register a user to a wordpress site. The intent is to have the user registration solely through the mobile device and not through a website front end. The app will update the wordpress site and the user will be able to login in to see his data. I have a general idea on how to use the wp hooks with json to do the mobile registration. However, is there a way to the registration process without enabling "anyone can register" in "general/settings"? (note: I looked through all the questions using "Mobile User Registration" but did not see any related.). Thanks in advance


Fetch post from one WordPress blog & display it on other WordPress blog

I am having 2 WordPress install.One for website & one for blog. I want to display post from my blog to website.How can i achieve it? Is there any way to fetch post from one blog to another?   Is it possible to fetch all post in file first & randomly pick one of the post from the file? I want some sort of caching of post.


Woocommerce display parent child category

I am using the WooCommerce with the Kallyas theme and have setup the following categories:               Parent Category 1       - Sub cat 1       - Sub cat 2          Parent  Category 2       - Sub cat 3       - Sub cat 4      On the shop page I want to display the parent category name as the heading and underneath that the relevant sub-categories. (as shown in the attached image). Clicking on the sub-category should list the relevant products. ![enter image description here](http://i.stack.imgur.com/EsmR6.jpg) Please can someone enlighten me on how to handle this?


Get Author for Single Post in Custom Post Type

I have looked high and low for an answer to this question and all I keep finding is how to make an archive page that list all authors and their post (including cpt's). I've tried to adapt these pages, but I still can't get just the author of a single post that happens to be in a custom post type. I just simply want to get the author of the current post which happens to be in a custom post type, which for one reason or another seems to be just about impossible. Can somebody please, please, please hook me up with a function or anything that can just simply get the author of the current post that happens to be in a custom post type. Thank you!! Thank you!!


Xml output not places where i want

I have a script that checks status (daily with cron) of some sites and write result in a xml document. Xml is like this :               <?xml version="1.0" encoding="UTF-8"?>      <xml>       <sites>        <site1>result of site1</site1>        <site2>result of site2</site2>        ...       </sites>      </xml>      Then i have a function that let me get xml content for each site with wordpress shortcodes , like this :               <?php     function CheckRemoteService($atts) {      extract(shortcode_atts(array(       'name' => 'txt',      ), $atts));          $xml = simplexml_load_file('my.xml');     echo $xml->sites->$name;          }     add_shortcode('checkmyurl','CheckRemoteService');     ?>      Shortcodes give me the correct output but all results are placed on same row at top , like if are blocked there. I want to insert these results in a table with other data. Is this a xml limit or i have done some mistakes ? Thanks.


apply_filters/do_action tag characters limit

Does **apply_filters** / **do_action** `$tag` name have a characters limit? Can be any problems if the tag name is way too long? I ask this because I know that WP transients have a limit of 45 characters. FYI, this is the tag I'm referring to:               apply_filters( $tag, ....


Howto check version of another plugin and then add a submenu page to it

i'm writing a plugin which requires another plugin. So i have to check first if the other plugin exists in a correct version. If yes i want to add a submenu page to the plugin page but here my code doesn't seem to work. I think the problem is, that i only can check the existence of other plugins with a late hook (admin_init). But to add submenus i have to use an earlier hook (admin_menu). How to solve that?               class acf_multisite_sync {              function __construct() {                  add_action('admin_init', array($this, 'acf_sync_init'));              }              function acf_sync_init() {                  $plugins = get_plugins();                  if (isset($plugins['advanced-custom-fields-pro/acf.php'])) {                      if ($plugins['advanced-custom-fields-pro/acf.php']['Version'] >= 5                      && is_plugin_active('advanced-custom-fields-pro/acf.php')                     && is_main_site()) {                          add_action('admin_menu', array($this, 'acf_sync_submenu'));                      }                  }              }              function acf_sync_submenu() {                  add_submenu_page(                 'edit.php?post_type=acf-field-group',                  'Multisite',                  'Multisite',                  'manage_options',                  'acf-sync',                  array($this, 'acf_sync_callback')             );              }              function acf_sync_callback() {                  echo 'My Submenu Content';              }          }          new acf_multisite_sync();


How to list a page tree?

I have this structure for example:               Page 1       Sub-Page 1.1         Sub-Page 1.1.1         Sub-Page 1.1.2         Sub-Page 1.1.3       Sub-Page 1.2         Sub-Page 1.2.1         Sub-Page 1.2.2         Sub-Page 1.2.3     Page 2       Sub-Page 2.1         Sub-Page 2.1.1         Sub-Page 2.1.2         Sub-Page 2.1.3       Sub-Page 2.2         Sub-Page 2.2.1         Sub-Page 2.2.2         Sub-Page 2.2.3      I would like to have a sidebar navigation which has all items from the root- page and the curent page should be marked with some css-class. For example I'm on Page 2.2.2, the navigation should look like this:               Sub-Page 2.1       Sub-Page 2.1.1       Sub-Page 2.1.2       Sub-Page 2.1.3     Sub-Page 2.2       Sub-Page 2.2.1       Sub-Page 2.2.2.current_page       Sub-Page 2.2.3      Second Example: I'm on Page 1.2:               Sub-Page 1.1       Sub-Page 1.1.1       Sub-Page 1.1.2       Sub-Page 1.1.3     Sub-Page 1.2.current_page       Sub-Page 1.2.1       Sub-Page 1.2.2       Sub-Page 1.2.3      I looked through the codex but I could not find anything which fits. Any Ideas?


How can I add widgets to specific post

Some of my post are longer than others. On those post I want to display more widgets for social media and such to fill in space, as well as to gain more exposure. I know there are plugins but I haven't seen ones that let me target specific URLs.


Query Problem in getting top viewed posts

I wanted to display top viewed posts by month, I add this code snip, to form a query and get required 15 posts, but it displays 3-4 posts.Here is my query:               global $post;          $args = array(         'meta_key' => post_views_count,         'orderby' => meta_value_num,         'numberposts' => 15,         'order' => 'DESC',     );          $top_viewed_posts = get_posts( $args );          foreach( $top_viewed_posts as $post ) :         $mylimit= 30 * 86400;        //To display post for last 30 days          $post_age = date('U') - get_post_time('U');         if ($post_age < $mylimit) {                  if (has_post_thumbnail()) { ?>

                         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
                     Views: <?php echo getPostViews(get_the_ID());?>
             <?php             }         }     endforeach; ?>      But when I remove this portion :               $mylimit= 30 * 86400;        //To display post for last 30 days      $post_age = date('U') - get_post_time('U');     if ($post_age < $mylimit) {      It displays correctly 15 posts. Please suggest!


permalink repeated

I just moved my blog to a new server (I've updated the dns). Everything is fine except the permalink settings. I used to choose the day- name style like: `mydomain.com/blog/2013/08/28/sample-post/`. But after the moving, it turns something like: `mydomain.com/blog/blog/2013/08/28/sample- post/`. So if I keep using this style, my previous blogs can't be visited because their links lead to `mydomain.com/blog/blog/2012/09/12/something`, while they should be `mydomain.com/blog/2012/09/12/something.` If I switch it to the default: `mydoamin.com/blog/?p=123`, all my old posts can be visited. Any one have dealt with this problem?


One of my users cannot select Categories for his posts

I have a users with limited access. The problem is they cannot check (select) the categories for a post in Edit Post. They can see them but not select them. Why is this happening? What do I need to change so they can select categories?


Metabox Data not saving

My Metabox data doesn't appear once I've saved the page, I tried vardump() on both getextra_mbe_date and getextra_mbe_time which returned null my code is               <?php     /*     Plugin Name: Events CPT     Plugin URI: ****     Description: This Plugins creates an events custom post type with a date and time metabox included.     Version: 0.01     Author: ***     Author URI: ****     License: GPLv2     */     ?>     <?php     function getextra_events_custom_post_type_create() {       $labels = array(         'name'               => 'Events',         'singular_name'      => 'Event',         'add_new'            => 'Add New Event',         'add_new_item'       => 'Add New Event',         'edit_item'          => 'Edit Event',         'new_item'           => 'New Event',         'all_items'          => 'All Events',         'view_item'          => 'View Event',         'search_items'       => 'Search Events',         'not_found'          => 'No Events found',         'not_found_in_trash' => 'No Eventss found in Trash',         'parent_item_colon'  => '',         'menu_name'          => 'Events'       );            $args = array(         'labels'             => $labels,         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'show_in_menu'       => true,         'query_var'          => true,         'rewrite'            => array( 'slug' => 'events' ),         'capability_type'    => 'post',         'has_archive'        => true,         'hierarchical'       => false,         'menu_position'      => null,         'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )       );       register_post_type( 'Events', $args );     }     add_action( 'init', 'getextra_events_custom_post_type_create' );     ?>     <?php     //creation of the metabox happens here     add_action( 'add_meta_boxes', 'getextra_mbe_create' );     function getextra_mbe_create() {         add_meta_box( 'getextra-meta-dt', 'Event Date and Time', 'getextra_mbe_dt_callback', 'Events', 'normal', 'high');     }     //function to display the form fields     function getextra_mbe_dt_callback($post) {         //get the metadata values if they exist         $getextra_mbe_date = get_post_meta ($post->ID, '_getextra_mbe_date', true);         $getextra_mbe_time = get_post_meta ($post->ID, '_getextra_mbe_time', true);         echo 'Please fill out the event time and date.';     ?>
Date: <input type="text" name="getextra_mbe_date" value="<?php esc_attr( $getextra_mbe_date); ?>" />

Time: <input type="text" name="getextra_mbe_time" value="<?php esc_attr( $getextra_mbe_time); ?>" />
      <?php }          //hook to save the meta box data         add_action ('save_post', 'getextra_mbe_save_dt');          function getextra_mbe_save_dt( $post_id ) {              //verify the metadata is set         if (isset( $_POST['getextra_mbe_date'])) {             //save the metadata             update_post_meta ($post_id, '_getextra_mbe_date', strip_tags($_POST['getextra_mbe_date']));             update_post_meta( $post_id, '_getextra_mbe_time', strip_tags($_POST['getextra_mbe_time']));         }          }      ?>


What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?

I am pretty new in WordPress theme development and I have the following doubt. I am working on this custom theme: http://lnx.asper-eritrea.com/ Into this website upper horizontal main menu I have a link named **LEGACY- POSTS** (the last one) that should show the list of all the posts belonging to a specific category (named **legacy-posts** ). Clicking on this link I obtain a white empty page: lnx.asper- eritrea.com/category/legacy-posts/ I think that it could depend by the fact that maybe I have to implement this page. Is it right? I was looking on the **Template Hierarchy** official WordPress documentation page: http://codex.wordpress.org/Template_Hierarchy But I am finding some difficulties to understand what name I have to use for the file that implement this page. Can you help me? Tnx


wp_next_scheduled returning a past timestamp

So, here is my entire code in wp_content/plugins/my_plugin/my_plugin.php :               register_activation_hook(__FILE__, 'comunity_mails_activation');     add_action('check_mails_to_send', 'do_this_daily');     register_deactivation_hook(__FILE__, 'comunity_mails_deactivation');           function comunity_mails_activation() {         wp_schedule_event(time(), 'daily', 'check_mails_to_send');     }          function comunity_mails_deactivation() {         wp_clear_scheduled_hook('check_mails_to_send');     }          function do_this_daily() {         wp_mail("my@email.net", "Automated Email", "Hell yeah it works!");     }      When I do `echo date("d-m-Y H:i:s",wp_next_scheduled('check_mails_to_send'));` in the functions.php of my theme, it prints 13-02-2013 14:22:03 So I tried to do this :               do_action('ckeck_mails_to_send');      And my mail was sent. So I wonder, do I have to unschedule the task and schedule it again for the next day and compare the two timestamps and ... sounds silly... I just don't understand why the mail has not been sent and why it's not scheduling it for the next day. Thanks for reading/helping =D


Embed plugin into Custom Page Template

I've created a new page type:               <?php     /*     Template Name: Pagina de Agenda     */     ?>               <?php get_header();?>          <?php $info_address = get_option('theme_info_address') ;?>                            <div id="content">                         </div>                  </div>             <!-- END OF CONTENT -->             <?php get_footer();?>      And the only thing I need, is to call [wcs] shortcode into content div... But It ain't working... Already tried:               [wcs]          <?php echo do_shortcode('[wcs]'); ?>          do_shortcode('wcs')      None of them worked :s I've seen a question about this here but didn't solve my problem yet...


Add class to all parent elements inside the_content

Is there a way to add a class to all parent elements inside the_content? My problem is I'm using this kind of css selector:               .post_content>* {margin-bottom:10px;}      This is to due with mostly paragraphs, but also any other element that might be added to the post which won't be wrapped in a paragraph. I thought the best way to avoid this (as its an expensive selector) would be to add a class to those elements. I would like a php solution, a filter in the_content that would let me add (not replace) the class of elements just below .post_content (or parent elements in $content). Thank you


Unique session WordPress

I want to allow only one session at the time across browsers and PCs. I want to "disconect" or log out to the old session if a new session starts in Wordpress.


Need help with category page customization meeting certain condition

I have 3 columns in my category page. On the left column, I want to show Recent posts only from that category I am viewing. In the middle column I want to show most viewed post only from that category and in the extreme right column I want o show all featured post. I am unable to accomplish that, so needing help.


Using Variable in WordPress Translate Functions

From everything I've read, you should only translate text strings via the WP translation functions like `_e()` or `__()`. However, I need a way to translate content submitted via a form. Is there some solution that will allow me to translate text outputted in a variable? Here's what I'm doing: I'm working on a plugin for a company and they need the ability to set the description text for a checkbox via a form on the back end. The checkbox will be placed on a WooCommerce checkout page. They're using the WPML plugin, and want that text to be translatable. Here's what I naturally would want to do, but I know it's wrong:               woocommerce_form_field( 'my_checkbox', array(          'type'     => 'checkbox',          'class'    => array('input-checkbox'),          'label'    => __( $sample_variable , 'woothemes'),           'required' => false,         ),      Here's what I think I should do, but it doesn't seem to work:               woocommerce_form_field( 'my_checkbox', array(          'type'     => 'checkbox',          'class'    => array('input-checkbox'),          'label'    => sprintf( __('%s', 'woothemes'), $mpo_check_box_desc ),           'required' => false,         ),      Any help would be much appreciated, thank you!


Twenty-Eleven Theme and Automatic Picture Resizing

I'm running a family wordpress blog: http://www.kjirstiandtom.com We have a lot of pictures we put up for family. I'm using the twenty-eleven theme, which I love. I did minor css edits to change colors and fonts, but it's otherwise pretty much stock. Resizing works great... until you get really skinny (e.g. iphone screen). if you resize the browser window, you see that the pictures width starts to resize, but the picture height does not. Any tips? Thanks!


On update to 3.04 site started recording accents as "Ã¡" and "Ã¡", what to do?

One day my site worked perfectly and the next it suddenly started to have trouble recording accented characters. The problem affects posts' body, if I submit a post with an accent on the title it records it correctly. However if I put it on the post's content instead of recording "casá" the posts "CasÃ¡" and if I edit it, it says "casÃ¡" It's causing havok on my site because it's very "search based" and searches no longer work. I really don't know what to do. Anyone has experienced something like this before or has any idea of how to fix it? Or as a last resort is there a way to turn everything to us characters?


How to add "data-toggle" to wp_bootstrap_navwalker?

I'm writing one pager for my client. I made Child Theme from Twenty Thirteen. All is made on Bootstrap 3.2.0. I use tabs, accordion. And i also want to use jQuery Smooth Scroll plugin. **Unfortunately tabs and smooth scroll have a conflict.** I resolved it by adding additional data-toogle to `<li>` element in HTML menu. Later on i have to switch from HTML menu to wp_nav_menu. **And this is when the problem starts:** default wp_nav_menu don't have ability to add unique data-toggle. I know i can modify it in walker_nav_menu. What is more i use one Walker already - wp_bootstrap_navwalker.php https://github.com/twittem/wp-bootstrap- navwalker/blob/master/wp_bootstrap_navwalker.php **My problem:** How can i modify wp_bootstrap_navwalker and add my unique data-toggle? I am begginer at php. My previuos html menu:

oferta szkoleniowa

informacje praktyczne

logowanie

o nas

kontakt

      My new wp_nav_menu:                       <?php             wp_nav_menu( array(                 'menu'              => 'Main menu',                 'container_class'   => 'navbar-collapse collapse',                 'menu_class'        => 'nav navbar-nav',                 'walker'            => new wp_bootstrap_navwalker())             );           ?>      Without data-toggle my jQuery Smooth Scroll doesn't work at all. Could you please please help me?


Display "Page 3 of 5" for a paginated post

I have a custom post type that I want to display the page you are on and how many pages total in this manner "Page 3 of 5" (meaning you are on page 3 of a 5 page post). These don't have to be links, just plain text numbers. I'd still like to keep the standard function of the wp_page_links parameter "next_or_number" set to "next", but add this other page indicator. I've tried experimenting with making my own funciton with some of the variables in the wp_page_links function on line 567 of the post-template.php file but I didn't get anywhere.


The famous Wordpress white screen of death

Like mentioned in the title, i think this is by far one problem Automattic or Wordpress team cannot solve until no matter what version Wordpress will go in future. In this question, i am focusing to the white screen of death that i get whenever i want to activate certain plugins. I am developing a site that requires me to use 30 plugins. Yeah, some will say thats too many plugins for a site, no wonder i will get the white screen. But hey, this is Wordpress, one of the reason that makes Wordpress the most popular blogging platform is because the availability of the plugins that can make you achieve your goal in less time. For those who expert in php+wp development, you guys can say hack the wp is better than using a lot of plugins like what i am doing but hey, majority of wp users are not php guru. Most of them are normal user like me or even just know how to install and use what are available to them. So far, here the common steps we do when get the white screen of death (WSOD).   1. Rename the **wp-content/plugins** folder name such as **wp-content/plugins-temp** , this will deactivate all plugins   2. Like me, i prefer rename the individual plugin folder name, such as **wp-content/plugins/akismet** to **wp-content/plugins/akismet-temp**   3. After that, reactivate all the plugins one by one, so we can know which plugin is the culprit   4. Check for extra empty space at the end of the plugin file, especially after the php closing tag ?> make sure there is no extra space after the tag. Make sure check at the theme functions.php file (if any) or the plugin file.   5. Increase the memory allocation for wordpress Usually, your site will be back to normal after that. **BUT** this will still not solve this problem. For me, this is very annoying to me, especially the step number 3. How can we know which plugin is the culprit?? At the first place, i thought the step number 3 is really a fact but now i think its a lie. WHY? Like right now, suddenly after i activate 25 plugins, one of plugin that i cannot reactivate is Akismet. What? Akismet? Yes, the plugin dev by the WP team itself. I know the step number 3 above is a lie because if i activate Akismet first, the Akismet is activated successfully. No problem at all. So right now the problem is plugins compatibility among the plugins. How can me as a normal user can identify which plugin that is not friendly to what plugin??? If i am using 30 plugins, how many probabilities from one plugin is not compatible to each plugin???? how can i know which plugins should be activated first so the WSOD will not appear? If there is error, then maybe i can have a clue, but its a plain white screen. I am clueless. This clash of plugins in wordpress is really an unsolved problem that makes me really stress. Anyone know how to fix this? At least know how to activate the plugins via mysql?


Stop Wordpress Wrapping Images In A "P" Tag

I have searched high and low for a simple solution to this, but to no avail. Wordpress keeps on wrapping my images in p tags and because of the eccentric nature of the layout for a site I am working on, this is highly annoying. I have created a jQuery solution to unwrap images, but it isn't that great. It lags because of other stuff loading on the page and so the changes are slow to be made. Is there a way to prevent Wordpress wrapping just images with p tags? A hook or filter perhaps that can be run. This is happening when uploading an image and then inserting it into the WYSIWYG editor. Manually going into the code view and removing the p tags is not an option as the client is not that technically inept. I understand that images are inline, but the way I have the site coded images are inside of divs and set to block, so they are valid code.


Should I add sharing buttons using a plugin or directly in my theme files?

This question relates to plugins for Linkedin Share buttons, Twitter Tweet buttons, and Facebook Like buttons. These are for blog posts on a WordPress blog which is at a subdomain of a site that is built in CakePHP. Considering the possibility that plugins can become outdated, and that if this happens there is a possibility of losing the counts of shares / tweets / likes, I'm wondering if it's better to add in these sharing buttons manually into the `single.php` theme file. Is it better to use plugins to add in these buttons, or to add the buttons manually into the `single.php` theme file?


Custom comment type maybe?

(First of all, sorry for bad english) If there are people here using wordpress as cms, you probably realize that you dont need comment system that much. Esspecially custom post types like products need a contact form system that saves coming input. What i am dreaming but cant coding: Changing comment system for custom post types. Let me explain on an example: Lets say we have a custom post type thats using for product list. We dont need/want customer comments on this product but we want customers send us what they are thinking on this product. So they will use this "custom comment type" system and sending us a comment but this comment is not publishing on website and in admin panel, when we reply to comment, wordpress will send that reply as e-mail. So we can see all new contact form inputs about this product in a list as archieved in wordpress comment table and we can reply them from admin panel. When product is updated or a special discount or something, we will have a list of customers that previously asked a question about it so we can contact them again about new updates. In background, as performance, product custom post type not need to load comments so this will reduce database queries. What do you think about it? Possible?


How do I list only children of a specific category in a drop-down?

Okay, I think I'm pretty close. I have the following going on:               $cat_id = get_cat_id('library');          wp_dropdown_categories('hierarchical=1&parent=$cat_id');      However, it doesn't work with $cat_id in there. It does work when I put the category's ID number in there (which I got when I echoed $cat_id), but obviously that presents a problem when I install the site on the real server. What should I try? Thanks!


Does WordPress keep track of a post's URL history and provide automatic redirects?

I just changed the URL of one of my posts from > http://2011.denmark.wordcamp.org/session/theme-frameworks-trends-og- > standardisering/ to > http://2011.denmark.wordcamp.org/session/wordpress-themes-mere-end-design/ Now, if I go to the old url, I get redirected to the new one. This is great of course!   ...But is this a feature of WordPress, or what's going on here? Does WP keep track of a post's URL history, providing rewrites/redirects for former URLs?   Looking at the response header I see WP is sending out a SEO friendly 301 redirect... Yes!?   I thought I'd have to set up those redirects using rewrite rules in my `.htaccess`, so I'm curious to know how it happens that WP is giving me my new URL when I type in the old one. Any light on how WP handles this would be appreciated.


Get custom post type categories to show up in menus

I'm wondering how it's possible to add custom post type categories as an option to add as a navigation menu item. What I have:               $portfolio_args = array(         'labels' => array(             'name' => 'Portfolio Items',             'singular_name' => 'Portfolio Item'),         'description' => 'Allows you to build custom portfolio items and link them to categories',         'public' => true,         'show_ui' => true,         'menu_position' => 20,         'supports' => array('title', 'editor', 'thumbnail'),         'has_archive' => true,         'rewrite' => array('slug' => 'portfolio-item'),         'can_export' => true     );          // http://codex.wordpress.org/Function_Reference/register_post_type     register_post_type('portfolio', $portfolio_args);          $categories_labels = array(         'label' => 'Categories',         'hierarchical' => true,         'query_var' => true     );          // Register taxonomies for extra post type capabilities     register_taxonomy('portfolio_categories', 'portfolio', $categories_labels);      Which works fine. I can create new categories for that specific post type. What I want to do is be able to go to wp-admin/nav-menus.php, scroll to the bottom and on the left, see the categories listed under 'Categories'. Any ideas? Thanks.