本文整理汇总了PHP中avia_get_the_id函数的典型用法代码示例。如果您正苦于以下问题:PHP avia_get_the_id函数的具体用法?PHP avia_get_the_id怎么用?PHP avia_get_the_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了avia_get_the_id函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shortcode_handler
/**
* Frontend Shortcode Handler
*
* @param array $atts array of attributes
* @param string $content text within enclosing form of shortcode element
* @param string $shortcodename the shortcode found, when == callback name
* @return string $output returns the modified html string
*/
function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
{
$atts = shortcode_atts(array('email' => get_option('admin_email'), 'button' => __("Submit", 'avia_framework'), 'autorespond' => '', 'captcha' => '', 'subject' => '', 'on_send' => '', 'link' => '', 'sent' => __("Your message has been sent!", 'avia_framework'), 'title' => __("Send us mail", 'avia_framework')), $atts, $this->config['shortcode']);
extract($atts);
$post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
$redirect = !empty($on_send) ? AviaHelper::get_url($link) : "";
$form_args = array("heading" => $title ? "<h3>" . $title . "</h3>" : "", "success" => "<h3 class='avia-form-success'>" . $sent . "</h3>", "submit" => $button, "myemail" => $email, "action" => get_permalink($post_id), "myblogname" => get_option('blogname'), "autoresponder" => $autorespond, "autoresponder_subject" => __('Thank you for your Message!', 'avia_framework'), "autoresponder_email" => $email, "subject" => $subject, "form_class" => $meta['el_class'], "multiform" => true, "label_first" => true, "redirect" => $redirect);
if (trim($form_args['myemail']) == '') {
$form_args['myemail'] = get_option('admin_email');
}
//form fields passed by the user
$form_fields = $this->helper_array2form_fields(ShortcodeHelper::shortcode2array($content, 1));
//fake username field that is not visible. if the field has a value a spam bot tried to send the form
$elements['avia_username'] = array('type' => 'decoy', 'label' => '', 'check' => 'must_empty');
//captcha field for the user to verify that he is real
if ($captcha) {
$elements['avia_age'] = array('type' => 'captcha', 'check' => 'captcha', 'label' => __('Please prove that you are human by solving the equation', 'avia_framework'));
}
//merge all fields
$form_fields = apply_filters('avia_contact_form_elements', array_merge($form_fields, $elements));
$form_args = apply_filters('avia_contact_form_args', $form_args, $post_id);
$contact_form = new avia_form($form_args);
$contact_form->create_elements($form_fields);
$output = $contact_form->display_form(true);
return $output;
}
示例2: do_action
<?php
do_action('ava_before_footer');
global $avia_config;
$blank = isset($avia_config['template']) ? $avia_config['template'] : "";
//reset wordpress query in case we modified it
wp_reset_query();
//get footer display settings
$the_id = avia_get_the_id();
//use avia get the id instead of default get id. prevents notice on 404 pages
$footer = get_post_meta($the_id, 'footer', true);
$footer_widget_setting = !empty($footer) ? $footer : avia_get_option('display_widgets_socket');
//check if we should display a footer
if (!$blank && $footer_widget_setting != 'nofooterarea') {
if ($footer_widget_setting != 'nofooterwidgets') {
//get columns
$columns = avia_get_option('footer_columns');
?>
<div class='container_wrap footer_color' id='footer'>
<div class='container footer-title'>
<p class="font-center" style="font-size:24px;">快速查看</p>
</div>
<div class='container'>
<?php
do_action('avia_before_footer_columns');
//create the footer columns by iterating
switch ($columns) {
case 1:
$class = '';
break;
case 2:
示例3: avia_header_class_string
function avia_header_class_string($necessary = array(), $prefix = "html_")
{
if (empty($necessary)) {
$necessary = array('header_position', 'header_layout', 'header_size', 'header_sticky', 'header_shrinking', 'header_topbar', 'header_transparency', 'header_mobile_activation', 'header_mobile_behavior', 'header_searchicon', 'layout_align_content', 'header_unstick_top', 'header_stretch', 'header_style', 'blog_global_style');
}
$settings = avia_header_setting();
$class = array();
$post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
foreach ($necessary as $class_name) {
if (!empty($settings[$class_name])) {
$result = array_filter(explode(' ', $settings[$class_name]));
$class = array_merge($class, $result);
}
}
if ($post_id) {
$class[] = "entry_id_" . $post_id;
}
$class = apply_filters('avf_header_classes', $class, $necessary, $prefix);
if (!empty($class)) {
$class = array_unique($class);
$class = " " . $prefix . implode(" " . $prefix, $class);
}
return $class;
}
示例4: avia_mynew_section
function avia_mynew_section($params = array())
{
global $avia_section_markup, $avia_config;
$defaults = array('class' => 'main_color', 'bg' => '', 'close' => true, 'open' => true, 'open_structure' => true, 'open_color_wrap' => true, 'data' => '', "style" => '', 'id' => "", 'main_container' => false, 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'attach' => "", 'before_new' => "", 'custom_markup' => '');
$defaults = array_merge($defaults, $params);
extract($defaults);
$post_class = "";
$output = "";
$bg_slider = "";
$container_style = "";
if ($id) {
$id = "id='{$id}'";
}
if ($close) {
$cm = avia_obeysection_close_markup();
$output .= "<!-- after firstsection-->" . avia_sc_section::$add_to_closing . avia_sc_section::$close_overlay;
}
//start new
if ($open) {
if (function_exists('avia_get_the_id')) {
$post_class = "post-entry-" . avia_get_the_id();
}
if ($open_color_wrap) {
if (!empty($video)) {
$slide = array('shortcode' => 'av_slideshow', 'content' => '', 'attr' => array('id' => '', 'video' => $video, 'slide_type' => 'video', 'video_mute' => true, 'video_loop' => true, 'video_ratio' => $video_ratio, 'video_controls' => 'disabled', 'video_section_bg' => true, 'video_format' => '', 'video_mobile' => '', 'video_mobile_disabled' => $video_mobile_disabled));
$bg_slider = new avia_slideshow(array('content' => array($slide)));
$bg_slider->set_extra_class('av-section-video-bg');
$class .= " av-section-with-video-bg";
$class .= !empty($video_mobile_disabled) ? " av-section-mobile-video-disabled" : "";
$data .= " data-section-video-ratio='{$video_ratio}'";
}
// add parallax div
$output .= $attach;
$output .= apply_filters('avf_section_container_add', '', $defaults);
}
}
return $output;
}
示例5: avia_get_the_id
<?php
global $avia_config, $post_loop_count;
$post_loop_count = 1;
$post_class = "post-entry-" . avia_get_the_id();
// check if we got posts to display:
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div class='post-entry post-entry-type-page <?php
echo $post_class;
?>
'>
<div class="entry-content clearfix">
<?php
$thumb = get_the_post_thumbnail(get_the_ID(), $avia_config['size']);
if ($thumb) {
echo "<div class='page-thumb'>{$thumb}</div>";
}
//display the actual post content
the_content(__('Read more', 'avia_framework') . '<span class="more-link-arrow"> →</span>');
wp_link_pages(array('before' => '<div class="pagination_split_post">', 'after' => '</div>', 'pagelink' => '<span>%</span>'));
if (has_tag() && is_single()) {
echo '<span class="blog-tags minor-meta">';
the_tags('<strong>' . __('Tags:', 'avia_framework') . '</strong><span> ');
echo '</span></span>';
}
示例6: avia_new_section
function avia_new_section($params = array())
{
global $avia_section_markup, $avia_config;
$defaults = array('class' => 'main_color', 'bg' => '', 'close' => true, 'open' => true, 'open_structure' => true, 'open_color_wrap' => true, 'data' => '', "style" => '', 'id' => "", 'main_container' => false, 'min_height' => '', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'attach' => "", 'custom_markup' => '');
$defaults = array_merge($defaults, $params);
extract($defaults);
$post_class = "";
$output = "";
$bg_slider = "";
if ($id) {
$id = "id='{$id}'";
}
//close old content structure. only necessary when previous element was a section. other fullwidth elements dont need this
if ($close) {
$cm = avia_section_close_markup();
$output .= "</div></div>{$cm}</div></div>";
}
//start new
if ($open) {
if (function_exists('avia_get_the_id')) {
$post_class = "post-entry-" . avia_get_the_id();
}
if ($open_color_wrap) {
if (!empty($min_height)) {
$class .= " av-minimum-height av-minimum-height-" . $min_height;
}
if (!empty($video)) {
$slide = array('shortcode' => 'av_slideshow', 'content' => '', 'attr' => array('id' => '', 'video' => $video, 'slide_type' => 'video', 'video_mute' => true, 'video_loop' => true, 'video_ratio' => $video_ratio, 'video_controls' => 'disabled', 'video_section_bg' => true, 'video_format' => '', 'video_mobile' => '', 'video_mobile_disabled' => $video_mobile_disabled));
$bg_slider = new avia_slideshow(array('content' => array($slide)));
$bg_slider->set_extra_class('av-section-video-bg');
$class .= " av-section-with-video-bg";
$class .= !empty($video_mobile_disabled) ? " av-section-mobile-video-disabled" : "";
$data .= " data-section-video-ratio='{$video_ratio}'";
}
$output .= "<div {$id} class='{$class} container_wrap " . avia_layout_class('main', false) . "' {$bg} {$data} {$style}>";
$output .= !empty($bg_slider) ? $bg_slider->html() : "";
$output .= $attach;
$output .= apply_filters('avf_section_container_add', '', $defaults);
}
//this applies only for sections. other fullwidth elements dont need the container for centering
if ($open_structure) {
if (!empty($main_container)) {
$markup = 'main ' . avia_markup_helper(array('context' => 'content', 'echo' => false, 'custom_markup' => $custom_markup));
$avia_section_markup = 'main';
} else {
$markup = "div";
}
$output .= "<div class='container'>";
$output .= "<{$markup} class='template-page content " . avia_layout_class('content', false) . " units'>";
$output .= "<div class='post-entry post-entry-type-page {$post_class}'>";
$output .= "<div class='entry-content-wrapper clearfix'>";
}
}
return $output;
}
示例7: shortcode_handler
/**
* Frontend Shortcode Handler
*
* @param array $atts array of attributes
* @param string $content text within enclosing form of shortcode element
* @param string $shortcodename the shortcode found, when == callback name
* @return string $output returns the modified html string
*/
function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
{
extract(shortcode_atts(array('link' => ''), $atts, $this->config['shortcode']));
$output = "";
$post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
$entry = AviaHelper::get_entry($link);
if (!empty($entry)) {
if ($entry->ID == $post_id) {
$output .= '<article class="entry-content" ' . avia_markup_helper(array('context' => 'entry', 'echo' => false, 'id' => $post_id, 'custom_markup' => $meta['custom_markup'])) . '>';
$output .= "You added a Post/Page Content Element to this entry that tries to display itself. This would result in an infinite loop. Please select a different entry or remove the element";
$output .= '</article>';
} else {
$output .= '<article class="entry-content" ' . avia_markup_helper(array('context' => 'entry', 'echo' => false, 'id' => $post_id, 'custom_markup' => $meta['custom_markup'])) . '>';
$output .= apply_filters('the_content', $entry->post_content);
$output .= '</article>';
}
}
return do_shortcode($output);
}
示例8: shortcode_handler
/**
* Frontend Shortcode Handler
*
* @param array $atts array of attributes
* @param string $content text within enclosing form of shortcode element
* @param string $shortcodename the shortcode found, when == callback name
* @return string $output returns the modified html string
*/
function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
{
if (empty($this->api_key)) {
return;
}
$lists = get_option('av_chimplist');
$newlist = array();
if (empty($lists)) {
return;
}
foreach ($lists as $key => $list_item) {
$newlist[$list_item['name']] = $key;
}
$lists = $newlist;
$atts = shortcode_atts(apply_filters('avf_sc_mailchimp_atts', array('list' => "", 'email' => get_option('admin_email'), 'button' => __("Submit", 'avia_framework'), 'captcha' => '', 'subject' => '', 'on_send' => '', 'link' => '', 'sent' => __("Thank you for subscribing to our newsletter!", 'avia_framework'), 'color' => "", 'hide_labels' => "", 'form_align' => "", 'listonly' => false, 'double_opt_in' => "")), $atts, $this->config['shortcode']);
if (empty($atts['list'])) {
return;
}
//extract form fields
if ($atts['listonly']) {
$form_fields = $this->convert_fields_from_list($atts['list']);
} else {
$content = str_replace("\\,", ",", $content);
$form_fields = $this->helper_array2form_fields(ShortcodeHelper::shortcode2array($content, 1));
}
if (empty($form_fields)) {
return;
}
extract($atts);
$post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
$redirect = !empty($on_send) ? AviaHelper::get_url($link) : "";
if (!empty($form_align)) {
$meta['el_class'] .= " av-centered-form ";
}
$form_args = array("heading" => "", "success" => "<h3 class='avia-form-success avia-mailchimp-success'>" . $sent . "</h3>", "submit" => $button, "myemail" => $email, "action" => get_permalink($post_id), "myblogname" => get_option('blogname'), "subject" => $subject, "form_class" => $meta['el_class'] . " " . $color . " avia-mailchimp-form", "form_data" => array('av-custom-send' => 'mailchimp_send'), "multiform" => true, "label_first" => true, "redirect" => $redirect, "placeholder" => $hide_labels, "mailchimp" => $atts['list'], "custom_send" => array($this, 'send'), "double_opt_in" => $atts['double_opt_in']);
if (trim($form_args['myemail']) == '') {
$form_args['myemail'] = get_option('admin_email');
}
$content = str_replace("\\,", ",", $content);
//fake username field that is not visible. if the field has a value a spam bot tried to send the form
$elements['avia_username'] = array('type' => 'decoy', 'label' => '', 'check' => 'must_empty');
//captcha field for the user to verify that he is real
if ($captcha) {
$elements['avia_age'] = array('type' => 'captcha', 'check' => 'captcha', 'label' => __('Please prove that you are human by solving the equation', 'avia_framework'));
}
//merge all fields
$form_fields = apply_filters('ava_mailchimp_contact_form_elements', array_merge($form_fields, $elements));
$form_fields = apply_filters('avf_sc_mailchimp_form_elements', $form_fields, $atts);
$form_args = apply_filters('avia_mailchimp_form_args', $form_args, $post_id);
$contact_form = new avia_form($form_args);
$contact_form->create_elements($form_fields);
$output = $contact_form->display_form(true);
return $output;
}
示例9: avia_title
function avia_title($args = false, $id = false)
{
global $avia_config;
if (!$id) {
$id = avia_get_the_id();
}
$defaults = array('title' => get_the_title($id), 'subtitle' => "", 'link' => get_permalink($id), 'html' => "<div class='{class} title_container'><div class='container'><{heading} class='main-title'>{title}</{heading}>{additions}</div></div>", 'class' => 'stretch_full container_wrap alternate_color ' . avia_is_dark_bg('alternate_color', true), 'breadcrumb' => true, 'additions' => "", 'heading' => 'h1');
if (is_tax() || is_category() || is_tag()) {
global $wp_query;
$term = $wp_query->get_queried_object();
$defaults['link'] = get_term_link($term);
} else {
if (is_archive()) {
$defaults['link'] = "";
}
}
// Parse incomming $args into an array and merge it with $defaults
$args = wp_parse_args($args, $defaults);
$args = apply_filters('avf_title_args', $args, $id);
// OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
extract($args, EXTR_SKIP);
if (empty($title)) {
$class .= " empty_title ";
}
if (!empty($link)) {
$title = "<a href='" . $link . "' rel='bookmark' title='" . __('Permanent Link:', 'avia_framework') . " " . esc_attr($title) . "'>" . $title . "</a>";
}
if (!empty($subtitle)) {
$additions .= "<div class='title_meta meta-color'>" . wpautop($subtitle) . "</div>";
}
if ($breadcrumb) {
$additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true));
}
$html = str_replace('{class}', $class, $html);
$html = str_replace('{title}', $title, $html);
$html = str_replace('{additions}', $additions, $html);
$html = str_replace('{heading}', $heading, $html);
if (!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview()) {
$avia_config['small_title'] = $title;
} else {
return $html;
}
}
示例10: avia_new_section
function avia_new_section($params = array())
{
$defaults = array('class' => 'main_color', 'bg' => '', 'close' => true, 'open' => true, 'open_structure' => true, 'open_color_wrap' => true, 'data' => '', "style" => '', 'id' => "");
$defaults = array_merge($defaults, $params);
extract($defaults);
$post_class = "";
$output = "";
if ($id) {
$id = "id='{$id}'";
}
//close old
if ($close) {
$output .= '</div></div></div></div></div>';
}
//start new
if ($open) {
if (function_exists('avia_get_the_id')) {
$post_class = "post-entry-" . avia_get_the_id();
}
if ($open_color_wrap) {
$output .= "<div {$id} class='{$class} container_wrap " . avia_layout_class('main', false) . "' {$bg} {$data} {$style}>";
$output .= apply_filters('avf_section_container_add', '', $defaults);
}
if ($open_structure) {
$output .= "<div class='container'>";
$output .= "<div class='template-page content " . avia_layout_class('content', false) . " units'>";
$output .= "<div class='post-entry post-entry-type-page {$post_class}'>";
$output .= "<div class='entry-content clearfix'>";
}
}
return $output;
}
示例11: shortcode_handler
/**
* Frontend Shortcode Handler
*
* @param array $atts array of attributes
* @param string $content text within enclosing form of shortcode element
* @param string $shortcodename the shortcode found, when == callback name
* @return string $output returns the modified html string
*/
function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
{
extract(shortcode_atts(array('link' => ''), $atts));
$output = "";
$post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
$entry = AviaHelper::get_entry($link);
if (!empty($entry)) {
if ($entry->ID == $post_id) {
$output .= "You added a Post/Page Content Element to this entry that tries to display itself. This would result in an infinite loop. Please select a different entry or remove the element";
} else {
$output .= apply_filters('the_content', $entry->post_content);
}
}
return do_shortcode($output);
}