Plugin Handle URL With Custom Theme

Here’s a slimmed-down version of what I usually do. Replace wpse100645 with whatever you want, but be respectful of the fact that you don’t want to interfere with a site’s content. <?php /** * Create a custom path and process code when it gets triggered * * @author Matthew Boynes */ if ( !class_exists( ‘WPSE_100645_Custom_Page’ … Read more

Category’s Description field as editor remove tag

How are you outputting the category description? You might need to use something like apply_filters(‘the_content’, category_description( $category_id )); or wpautop(category_description( $category_id )); to have paragraphs in the output. Edit: Adding what you had in JSFiddle – note where $term->description is, I wrap it in wpautop. See if that works. If not, try apply_filters(‘the_content’, $term->description) instead: … Read more

Theme my Login plugin, how to update fields

The user_register hook only fires when the user first registers. To have the custom profile data show up on the Edit User screen, you should use the edit_user_profile hook (and possibly show_user_profile, if you want users to be able to edit their own custom profile information).

Why Won’t Exported Blog From One Site Import Into New Site?

A lot of people (including myself) have experienced random issues like you describe with this latest version of the WordPress Importer plugin. I recommend using WP Migrate DB. This plugin will not only migrate your content, but allow you to optionally find/replace any serialized URLs (in the event you’re migrating to a different domain as … Read more

How to add equivalent of php include to one page (as plugin?)

Adding a new shortcode requires the following function in your plugin file: add_shortcode( ‘google-cal’, ‘output_calendar’ ); This means that your plugin has a function named output_calendar that is called anytime WordPress sees the shortcode [google-cal] in post or page content. Put your existing code in the output_calendar function. You only need three things in your … Read more

Correct way to perform non-cacheable DB query

I am not completely sure what you are talking about so I will mention the possibilities that come to mind. Maybe this… // Keep track of the last query for debug.. $this->last_query = $query; http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/wp-db.php#L1195 … is what you are talking about. If so, your code just runs the flush method which resets $wpdb properties … Read more

Is there a way to share your Facebook Page’s stream on a WordPress page or post?

The solution is simple, you need your FB page RSS feed. To have it you can modify this simple URL: https://www.facebook.com/feeds/page.php?id=136027779805212&format=rss20 As you can see the number after ‘id=’ and before ‘&format’ is the page ID. If you don’t know how to find your page ID use this simple online service: http://findmyfacebookid.com/ Then with any … Read more

Best approach to fetch data from wp options to js file or php file

Assuming you’re not using AJAX for form submission, you can use wp_localize_script(). Here’s a simplified version: In your plugin file: function wpse105919_add_scripts(){ wp_enqueue_script( ‘myjs’, plugins_url( ‘/myjs.js’, __FILE__ ) ); wp_localize_script( ‘myjs’, ‘jsLocalizedObject’, ‘hello world’); } add_action(‘wp_enqueue_scripts’, ‘wpse105919_add_scripts’); contents of myjs.js file: alert( jsLocalizedObject ); wp_localize_script() will add a global variable called jsLocalizedObject to your document’s … Read more