helifunctions.php

<?php/*Plugin Name: heli-functionsPlugin URI: http://www.aerzte4840.at/zoo/2011/plugin-last-modified-posts-shortcode/Description: shortcodes and actions made by Heli Retzek for own homepage - see also last-modified-post-shortcodeVersion: 0.1Author: heli retzekAuthor URI: http://aerzte4840.at/zooLicense: GPL2*//*  Copyright 2011  Heli Retzek  */

/*

This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.

This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.

You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/

function HeliListCatString($PostID) {$post_categories = wp_get_post_categories( $PostID );foreach($post_categories as $c){	$cat = get_category( $c );	$r = $r . ' ' . $cat->slug;    }return trim($r);}

function bluebox_function($atts , $content=null){return '<div class="bluebox"><span style="background-color:whitesmoke;padding:5px;">' . $content . '</span></div>';}add_shortcode ('bluebox','bluebox_function');

function similar_post_function($atts , $content=null) {	extract( shortcode_atts( array(		'style' => '',		'class' => '',	), $atts ) );	if (!empty($content))	   $content=' ' . $content;    return '<?php similar_posts(); ?>';	}

add_shortcode('similar','similar_post_function');

if ( !is_admin() ) {     $theme  = get_theme( get_current_theme() );    wp_register_style( 'helistyle', get_template_directory_uri() . "/helistyle.css", false, false  );    wp_enqueue_style( 'helistyle' );	wp_register_style( 'megamenu', "http://www.homeopathy.at/wp-content/plugins/wp-uber-menu/styles/heli-basic.css", false, false  );    wp_enqueue_style( 'megamenu' );	    //wp_register_style( 'heliIE7', get_template_directory_uri() . "/heliIE7quirks.css", false, false  );    //wp_enqueue_style( 'heliIE7' );

} 

// echo '<!--[if IE 6]> <link rel="stylesheet" type="text/css" href="http://www.homeopathy.at/wp-content/themes/dejavu/heliIE7quirks.css"> <![endif]-->';// echo '<!--[if IE 7]> <link rel="stylesheet" type="text/css" href="http://www.homeopathy.at/wp-content/themes/dejavu/heliIE7quirks.css"> <![endif]-->';

// <link rel="stylesheet" href="http://www.homeopathy.at/wp-content/themes/helistyle.css" type="text/css" media="screen" />

function cap_function($atts , $content=null){return '<span class="cap">' . $content . '</span>';}add_shortcode ("cap","cap_function");

// Ajax View Counter of Tbl top_ten

function view_hits_function($atts , $content=null) {	global $wpdb;	$table_name = $wpdb->prefix . "top_ten";	// echo $table_name;	$myid = get_the_ID();	// echo 'the ID ' .$myid;

        return ($wpdb->get_var($wpdb->prepare("SELECT cntaccess FROM $table_name WHERE postnumber = '$myid'")));

        }

add_shortcode("view_hits","view_hits_function");

function ordi_header_function($atts , $content=null)  {return ('<h1>Ordination Dr. Retzek - V&ouml;cklabruck / O&Ouml;</h1>');}add_shortcode("ordi-header","ordi_header_function");

function mb_rezept_function($atts , $content=null)  {//return do_shortcode('<h1>Rezepte!</h1>
Metabolic Balance Rezepte! unsere eigenen Lieblingsrezepte – manche auch von Klienten!
');return ('<div style="padding:10px 20px;">Metabolische Rezepte die wir selber regelmässig verwenden. tw. auch "Lieblingsrezepte" von unseren Klienten.<img class="alignright size-full wp-image-2700" style="z-index:100000;top:130px;right:-40px;position:absolute;width: 384px; height: 114px;" src="http://www.homeopathy.at/wp-content/uploads/mb-teaser.png" alt="" width="192" height="57" /></div>');}add_shortcode("mb-rezept-header","mb_rezept_function"); // '<img class ="mb-header-logo" src="http://www.aerzte4840.at/zoo/wp-content/uploads/MB-Logo-NEU_CI_jpeg_Internet_13KB_farbig.jpg" alt="" width="162" height="45" /><h1 class="mb-header">Rezepte</h1><p class="mb-header">unsere Rezeptsammlung: eigene Rezepte?und von unseren Klienten als Lieblingsrezepte beigebrachte Vorschl?ge</p>'; } function mb_header_function($atts , $content=null) {return do_shortcode('<div><img title="MB-Logo translucent" src="http://www.homeopathy.at/wp-content/uploads/MB-Logo-translucent.png" alt="Metabolic Balance - fantastisches Stoffwechselprogramm zur Gewichtsreduktion" width="284" height="78" /><img class="alignright size-full wp-image-2700" style="z-index:100000;top:90;right:50px;position:absolute;width: 384px; height: 114px;" src="http://www.homeopathy.at/wp-content/uploads/mb-teaser.png" alt="" width="192" height="57" /></div>');}add_shortcode("mb-header","mb_header_function"); function hr_function(){return '<hr>';}add_shortcode("hr","hr_function"); function load_yellow_function($atts , $content=null){return '<style type="text/css">@import url("http://www.homeopathy.at/wp-content/themes/dejavu/heliyellowstyle.css");</style>'; } add_shortcode("backyellow","load_yellow_function"); function remove_sidebar_shortcode($atts , $content=null){return '<style type="text/css">@import url("http://www.homeopathy.at/wp-content/themes/dejavu/heli-nosidebar.css");</style>'; } add_shortcode("nosidebar","remove_sidebar_shortcode"); //tell wordpress to register the demolistposts shortcode // for nested DIVS as shortcodes within the text function div_function( $atts , $content=null) { extract( shortcode_atts( array( 'style' => '', 'class' => '', ), $atts ) ); if (!empty($class)) {$ss='class="' . $class . '" ';} if (!empty($style)) {$ss.='style="' . $style . '" ';} $ss = '<div ' . $ss. '>' . do_shortcode($content). '</div>'; // return return $ss;} add_shortcode( 'div1', 'div_function' );add_shortcode( 'div2', 'div_function' );add_shortcode( 'div3', 'div_function' ); function heliwidget($atts) { global $wp_widget_factory; extract(shortcode_atts(array( 'widget_name' => FALSE ), $atts)); $widget_name = wp_specialchars($widget_name); if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')): $wp_class = 'WP_Widget_'.ucwords(strtolower($class)); if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')): return '<p>'.sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"),'<strong>'.$class.'</strong>').'</p>'; else: $class = $wp_class; endif; endif; ob_start(); the_widget($widget_name, $instance, array('widget_id'=>'arbitrary-instance-'.$id, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '' )); $output = ob_get_contents(); ob_end_clean(); return $output; }add_shortcode('widget','heliwidget'); if (is_admin()) { add_action('admin_head', array('wf_ftw', 'admin_head')); } else { add_action('wp_footer', array('wf_ftw', 'wp_footer')); } // test-action, nur beim publizieren wird eine email an heli geschicktfunction email_heli( $post_ID ) { $friends = 'heli@retzek.at, heli.retzek@homeopathy.at'; wp_mail( $friends, "heli's blog updated", 'I just put something on my blog: http://www.homeopathy.at' ); return $post_ID;}add_action('publish_post', 'email_heli'); function do_footer_function() { echo '<style type="text/css">@import url("http://fonts.googleapis.com/css?family=Schoolbell");</style>' . "\n";}add_action('wp_footer','do_footer_function'); // CUSTOM ADMIN MENU LINK FOR ALL SETTINGS function all_settings_link() { add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php'); } add_action('admin_menu', 'all_settings_link'); // remove version info from head and feedsfunction complete_version_removal() { return '';}add_filter('the_generator', 'complete_version_removal'); // spam & delete links for all versions of wordpressfunction delete_comment_link($id) { if (current_user_can('edit_post')) { echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&c='.$id.'">del</a> '; echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&dt=spam&c='.$id.'">spam</a>'; }}/** * Set the post revisions unless the constant was set in wp-config.php */if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 5); // remove unncessary header infofunction remove_header_info() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'start_post_rel_link'); remove_action('wp_head', 'index_rel_link'); remove_action('wp_head', 'adjacent_posts_rel_link');}add_action('init', 'remove_header_info'); //Enable GZIP output compression Normally the server should be set up to do this automatically, but a lot of shared hosts don t do this (probably to increase client bandwidth usage) if(extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler")) add_action('wp', create_function('', '@ob_end_clean();@ini_set("zlib.output_compression", 1);')); //Here is a way to load scripts only if a particular shortcode or widget is present. source: Loading scripts only if a particular shortcode or widget is present [1]function has_my_shortcode($posts) { if ( empty($posts) ) return $posts; $found = false; foreach ($posts as $post) { if ( stripos($post->post_content, '[my_shortcode') ) $found = true; break; } if ($found){ $urljs = get_bloginfo( 'template_directory' ).IMP_JS; wp_register_script('my_script', $urljs.'myscript.js' ); wp_print_scripts('my_script');} return $posts;}add_action('the_posts', 'has_my_shortcode'); function admin_favicon() { echo '<link rel="shortcut icon" type="image/x-icon" href="' . get_bloginfo('template_directory') . '/images/favicon.ico" />';}// add_action( 'admin_head', 'admin_favicon' ); ?>

Eine Bemerkung hinterlassen

diese Seite wurde 60 angesehen | Facebook Info-Seite Dr. Retzek | Teile diese Seite hier Share

Besuchen Sie bitte auch MALENNA - unseren Praxis-Shop, wir haben die wichtigsten Mikronährstoffe und Ortho-Therapeutika zu einem in Europa konkurrenzlos günstigen Preis!




Newsletter von Dr. Retzek anmelden (ca 6 x jährlich):