How to get Post ID with the Add Filter Function

Nevermind, found out I can use get_the_ID();. This function will return the post id inside the the_content filter. The function simply declares the global $post object and returns its ID. add_filter(‘the_content’, ‘wpse51205_content’) wpse51205_content($content) { echo $content; // Echo out post content $PersonName = get_post_meta(get_the_ID(), ‘PersonName’, true); echo ‘Person: ‘ . $PersonName; } If you don’t … Read more

How can I track active users of my plugin? and why doesn’t WordPress.Org offer this?

You cannot get these data. There are several issues with plugin usage tracking: No clear definition of a user: Think multi-site, local installations, intranets … Privacy: You would have to ask the user before you can activate tracking. There are many good reasons not to send any data to an unknown entity without consent (traffic, … Read more

How to add a button to custom post type’s posts-page

You can add button via add_meta_box function. function add_your_meta_box(){ add_meta_box(‘your-metabox-id’, ‘Title’, ‘function_of_metabox’, ‘custom_post_type’, ‘side’, ‘high’);} add_action(‘add_meta_boxes’, ‘add_your_meta_box’); function function_of_metabox() {?> <input type=”submit” class=”button button-primary button-large” value=”Add New” id=”add-new”/> <?php } if you add to multiple post type, you should use foreach loop. function add_your_meta_box(){ $types = array(“post”,”page”,”custom_post_type”); foreach($types as $type){ add_meta_box(‘your-metabox-id’, ‘Title’, ‘function_of_metabox’, $type, ‘side’, … Read more

Where do I start from

Glad your taking the jump into wordpress, wordpress is an amazing platform for developers and non-developers alike, if you have knowledge of PHP, HTML, CSS (and jQuery in some instances) you will enjoy working with wordpress. A great place to start understanding wordpress would of-course be the wordpress website itself. http://codex.wordpress.org/Main_Page I hope this helps, … Read more

Nav Menu meta failing to import

The problem was ultimately with the WordPress Importer plugin. I could hack at it (and have suggested an improvement to the developers) but I am going to got around this by writing a custom Importer of my own. It isn’t the most convenient (to re-upload the .XML file) but in cases where users have complex … Read more