How to add a class and title attribute to the link generated by next/previous post

previous_post and next_post are deprecated. you should be using previous_post_link and next_post_link. That function applies the {$adjacent}_post_link filter. You can use that to get what you want. A very, very crude example: function construct_np_attr_wpse_92086($matches) { if (‘prev’ == $matches[1]) { $np = ‘Previous’; } else { $np = ‘Next’; } $ret=”rel=””.$matches[1].'” class=”normalTip” ‘; if (!empty($np)) … Read more

Custom Function for SEO by Yoast plugin

What you need is get_post_meta instead of get_post_type This: if ( get_post_type( $post->ID ) == ‘design’ ) { Should be: $meta = get_post_meta($post->ID,’your-meta-key’,true); if (!empty($meta)) { Put altogether function design_canonical_wpse_93717() { global $post; $meta = get_post_meta($post->ID,’your-meta-key’,true); if (!empty($meta)) { return $meta; // assuming this is an absolute URL } } add_filter( ‘wpseo_canonical’, ‘design_canonical_wpse_93717’ ); The … Read more

Using Output from one Function and calling it into another

This isn’t really a WordPress question… that said $recClasses = pa_insertPage($output); is incorrect. here you should be passing to insertPage whatever the arguments are. Then insertPage will return $output, making $recClasses the same value as $output. $recClasses = pa_insertPage(‘your attributes’); // $recClasses now equals $output;

Conditional Content Display

You can’t execute PHP code from within a string. You can however define a function that executes code and call that function within your if clauses. function dz_slick_longstring() { $query = new WP_Query(‘category_name=intro-paragraphs’); if($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?> <div class=”mid-box”> <h1><?php the_title(); ?></h1> <?php echo excerpt(40); ?><br/> <a href=”<?php echo get_permalink(); ?>”>&raquo; read more…</a> … Read more

Adding code to the function file

If you move the function and the add_filter function to the functions file, the you don’t need to echo the function after. If the function doesn’t involve using add_filter then you could echo out the function in your template file. Placing it in the functions.php file, will run on every page/post load unless specified otherwise.