SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
add_tag_shortcode.php                                                2011-11-06
<?php
/*
Plugin Name: Add Tag Shortcode
Plugin URI: http://semperfiwebdesign.com/
Description: Adds shortcodes for use with basic wordpress template tags.
Version: 1.0
Author: Semper Fi Web Design
Author URI: http://semperfiwebdesign.com/
*/

if ( ! function_exists( 'sfwd_add_tag_shortcode' ) ) {
    function sfwd_add_tag_shortcode($atts, $content='', $code) {
        extract(shortcode_atts(array(
                'has_func' => "has_$code",
                'get_func' => "get_the_$code",
        ), $atts));
        if ( $has_func && function_exists( $has_func ) ) {
            if ( !( call_user_func ( $has_func ) ) ) {
                return;
            }
        }
        if ( $get_func && function_exists( $get_func ) ) {
            return "<span class='add_$code'>".do_shortcode(call_user_func(
$get_func )).'</span>';
        }
    }
}

add_shortcode( 'title',   'sfwd_add_tag_shortcode' );
add_shortcode( 'content', 'sfwd_add_tag_shortcode' );
add_shortcode( 'excerpt', 'sfwd_add_tag_shortcode' );
?>




                                    - 1/1 -

Mais conteúdo relacionado

Mais procurados

Form Script
Form ScriptForm Script
Form Script
lotlot
 
Юнит тестирование в Zend Framework 2.0
Юнит тестирование в Zend Framework 2.0Юнит тестирование в Zend Framework 2.0
Юнит тестирование в Zend Framework 2.0
zfconfua
 
Un juego creado en php
Un juego creado en phpUn juego creado en php
Un juego creado en php
Erwin Lobo
 

Mais procurados (20)

PHP Profiling
PHP ProfilingPHP Profiling
PHP Profiling
 
Silex al límite
Silex al límiteSilex al límite
Silex al límite
 
Sumahexavector
SumahexavectorSumahexavector
Sumahexavector
 
JavaScript Tips
JavaScript TipsJavaScript Tips
JavaScript Tips
 
Crea un tema compatibile con le ultime novità WordPress
Crea un tema compatibile con le ultime novità WordPressCrea un tema compatibile con le ultime novità WordPress
Crea un tema compatibile con le ultime novità WordPress
 
Introduction to Service Worker
Introduction to Service WorkerIntroduction to Service Worker
Introduction to Service Worker
 
Php & mysql
Php & mysqlPhp & mysql
Php & mysql
 
Form Script
Form ScriptForm Script
Form Script
 
jQuery PLUGIN
jQuery PLUGINjQuery PLUGIN
jQuery PLUGIN
 
Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio Palestra sobre MongoDB com PHP no PHP'n'Rio
Palestra sobre MongoDB com PHP no PHP'n'Rio
 
Web App Mvc
Web App MvcWeb App Mvc
Web App Mvc
 
Zend bootstrap
Zend bootstrapZend bootstrap
Zend bootstrap
 
Introducción a Bolt
Introducción a BoltIntroducción a Bolt
Introducción a Bolt
 
Clase 10 electiva profesional 3 aws rds php y mysql
Clase 10 electiva profesional 3 aws rds php y mysqlClase 10 electiva profesional 3 aws rds php y mysql
Clase 10 electiva profesional 3 aws rds php y mysql
 
Func
FuncFunc
Func
 
Юнит тестирование в Zend Framework 2.0
Юнит тестирование в Zend Framework 2.0Юнит тестирование в Zend Framework 2.0
Юнит тестирование в Zend Framework 2.0
 
Testování prakticky
Testování praktickyTestování prakticky
Testování prakticky
 
Un juego creado en php
Un juego creado en phpUn juego creado en php
Un juego creado en php
 
Секреты WP_Query
Секреты WP_QueryСекреты WP_Query
Секреты WP_Query
 
Templating WordPress
Templating WordPressTemplating WordPress
Templating WordPress
 

Destaque (6)

Membership Plugins in WordPress
Membership Plugins in WordPressMembership Plugins in WordPress
Membership Plugins in WordPress
 
Debugging and Profiling in WordPress: What is My Site Doing?
Debugging and Profiling in WordPress: What is My Site Doing?Debugging and Profiling in WordPress: What is My Site Doing?
Debugging and Profiling in WordPress: What is My Site Doing?
 
Mastering the shortcode api
Mastering the shortcode apiMastering the shortcode api
Mastering the shortcode api
 
Speed Up That Site! - a guide to caching plugins
Speed Up That Site! - a guide to caching pluginsSpeed Up That Site! - a guide to caching plugins
Speed Up That Site! - a guide to caching plugins
 
Doing cool stuff with WordPress
Doing cool stuff with WordPressDoing cool stuff with WordPress
Doing cool stuff with WordPress
 
WordPress Server Security
WordPress Server SecurityWordPress Server Security
WordPress Server Security
 

Add tag shortcode

  • 1. add_tag_shortcode.php 2011-11-06 <?php /* Plugin Name: Add Tag Shortcode Plugin URI: http://semperfiwebdesign.com/ Description: Adds shortcodes for use with basic wordpress template tags. Version: 1.0 Author: Semper Fi Web Design Author URI: http://semperfiwebdesign.com/ */ if ( ! function_exists( 'sfwd_add_tag_shortcode' ) ) { function sfwd_add_tag_shortcode($atts, $content='', $code) { extract(shortcode_atts(array( 'has_func' => "has_$code", 'get_func' => "get_the_$code", ), $atts)); if ( $has_func && function_exists( $has_func ) ) { if ( !( call_user_func ( $has_func ) ) ) { return; } } if ( $get_func && function_exists( $get_func ) ) { return "<span class='add_$code'>".do_shortcode(call_user_func( $get_func )).'</span>'; } } } add_shortcode( 'title', 'sfwd_add_tag_shortcode' ); add_shortcode( 'content', 'sfwd_add_tag_shortcode' ); add_shortcode( 'excerpt', 'sfwd_add_tag_shortcode' ); ?> - 1/1 -