Best practices for multiple Custom Feeds functions

Here’s what I do to keep my RSS Templates together though depending on your version of PHP this may not work but it’s pretty clean. You can add multiple feeds here. /** Register Our RSS Feeds **/ function my_rss_templates() { add_feed( ‘feedname2’, function(){ get_template_part(‘rss’, ‘feedname2”); }); // Rinse and Repeat… } add_action( ‘after_setup_theme’, ‘my_rss_templates’ ); … Read more

wpautop – disable tags, keep tags

wpautop can ignore the linkebreaks if you use wpautop( $content, false ); To pass a parameter to wpautop via add_filter, use an anonymous function. This snippets seems to work for me if I add it to my theme’s functions.php: remove_filter( ‘the_content’, ‘wpautop’ ); $br = false; add_filter( ‘the_content’, function( $content ) use ( $br ) … Read more

PHP files included in functions.php don’t seem to work

I always break my functions.php up into more managable, specific functionality files, for instance, all footer related functions goes into a file called footer-functions.php and pagination functions goes into a file called pagination-functions.php. This way, my code stays organised, managable and I don’t kill my functions.php. This however, is only related to theme specific functions, … Read more

How to get variables from fucntion.php to my plugin files

There is three way to use function.php file variable into plugin file. Using global. Make sure you globalize it first. global $my_variable; echo $my_variable; I recommend is using WordPress built-in filter mechanism add_filter. You add the filter in your functions.php file and apply it where needed. In functions.php: add_filter( ‘my_variable’, ‘return_my_variable’ ); function return_my_variable( $arg … Read more

What will happen if I delete the functions.php file?

In all propability this infection is not restricted to functions.php only. Non WordPress files on your server might be infected as well as well as your wp-config.php and your db. Hackers do quite a good job when they hack a site. Simply deleting (which will in all propability break your site leaving you with WSOD) … Read more

Placing raw HTML inside a WordPress shortcode

For the sake of having @Milo’s comment as an answer. Your code works as it should, it is just not possible to “write” HTML in the visual editor also in shortcodes. Shorcodes are not treated differently then any other text. If you want formatted HTML in your shortcode you just need to use the normal … Read more