shortcode help require

Here you go: add_shortcode(‘latest_tweets’, ‘latest_tweets’); function latest_tweets($atts){ extract(shortcode_atts(array( ‘max’ => 5 ), $atts)); $twitter_id = esc_attr(strip_tags($atts[0])); // try to get data from cache to avoid slow page loading or twitter blocking if (false === ($output = get_transient(“latest_tweets_{$twitter_id}”))): $doc = new DOMDocument(); $feed = “http://twitter.com/statuses/user_timeline/{$twitter_id}.rss”; $doc->load($feed); $output = “<ul>”; $i = 1; foreach ($doc->getElementsByTagName(‘item’) as $node) … Read more

Alter required message using comment form api

What you need to use is comment_form_defaults filter that has large and nested $defaults array passed. That array will have (among other things) something like this in it: fields author << this will have something like <span class=”required”>*</span> in it email << this will have something like <span class=”required”>*</span> in it url comment_notes_before << this … Read more

Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view

Start by reading the notices–they tell you very explicitly what the problem is. Let’s start with the first one: Notice: Undefined index: _wr_event_speaker in /Users/my/htdocs/wr/wp-content/themes/wr/functions.php on line 246 First, this is just a “notice”. Meaning that no error has actually occurred. PHP is just telling you that something isn’t quite right, but that it skipped … Read more

Load Javascript from Plugin in One Page Only?

Drop this in your functions.php or a custom plugin. function wpse_57621_alo_tidy() { if ( $page_id = get_option( ‘alo_em_subsc_page’ ) ) { if ( ! is_page( $page_id ) ) remove_action( ‘wp_head’, ‘alo_em_ajax_js’ ); } } add_action( ‘wp’, ‘wpse_57621_alo_tidy’ ); It’s attached to the wp hook, which runs just after the request has been handled & queried. … Read more

Custom theme, contact form 7 & fast secure form doesn’t work

I found the solution myself, It had something to do with my code echoing out $content = $page->post_content … echo $content;… I changed this to $content = apply_filters(‘the_content’, $page->post_content); … echo $content;… And now it works! Ref: https://stackoverflow.com/questions/6405974/using-get-pages-in-wordpress-is-stripping-out-my-p-tags

error in getting post id

On a default install of WP you get always the ID of a post with the function get_the_ID(). Id dosnt work this you go about the global var: $post. echo $GLOBALS[‘post’]->ID Is this not enough, then go about the global wp_query $GLOBALS[‘wp_query’]->post->ID;

List the authors that have written posts in a category

I found a solution. CODE: <?php $cat_arr = get_categories(); // Get the list of Categories foreach ($cat_arr as $cat_obj) { $term_id = $cat_obj->term_id; // Print the Name ?> <br> CAT NAME: <?php echo $cat_obj->name ?>, AUTHOR: <?php // Get all Posts of that Category $posts = get_posts(array(‘category’=>$term_id)); $authors_arr = array(); foreach ($posts as $post_obj) { … Read more

wp_get_post_terms Order by not working

Your title is wp_get_post_terms Order by not working but if you use a custom post type you need to use wp_get_object_terms() I’m not sure what your aim is, but here is a code example you can try: $my_post_type=”post”; // edit this $my_taxonomy=”category”; // edit this $my_query = new WP_Query(array(‘post_type’ => $my_post_type,’posts_per_page’=>10)); if ($my_query->have_posts()) : while … Read more