MySQL WordPress oprhan postmeta CleanUp

If your blog get agged probably it get slow . To clean up old SQL entrys there are several plugins but some time like in my case you need to delete millions of outdated Orphaned Post Meta  , than plugins will timeout your SQL Database.

Especially if you experiment with  post  plugins loops can cause very fast tausend of duplicated post and metas.This is the first try to explore and dig a bit deeper into the Developer World , not only from the code and benefit side but also to learn more about the style and thinking that build the red line thru all his work . Many times phantastic people nearly disappear online and there Blogs get abandoned . Most likely one of the Big 5 IT cooperation already hired him and no time for free plugins or Blogging .

  • Revisiones
  • Auto drafts
  • Deleted comments
  • Unapproved comments
  • Spammed comments
  • Deleted comments
  • Orphaned post meta
  • Orphaned comment meta
  • Orphaned user meta
  • Orphaned term meta
  • Orphan term relationships
  • Unused terms
  • Duplicated post meta
  • Duplicated comment meta
  • Duplicated user meta
  • Duplicated term meta
  • Transient options
  • Optimizes database tables
  • oEmbed caches in post meta

Wp- Sweep is from the Developer Lester Chan a well known high profile WordPress Developer . The Plugin works smooth and clean following WordPress Tables and Terms as long they stay below 100.000 entry then it still works but can take extremely long and outtime your SQL Database on a shared hostThe image below show the wp sweep admin screen after cleanup .Of course before you make any change or clean up in your database dont forget the full backup . For a faster access i use a client like Sequel Pro to manage all the Databases<code>

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

</code>

Extending WordPress Revolution Slider for Cover area

Since i discovered the revolution Slider iam got a big fan of the Slider even its quite heavy load but on some pages its more than worth. But the problem as long its not a part of your theme the Slider will play only in my blog content area . So i wish to play revolutions slides even in the banner area . Socalled execute revolution Shortcodes on the single blog page and even on the frontpage slider .Where i normally chose images who should rotate.

Here a view lines of code i added to the theme frontpage theme template . To clarify i use the Blip Theme and Option Tree to setup theme options and more . Blimp is not any more maintenance so any change and upgrade i have to make myself.

<?php $sliders = ot_get_option('pxg_bliv_homepage_slider'); ?>
<div class="featured-inner flexslider">
 <ul class="slides">
 <?php 
 // ALL TIME RENDER BACKGROUND IMAGE 
 foreach ($sliders as $key => $slider) { ?>
 <li style="background-image: url('<?php echo $slider["image"] ?>')">
 <?php
 // IF REVOLUTION SLIDER 
 if (preg_match("/(?<=alias=\").*?(?=\"\])/s", $slider["title"], $result)){
 $revolID = $result[0];
 } 
 if (strpos($slider["title"],'');
 
 // RENDER ANY SHORTCODE WE FOUND IN TITEL 
 }elseif(strpos( $slider["title"], '[' ) !== false){ 
 
 echo do_shortcode($slider["title"]);
 
 // ELSE DAFULT SLider
 }else{ ?> 
 <div class="container">
 <span class="sub-title"><?php echo $slider["description"] ?></span>
 <span class="title"><?php echo $slider["title"] ?></span>
 </div>
 
 <?php } ?>
 </li> 
 <?php } ?>
 </ul>
 </div>

To explain the code , we check if a revolution slider shortcode is in the Title if so we extract the parameter and execute with do_shortcode the Slider . After we look if any other shortcode is in the Title if so we execute that . In my case i use iframe Advanced and sometime i would like to render some fancy D3 animation or Odyssey.js   in the header.  If No shortcode is found we render the default images set in the theme Settings.

this is probably not 100% foolproof but for now it works quite well. Code above is for the front-page.php but its nearly the same for the single blog post page . Below how it looks like from a test blog. header cover is with revolution slider and fully anim able from the backend . The Slider loads beforehand the default image still the Big Slider is finally loaded. This is nothing that make since for fast pages but since i seperate Blog and Main page it will not affect the blog.

Screen shot 2016-01-07 at 14.37.00

Just wrote this down to remember all the little changes for later, or if i change the theme one day. Formating of the code need to be changed to be a little bit clearer

 

Custom mode for Subway WordPress Page Builder

One of my favorite Themes with the Page Builder need a custom extension for a module . Modded it once here i logged the process to remember for future upgrades. These topic will show how to add link parameter to the icon list modul for in Theme  Page Builder. Of course you can customise the same effect with the editor and some html lines but for Clients with no html knowledge its much easier to simply fill the module form and a additional field.

Icon-List

visually high value the Icon List Module the only part i missed is to add a link to the icon .  Its quite simple by extending the json parameter for that module . You have to edit the extend-vc.php file that can be found in your subway theme folder

wp-content/theme/subway/extendvc 

All modules are here defined by va_map arrays to exend our modul we need to add some link parameter to the array definition of the Icon list you can find it around line 777 . METAMODE is only a personal marker for myself to find changed code in a plugin.

