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

get_posts() method and paging is not working

@user702325 Here’s how i got it working fine on localhost: I installed the plugin and set the option Place Pager Automatically in Template on “on“. Then in author.php i modified the original query to add some custom parameters. I added this: global $query_string; // required $posts = query_posts(‘posts_per_page=2’); right between rewind_posts(); and get_template_part( ‘loop’, ‘author’ … Read more

why doesn’t my rewrite rule work? (is there something weird with wordpress htaccess?)

Sooo the problem was my brackets around the content in the condition I think. I’m still not so hot on these things, but I use these rules and they work: RewriteCond %{REQUEST_URI} ^/(review|preview|feature).*\-[0-9]+$ RewriteRule ^review/(.*)\-[0-9]+$ /$1 [R=301,L] RewriteRule ^preview/(.*)\-[0-9]+$ /$1 [R=301,L] RewriteRule ^feature/(.*)\-[0-9]+$ /$1 [R=301,L] note: the (review|preview|feature) but is an x OR y OR … Read more

Ordering custom posts

The way I previously did this, was by adding a custom field to my CPTs, and ordering by that value when I fetched my posts with WP_Query. $myquery = new WP_Query( array( ‘post_type’ => ‘your_post_type’, ‘meta_key’ => ‘my_custom_field_name’, ‘orderby’ => ‘meta_value’ ) ); However, I believe if you add ‘page-attributes’ to your ‘supports’ parameter when … Read more

help with rewrite_tag and rewrite_rule for custom page GET variables [duplicate]

You should use get_query_var rather than $_GET. But you will need to register you custom variables, for instance: add_filter(‘query_vars’, ‘register_my_query_vars’ ); function register_my_query_vars( $qvars ){ //Add these query variables $qvars[] = ‘video_id’; $qvars[] = ‘vide_title’; $qvars[] = ‘venue_src’; return $qvars; } Then you should be able to use get_query_var(‘venue_id’).