Code snippets php

Replace or delete pretext h1 entry article title

//replace or delete pretext h1 entry article title
function the_title_trim($title)
{
  $pattern[0] = '/Protected:/';
  $pattern[1] = '/Private:/';
  $pattern[2] = '/Beveiligd:/';
  $replacement[0] = ''; // Enter some text to put in place of Protected:
  $replacement[1] = ''; // Enter some text to put in place of Private:
  $replacement[2] = ''; // Enter some text to put in place of Beveiligd:

  return preg_replace($pattern, $replacement, $title);
}
add_filter('the_title', 'the_title_trim');

Shortcode insert div to content (editor)

Sometimes extra “div’s” are needed …
Insert div via shortcode. It’s easy !

Why would you want to insert div’s?
Standard WordPress wraps all the content in paragraphs ( you know those p tags) however now and then you want two columns or assign a class to a certain part of your content. Or maybe you want to split the page, there are of course different ways to go about, using this snippet is one of them.
[div id="ID" class="CLASS"]xxxx[/div]

Credits go to Neil, I’ve found it at  githhub

Continue reading Shortcode insert div to content (editor)