Problem with shortcode inside a shortcode

Here’s a trick that wp-includes/media.php uses for the embed shortcode: first remove all shortcodes, then add a specific shortcode back to the system, filter your content for it, then re-register the original shortcodes. Try this: function etdc_tab_group( $atts, $content ){ global $shortcode_tags; $GLOBALS[‘tab_count’] = 0; // save the shortcode registrations $orig_shortcode_tags = $shortcode_tags; // remove … Read more

WordPress – using sessions?

It’s probably better to add your session_start(); to the top of your header.php file if you’re planning to use it in your theme. If you are wanting to use a session in the admin, I’d recommend either passing variables through $_GET or $_POST. Also, if you need long term storage of variables, it’s pretty easy … Read more

How to display this meta data (an array) in form of a function (created with a custom write panel)?

Try this? <?php function get_project_services() { global $post; $data = get_post_meta( $post->ID, ‘project’, true ); $project_services = $data[‘project_services’]; return $project_services; } ?> Then in your template file: <p><?php echo get_project_services(); ?></p> I think that will do what you’re asking? (Edited to match your comment.)

the_excerpt function not showing image

If you did not set an explicit excerpt for your post in the post editor, WordPress by default calls wp_trim_excerpt() to auto-generate an excerpt. This function throws out all HTML tags to make life simple. the_content() does not do this when it splits your post on a <!–more–> tag. If you don’t want this default … Read more

Add a custom function to widget code

Where did you call your item_width_cols_to_class “function”? You are using the function as a method inside the My_Widget class. Therefore, you have to call it with a reference to its non-existent object e.g. $this->item_width_cols_to_class() or self::item_width_cols_to_class() (static).

Editor cannot access Theme Options

First, you used a Theme Options tutorial that is way out of date. Using such out-of-date code is going to cause you many problems. You might try this one that I wrote. But specific to your current code, your call to add_menu_page() uses the edit_themes capability, which is limited to Administrator only. You need to … Read more

Unable to use get_page_by_title() more than once per page?

get_page_by_title returns an id not content. here is an example of what I use to get content from a certain page id. call the function $page_id = get_page_by_title(‘title’); $excerpt = get_excerpt_by_id($page_id); in functions.php function get_excerpt_by_id($post_id) { global $wpdb; $query = “SELECT post_content FROM $wpdb->posts WHERE ID = $post_id LIMIT 1”; $result = $wpdb->get_results($query, ARRAY_A); return … Read more