This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php add_action( 'init', 'sennza_register_cpt_testimonial' ); | |
function sennza_register_cpt_testimonial() { | |
$args = array( | |
'public' => true, | |
'query_var' => 'testimonial', | |
'rewrite' => array( | |
'slug' => 'testimonials', | |
'with_front' => false | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /** | |
* Adds a custom meta box to the Testimonials editor page for collecting | |
* Testimonial meta. | |
* Refer to: https://gist.github.com/1971046 for the Custom Post Type Setup | |
* | |
* @since 1.0 | |
*/ | |
function sennza_add_meta_boxes() { | |
add_meta_box( 'sennza_testimonials_meta_box', __( 'Testimonial Details' ), 'sennza_testimonials_meta_box', 'testimonial', 'side', 'core' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if( ! class_exists( 'Testimonials_Widget' ) ) : | |
/** | |
* Create a widget to display a random testimonial post. | |
* Refer to https://gist.github.com/1971046 and https://gist.github.com/1971054 for the Custom Post Type and Meta Box Setup | |
* | |
* @since 1.0 | |
*/ | |
class Testimonials_Widget extends WP_Widget { | |
function Testimonials_Widget() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
* This is just a simple loop to display 7 attachments attached to a post or page in WordPress | |
* You can change 'medium' and 'thumbnail' to add sizes you have definied in your theme by the add_image_size function | |
* in WordPress | |
*/ | |
?> | |
<div id="thumbs" class="pic_list"> | |
<ul class="thumbs"> | |
<?php /* Time to create a new loop that pulls out the first 7 image attachments for this post */ | |
$args = array( 'post_type' => 'attachment', 'numberposts' => 7, 'post_status' => null, 'post_parent' => $post->ID ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
* Add the anchor link button back to the TinyMCE Editor in WordPress | |
*/ | |
function sennza_mce_buttons( $buttons ){ | |
array_push( $buttons, "anchor" ); | |
return $buttons; | |
} | |
add_filter( 'mce_buttons', 'sennza_mce_buttons' ); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
* In some weird occasions Pages need to have Categories like Posts in WordPress. | |
*/ | |
add_action( 'init', 'sennza_add_page_cats' ); | |
function sennza_add_page_cats() | |
{ | |
register_taxonomy_for_object_type( 'category', 'page' ); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Add back the superscript TinyMCE button in WordPress */ | |
function sennza_add_more_buttons( $buttons ) | |
{ | |
$buttons[] = 'sup'; | |
return $buttons; | |
} | |
add_filter( 'mce_buttons_3', 'sennza_add_more_buttons' ); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
* Sometimes you will might want something like the_excerpt but still want <strong> tags. Add this function and call it | |
* inside your theme template file e.g. sennza_enhanced_excerpt(); | |
*/ | |
function sennza_enhanced_excerpt( $content ) { | |
$content = strip_shortcodes( $content ); | |
$content = str_replace( ']]>', ']]>', $content ); | |
$content = preg_replace( '/<img[^>]+./','',$content ); | |
$content = preg_replace( '%<div.+?</div>%is', '', $content ); | |
$content = preg_replace( '%<object.+?</object>%is', '', $content ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* A WordPress widget that displays all PDF's attached to the current post | |
* You can adapt this widget to extract other file types by altering the 'post_mime_type' => 'application/pdf' | |
* argument refer to: http://en.wikipedia.org/wiki/Internet_media_type#List_of_common_media_types for mime types | |
*/ | |
class Sennza_PDF_Download_Widget extends WP_Widget | |
{ | |
/** constructor */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
* Add the horizontal rule button back to the WordPress TinyMCE editor | |
*/ | |
function sennza_hr_button($buttons) { | |
$buttons[] = 'hr'; | |
return $buttons; | |
} | |
add_filter( 'mce_buttons', 'sennza_hr_button' ); ?> |
OlderNewer