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 | |
//* Just add this anywhere in yopur template where you want language switcher to appear. | |
//* This switcher just shows the flags. But you can make it work anyway you like | |
?> | |
<ul class="lang-switcher"> | |
<?php | |
$languages = icl_get_languages('skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str'); | |
foreach($languages as $language){ | |
$flag = $language['country_flag_url']; |
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_filter( 'wp_nav_menu_items', 'add_login_logout_to_primary_menu', 10, 2 ); | |
function add_login_logout_to_primary_menu( $items, $args ) { | |
if( 'primary' === $args->theme_location ) : | |
if (is_user_logged_in()) { | |
$items .= '<li><a href="'.wp_logout_url(home_url()).'">Logout</a></li>'; | |
} else { | |
$items .= '<li><a href="'.wp_login_url().'">Login</a></li>'; | |
} |
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 | |
function bootstrap_pager($pages = '', $range = 2) { | |
$showitems = ( $range * 2 )+1; | |
global $paged; | |
if ( empty( $paged ) ) $paged = 1; | |
if ( $pages == '' ) { | |
global $wp_query; | |
$pages = $wp_query->max_num_pages; | |
if ( !$pages ) { |
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 | |
# WPML - Add language class to body element | |
function append_language_class($classes) { | |
$classes[] = 'lang-' . ICL_LANGUAGE_CODE; | |
return $classes; | |
} | |
add_filter('body_class', 'append_language_class'); | |
?> |
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 | |
/* | |
* Debugging (Development) | |
*/ | |
// Enable WordPress debugging (NEVER LEAVE ENABLED ON PRODUCTION SITES!) | |
define('WP_DEBUG', false); | |
// Enable Debug logging to the /wp-content/debug.log file | |
// define('WP_DEBUG_LOG', true); |
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 | |
// Customize Font Family, Size, and Color Options | |
function vital_tinymce($options) { | |
$options['fontsize_formats'] = '0.75em 0.875em 1em 1.125em 1.25em 1.375em 1.5em 1.75em 1.875em 2em'; | |
// Color Picker | |
$options['textcolor_map'] = '['.' | |
"ffffff", "White", | |
"000000", "Black" | |
'.']'; | |
// Font Families |
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 | |
//* Font Awesome | |
//* EXAMPLE: [fa icon="fa-search" color="#555555"] | |
function font_awesome_shortcode( $atts ) { | |
extract( shortcode_atts( array( | |
'icon' => 'fa-question-circle', | |
'color' => '#555555' | |
), $atts ) ); | |
return "<span class='fa {$icon}' style='color:{$color}'></span>"; | |
} |
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 | |
$description = get_field('descripton'); | |
if( strpos($description, '<!--more-->') >= 1 ) { | |
$more_position = 11 + strpos($description, '<!--more-->'); | |
$before_more = substr($description, 0, $more_position); | |
$after_more = substr($description, $more_position); ?> | |
<div class="excerpt"> | |
<?php echo $before_more; ?> | |
</div> | |
<div class="read-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
<?php | |
$args = array( | |
'post_type' => 'post', | |
'tax_query' => array( | |
'relation' => 'AND', | |
array( | |
'taxonomy' => 'movie_genre', | |
'field' => 'slug', | |
'terms' => array( 'action', 'comedy' ) | |
), |
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 | |
function add_favicons() { | |
echo '<link rel="shortcut icon" href="' . get_stylesheet_directory_uri() . '/images/favicon.ico">'."\n"; | |
echo '<link rel="apple-touch-icon-precomposed" href="' . get_stylesheet_directory_uri() . '/images/apple-touch-icon-precomposed.png" />'."\n"; | |
} | |
add_action('wp_head', 'add_favicons'); | |
?> |