Add title & subtitle to shortcodes

function spoiler( $atts, $content = NULL ) { extract( shortcode_atts( array( ‘title’ => ‘default title’, ‘subtitle’ => ‘default subtitle’, ), $atts ) ); return ‘<div class=”moreinfo”><h3 class=”click drop subtitle”>’ .’Title:’.$title.’Subtitle:’.$subtitle. ‘</h3><div class=”morecontent”><p>’ .$content. ‘</p></div><!–/.morecontent–></div><!–/.moreinfo–>’; } add_shortcode( ‘spoiler’, ‘spoiler’ ); //[spoiler title=”title” subtitle=”subtitle”]content[/spoiler] Docs: add_shortcode, extract That should allow you to display the title and subtitle … Read more

How to Insert A List of Posts in A Category Written by the Author into the Author Archive

Not the most efficient way but it works, put this in your theme’s functions.php function author_post_breakdown($author_id){ //get all post of this author $n = get_posts(array( ‘author’ => $author_id, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’ ) ); $cats= array(); //loop over all post of this author and get the categories for each post foreach((array)$n as $id){ … Read more

Gallery Shortcode Function Help

The function you’ve supplied actually doesn’t look that bad. It’s almost the same way I’d handle the problem, however if you only ever want to modify the include part and always get the attachment_ids associated with the post, here is what I would do. I would actually create a new shortcode which in turn calls … Read more

Using is_plugin_active within functions.php

How about this? function useragent_shortcode($tag) { include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ ); if ( is_plugin_active(‘contact-form-7/wp-contact-form-7.php’) ) { if ( ! is_array( $tag ) ) return ”; $options = (array) $tag[‘options’]; foreach ( $options as $option ) { if ( preg_match( ‘%^name:([-0-9a-zA-Z_]+)$%’, $option, $matches ) ){ $name_att = $matches[1]; } $userAGENT .= $_SERVER[‘HTTP_USER_AGENT’]; } $user_agent = $userAGENT; … Read more