Allowed memory size of (…) exhausted

Turns out this issue was caused by bad code (a missing assert) in my theme. More specifically the theme requires a custom navigation menu. As this menu hadn’t been created and assigned the site crashed. Why this caused an memory exhaustion error on my production server and not my development computer I unfortunately don’t know.

Problem dynamically generating an all purpose title tag

I wound up fixing it like this. All pages now work. But it looks …well …ugly. <?php if (function_exists(‘is_tag’) && is_tag()) { single_tag_title(‘Tag Archive for &quot;’); echo ‘&quot; | ‘; } elseif (is_archive()) { wp_title(”); echo ‘ Archive | ‘; } elseif (is_search()) { echo ‘Search for &quot;’.esc_html($s).’&quot; | ‘; } elseif (!(is_404()) && is_single() … Read more

How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?

The get_template_part(‘content’, get_post_format()); line includes content from one of the other files in your theme based on the post type, the file name will be something like content-page.php (or content.php if the format is not found). If you print out what get_post_format() returns, you will be able to tell which content file to look into. … Read more

Add the title of a widget as an ID – for anchor links

Yes you can add an around the title of the widget, you do this in the register_sidebar code which you would put in your functions.php add_action( ‘widgets_init’, ‘theme_register_sidebars’ ); function theme_register_sidebars() { register_sidebar( array( ‘id’ => ‘mysidebar-sidebar’, ‘name’ => __( ‘My Sidebar’, ‘themename’ ), ‘description’ => __( ‘Widgets for my sidebar’, ‘themename’ ), ‘before_widget’ => … Read more

How to output wp_enqueue_style() in HTML head instead of footer

hook into init action on your initial plugin function add_action(‘init’, array(__CLASS__, ‘your_function_within_class’)); and add the function public static function your_function_within_class() { wp_register_style(‘myfirstplugin-admin-css’, ‘/wp-content/plugins/myfirstplugin/assets/style.css’, false); wp_enqueue_style(‘myfirstplugin-admin-css’); } hope this help