function get_inti_option($field_name, $option_array, $default = false, $meta_id = null) { // if meta_id isset then get the post meta if (isset($meta_id)) { $post_id = absint(get_queried_object_id()); // if posts page is set in reading settings get the page id if ('page' == get_option('show_on_front') && get_option('page_for_posts') && is_home()) { the_post(); $post_id = get_option('page_for_posts'); wp_reset_postdata(); } // get the meta from the database $meta = get_post_meta($post_id, $meta_id, true) ? get_post_meta($post_id, $meta_id, true) : null; // if meta is an array check for the name in the array if (is_array($meta)) { $meta = $meta[$field_name]; } // if meta isset return the value if (isset($meta)) { $meta = do_shortcode($meta); return apply_filters("inti_meta_{$field_name}", $meta); } // if meta_id is null, then we're talking theme options, get the array of options } else { $options = get_option($option_array) ? get_option($option_array) : null; } // return the option if it exists if (isset($options[$field_name])) { return $options[$field_name]; } // return default if nothing else return $default; }
function document_title_parts_cb_s($title) { if (is_single() and $id = get_queried_object_id()) { $title[] = '#' . $id; } return $title; }
/** * Factory method * * @param int $id * * @return MslsOptionsTax */ public static function create($id = 0) { if (is_admin()) { $obj = MslsContentTypes::create(); $id = (int) $id; $req = $obj->acl_request(); } else { $id = get_queried_object_id(); $req = is_category() ? 'category' : (is_tag() ? 'post_tag' : ''); } switch ($req) { case 'category': $options = new MslsOptionsTaxTermCategory($id); break; case 'post_tag': $options = new MslsOptionsTaxTerm($id); break; default: $options = new MslsOptionsTax($id); } if ($req) { add_filter('check_url', array($options, 'check_base'), 9, 2); } else { global $wp_rewrite; $options->with_front = !empty($wp_rewrite->extra_permastructs[$options->get_tax_query()]['with_front']); } return $options; }
/** * Shortcode Output */ public function shortcode() { /* * Because it's possible to trigger inception, we need to keep track which * level we are in, and reset the shortcode object accordingly. * * Clever alert. The ++ happens AFTER the value is read, So $my_level starts at 0. */ $my_level = self::$inception_levels++; $args = $this->map_related_term_args($this->get_initial_query_args()); if (!$args) { // We failed the related term check. return ''; } if (!isset($args['post__not_in']) && is_singular($this->sermons->post_type())) { $args['post__not_in'] = array(get_queried_object_id()); } $sermons = $this->sermons->get_many($args); if (!$sermons->have_posts()) { return ''; } $max = $sermons->max_num_pages; $sermons = $this->map_sermon_args($sermons, $my_level); $content = ''; if (0 === $my_level) { $content .= GCS_Style_Loader::get_template('list-item-style'); } $args = $this->get_pagination($max); $args['wrap_classes'] = $this->get_wrap_classes(); $args['sermons'] = $sermons; $content .= GCS_Template_Loader::get_template('sermons-list', $args); return $content; }
static function get_primary_category_id() { if (empty(self::$post->ID)) { return get_queried_object_id(); } return self::$primary_category; }
public function display($post) { if (!empty($this->settings['page_template'])) { //echo $this->settings['page_template']; $page_template = get_page_template_slug(get_queried_object_id()); if ($page_template != $this->settings['page_template']) { return false; } } $this->postID = $post->ID; wp_nonce_field($this->settings['id'], TF . '_' . $this->settings['id'] . '_nonce'); if (!empty($this->settings['desc'])) { ?> <p class='description'><?php echo $this->settings['desc']; ?> </p><?php } ?> <table class="form-table tf-form-table"> <tbody> <?php foreach ($this->options as $option) { $option->display(); } ?> </tbody> </table> <?php }
/** * Outputs the entire chunk of FAQs * @author Mike Biel <*****@*****.**> */ function outputFaqs() { //Gets the current page id $post_id = get_queried_object_id(); $return = ''; $faqHTML = ''; $faqs = get_field('related_faqs', $post_id); $show_adv_options = get_field('show_adv_options', $post_id); if ($faqs) { foreach ($faqs as $k => $f) { // variable must be called $post (IMPORTANT) // Question $question = $this->faqQuestion(get_field('question', $f->ID), $f->ID, 0 == $k); // Answer $answer = $this->faqAnswer(get_field('answer', $f->ID), $f->ID, 0 == $k); // Output Formatting $faqHTML .= $this->formatFAQ($question, $answer); } $advOptions = $show_adv_options ? $this->outPutAdvancedExpHTML() : ''; $return = ' <!-- START THE FAQS!!1!1!111 --> <div class="container-fluid"> <div class="row"> <div id="faqBlock" class="block"> ' . $advOptions . ' <div class="group-holder"> ' . $faqHTML . ' </div> ' . $advOptions . ' </div> </div> </div>'; } return $return; }
/** * function which forces all users to log in */ public static function force_members_login_init() { /* If the user is logged in, then abort */ if (current_user_can('read')) { return; } /* get options to determine login page ID */ $options = ltp_options::get_options(); /* This is an array of pages that will be EXCLUDED from being blocked */ $exclusions = array('wp-cron.php', 'wp-trackback.php', 'xmlrpc.php'); /* If the current script name is in the exclusion list, abort */ if (in_array(basename($_SERVER['PHP_SELF']), $exclusions)) { return; } /* if this is the login page, abort */ if (isset($options["login_page_id"])) { if (get_queried_object_id() == $options["login_page_id"]) { return; } /* Still here? Okay, then redirect to the login form */ self::redirect(); } else { return; } }
/** * Gets the layout for the current post based off the 'Layout' custom field key if viewing a singular post * entry. All other pages are given a default layout of 'layout-default'. * * @since 0.2.0 * @return string The layout for the given page. */ function theme_layouts_get_layout() { /* Get the available post layouts. */ $post_layouts = get_theme_support('theme-layouts'); /* Set the layout to an empty string. */ $layout = ''; /* If viewing a singular post, check if a layout has been specified. */ if (is_singular()) { /* Get the current post ID. */ $post_id = get_queried_object_id(); /* Get the post layout. */ $layout = get_post_layout($post_id); } elseif (is_author()) { /* Get the current user ID. */ $user_id = get_queried_object_id(); /* Get the user layout. */ $layout = get_user_layout($user_id); } /* Make sure the given layout is in the array of available post layouts for the theme. */ if (empty($layout) || !in_array($layout, $post_layouts[0])) { $layout = 'default'; } /* @deprecated 0.2.0. Use the 'get_theme_layout' hook. */ $layout = apply_filters('get_post_layout', "layout-{$layout}"); /* Return the layout and allow plugin/theme developers to override it. */ return esc_attr(apply_filters('get_theme_layout', $layout)); }
function custom_list_categories($args = '') { $defaults = array('taxonomy' => 'category', 'show_option_none' => '', 'echo' => 1, 'depth' => 2, 'wrap_class' => '', 'level_class' => '', 'parent_title_format' => '%s', 'current_class' => 'current'); $r = wp_parse_args($args, $defaults); if (!isset($r['wrap_class'])) { $r['wrap_class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy']; } extract($r); if (!taxonomy_exists($taxonomy)) { return false; } $categories = get_categories($r); $output = "<ul class='" . esc_attr($wrap_class) . "'>" . PHP_EOL; if (empty($categories)) { if (!empty($show_option_none)) { $output .= "<li>" . $show_option_none . "</li>" . PHP_EOL; } } else { if (is_category() || is_tax() || is_tag()) { $current_term_object = get_queried_object(); if ($r['taxonomy'] == $current_term_object->taxonomy) { $r['current_category'] = get_queried_object_id(); } } $depth = $r['depth']; $walker = new My_Category_Walker(); $output .= $walker->walk($categories, $depth, $r); } $output .= "</ul>" . PHP_EOL; if ($echo) { echo $output; } else { return $output; } }
public function add_script_vars() { $post_id = get_queried_object_id(); ?> <script type="text/javascript"> var optinoid = { id: '<?php echo get_queried_object_id(); ?> ', api_url: '<?php echo admin_url('admin-ajax.php'); ?> ', nonce: '<?php echo wp_create_nonce('optinoid'); ?> ', is_home: <?php echo is_front_page() ? 1 : 0; ?> }; </script> <?php }
/** * Outputs the widget based on the arguments input through the widget controls. * * @since 0.1.0 * @access public * @return void */ public function widget($sidebar, $instance) { extract($sidebar); /* If not viewing a single post, bail. */ if (!is_singular()) { return; } /* Get the current post ID. */ $post_id = get_queried_object_id(); /* Get the snippet content and title. */ $snippet_content = get_post_meta($post_id, 'Snippet', true); $snippet_title = get_post_meta($post_id, 'Snippet Title', true); /* If there's no snippet content, bail. */ if (empty($snippet_content)) { return false; } /* If there's a custom snippet title, use it. Otherwise, default to the widget title. */ $instance['title'] = !empty($snippet_title) ? $snippet_title : $instance['title']; /* Output the theme's widget wrapper. */ echo $before_widget; /* If a title was input by the user, display it. */ if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } /* Output the snippet. */ printf('<div class="snippet-content">%s</div>', apply_filters('my_snippets_content', $snippet_content)); /* Close the theme's widget wrapper. */ echo $after_widget; }
public function handle_form_submission() { if (get_queried_object_id() != $this->get_page_id()) { return false; } $action = $this->get_action(); if (get_query_var('cuar_action', null) != null) { $action = get_query_var('cuar_action', null); } if (!$this->is_action_authorized($action)) { return false; } do_action('cuar/private-content/edit/before_' . $action, $this, $this->form_errors); do_action('cuar/private-content/edit/before_' . $action . '/page-slug=' . $this->get_slug(), $this, $this->form_errors); $result = $this->do_edit_content($action, $_POST); do_action('cuar/private-content/edit/after_' . $action, $this, $this->form_errors); do_action('cuar/private-content/edit/after_' . $action . '/page-slug=' . $this->get_slug(), $this, $this->form_errors); if (true === $result && empty($this->form_errors)) { $redirect_url = apply_filters('cuar/private-content/edit/after_' . $action . '/redirect_url', $this->get_redirect_url_after_action(), $this->get_slug()); if ($redirect_url != null) { wp_redirect($redirect_url); exit; } } return true; }
function widget($args, $instance) { extract($args); $user_id = $instance['user_id']; if (empty($user_id)) { if (is_author()) { $user_id = get_queried_object_id(); } else { return; } } $title = apply_filters('widget_title', $title, $instance, $this->id_base); $title = sprintf($instance['title'], '<span class="display-name">' . get_the_author_meta('display_name', $user_id) . '</span>'); $bio = get_the_author_meta('description', $user_id); if ($instance['strip_tags']) { $bio = strip_tags($bio); } if (function_exists('mb_strimwidth') && ($bio_length = $instance['bio_length'])) { $bio = mb_strimwidth($bio, 0, $bio_length); } echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } echo '<div class="bio">' . wpautop($bio) . '</div>'; echo $after_widget; }
/** * Get post specific CSS styles and paste it to head. * * @since 4.0.0 */ function cherry_post_inline_styles() { $post_id = get_queried_object_id(); $post_type = get_post_type($post_id); if (!$post_type || !post_type_supports($post_type, 'cherry-post-style')) { return; } if (wp_style_is(CHERRY_DYNAMIC_CSS_HANDLE, 'enqueued')) { $handle = CHERRY_DYNAMIC_CSS_HANDLE; } else { $cherry_styles = cherry_get_styles(); $handle = isset($cherry_styles['style']) ? $cherry_styles['style']['handle'] : false; } if (!$handle) { return; } $header_bg = cherry_current_page()->get_property('background', 'header'); if (!$header_bg) { return; } $custom_bg = cherry_get_background_css('.site-header', $header_bg); /** * Filter a custom background style. * * @since 4.0.0 * @param string $custom_bg Background style. * @param int $post_id The post ID. */ $custom_bg = apply_filters('cherry_post_inline_styles', $custom_bg, $post_id); if (!$custom_bg) { return; } wp_add_inline_style($handle, sanitize_text_field($custom_bg)); }
/** * Display a list categories * @param array $args * @return bool */ function zfwca_list_categories($args = array()) { $defaults = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'exclude' => '', 'include' => '', 'exclude_tree' => '', 'current_category' => 0, 'taxonomy' => 'category'); $r = wp_parse_args($args, $defaults); $r['walker'] = new ZFWCA_Post_Category_Walker(); if (!isset($r['class'])) { $r['class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy']; } extract($r); if (!taxonomy_exists($taxonomy)) { return false; } $categories = get_categories($r); $output = ''; if (empty($categories)) { $output .= 'No categories'; } else { if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) { $current_term_object = get_queried_object(); if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) { $r['current_category'] = get_queried_object_id(); } } $output .= walk_category_tree($categories, 0, $r); } $output = apply_filters('zfwca_wp_list_categories', $output, $args); return $output; }
/** * Plugin Name: Site Breadcrumbs * Plugin URI: https://wordpress.com * Description: Quickly add breadcrumbs to the single view of a hierarchical post type or a hierarchical taxonomy. * Author: Automattic * Version: 1.0 * Author URI: https://wordpress.com * License: GPL2 or later */ function jetpack_breadcrumbs() { $taxonomy = is_category() ? 'category' : get_query_var('taxonomy'); $is_taxonomy_hierarchical = is_taxonomy_hierarchical($taxonomy); $post_type = is_page() ? 'page' : get_query_var('post_type'); $is_post_type_hierarchical = is_post_type_hierarchical($post_type); if (!($is_post_type_hierarchical || $is_taxonomy_hierarchical) || is_front_page()) { return; } $breadcrumb = ''; if ($is_post_type_hierarchical) { $post_id = get_queried_object_id(); $ancestors = array_reverse(get_post_ancestors($post_id)); if ($ancestors) { foreach ($ancestors as $ancestor) { $breadcrumb .= '<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="' . esc_url(get_permalink($ancestor)) . '" itemprop="item"><span itemprop="name">' . esc_html(get_the_title($ancestor)) . '</span></a></span>'; } } $breadcrumb .= '<span class="current-page" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><span itemprop="name">' . esc_html(get_the_title($post_id)) . '</span></span>'; } elseif ($is_taxonomy_hierarchical) { $current = get_term(get_queried_object_id(), $taxonomy); if (is_wp_error($current)) { return; } if ($current->parent) { $breadcrumb = jetpack_get_term_parents($current->parent, $taxonomy); } $breadcrumb .= '<span class="current-category" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><span itemprop="name">' . esc_html($current->name) . '</span></span>'; } $home = '<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="' . esc_url(home_url('/')) . '" class="home-link" itemprop="item" rel="home"><span itemprop="name">' . esc_html__('Home', 'jetpack') . '</span></a></span>'; echo '<nav class="entry-breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">' . $home . $breadcrumb . '</nav>'; }
/** * returns the language based on the queried content * * @since 1.2 * * @return object|bool detected language, false if none was found */ protected function get_language_from_content() { // no language set for 404 if (is_404() || is_attachment() && !$this->options['media_support']) { return $this->get_preferred_language(); } if ($var = get_query_var('lang')) { $lang = explode(',', $var); $lang = $this->model->get_language(reset($lang)); // choose the first queried language } elseif ((is_single() || is_page() || is_attachment() && $this->options['media_support']) && (($var = get_queried_object_id()) || ($var = get_query_var('p')) || ($var = get_query_var('page_id')) || ($var = get_query_var('attachment_id')))) { $lang = $this->model->post->get_language($var); } else { foreach ($this->model->get_translated_taxonomies() as $taxonomy) { if ($var = get_query_var(get_taxonomy($taxonomy)->query_var)) { $lang = $this->model->term->get_language($var, $taxonomy); } } } /** * Filter the language before it is set from the content * * @since 0.9 * * @param bool|object $lang language object or false if none was found */ return apply_filters('pll_get_current_language', isset($lang) ? $lang : false); }
/** * the_content filter that will add linked posts to the bottom of the main post content * * @param $content * * @return string */ public function run($content) { /** * Wow, what's going on here?! Well, setup_postdata() sets a lot of variables but does not change the $post variable. * All checks return the main queried ID but we want to check if this specific filter call is the for the 'main' content. * The method setup_postdata() does global and set the $id variable, so we're checking that. */ global $id; // Only run on single if (!is_singular() || !is_main_query() || $id != get_queried_object_id()) { return $content; } // Allow disabling content filter if (false === apply_filters('rp4wp_append_content', true)) { return $content; } // The Post Type $post_type = get_post_type($id); // The Post Type Manager $pt_manager = new RP4WP_Post_Type_Manager(); // Check if this Post Type is installed if ($pt_manager->is_post_type_installed($post_type) && isset(RP4WP()->settings['general_' . $post_type])) { // Related Post Manager $related_post_manager = new RP4WP_Related_Post_Manager(); // The Output $output = $related_post_manager->generate_related_posts_list($id); // Add output if there is any if ('' != $output) { $content .= $output; } } // Return the content return $content; }
/** * Get the post layout based on the given post ID. */ function tamatebako_get_post_layout($post_id = '') { if (empty($post_id)) { $post_id = get_queried_object_id(); } return get_post_meta($post_id, tamatebako_layout_meta_key(), true); }
function widget($args, $instance) { if (!is_singular()) { return; } $instance = array_merge($this->defaults, $instance); $post_id = get_queried_object_id(); $ctype = p2p_type($instance['ctype']); if (!$ctype) { return; } $directed = $ctype->find_direction($post_id); if (!$directed) { return; } if ('related' == $instance['listing']) { $connected = $ctype->get_related($post_id); $title = sprintf(__('Related %s', P2P_TEXTDOMAIN), $directed->get_current('side')->get_title()); } else { $connected = $directed->get_connected($post_id); $title = $directed->get_current('title'); } if (!$connected->have_posts()) { return; } $title = apply_filters('widget_title', $title, $instance, $this->id_base); extract($args); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } p2p_list_posts($connected); echo $after_widget; }
function store_seo_info() { if (get_post_type() == 'store' && !is_singular()) { $id = get_queried_object_id(); if ((taxonomy_exists('products_category') || taxonomy_exists('products_tag')) && $id != 0) { $term_name = get_term_field('name', $id, 'products_category'); $title = $term_name; $paged = get_query_var('paged'); if ($paged > 1) { $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged); } $title .= ' - ' . get_bloginfo('name') . '商城'; $keywords = $term_name . ",商城"; $description = strip_tags(term_description()); } elseif (is_archive() && $id == 0) { $title = ot_get_option('shop_archives_title', 'WordPress商店'); $paged = get_query_var('paged'); if ($paged > 1) { $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged); } $title .= ' - ' . get_bloginfo('name'); $keywords = '商品归档,商城,归档'; $description = get_bloginfo('name') . '商城'; } $seo_text = '<title>' . $title . '</title><meta name="description" content="' . $description . '" /><meta name="keywords" content="' . $keywords . '" />'; } else { $seo_text = ''; } return $seo_text; }
public function fully_background_setup() { if (!is_singular()) { return; } $post = get_queried_object(); $post_id = get_queried_object_id(); if (!post_type_supports($post->post_type, 'fully-background-manager')) { return; } $this->color = get_post_meta($post_id, '_fully_background_color', true); $is_layout = get_post_meta($post_id, '_fully_is_layout', true); $attachment_id = get_post_meta($post_id, '_fully_background_image_id', true); $pattern_image = get_post_meta($post_id, '_fully_background_pattern', true); if ($is_layout == "Yes" && $pattern_image != "") { $image = $this->plugin_path . "assets/images/big/" . $pattern_image . ".jpg"; $this->image = !empty($image) ? esc_url($image) : ''; } if ($is_layout == "No") { $image = wp_get_attachment_image_src($attachment_id, 'full'); $this->image = !empty($image) && isset($image[0]) ? esc_url($image[0]) : ''; } add_filter('theme_mod_background_color', array($this, 'fbm_background_color'), 25); add_filter('theme_mod_background_image', array($this, 'fbm_background_image'), 25); if (!empty($this->image)) { $this->attachment = get_post_meta($post_id, '_fully_background_attachment', true); $this->repeat = get_post_meta($post_id, '_fully_background_repeat', true); add_filter('theme_mod_background_attachment', array($this, 'fbm_background_attachment'), 25); add_filter('theme_mod_background_repeat', array($this, 'fbm_background_repeat'), 25); } }
/** * Outputs the entire chunk of Page Blocks * @author Andi Ruggles <*****@*****.**> * @author Mark Furrow */ public static function output() { $page_block_rows = ''; // Gets the current page id $page_id = get_queried_object_id(); $posts = get_field('page_blocks_join', $page_id); if ($posts) { foreach ($posts as $p) { // variable must be called $post (IMPORTANT) $columns = ''; self::$ID = $p->ID; self::$layout = get_field('layout', self::$ID); self::$has_flag = get_field('add_flag', self::$ID); // Hidden? if (get_field('hidden', self::$ID) != 'yes') { // Set Header Data self::setHeader(); // Set Column Data self::setColumnsData(); // Display For: One, Two, or Three Cols $columns = self::formatColumns(); // Build collection of Rows $page_block_rows .= self::formatRow($columns); } $return = ' <div id="pageBlocks"> ' . $page_block_rows . ' </div> '; } } echo $return; }
/** * Reactor Get Options * based on get_theme_mod in wp-includes/theme.php * retrieves an option from the database or cache * can also get a value from post meta * * @package Reactor * @since 1.0.0 * @author Anthony Wilhelm (@awshout / anthonywilhelm.com) * @param $name option name in database * @param $default a default value if option is avialble * @param $meta_id post meta id to retrieve meta from database * @license GNU General Public License v2 or later (http://www.gnu.org/licenses/gpl-2.0.html) */ function reactor_option($name, $default = false, $meta_id = null) { // if meta_id isset get post meta if (isset($meta_id)) { $post_id = absint(get_queried_object_id()); // if posts page is set in reading settings get the page id if ('page' == get_option('show_on_front') && get_option('page_for_posts') && is_home()) { the_post(); $post_id = get_option('page_for_posts'); wp_reset_postdata(); } // get the meta from the database $meta = get_post_meta($post_id, $meta_id, true) ? get_post_meta($post_id, $meta_id, true) : null; // if meta is an array check for the name in the array if (is_array($meta)) { $meta = $meta[$name]; } // if meta isset return the value if (isset($meta)) { $meta = do_shortcode($meta); return apply_filters('reactor_option_$name', $meta); } } else { // else get array of options $options = get_option('reactor_options') ? get_option('reactor_options') : null; } // return the option if it exists if (isset($options[$name])) { return apply_filters('reactor_option_$name', $options[$name]); } // return default if nothing else return apply_filters('reactor_option_$name', $default); }
function dt_inline_css_default_banner_image() { global $krypton_config; $custom_title_css = ''; $post = get_post(); $post_id = $post ? $post->ID : 0; $slidedata = $krypton_config['homeslide']; $content_top_margin = 0; if (!empty($krypton_config['dt-content-top-margin'])) { $content_top_margin = intval($krypton_config['dt-content-top-margin']); } if (isset($krypton_config['dt-display-header']) && $krypton_config['dt-display-header'] == 1) { $blog_page_id = get_option('page_for_posts'); $queried_object_id = get_queried_object_id(); if ($blog_page_id == $queried_object_id) { // kalo di page yg di set sbg posts page $featured_img_fullsize_url = wp_get_attachment_image_src(get_post_thumbnail_id($blog_page_id), 'full'); if (isset($featured_img_fullsize_url) && !empty($featured_img_fullsize_url)) { $custom_title_css = '.blog_classic .subpage-banner { background: url(' . esc_url($featured_img_fullsize_url['0']) . ') no-repeat scroll 0 0 !important; background-size: cover!important; margin-bottom: ' . $content_top_margin . 'px;}'; } else { $custom_title_css = '.blog_classic .subpage-banner { background: url(' . esc_url($krypton_config['dt-banner-image']['url']) . ') no-repeat scroll 0 0 !important; background-size: cover!important; margin-bottom: ' . $content_top_margin . 'px; }'; } } else { if (has_post_thumbnail($post_id)) { $featured_img_fullsize_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full'); if (is_front_page() && isset($slidedata) && is_array($slidedata) && count($slidedata) && $krypton_config['showslide'] == 1 && (!empty($slidedata[0]['title']) || !empty($slidedata[0]['attachment_id']) || !empty($slidedata[0]['description']) || !empty($slidedata[0]['logo_id']) || !empty($slidedata[0]['slidelabel']))) { $custom_title_css = '.blog_classic .subpage-banner { background: url(' . esc_url($featured_img_fullsize_url['0']) . ') no-repeat scroll 0 0 !important; background-size: cover!important; margin-bottom: ' . $content_top_margin . 'px;}'; } else { $custom_title_css = '.blog_classic .subpage-banner { background: url(' . esc_url($featured_img_fullsize_url['0']) . ') no-repeat scroll 0 0 !important; background-size: cover!important; margin-bottom: ' . $content_top_margin . 'px;}'; } } else { if (isset($krypton_config['dt-banner-image']['url']) && $krypton_config['dt-banner-image']['url'] != '') { if (is_front_page() && isset($slidedata) && is_array($slidedata) && count($slidedata) && $krypton_config['showslide'] == 1 && (!empty($slidedata[0]['title']) || !empty($slidedata[0]['attachment_id']) || !empty($slidedata[0]['description']) || !empty($slidedata[0]['logo_id']) || !empty($slidedata[0]['slidelabel']))) { $custom_title_css = '.blog_classic .subpage-banner { background: url(' . esc_url($krypton_config['dt-banner-image']['url']) . ') no-repeat scroll 0 0 !important; background-size: cover!important; margin-bottom: ' . $content_top_margin . 'px;}'; } else { $custom_title_css = '.blog_classic .subpage-banner { background: url(' . esc_url($krypton_config['dt-banner-image']['url']) . ') no-repeat scroll 0 0 !important; background-size: cover!important; margin-bottom: ' . $content_top_margin . 'px; }'; } } else { $custom_title_css = '.blog_classic .subpage-banner { background-color: rgba(200,200,200,0.7); margin-bottom: ' . $content_top_margin . 'px; } .blog_classic .subpage-banner .container .header-group h1 {font-size:30px;}'; } } } } else { //if (isset($krypton_config['dt-display-header']) && $krypton_config['dt-display-header']==1) if (is_front_page() && isset($slidedata) && is_array($slidedata) && count($slidedata) && $krypton_config['showslide'] == 1 && (!empty($slidedata[0]['title']) || !empty($slidedata[0]['attachment_id']) || !empty($slidedata[0]['description']) || !empty($slidedata[0]['logo_id']) || !empty($slidedata[0]['slidelabel']))) { $custom_title_css = '.blog_classic .subpage-banner { min-height: 0px; max-height: 0px; height: 0px; margin-bottom: ' . $content_top_margin . 'px; } .blog_classic .subpage-banner .container { display: none !important; } '; //$custom_title_css = '.blog_classic .subpage-banner { margin-bottom: 40px; height: 0px; margin-bottom: '.$content_top_margin.'px; } .blog_classic .subpage-banner .container { display: none !important; } '; } else { $custom_title_css = '.blog_classic .subpage-banner { min-height: 0px; max-height: 0px; height: 0px; margin-bottom: ' . $content_top_margin . 'px } .blog_classic .subpage-banner .container { display: none !important; } '; //$custom_title_css = '.blog_classic .subpage-banner { margin-bottom: 100px; height: 0px; margin-bottom: '.$content_top_margin.'px } .blog_classic .subpage-banner .container { display: none !important; } '; } } ?> <style type="text/css"> <?php print $custom_title_css; ?> </style> <?php }
/** * Are we on Sitewide gallery page? * * @return boolean */ function mpp_is_sitewide_gallery_component() { if (is_singular(mpp_get_gallery_post_type()) && mpp_is_sitewide_gallery(get_queried_object_id())) { return true; } return false; }
function amp_frontend_add_canonical() { if (false === apply_filters('amp_frontend_show_canonical', true)) { return; } $amp_url = amp_get_permalink(get_queried_object_id()); printf('<link rel="amphtml" href="%s" />', esc_url($amp_url)); }
/** * Returns the ID of the queried object. * * For term archives, this is the term taxonomy ID (not the term ID). * * @since 3.0.0 * * @return int The ID of the queried object. */ public function queried_object_id() { if (is_category() || is_tag() || is_tax()) { $queried_object = get_queried_object(); return isset($queried_object->term_taxonomy_id) ? (int) $queried_object->term_taxonomy_id : 0; } return (int) get_queried_object_id(); }
/** * Disables sidebars if viewing a two-column - wide page, or a gallery post. * */ function ascetica_disable_sidebars($sidebars_widgets) { global $wp_query; if (is_page_template('page-template-wide.php') || is_singular() && has_post_format('gallery', get_queried_object_id())) { $sidebars_widgets['secondary'] = false; } return $sidebars_widgets; }