title: How to copy [gallery] shortcode between posts using polylang

text: 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...


title: Quotation marks disappearing from custom field

text: 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?


title: Get attachment id from thumbnail url

text: > **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?


title: one page wordpress theme

text: 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?


title: Changing permalink changes stylesheet path?

text: 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.


title: my own SVN for a plugin/theme

text: 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?


title: Change content before writing to database

text: 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.


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

text: 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?


title: Get Wordpress Category ID from a URL string

text: 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 :)


title: Create and Assign Page on Signup

text: 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?


title: How to show one post different from the rest?

text:
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?


title: Pages not using permalink

text: 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?


title: https and wordpress breaks posts

text: 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_ * * *


title: Organizing Custom Post Type Archive Template

text: 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 );          }


title: Advanced Custom Fields google map

text: 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.


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

text: 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.


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

text:
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!


title: Email stats at Ma.tt contact form

text: 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.


title: Role based permission edit for plugins

text: 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/


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

text:
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?


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

text:
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?


title: How to change user`s avatar?

text: 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? ;/


title: WordPress Core - Optimizing meta_query generated SQL?

text: 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?


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

text: 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.


title: approval of posts via email

text: **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?


title: Is get_posts() more efficient than The Loop?

text: 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.


title: How to setup a wordpress backup in localhost?

text: 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.


title: Settings API repeater fields

text: 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.


title: Displaying Slider in Front Page (home) using Customizr Theme

text: 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 :-(


title: Same date post in one box

text: 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.     |     +------------------------+


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

text: 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


title: List Categories in Custom Order

text: 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.


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

text: 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?


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

text: 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?


title: Making Quote Plugin more efficient

text:
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 } ?>


title: .htaccess browser caching and user login

text: 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 ##


title: How can I get a traceback on function calls?

text: 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.


title: Query post names based on tags of current post

text: 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


title: Best Practice for Changing Custom Fields

text: 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!


title: Mobile User Registration

text: 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


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

text: 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.


title: Woocommerce display parent child category

text: 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?


title: Get Author for Single Post in Custom Post Type

text: 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!!


title: Xml output not places where i want

text: 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.


title: apply_filters/do_action tag characters limit

text: 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, ....


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

text: 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();


title: How to list a page tree?

text: 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?


title: How can I add widgets to specific post

text: 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.


title: Query Problem in getting top viewed posts

text:
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!


title: permalink repeated

text: 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?


title: One of my users cannot select Categories for his posts

text: 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?


title: Metabox Data not saving

text:
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']));         }          }      ?>


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

text: 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


title: wp_next_scheduled returning a past timestamp

text: 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


title: Embed plugin into Custom Page Template

text: 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...


title: Add class to all parent elements inside the_content

text: 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


title: Unique session WordPress

text: 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.


title: Need help with category page customization meeting certain condition

text: 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.


title: Using Variable in WordPress Translate Functions

text: 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!


title: Twenty-Eleven Theme and Automatic Picture Resizing

text: 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!


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

text: 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?


title: How to add "data-toggle" to wp_bootstrap_navwalker?

text:
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?


title: Display "Page 3 of 5" for a paginated post

text: 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.


title: The famous Wordpress white screen of death

text: 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?


title: Stop Wordpress Wrapping Images In A "P" Tag

text: 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.


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

text: 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?


title: Custom comment type maybe?

text: (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?


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

text: 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!


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

text: 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.


title: Get custom post type categories to show up in menus

text: 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.


title: Get Tags specific to Category using WooCommerce plugin

text:
Could anyone help me to implement this code in WooCommerce, ie instead of categories to use product categories, and instead of tag to use product tag. In functions.php :               function get_category_tags($args) {     global $wpdb;     $tags = $wpdb->get_results     ("         SELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, null as tag_link         FROM             wp_posts as p1             LEFT JOIN wp_term_relationships as r1 ON p1.ID = r1.object_ID             LEFT JOIN wp_term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id             LEFT JOIN wp_terms as terms1 ON t1.term_id = terms1.term_id,                  wp_posts as p2             LEFT JOIN wp_term_relationships as r2 ON p2.ID = r2.object_ID             LEFT JOIN wp_term_taxonomy as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id             LEFT JOIN wp_terms as terms2 ON t2.term_id = terms2.term_id         WHERE             t1.taxonomy = 'category' AND p1.post_status = 'publish' AND terms1.term_id IN (".$args['categories'].") AND             t2.taxonomy = 'post_tag' AND p2.post_status = 'publish'             AND p1.ID = p2.ID         ORDER by tag_name     ");     $count = 0;     foreach ($tags as $tag) {         $tags[$count]->tag_link = get_tag_link($tag->tag_id);         $count++;     }     return $tags;     }      In wp theme:               $args = array('categories'=> '3');      $tags = get_category_tags($args);      $content .= "
";      foreach ($tags as $tag) {          $content .= "
tag_link\">$tag->tag_name
";     }      $content .= "
";      echo $content;


title: WordPress 3.1 not compatible with jQuery Mobile?

text: I recently updated to WordPress 3.1, and with that update, something very interesting happened. Links became unclickable -- clicking on any link would literally result in nothing happening. Interestingly enough, all of the jQuery stuff still works. Removing the jQuery Mobile script gets rid of the problem. The error being generated was:               Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: http://......./wp-includes/js/jquery/jquery.js?ver=1.4.4 :: anonymous :: line 138"  data: no]      Any idea how to fix this?


title: How to create a custom search in wordpess matching with title and metadata

text: I want a custom search in wordpress where the search query should return results matching to post title or with a custom metadata. For example if a user is searching for "chicken" in my site, it should return all posts with a matching title like "chicken fry" and all posts which use chicken as an "ingredient" (ingredient is the metadata name). I wrote the following script                       $searchArgs = array(                 'post_type' => 'post',                 'post_status' => 'publish',                 'orderby' => 'title',                 'order' => 'ASC',                 'nopaging' => true,                 'meta_query' => array(                     'relation' => 'AND',                     array(                         'key' => 'ingredient',                         'value' => $q,                         'compare' => 'LIKE',                     )                 )                    );             $the_query = new WP_Query( $searchArgs );             while ( $the_query->have_posts() ) {                 $the_query->the_post();                 echo get_the_title();             }      How can I include a like search in title also? I found this post Using meta query ('meta_query') with a search query ('s') But it needs three queries and seems a little complex. Is there any direct query?


title: Using My-Meta-Box-Class plugin, how is 'Date' value stored?

text: I've created some custom fields in a custom post type using the my-meta-box- class plugin which comes with a built in 'date' type of meta box input. I'm having a hard time ordering my custom posts by date. Is the date in this plugin stored as a strtotime()? If not, how can I slightly modify the plugin to get it to do so. Is that even necessary? Is there an easier way to order the events in my custom post type using what is already there in the plugin?


title: Using functions from a plugin in your theme

text: I am a beginner to wordpress (and to php for that matter). I am trying to understand some of the basics, and building a little e-commerce store using a plugin called "Jigoshop." I'm reading through the source files and seeing a bunch of useful functions- things like a "is_featured" function that returns true if the product has a product meta that marks it as featured; or a reference to all products that I can use without having to set up my own by querying the posts and filtering out those that are not products. I have a custom-template file that I am using for the storefront (homepage), and I would like to access some of these functions to simplify the code I have to write, but it seems I don't have access to them. My questions is: Are functions and objects defined in a plugin useable in my theme templates (or custom templates; I'm using a child theme right now)?


title: Display number of latest images from wordpress gallery in your homepage

text: I was trying to get a solution for something that I am trying to accomplish. I am using the wordpress native and simple gallery to show images in a page called: "gallery" so far - very simple. it works fine and I have a gallery page with thumbnails. Now, I would like to show 8 latest photo thumbnails in my homepage. no link to the bigger image is necessary, just literally, grab 8 (or another number..) latest images which was added to that gallery and show them in a simple box in my homepage. I would also like to output my own HTML so I can customize it to my homepage needs. anyone has a solution? Thanks a lot.


title: Multiplile values checkbox or select in custom meta box

text: I have followed the great answer by Jan Fabry in this question . How to make multicheck for post/page meta box this works great. My question though would be , what if someone WANTS a serialized value (array e.g. :"banana,apple,grapes" in ONE field ? ) and not separate values ? It is strange how in all the tutorials, example, and classes, everyone ignores multiple selection (also in select list)


title: How to make an admin create/edit post page to look like taxonomy page?

text: This idea just came to me, where I thought it would be great to have something like this for CPTs that doesn't need much content/fields to fill out. Basically a Post page where your able to add a post, as well as see the other posts in a list-table next to edit. For instance like the picture below: ![Post Page that looks like Taxonomy Admin Page](http://i.stack.imgur.com/Z4ecm.jpg) Of course, there will be no use for WYSIWYGs, but I think this would be great for simple CPTs if this is something we're able to create in the Admin page. Would love to know if this is possible, or examples of something similar if you seen such a thing.


title: PHP Fatal Error - $wpdb a non-object?

text: I'm getting many Fatal errors like this in Wordpress 3.6.1, multisite with Buddypress: `PHP Fatal error: Call to a member function suppress_errors() on a non-object in /myblog/wproot/wp-includes/option.php on line 143` The non-object referred to is the global value $wpdb, in the line: `$suppress = $wpdb->suppress_errors();` which is in the function **wp_load_alloptions()** Any ideas why $wpdb would not be set, and if there is anything to be done to remedy this? Sorry I don't have any more useful on this, the errors are isolated and don't show a stack trace.


title: Multilanguage site with two domains

text: I want to make the same site in two languages, spanish and english. After test a pair of plugins and see which options exists looking at some technical blogs, I think the better is to make two blog with native languages in different domains. So now I have one site running in spanish (not full but near ready), and I need to translate to english. Migrate content is hard but I think I can do it. The problem for me is how to display flags, and redirect to target site. ¿How can I do this? I´ve seen Zanto plugin but I don´t know if it suits my needs. Any comment or advise is very welcome.


title: Grant user rights to access certain tabs of a plugin

text: I found out a way to grant a user permission to access a single plugin but it has its flaws. Right now there are 6 tabs on the options page of this plugin. ![The tabs](http://i.stack.imgur.com/mh1cC.png) The user has access to all these tabs now. I just want him to be able to access "1, 2 and 4 ". The rest should **not** be visible for him. This is the piece of code I have set up for this. It allows the Editor to access the settings page. See image for the settings page.               if ( is_admin() )       {           add_action( 'admin_menu', 'add_plugin_for_editors' );       }            function add_plugin_for_editors()        {           if (!current_user_can( 'manage_options' ))           {               add_menu_page('Rooster', 'Rooster', 'editor', 'rooster', 'rooster_html_page');           }       }        If something is unclear please let me know. Feel free to edit my post if you see any grammatical errors.


title: Wp3.5 Media Gallery Edit modal: change captions to title

text: How can i change those editing inputs to title from caption? ![wp3.5 gallery edit](http://i.stack.imgur.com/MDUwZ.png) Some sources i found about new upload system:   * Using the WordPress 3.5 Media Uploader within plugins   * How to Add the WordPress 3.5 Media Manager Interface Basically looking for a proper solution like this:               // http://wordpress.org/support/topic/wp-35-any-way-to-default-add-media-to-upload-files#post-3709109     // If you want to have the editor default to the Upload Files tab in the admin editor     add_action( 'admin_footer-post-new.php', 'idealien_mediaDefault_script' );     add_action( 'admin_footer-post.php', 'idealien_mediaDefault_script' );     function idealien_mediaDefault_script()     {         ?>     <script type="text/javascript">     jQuery(document).ready(function($){         wp.media.controller.Library.prototype.defaults.contentUserSetting = false; // making editor default to the Upload Files          });     </script>     <?php }


title: Variable use in get_template_part

text: As far as I understand (from the get_template_part codex) `get_template_part` is just a wrapper round the PHP require function. So if I have a variable that I have create in a page template file e.g. `$message`, I would have assumed you could directly use that variable in the template part So in template file:               <?php      $message = 'my message';     get_template_part('messages');      ?>      Then in template part messages.php:               <?php echo $message; ?>      However the echo will display nothing.


title: How to change twentytwelve child theme site title separator

text: I am using a child theme with WordPress twentytwelve. I'm confused as to what function I can use in the child theme's functions.php to just change the site title separator, from its default vertical slash | to a hyphen -


title: Get all media categories

text: I've added a new taxonomy for the medias post type:               function register_taxonomy_for_images()     {         register_taxonomy_for_object_type('category', 'attachment');     }          add_action('init', 'register_taxonomy_for_images');      And I've added a few categories via wordpress admin.How can I get an array of all the media categories that I added? I've tried get_categories() but it doesn't work.


title: WordPress 3.8 get current admin color scheme

text: I'm trying to get the stylesheet of the currently active admin color scheme to style a plugin to fit into the color context. As mentioned in this post I had a look at the implementation of `admin_color_scheme_picker()` in `wp-admin/includes/misc.php:564`. They use a global variable called `$_wp_admin_css_colors` but when I try to access (`var_dump()`) it, it's `NULL`. Is there any way to access to actual CSS code? Why is the global variable `NULL`? I did a `grep -n '$_wp_admin_css_colors' -r .` and couldn't find any line where it gets destroyed... **EDIT** I see it wasn't clear what I exactly want. I don't want to access the actual CSS code, but the color codes that gets parsed into CSS. In `wp- includes/general-template.php:2117` the default themes are registered like this:               wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),         admin_url( "css/colors$suffix.css" ),         array( '#222', '#333', '#0074a2', '#2ea2cc' ),         array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' )     );      And I'd like to access the variables like this in PHP. Copying the definition is not an option, since other plugins and themes could add their theme themselves.


title: publish_post plugin hook doesn't always pass $post->post_content

text: I've written a simple plugin that grabs the contents of a post, as the post is published, and sends them to an external site for archiving. This generally works but when dealing with posts that haven't previously been saved or published, no `post_content` value is available. If you save as draft before publishing it all works fine, it's only when you publish straight away that the value is empty. My plugin is something like this:               function send_data($postID,$post){       global $post;       print_r($post); //used for debugging the contents of $post       //stuff here to send the post for archiving     }     add_action('publish_post','send_data',2);      And, if all goes well, I get this as the content of $post:               WP_Post Object ( [ID] => 159 [post_author] => 1 [post_date] => 2013-01-30 09:11:05 [post_date_gmt] => 0000-00-00 00:00:00 [post_content] => This is the content of the post [post_title] => Something new [post_excerpt] => [post_status] => draft [comment_status] => open [ping_status] => open [post_password] => [post_name] => [to_ping] => [pinged] => [post_modified] => 2013-01-30 09:11:05 [post_modified_gmt] => 2013-01-30 09:11:05 [post_content_filtered] => [post_parent] => 0 [guid] => http://wordpress/?p=159 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw )      But, if I jump straight from creating my post contents to the 'publish' button, I get an empty value for `$post->post_content`:               WP_Post Object ( [ID] => 159 [post_author] => 1 [post_date] => 2013-01-30 09:11:05 [post_date_gmt] => 0000-00-00 00:00:00 [post_content] => [post_title] => Something new [post_excerpt] => [post_status] => draft [comment_status] => open [ping_status] => open [post_password] => [post_name] => [to_ping] => [pinged] => [post_modified] => 2013-01-30 09:11:05 [post_modified_gmt] => 2013-01-30 09:11:05 [post_content_filtered] => [post_parent] => 0 [guid] => http://wordpress/?p=159 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw )      Does anyone have any thoughts on how I can make this more reliable? Is there a hook for `after_publish_post` or something similar? Any thoughts appreciated.


title: Facebook social publisher and custom post type fields

text: I have a problem with how Facebook plugin shows my WordPress-based posts on my timeline. What basically happens is that the post image isn't shown. Now, the post image I want to show is a custom field of a custom post type, and this is probably what's causing the problem to the Facebook plugin. On the single-post page I added manually the `og:` tags, and they're working properly (I see the image if I share the link on Facebook, and the Facebook object debugger shows it too, saying there are no problems). Do have I to do something to add manually the requested `og:` tags in post_publish hook? A sample page is this: http://www.zannoni-store.it/prodotti/canestro-sonoro And what I added in order to let the image be shown on share is this:               ..     $img = get_post(get_post_meta($post->ID, 'immagine', true));      echo '<meta property="og:image" content="'.$img->guid.'" />';     ..


title: Parse a shortcode differently based on on what it's nested in

text: Suppose we have two different sets of nested shortcodes, like this: ### Apple version   * `[wrapper snack="apple"] Today I had a [flavor] snack... [/wrapper]`   * **Desired output:** My snack was quite HEALTHY today... ### Donut Version   * `[wrapper snack="donut"] Today I had a [flavor] snack... [/wrapper]`   * **Desired output:** My snack was quite FATTY today... My question is: how can I parse the nested shortcode (`[flavor]`) differently depending on the shortcode it's nested in (i.e., based on `[wrapper]`'s snack attribute)? Please accept for the sake of the question that it's impossible/impractical to add an attribute to `[flavor]`. In pseudo-code, it might work something like this:               function flavor_shortcode_handler ( $atts, $content ) {         $wrapper = ??? // The value of the shortcode this is nested inside              if ( $wrapper == 'apple' ) return 'HEALTHY';         if ( $wrapper == 'donut' ) return 'FATTY';     }      I imagine there are a variety of ways to get the same effect by how we write `wrapper`'s handler function. ## Idea 1: Use a global variable               function wrapper_shortcode_handler ( $atts, $content ) {          // After extracting the snack attribute...          $GLOBALS['wrapper_value'] = $snack;          return do_shortcode( $content );     }      ## Idea 2: Find/replace the nested shortcode before processing it               function wrapper_shortcode_handler ( $atts, $content ) {          // After extracting the snack attribute...          $new_content = str_replace( '[flavor]', '[flavor wrapper="'.$snack.'"]', $content );          return do_shortcode( $new_content );     }      Obviously the examples and solutions are oversimplified, but is there an alternative that would work better?


title: Is it possible to remove next-post / previous-post with out creating a custom template?

text: I'm creating a plugin that uses a custom post type. I do not want to make a custom template for viewing the posts and discovered I can add a filter for the_content to include my custom fields, this works great. However, I don't want visitors to navigate the custom post types with the previous next navigation. It there a way to remove these without creating a custom template? Thank you for taking the time to look at my issue.


title: Show all parents and child posts using Types plugin

text:
I'm using the plugin Types and need to show all the parents and their children. There parent is specialty and the child is specialtytype For example:   1. parent      * child     * child   2. parent      * child   3. parent      * child     * child     * child Here is my code that is only show the parents and not outputting the child posts:               $args = array('numberposts' => -1, 'orderby' => 'name', 'post_type' => 'specialty');     $query = get_posts($args);          foreach($query as $post)     {       echo '
' . get_the_title($post->ID) . '
';            //children       $child_posts = types_child_posts('specialtytype', array('post_id'=> $post->ID));            foreach ($child_posts as $child_post)       {         echo '
' . get_the_title($child_post->ID) . '
';       }     }


title: WordPress Multisite — Have same navigation, sidebar and footer across all sites.

text: I've been looking around for a while now and still can't find a solution so am asking here. I have a site where anyone can sign up and create their own blog as a subdirectory of the main website. What I want is for every blog to have the same navigation (in essence the same header), footer and sidebar as the main website of the network. I couldn't find what I was looking for in the WordPress Codex. Has anyone found a solution to this before or can point me in the right direction?


title: How can I check for a thumbnail in WordPress?

text: How can I can I check if a post has a thumbnail and if does do something? If doesn't do something else. This is what I have:                <?php if (has_post_thumbnail()) ?>           <?php the_thumbnail(); ?>      ?>           <?php else ?>           <?php the_permalink();?>           <?php endif; ?>      Any help will be appreciate it.


title: add_action 'init' from inside a class for custom post types

text: I'm trying to create archive pages for my custom post type. I create custom post types from within custom classes: functions.php               include_once(get_template_directory() . '/admin/admin_init.php');      admin_init.php               include_once(ADMIN_CPT_DIR . '/CPT.php');      CPT.php               class CPT     {         protected $cpt_name;              public function __construct($cpt_name)         {             $this->cpt_name = $cpt_name;             add_action('init', array( $this, 'cpt_init' ) );         }              public function cpt_init()        {             $labels = array(             'name' => __('custom_name', 'textDomain'),             'singular_name' => __('custom_name', 'textDomain')              );                  $args = array(             'labels' => $labels,             'public' => true,             'has_archive' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'show_ui' => true,             'show_in_menu' => true,             'has_archive' => true,             'query_var' => true,             'rewrite' => array('slug' => 'custom_name'),             'supports' =>array('title','editor', 'custom-fields','thumbnail')         );              register_post_type( $this->cpt_name, $args );        }     }          if( is_admin() )         $cpt = new CPT('cpt_child');      The custom post type is registered and all works fine, but I always get a 404 when trying to access the archive page (archive-custom_name.php). If I take the inner part of the cpt_init - method and put it into the functions.php like so:               add_action( 'init', 'create_post_type' );              function create_post_type()         {             $labels = array(             'name' => __('mycpt', 'synTh_textDomain'),             'singular_name' => __('mycpt', 'synTh_textDomain')             );                  $args = array(             'labels' => $labels,             'public' => true,             'has_archive' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'show_ui' => true,             'show_in_menu' => true,             'has_archive' => true,             'query_var' => true,             'rewrite' => array('slug' => 'boom'),             'supports' =>array('title','editor', 'custom-fields','thumbnail')             );                    register_post_type( 'mycpt', $args );         }      everything works as expected. There is an `archive-boom.php`, which I can access via: `www.domain.com/boom/` I flushed the permalinks settings and I have them set to postname. Is there a difference, when attaching to a hook from inside a class??


title: How to add external remote JS source to Gravity Forms?

text: I would like to add an external javascript source to my Gravity Form. Like this:               <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true_or_false"></script>      How to do this? I don't get how can I do this with the function: wp_enqueue_script Then after adding this external/remote JS source, I would like use a custom JS with http://www.gravityhelp.com/documentation/page/Gform_register_init_scripts such as this line:               var autocomplete = new google.maps.places.Autocomplete(inputAddress);      But this won't work unless I have the external JS source added...Any ideas?


title: How to load a jQuery script last?

text: How to get this to load last?                <script type="text/javascript">       jQuery(document).ready(function(){        jQuery("div.domTip_tipBody").mouseover(function(){        jQuery("#yyy a.tippy_link").css("background-color","yellow");});               jQuery("div.domTip_tipBody").mouseout(function(){        jQuery("#yyy a.tippy_link").css("background-color","red");      });       });        </script>      It is running before "div.domTip_tipBody" is being run (which is generated by a shortcode) so nothing happens. I have tried:               <script src="script.js" type="text/javascript" defer="defer"></script>      in my header.php before               </head>       but it doesn't help. Have seen "window.onload =" but not sure how to apply it. Any insight is appreciated. Thanks


title: Using browser detection and the body_class() function to modify css

text: I'm using the following function, as described here: http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/ Now when I use the following css styles, it does exactly what I want in Safari and Chrome:               .safari li#linkrss {margin-top: -15px;}     .chrome li#linkrss {margin-top: -15px;}      When I try `.gecko li#linkrss {margin-top: 0px;}` for Firefox, however, it doesn't seem to apply. For example, when I inspect the css element using FireBug, it shows the style for Safari. Any tips on how to fix this?


