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 | |
$content = get_the_content(); | |
echo wp_trim_words( $content , '25' ); | |
?> |
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
function truncate_field($title) { | |
global $post; | |
$text = get_field($title); | |
if ( '' != $text ) { | |
$text = strip_shortcodes( $text ); | |
$text = apply_filters('the_content', $text); | |
$text = str_replace(']]>', ']]>>', $text); | |
$text_length = strlen($text); // Get text length (characters) | |
$excerpt_length = 100; // 50 desired characters | |
$excerpt_more = '...'; |
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
*, *:before, *:after { | |
/* suppressing the tap highlight */ | |
-webkit-tap-highlight-color: rgba(0,0,0,0); | |
/* this is a personal preference */ | |
box-sizing: border-box; | |
vertical-align: top; | |
padding: 0; | |
margin: 0; | |
-webkit-font-smoothing: antialiased; |
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
/** | |
* Custom CSS field for posts/pages (inserted into <head></head>) | |
*/ | |
add_action('admin_menu', 'custom_css_hooks'); | |
add_action('save_post', 'save_custom_css'); | |
add_action('wp_head','insert_custom_css'); | |
function custom_css_hooks() { | |
add_meta_box('custom_css', 'Custom CSS', 'custom_css_input', 'post', 'normal', 'high'); | |
add_meta_box('custom_css', 'Custom CSS', 'custom_css_input', 'page', 'normal', 'high'); | |
} |
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
//* Change excerpt more - only active where excerpt is customized | |
function manual_excerpt_more( $excerpt ) { | |
$excerpt_more = ''; | |
if( has_excerpt() ) { | |
$excerpt_more = ' <a href="' . get_permalink() . '" rel="nofollow">[Read more]</a>'; | |
} | |
return $excerpt . $excerpt_more; | |
} | |
add_filter( 'get_the_excerpt', 'manual_excerpt_more' ); |
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
function is_tree($pid) | |
{ | |
global $post; | |
$ancestors = get_post_ancestors($post->$pid); | |
$root = count($ancestors) - 1; | |
$parent = $ancestors[$root]; | |
if(is_page() && (is_page($pid) || $post->post_parent == $pid || in_array($pid, $ancestors))) | |
{ |
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
Edit file /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/nginx.conf and add the following rules above the WordPress directives: | |
# BEGIN W3TC Page Cache core | |
set $w3tc_rewrite 1; | |
if ($request_method = POST) { | |
set $w3tc_rewrite 0; | |
} | |
if ($query_string != "") { | |
set $w3tc_rewrite 0; | |
} |
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 | |
$temp = $wp_query; | |
$wp_query = null; | |
$wp_query = new WP_Query(); | |
$wp_query->query('showposts=6&post_type=news'.'&paged='.$paged); | |
while ($wp_query->have_posts()) : $wp_query->the_post(); | |
?> | |
<!-- LOOP: Usual Post Template Stuff Here--> |
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
function bootstrap_wp_pager() { | |
echo '<ul class="pager">'; | |
$next = get_next_posts_link( 'Older →'); | |
$prev = get_previous_posts_link( 'Newer ←' ); | |
if ( !empty($prev) ) | |
echo '<li class="previous">'.$prev.'</li>'; | |
if ( !empty($next) ) | |
echo '<li class="next">'.$next.'</li>'; | |
echo '</ul>'; | |
} |