';
$post_meta = '';
if($page_type['post'] && !$is_password_protected){
$post_meta = posterity_get_post_meta_data();
}
if($title_bar_variant === 'classic' && $called_position === 'outside'){
$html .= '
';
$html .= $post_meta;
}
else{
$html .= $post_meta;
$html .= '
';
}
//subtitle
if($subtitle_on){
$html .= '
'.$subtitle.'
';
}
//main title
$html .= ''.$title.'
';//sometimes we add html here, so don't escape!
$html .='';//.titles
$html .='
';
return $html;
}
}
if(!function_exists('posterity_title_bar')){
/**
* Prints Page title bar
*
* @param string $called_position position of title bar in page
* @param string $title title of page
* @param string $subtitle subtitle of page
*
*/
function posterity_title_bar( $called_position = 'outside', $title = '', $subtitle = '') {
//posterity_get_title_bar() produces escaped content
echo posterity_get_title_bar( $called_position, $title, $subtitle); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
if(!function_exists('posterity_page_individual_look')){
/**
* Prints CSS for title bar
*/
function posterity_page_individual_look(){
global $posterity_a13;
//checks if page can have meta fields
//if not page will use styles defined in user.css
if(!posterity_is_no_property_page()){
$css = '';
$page_type = posterity_what_page_type_is_it();
$body_class = '.page';
//if this is not page, post or work, then have nothing to do here
if(!($page_type['post'] || $page_type['page'])){
return;
}
//we set style for these in customizer, so we don't use settings from "Page details"
if($page_type['shop'] || $page_type['blog_type']){
return;
}
//id from where
$meta_id = false;
if($page_type['page']){
$meta_id = get_the_ID();
}
elseif($page_type['post']){
$meta_id = get_the_ID();
$body_class = '.single-post';
}
//even if it is static currently, let's be safe for future
$body_class = wp_strip_all_tags( $body_class );
/***************************************/
/* PAGE BACKGROUND */
/***************************************/
$page_bg_option = $posterity_a13->posterity_get_meta('_page_bg_settings', $meta_id);
if($page_bg_option === 'custom'){
$bg_color = wp_strip_all_tags( get_post_meta($meta_id, '_page_bg_color', true) );
$bg_image = wp_strip_all_tags( get_post_meta($meta_id, '_page_image', true) );
$bg_image_fit = wp_strip_all_tags( posterity_bg_fit_helper(get_post_meta($meta_id, '_page_image_fit', true)) );
$css .= '
'.$body_class.' .page-background{
background-color:'.$bg_color.';
background-image: url('.$bg_image.');
'.$bg_image_fit.'
}
';
}
/***************************************/
/* TITLE BAR */
/***************************************/
$title_bar_option = $posterity_a13->posterity_get_meta( '_title_bar_settings', $meta_id );
//change everything
if ( $title_bar_option === 'custom' ) {
//where title bar should be displayed
$position = $posterity_a13->posterity_get_meta( '_title_bar_position', $meta_id );
//we don't style "inside" title bars
if ( $position !== 'inside' ) {
$bg_color = wp_strip_all_tags( get_post_meta( $meta_id, '_title_bar_bg_color', true ) );
$bg_image = wp_strip_all_tags( posterity_get_top_image_video(false, array('return_src' => true, 'force_image' => true, 'full_size' => true)) );
$bg_fit = wp_strip_all_tags( posterity_bg_fit_helper( get_post_meta( $meta_id, '_title_bar_image_fit', true ) ) );
$title_color = wp_strip_all_tags( get_post_meta( $meta_id, '_title_bar_title_color', true ) );
$second_color = wp_strip_all_tags( get_post_meta( $meta_id, '_title_bar_color_1', true ) );
$space = wp_strip_all_tags( get_post_meta( $meta_id, '_title_bar_space_width', true ) );
$css .= '
' . $body_class . ' .title-bar.outside{
background-image:url(' . esc_url( $bg_image ) . ');
'.$bg_fit.'
}
' . $body_class . ' .title-bar.outside .overlay-color{
background-color:' . $bg_color . ';
padding-top:' . $space . ';
padding-bottom:' . $space . ';
}
' . $body_class . ' .title-bar.outside .page-title,
' . $body_class . ' .title-bar.outside h2{
color:' . $title_color . ';
}
' . $body_class . ' .title-bar.outside .post-meta,
' . $body_class . ' .title-bar.outside .post-meta a,
' . $body_class . ' .title-bar.outside .post-meta a:hover{
color:' . $second_color . ';
}
';
}
}
//change only post thumbnail
elseif(($title_bar_option === 'global' || $title_bar_option === '') && has_post_thumbnail()){
//where title bar should be displayed
if( $page_type['page'] ){
$post_type = 'page';
}
elseif( $page_type['post'] ){
$post_type = 'post';
}
$position = $posterity_a13->get_option( $post_type . '_title_bar_position' );
if ( $position !== 'inside' ){
$bg_image = wp_strip_all_tags( posterity_get_top_image_video(false, array('return_src' => true, 'force_image' => true, 'full_size' => true)) );
$css .= '
' . $body_class . ' .title-bar.outside{
background-image:url(' . esc_url( $bg_image ) . ');
}
';
}
}
//if we have some CSS then add it
if(strlen($css)){
wp_add_inline_style( 'posterity-a13-user-css', posterity_minify_css($css) );
}
}
}
}
add_action( 'wp_enqueue_scripts', 'posterity_page_individual_look', 27 );
if(!function_exists('posterity_social_icons')){
/**
* HTML for social icons
*
* @param string $normal - color of icons for normal state
* @param string $hover - color of icons for hover state
* @param string $socials_array - array of social icons
* @param bool $hide_on_mobile - should icons be hidden on small devices
*
* @return string HTML
*
*/
function posterity_social_icons($normal, $hover, $socials_array = '', $hide_on_mobile = false ){
global $posterity_a13;
//did we send social icons set
if( is_array($socials_array) ){
$socials = $socials_array;
}
//we use socials from theme settings
else{
$socials = $posterity_a13->get_option( 'social_services' );
}
$classes = 'socials '.$posterity_a13->get_option( 'socials_variant' );
$classes .= ' '.$normal;
$classes .= ' '.$hover.'_hover';
$classes .= $hide_on_mobile ? ' hide_on_mobile': '';
$icons_classes = $posterity_a13->posterity_get_social_icons_list('classes');
$icons_names = $posterity_a13->posterity_get_social_icons_list();
$soc_html = '';
$has_active = false;
$protocols = wp_allowed_protocols();
$protocols[] = 'skype';
foreach( $socials as $service_id => $service_link ){
if( ! empty($service_link) && $service_id !== '__last_edit' ){
$icon_class = 'a13_soc-'.$service_id.' '.$icons_classes[$service_id];
$soc_html .= '
';
$has_active = true;
}
}
if($has_active){
$soc_html = '
'.$soc_html.'
';
}
return $soc_html;
}
}
if(!function_exists('posterity_page_like_content')){
/**
* prints HTML for some special templates, that use static pages for layout
*
* @param WP_Query $query
*/
function posterity_page_like_content($query){
// almost copy of page.php
$query->the_post(); //before header to get proper classes of custom template!
get_header();
posterity_title_bar();
?>
get( 'paged' ) );
$total = $query->found_posts;
$last = min( $total, $query->get( 'posts_per_page' ) * $paged );
if ( 1 == $total ) {
echo '1/1';
} else {
printf( '%1$d/%2$d', esc_html($last), esc_html($total) );
}
?>
'default',
// search engine to use (if SearchWP is available)
'input' => array(
'delay' => 500, // wait 500ms before triggering a search
'min_chars' => 3, // wait for at least 3 characters before triggering a search
),
'results' => array(
'position' => 'bottom', // where to position the results (bottom|top)
'width' => 'css', // whether the width should automatically match the input (auto|css)
'offset' => array(
'x' => 0, // x offset (in pixels)
'y' => 0 // y offset (in pixels)
),
),
'spinner' => array( // powered by http://fgnass.github.io/spin.js/
'lines' => 10, // number of lines in the spinner
'length' => 8, // length of each line
'width' => 4, // line thickness
'radius' => 8, // radius of inner circle
'corners' => 1, // corner roundness (0..1)
'rotate' => 0, // rotation offset
'direction' => 1, // 1: clockwise, -1: counterclockwise
'color' => '#000', // #rgb or #rrggbb or array of colors
'speed' => 1, // rounds per second
'trail' => 60, // afterglow percentage
'shadow' => false, // whether to render a shadow
'hwaccel' => false, // whether to use hardware acceleration
'className' => 'spinner', // CSS class assigned to spinner
'zIndex' => 2000000000, // z-index of spinner
'top' => '50%', // top position (relative to parent)
'left' => '50%', // left position (relative to parent)
),
'results_destroy_on_blur' => false,
'parent_el' => '#search-results-header'
);
return $configs;
}
}
add_filter( 'searchwp_live_search_configs', 'posterity_searchwp_live_search_configs' );
if(!function_exists('posterity_remove_searchwp_live_search_theme_css')) {
/**
* remove the default visual styling of Live Search plugin
*/
function posterity_remove_searchwp_live_search_theme_css() {
wp_dequeue_style( 'searchwp-live-search' );
}
}
add_action( 'wp_enqueue_scripts', 'posterity_remove_searchwp_live_search_theme_css', 20 );
//disable default results pane positioning CSS
add_filter( 'searchwp_live_search_base_styles', '__return_false' );
//prevent SearchWP from automatically enabling live search on forms generated with get_search_form(),
add_filter( 'searchwp_live_search_hijack_get_search_form', '__return_false' );
}
if(!function_exists('posterity_make_post_grid_filter')) {
function posterity_make_post_grid_filter( $terms, $filter_class = '', $selected_term = '__all', $show_all = true ) {
if( count( $terms ) ){
echo '
';
}
}
}