//Icon List Item METAMODE
vc_map( array(
"name" => __("Icon List Item"),
"base" => "icon_list_item",
'admin_enqueue_css' => array(get_template_directory_uri().'/css/admin/vc-extend.css'),
"icon" => "icon-wpb-icon_list_item",
"category" => __('by QODE'),
"params" => array(
array(
"type" => "dropdown",
"class" => "",
"heading" => __("Icon"),
"param_name" => "icon",
"value" => $icons,
"description" => __("")
),
array(

Just add a additional textfield with link parameter inside the icon list array. After adding these part we only need to extend the part that renders the module.

Add input fields your icon-list module

array(
     "type" => "textfield",
     "holder" => "div",
     "class" => "",
     "heading" => __("Link"),
     "param_name" => "link",
      "value" => $link,
     "description" => __("")
),

To keep the Theme free for future update we will test to move the mode in our function or even better in a custom new plugin .

Full Extension for Function or WP Plugin copy & past these part below.

//Icon List Item METAMODE
vc_map( array(
"name" => __("Icon List Item"),
"base" => "icon_list_item",
'admin_enqueue_css' => array(get_template_directory_uri().'/css/admin/vc-extend.css'),
"icon" => "icon-wpb-icon_list_item",
"category" => __('by QODE'),
"params" => 
           array(
                "type" => "textfield",
                 "holder" => "div",
                 "class" => "",
                 "heading" => __("Link"),
                 "param_name" => "link",
                 "value" => $link,
                 "description" => __("")
                ),
)
) );

Now you added the additional Link Form to your module it should look like these in the Editor if you click the Pencil

Icon_List Editor

Still no link on the rendered Front page now we edit the rendering part. To edit the modul template file we need in

subway/inlcude/shortcodes.php

and add the new Link part to the Shortcode for the Icon list Shortcode part to the $html you find that around line 1353 depends on the theme version

Render the new link Icon list Shortcode

Finaly we need to change the icon list shortcode to render the link for the icon list for these we need to edit shortcodes.php

We add the additional html and extract the link attribute in the first line to make it short we only add the href part to the title
change  first function line to

extract(shortcode_atts(array("link"=>"","icon"=>"", "icon_color"=>"", "icon_background_color"=>"", "icon_border_color"=>"", "title"=>"","title_color"=>""), $atts));

and the link hmtl

$html .= '><a href="'.$link.'">'.$title.'</a></p>';

Finaly the new full shortcode for list icon will lock like below

/* Icon List Item shortcode */
/* Metamode */
if (!function_exists('icon_list_item')) {
function icon_list_item($atts, $content = null) {
	extract(shortcode_atts(array("link"=>"","icon"=>"", "icon_color"=>"", "icon_background_color"=>"", "icon_border_color"=>"", "title"=>"","title_color"=>""), $atts));
	$html = '';
	$html .= '<div class="icon_list">';
	$html .= '<!-- testlistshortcode -->';
	$html .= '<i class="'.$icon.' pull-left icon-border" ';
	if($icon_color != "" || $icon_background_color != "" || $icon_border_color != ""){
		$html .= 'style="';
		if($icon_color != ""){
			$html .= 'color:'.$icon_color.';';
		}
		if($icon_background_color != ""){
			$html .= 'background-color:'.$icon_background_color.';';
		}
		if($icon_border_color != ""){
			$html .= 'border-color:'.$icon_border_color.';';
		}
		$html .= '"';
	}
	$html .= '></i>';
	$html .= '<p';
	if($title_color != ""){
		$html .= ' style="color:'.$title_color.';"';
	}
	$html .= '><a href="'.$link.'">'.$title.'</a></p>';
	//$html .= '>'.$title.'</p>';
	$html .= '</div>';
	return $html;
}
}
add_shortcode('icon_list_item', 'icon_list_item');

 

Amazing post with all the goodies

In varius varius justo, eget ultrices mauris rhoncus non. Morbi tristique, mauris eu imperdiet bibendum, velit diam iaculis velit, in ornare massa enim at lorem. Etiam risus diam, porttitor vitae ultrices quis, dapibus id dolor. Morbi venenatis lacinia rhoncus. Vestibulum tincidunt ullamcorper eros eget luctus. Nulla eget porttitor libero. Read more Amazing post with all the goodies

Forest Path

S eparated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

But nothing the copy said could convince her

and so it didn’t take long until a few insidious

Copy Writers ambushed her

The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then she continued her way. On her way she met a copy.Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

Amazing standard post

In varius varius justo, eget ultrices mauris rhoncus non. Morbi tristique, mauris eu imperdiet bibendum, velit diam iaculis velit, in ornare massa enim at lorem. Etiam risus diam, porttitor vitae ultrices quis, dapibus id dolor. Morbi venenatis lacinia rhoncus. Read more Amazing standard post