Using $variable in shortcode

If you’re using PHP > 5.3, then you can use a closure on the the_content filter. This filter needs to be added after the $variable has been defined and before the the_content filter has fired. add_filter( ‘the_content’, function( $content ) use ( $variable ) { return str_replace( ‘[variable][/variable]’, $variable, $content ); } ); Shortcodes are … Read more

WP Site Hacked, Serp Google Spam [closed]

I’ve cleaned up a few hacked sites, and have developed my own personal procedure here. But there are many googles on how to clean up. The basics are change the passwords of everything (hosting, database, FTP, users), reinstall WP and all themes/plugins from a known good source (WP repository), and manual inspection for bad files. … Read more

Error 404 blog/page/2/

I guess you don’t need to target a taxonomy. You can use the code below: function query_change_function( $query ) { $query->set( ‘posts_per_page’, 5 ); } add_action(‘pre_get_posts’, ‘query_change_function’); You should wrap the $query->set( ‘posts_per_page’, 5 ); around with if ( ! is_admin() && is_home() ) {//the $query->set code} to avoid it changing to 5-posts everywhere.

Templates to use multiple time within page? [closed]

If you are trying to do this within a page or post, you could make a shortcode out of it. [movie-template title=”Gone With the Wind” date=”1939″ image=”gwtw.jpg”] [movie-template title=”Citizen Kane” date=”1941″ image=”ck.jpg”] [movie-template title=”Star Wars” date=”1977″ image=”sw.jpg”] Then you need a little code, in your template’s functions.php, or in a custom plugin: add_shortcode( ‘movie-template’, ‘my_movie_listings’ … Read more