如何在帖子标题下显示日期?

时间:2018-08-10 作者:Quinty van Dijk

他告诉大家我是wordpress/php的新手,还有一个问题。我试图在帖子标题下获取日期,而不是在标题上方显示类别标签。我试着改变它的东西是索引。php,但它不会工作。如何修复此页面的此问题http://www.quintyvandijk.com/gallery/.

<?php
$edgt_blog_type = milieu_edge_get_archive_blog_list_layout();
milieu_edge_include_blog_helper_functions( \'lists\', $edgt_blog_type );
$edgt_holder_params = milieu_edge_get_holder_params_blog();

get_header();
milieu_edge_get_title();
?>

<div class="<?php echo esc_attr( $edgt_holder_params[\'holder\'] ); ?>">
    <?php do_action( \'milieu_edge_action_after_container_open\' ); ?>

    <div class="<?php echo esc_attr( $edgt_holder_params[\'inner\'] ); ?>">
        <?php milieu_edge_get_blog( $edgt_blog_type ); ?>
    </div>

    <?php do_action( \'milieu_edge_action_before_container_close\' ); ?>
</div>

<?php do_action( \'milieu_edge_action_blog_list_additional_tags\' ); ?>
<?php get_footer(); ?>  

2 个回复
SO网友:Quinty van Dijk

这在档案中。php

<?php
$edgt_blog_type = milieu_edge_get_archive_blog_list_layout();
milieu_edge_include_blog_helper_functions( \'lists\', $edgt_blog_type );
$edgt_holder_params = milieu_edge_get_holder_params_blog();

get_header();
milieu_edge_get_title();
get_template_part( \'slider\' );
?>

<div class="<?php echo esc_attr( $edgt_holder_params[\'holder\'] ); ?>">
    <?php do_action( \'milieu_edge_action_after_container_open\' ); ?>

    <div class="<?php echo esc_attr( $edgt_holder_params[\'inner\'] ); ?>">
        <?php milieu_edge_get_blog( $edgt_blog_type ); ?>
    </div>

    <?php do_action( \'milieu_edge_action_before_container_close\' ); ?>
</div>

<?php do_action( \'milieu_edge_action_blog_list_additional_tags\' ); ?>
<?php get_footer(); ?>

SO网友:Quinty van Dijk

下面是函数的一部分。php

if ( ! function_exists( \'milieu_edge_theme_setup\' ) ) {
    /**
     * Function that adds various features to theme. Also defines image sizes that are used in a theme
     */
    function milieu_edge_theme_setup() {
        //add support for feed links
        add_theme_support( \'automatic-feed-links\' );

        //add support for post formats
        add_theme_support( \'post-formats\', array( \'gallery\', \'link\', \'quote\', \'video\', \'audio\' ) );

        //add theme support for post thumbnails
        add_theme_support( \'post-thumbnails\' );

        //add theme support for title tag
        add_theme_support( \'title-tag\' );

        //add theme support for editor style
        add_editor_style( \'framework/admin/assets/css/editor-style.css\' );

        //defined content width variable
        $GLOBALS[\'content_width\'] = apply_filters( \'milieu_edge_filter_set_content_width\', 1100 );

        //define thumbnail sizes
        add_image_size( \'milieu_edge_image_size_square\', 550, 550, true );
        add_image_size( \'milieu_edge_image_size_landscape\', 1100, 550, true );
        add_image_size( \'milieu_edge_image_size_portrait\', 550, 1100, true );
        add_image_size( \'milieu_edge_image_size_huge\', 1100, 1100, true );

        load_theme_textdomain( \'milieu\', get_template_directory() . \'/languages\' );
    }

    add_action( \'after_setup_theme\', \'milieu_edge_theme_setup\' );
}

if ( ! function_exists( \'milieu_edge_is_responsive_on\' ) ) {
    /**
     * Checks whether responsive mode is enabled in theme options
     * @return bool
     */
    function milieu_edge_is_responsive_on() {
        return milieu_edge_options()->getOptionValue( \'responsiveness\' ) !== \'no\';
    }
}

if ( ! function_exists( \'milieu_edge_rgba_color\' ) ) {
    /**
     * Function that generates rgba part of css color property
     *
     * @param $color string hex color
     * @param $transparency float transparency value between 0 and 1
     *
     * @return string generated rgba string
     */
    function milieu_edge_rgba_color( $color, $transparency ) {
        if ( $color !== \'\' && $transparency !== \'\' ) {
            $rgba_color = \'\';

            $rgb_color_array = milieu_edge_hex2rgb( $color );
            $rgba_color      .= \'rgba(\' . implode( \', \', $rgb_color_array ) . \', \' . $transparency . \')\';

            return $rgba_color;
        }
    }
}

if ( ! function_exists( \'milieu_edge_header_meta\' ) ) {
    /**
     * Function that echoes meta data if our seo is enabled
     */
    function milieu_edge_header_meta() { ?>

        <meta charset="<?php bloginfo( \'charset\' ); ?>"/>
        <link rel="profile" href="http://gmpg.org/xfn/11"/>
        <?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
            <link rel="pingback" href="<?php bloginfo( \'pingback_url\' ); ?>">
        <?php endif; ?>

    <?php }

    add_action( \'milieu_edge_action_header_meta\', \'milieu_edge_header_meta\' );
}

if ( ! function_exists( \'milieu_edge_user_scalable_meta\' ) ) {
    /**
     * Function that outputs user scalable meta if responsiveness is turned on
     * Hooked to milieu_edge_action_header_meta action
     */
    function milieu_edge_user_scalable_meta() {
        //is responsiveness option is chosen?
        if ( milieu_edge_is_responsive_on() ) { ?>
            <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=yes">
        <?php } else { ?>
            <meta name="viewport" content="width=1200,user-scalable=yes">
        <?php }
    }

    add_action( \'milieu_edge_action_header_meta\', \'milieu_edge_user_scalable_meta\' );
}

if ( ! function_exists( \'milieu_edge_smooth_page_transitions\' ) ) {
    /**
     * Function that outputs smooth page transitions html if smooth page transitions functionality is turned on
     * Hooked to milieu_edge_action_after_body_tag action
     */
    function milieu_edge_smooth_page_transitions() {
        $id = milieu_edge_get_page_id();

        if ( milieu_edge_get_meta_field_intersect( \'smooth_page_transitions\', $id ) === \'yes\' &&
             milieu_edge_get_meta_field_intersect( \'page_transition_preloader\', $id ) === \'yes\'
        ) { ?>
            <div class="edgt-smooth-transition-loader edgt-mimic-ajax">
                <div class="edgt-st-loader">
                    <div class="edgt-st-loader1">
                        <?php milieu_edge_loading_spinners(); ?>
                    </div>
                </div>
            </div>
        <?php }
    }

    add_action( \'milieu_edge_action_after_body_tag\', \'milieu_edge_smooth_page_transitions\', 10 );
}

if (!function_exists(\'milieu_edge_back_to_top_button\')) {
    /**
     * Function that outputs back to top button html if back to top functionality is turned on
     * Hooked to milieu_edge_action_after_header_area action
     */
    function milieu_edge_back_to_top_button() {
        if (milieu_edge_options()->getOptionValue(\'show_back_button\') == \'yes\') { ?>
            <a id=\'edgt-back-to-top\' href=\'#\'>
                <span class="edgt-icon-stack">
                     <?php milieu_edge_icon_collections()->getBackToTopIcon(\'font_awesome\');?>
                </span>
            </a>
        <?php }
    }

    add_action(\'milieu_edge_action_after_header_area\', \'milieu_edge_back_to_top_button\', 10);
}

if ( ! function_exists( \'milieu_edge_get_page_id\' ) ) {
    /**
     * Function that returns current page / post id.
     * Checks if current page is woocommerce page and returns that id if it is.
     * Checks if current page is any archive page (category, tag, date, author etc.) and returns -1 because that isn\'t
     * page that is created in WP admin.
     *
     * @return int
     *
     * @version 0.1
     *
     * @see milieu_edge_is_woocommerce_installed()
     * @see milieu_edge_is_woocommerce_shop()
     */
    function milieu_edge_get_page_id() {
        if ( milieu_edge_is_woocommerce_installed() && milieu_edge_is_woocommerce_shop() ) {
            return milieu_edge_get_woo_shop_page_id();
        }

        if ( milieu_edge_is_default_wp_template() ) {
            return - 1;
        }

        return get_queried_object_id();
    }
}

if ( ! function_exists( \'milieu_edge_get_multisite_blog_id\' ) ) {
    /**
     * Check is multisite and return blog id
     *
     * @return int
     */
    function milieu_edge_get_multisite_blog_id() {
        if ( is_multisite() ) {
            return get_blog_details()->blog_id;
        }
    }
}

if ( ! function_exists( \'milieu_edge_is_default_wp_template\' ) ) {
    /**
     * Function that checks if current page archive page, search, 404 or default home blog page
     * @return bool
     *
     * @see is_archive()
     * @see is_search()
     * @see is_404()
     * @see is_front_page()
     * @see is_home()
     */
    function milieu_edge_is_default_wp_template() {
        return is_archive() || is_search() || is_404() || ( is_front_page() && is_home() );
    }
}

if ( ! function_exists( \'milieu_edge_has_shortcode\' ) ) {
    /**
     * Function that checks whether shortcode exists on current page / post
     *
     * @param string shortcode to find
     * @param string content to check. If isn\'t passed current post content will be used
     *
     * @return bool whether content has shortcode or not
     */
    function milieu_edge_has_shortcode( $shortcode, $content = \'\' ) {
        $has_shortcode = false;

        if ( $shortcode ) {
            //if content variable isn\'t past
            if ( $content == \'\' ) {
                //take content from current post
                $page_id = milieu_edge_get_page_id();
                if ( ! empty( $page_id ) ) {
                    $current_post = get_post( $page_id );

                    if ( is_object( $current_post ) && property_exists( $current_post, \'post_content\' ) ) {
                        $content = $current_post->post_content;
                    }
                }
            }

            //does content has shortcode added?
            if ( stripos( $content, \'[\' . $shortcode ) !== false ) {
                $has_shortcode = true;
            }
        }

        return $has_shortcode;
    }
}

if ( ! function_exists( \'milieu_edge_get_unique_page_class\' ) ) {
    /**
     * Returns unique page class based on post type and page id
     *
     * $params int $id is page id
     * $params bool $allowSingleProductOption
     * @return string
     */
    function milieu_edge_get_unique_page_class( $id, $allowSingleProductOption = false ) {
        $page_class = \'\';

        if ( milieu_edge_is_woocommerce_installed() && $allowSingleProductOption ) {

            if ( is_product() ) {
                $id = get_the_ID();
            }
        }

        if ( is_single() ) {
            $page_class = \'.postid-\' . $id;
        } elseif ( is_home() ) {
            $page_class .= \'.home\';
        } elseif ( is_archive() || $id === milieu_edge_get_woo_shop_page_id() ) {
            $page_class .= \'.archive\';
        } elseif ( is_search() ) {
            $page_class .= \'.search\';
        } elseif ( is_404() ) {
            $page_class .= \'.error404\';
        } else {
            $page_class .= \'.page-id-\' . $id;
        }

        return $page_class;
    }
}

if ( ! function_exists( \'milieu_edge_page_custom_style\' ) ) {
    /**
     * Function that print custom page style
     */
    function milieu_edge_page_custom_style() {
        $style = apply_filters( \'milieu_edge_filter_add_page_custom_style\', $style = \'\' );

        if ( $style !== \'\' ) {

            if ( milieu_edge_is_woocommerce_installed() && milieu_edge_load_woo_assets() ) {
                wp_add_inline_style( \'milieu-edge-style-handle-woo\', $style );
            } else {
                wp_add_inline_style( \'milieu-edge-style-handle-modules\', $style );
            }
        }
    }

    add_action( \'wp_enqueue_scripts\', \'milieu_edge_page_custom_style\' );
}

if ( ! function_exists( \'milieu_edge_container_style\' ) ) {
    /**
     * Function that return container style
     */
    function milieu_edge_container_style( $style ) {
        $page_id      = milieu_edge_get_page_id();
        $class_prefix = milieu_edge_get_unique_page_class( $page_id, true );

        $container_selector = array(
            $class_prefix . \' .edgt-content .edgt-content-inner > .edgt-container\',
            $class_prefix . \' .edgt-content .edgt-content-inner > .edgt-full-width\'
        );

        $container_class       = array();
        $page_backgorund_color = get_post_meta( $page_id, \'edgt_page_background_color_meta\', true );

        if ( $page_backgorund_color ) {
            $container_class[\'background-color\'] = $page_backgorund_color;
        }

        $current_style = milieu_edge_dynamic_css( $container_selector, $container_class );
        $current_style = $current_style . $style;

        return $current_style;
    }

    add_filter( \'milieu_edge_filter_add_page_custom_style\', \'milieu_edge_container_style\' );
}

if ( ! function_exists( \'milieu_edge_content_padding_top\' ) ) {
    /**
     * Function that return padding for content
     */
    function milieu_edge_content_padding_top( $style ) {
        $page_id      = milieu_edge_get_page_id();
        $class_prefix = milieu_edge_get_unique_page_class( $page_id, true );

        $current_style = \'\';

        $content_selector = array(
            $class_prefix . \' .edgt-content .edgt-content-inner > .edgt-container > .edgt-container-inner\',
            $class_prefix . \' .edgt-content .edgt-content-inner > .edgt-full-width > .edgt-full-width-inner\',
        );

        $content_class = array();

        $page_padding_top = get_post_meta( $page_id, \'edgt_page_content_top_padding\', true );

        if ( $page_padding_top !== \'\' ) {
            if ( get_post_meta( $page_id, \'edgt_page_content_top_padding_mobile\', true ) == \'yes\' ) {
                $content_class[\'padding-top\'] = milieu_edge_filter_px( $page_padding_top ) . \'px !important\';
            } else {
                $content_class[\'padding-top\'] = milieu_edge_filter_px( $page_padding_top ) . \'px\';
            }
            $current_style .= milieu_edge_dynamic_css( $content_selector, $content_class );
        }

        $current_style = $current_style . $style;

        return $current_style;
    }

    add_filter( \'milieu_edge_filter_add_page_custom_style\', \'milieu_edge_content_padding_top\' );
}

if ( ! function_exists( \'milieu_edge_print_custom_js\' ) ) {
    /**
     * Prints out custom css from theme options
     */
    function milieu_edge_print_custom_js() {
        $custom_js = milieu_edge_options()->getOptionValue( \'custom_js\' );

        if ( ! empty( $custom_js ) ) {
            wp_add_inline_script( \'milieu-edge-script-handle-modules\', $custom_js );
        }
    }

    add_action( \'wp_enqueue_scripts\', \'milieu_edge_print_custom_js\' );
}

if ( ! function_exists( \'milieu_edge_get_global_variables\' ) ) {
    /**
     * Function that generates global variables and put them in array so they could be used in the theme
     */
    function milieu_edge_get_global_variables() {
        $global_variables = array();

        $global_variables[\'edgtAddForAdminBar\']      = is_admin_bar_showing() ? 32 : 0;
        $global_variables[\'edgtElementAppearAmount\'] = - 100;
        $global_variables[\'edgtAjaxUrl\']             = admin_url( \'admin-ajax.php\' );

        $global_variables = apply_filters( \'milieu_edge_filter_js_global_variables\', $global_variables );

        wp_localize_script( \'milieu-edge-script-handle-modules\', \'edgtGlobalVars\', array(
            \'vars\' => $global_variables
        ) );
    }

    add_action( \'wp_enqueue_scripts\', \'milieu_edge_get_global_variables\' );
}

if ( ! function_exists( \'milieu_edge_per_page_js_variables\' ) ) {
    /**
     * Outputs global JS variable that holds page settings
     */
    function milieu_edge_per_page_js_variables() {
        $per_page_js_vars = apply_filters( \'milieu_edge_filter_per_page_js_vars\', array() );

        wp_localize_script( \'milieu-edge-script-handle-modules\', \'edgtPerPageVars\', array(
            \'vars\' => $per_page_js_vars
        ) );
    }

    add_action( \'wp_enqueue_scripts\', \'milieu_edge_per_page_js_variables\' );
}

if ( ! function_exists( \'milieu_edge_content_elem_style_attr\' ) ) {
    /**
     * Defines filter for adding custom styles to content HTML element
     */
    function milieu_edge_content_elem_style_attr() {
        $styles = apply_filters( \'milieu_edge_filter_content_elem_style_attr\', array() );

        milieu_edge_inline_style( $styles );
    }
}

if ( ! function_exists( \'milieu_edge_core_plugin_installed\' ) ) {
    /**
     * Function that checks if Edge Core plugin installed
     * @return bool
     */
    function milieu_edge_core_plugin_installed() {
        return defined( \'EDGE_CORE_VERSION\' );
    }
}

if ( ! function_exists( \'milieu_edge_is_woocommerce_installed\' ) ) {
    /**
     * Function that checks if Woocommerce plugin installed
     * @return bool
     */
    function milieu_edge_is_woocommerce_installed() {
        return function_exists( \'is_woocommerce\' );
    }
}

if ( ! function_exists( \'milieu_edge_visual_composer_installed\' ) ) {
    /**
     * Function that checks if Visual Composer plugin installed
     * @return bool
     */
    function milieu_edge_visual_composer_installed() {
        return class_exists( \'WPBakeryVisualComposerAbstract\' );
    }
}

if ( ! function_exists( \'milieu_edge_revolution_slider_installed\' ) ) {
    /**
     * Function that checks if Revolution Slider plugin installed
     * @return bool
     */
    function milieu_edge_revolution_slider_installed() {
        return class_exists( \'RevSliderFront\' );
    }
}

if ( ! function_exists( \'milieu_edge_contact_form_7_installed\' ) ) {
    /**
     * Function that checks if Contact Form 7 plugin installed
     * @return bool
     */
    function milieu_edge_contact_form_7_installed() {
        return defined( \'WPCF7_VERSION\' );
    }
}

if ( ! function_exists( \'milieu_edge_is_wpml_installed\' ) ) {
    /**
     * Function that checks if WPML plugin installed
     * @return bool
     */
    function milieu_edge_is_wpml_installed() {
        return defined( \'ICL_SITEPRESS_VERSION\' );
    }
}

if ( ! function_exists( \'milieu_edge_max_image_width_srcset\' ) ) {
    /**
     * Set max width for srcset to 1920
     *
     * @return int
     */
    function milieu_edge_max_image_width_srcset() {
        return 1920;
    }

    add_filter( \'max_srcset_image_width\', \'milieu_edge_max_image_width_srcset\' );
}

结束