WordPress get_the_content WITH formatting
global $post; ob_start(); the_content(); $output = ob_get_contents(); ob_end_clean();
Source: WordPress › Support » get_the_content WITH formatting
global $post; ob_start(); the_content(); $output = ob_get_contents(); ob_end_clean();
Source: WordPress › Support » get_the_content WITH formatting
add_filter( 'post_thumbnail_html', 'my_post_thumbnail_html' ); function my_post_thumbnail_html( $html ) { if ( empty( $html ) ) $html = '<img src="' . trailingslashit( get_stylesheet_directory_uri() ) . 'images/default-thumbnail.png' . '" alt="" />'; return $html; }
Two simple ways to correctly define a default post thumbnail (i.e., featured image) in WordPress.
function on_all_status_transitions( $new_status, $old_status, $post ) { if ( $new_status != $old_status ) { // A function to perform actions any time any post changes status. } } add_action( 'transition_post_status', 'on_all_status_transitions', 10, 3 );
//add this to wp-config.php define('AUTOSAVE_INTERVAL', 300 ); // seconds define('WP_POST_REVISIONS', false );
Simply disable Post Revisions feature in WordPress by following this tutorial and reduce your database size.
Source: How to Disable Post Revisions in WordPress and Reduce Database Size
Source: Setting up a Secure Single Node Elasticsearch server behind Nginx – Dreaming in Data
An easy way to go about securing Elasticsearch is to wrap it in a Nginx proxy. This post will show you how.
Source: Securing Elasticsearch using Nginx as a Proxy – EagerElk
sudo add-apt-repository ppa:webupd8team/java -y sudo apt-get update sudo apt-get install oracle-java8-installer
Source: java – How to install OpenJDK 8 on 14.04 LTS? – Ask Ubuntu
sudo /usr/libexec/locate.updatedb
Source: osx – Upgrading rsync on OS X using Homebrew – Stack Overflow
function render($script, array $vars = array()) { extract($vars); ob_start(); include $script; return ob_get_clean(); } $test = 'one'; echo render('foo.php', array('test' => 'two')); echo $test; // is still 'one' ... render() has its own scope
I’m messing around with templating and I’ve run into a situation where I need to echo to the browser a template that contains html & php. How do I evaluate the PHP and send it to the browser? So
Source: templates – PHP Eval that evaluates HTML & PHP – Stack Overflow
Reply