title: Wordpress Excerpt Paragraph Limiting

text: I was wondering if it was possible to get the first two paragraphs and the feature image in the excerpt. I currently have the first 100 words, but would like the the first two paragraphs. What I want to achieve is something like Smashing Magazine, where the first paragraph is one font, and the second is the base, while and image is in- between. (http://smashingmagazine.com) I know you can do this with the manual excerpt too, but that's way too tedious!


title: wp_set_object_terms() Fails to Set Terms

text: Okay guys, here's the scenario. I'm am trying to setup a function that will automatically duplicate a post (when published) over to another post type. So, a regular blog post is published, and when it is published, all of its information is copied over to a custom post type (for WP ECommerce), automatically creating a store entry for that blog post. I've written a function that takes care of picking up all of the information and inserting it into a new post with wp_insert_post(). It all works great, except for one thing. I'm using wp_set_object_terms() to set the store category ids of the new product based on the tags of the blog post. However, for some reason, wp_set_object_terms() never works. Now, here's the catch. I'm running all of this on a multi site install and am using threeWP_Broadcast to allow me to cross publish posts. The blog posts (which have to be copied to the store) are published from a sub site and broadcasted to the main site. The store is on the main site. So I've hooked my custom function into the broadcast plugin so that it gets fired when a post is broadcasted from a sub site to the main site. Everything with my function works great, except for the wp_set_object_terms() Here's function:               function copy_post_to_store_product() {          global $blog_id;     global $wpdb;          // only copy the post over if on main site, not subsites     if ($blog_id == 1) {              $args = array('numberposts' => 1);         $latest = get_posts($args);         foreach($latest as $post) : setup_postdata($post);                  // if NOT Tip and NOT source avail, create product             // if source, price is ALWAYS $4             // auto create for source files only -- regular post type                  $custom_meta = get_post_custom($post->ID);                  // what kind of post is this?             $post_type = $custom_meta['cgc_post_type'][0];             // does this post have a source file product associated with it?             $source_avail = $custom_meta['cgc_source_avail'][0];                  // source file price             $price = '4';                       $product_info = array(                 'post_title'    => $post->post_title,                 'post_type'     => 'wpsc-product',                 'post_content'  => $post->post_content,                 'post_author'   => $post->post_author,                 'post_status'   => 'draft',              );                       if($post_type == 'Regular' && $source_avail == true) {                 // only auto create product for Regular posts that have source files for sale                 $product_id = wp_insert_post($product_info);                 update_post_meta($product_id, '_wpsc_price', $price);                      if (has_tag('blender', $post->ID))                  {                      $product_cats = array(23,32);                 }                 elseif (has_tag('max', $post->ID)) {                     $product_cats = array(23,34);                 }                 elseif (has_tag('modo', $post->ID)) {                     $product_cats = array(23,19);                 }                      // set the product categories                 wp_set_object_terms($product_id, $product_cats, 'wpsc_product_category' );                  }                   endforeach;     }      } The function works by retrieving the latest post from the main site ($blog_id == 1) and copying all of its information into variables for wp_insert_post(). Now, the really interesting thing is that works perfectly if I attach the function to a publish_post hook, but, unfortunately, I can't do that because that hook doesn't fire when a post is broadcasted. Any ideas would be hugely appreciated.