This file contains 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
//EXCERPT LIMIT | |
function get_excerpt(){ | |
$excerpt = get_the_content(); | |
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt); | |
$excerpt = strip_shortcodes($excerpt); | |
$excerpt = strip_tags($excerpt); | |
$excerpt = substr($excerpt, 0, 300); | |
$excerpt = substr($excerpt, 0, strripos($excerpt, " ")); | |
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); | |
return $excerpt.' ...'; |
This file contains 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
//dynamically populate a select fields choices | |
function acf_load_category_field_choices( $field ) { | |
// reset choices | |
$field['choices'] = array(); | |
// get the textarea value from options page without any formatting | |
$choices = get_categories(); |
This file contains 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
//Set bloginfo with two different colors | |
/** | |
* Wrap the first word of the blog title with the <span>...</span> tag. | |
* Assumes the Twenty Twelve theme. | |
* | |
* @see http://stackoverflow.com/a/25096093/2078474 | |
*/ | |
add_filter( 'body_class', | |
function( $class ) |
This file contains 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
// ADD SLIDEDOWN ANIMATION TO DROPDOWN // | |
$('.dropdown').on('show.bs.dropdown', function(e){ | |
$(this).find('.dropdown-menu').first().stop(true, true).slideDown(); | |
}); | |
// ADD SLIDEUP ANIMATION TO DROPDOWN // | |
$('.dropdown').on('hide.bs.dropdown', function(e){ | |
$(this).find('.dropdown-menu').first().stop(true, true).slideUp(); | |
}); |
This file contains 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 (has_post_thumbnail( $post->ID ) ): ?> | |
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> | |
<div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')"> | |
</div> | |
<?php endif; ?> |
This file contains 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
HTML | |
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button> | |
<!-- Modal --> | |
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | |
<div class="vertical-alignment-helper"> | |
<div class="modal-dialog vertical-align-center"> | |
<div class="modal-content"> | |
<div class="modal-header"> |
This file contains 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 | |
/** | |
* Gravity Forms Bootstrap Styles | |
* | |
* Applies bootstrap classes to various common field types. | |
* Requires Bootstrap to be in use by the theme. | |
* | |
* Using this function allows use of Gravity Forms default CSS | |
* in conjuction with Bootstrap (benefit for fields types such as Address). | |
* |
This file contains 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
//Get page title with ID | |
$pageID = 26; | |
$page = get_post($pageID); | |
echo $page->post_title; | |
echo $page->post_content; | |
//Get page thumbnail with ID | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id('26'), 'post'); | |
echo $thumb[0]; |
OlderNewer