'list_header_hide', 'list_title_display' => 'list_title_hide', 'list_author_display' => 'list_author_hide', 'list_date_display' => 'list_date_hide', 'list_category_display' => 'list_category_hide', 'list_thumbnail_display' => 'list_thumbnail_hide', 'list_summary_display' => 'list_summary_hide', 'list_footer_display' => 'list_footer_hide', 'list_tags_display' => 'list_tags_hide', 'list_button_comment_display' => 'list_button_comment_hide', 'list_button_edit_display' => 'list_button_edit_hide', ); foreach ( $options_list as $option => $class ) { $value = get_post_meta( $post_id, 'pen_' . $option . '_override', true ); if ( $value && 'default' !== $value ) { $classes[] = 'pen_' . $class; } } $animation_reveal = get_post_meta( $post_id, 'pen_list_animation_reveal_override', true ); if ( ! $animation_reveal || 'default' === $animation_reveal ) { $animation_reveal = pen_option_get( 'list_animation_reveal' ); } if ( $animation_reveal ) { $classes[] = 'pen_custom_animation_' . $animation_reveal; } $header_alignment = get_post_meta( $post_id, 'pen_list_post_header_alignment_override', true ); if ( ! $header_alignment || 'default' === $header_alignment ) { $header_alignment = pen_option_get( 'list_post_header_alignment' ); } if ( $header_alignment && 'no' !== $header_alignment ) { $classes[] = 'pen_list_header_center'; } $title_alignment = get_post_meta( $post_id, 'pen_list_title_alignment_override', true ); if ( ! $title_alignment || 'default' === $title_alignment ) { $title_alignment = pen_option_get( 'list_title_alignment' ); } if ( $title_alignment && 'no' !== $title_alignment ) { $classes[] = 'pen_list_title_center'; } $thumbnail_style = get_post_meta( $post_id, 'pen_list_masonry_thumbnail_style_override', true ); if ( false === $thumbnail_style || empty( $thumbnail_style ) || 'default' === $thumbnail_style ) { $thumbnail_style = pen_option_get( 'list_masonry_thumbnail_style' ); } $classes[] = 'pen_thumbnail_style_' . $thumbnail_style; } return post_class( $classes ); } } if ( ! function_exists( 'pen_post_excerpt' ) && ! is_admin() ) { /** * Tweaks the automatically generated post excerpt. * * @param string $more Default 'more' string. * * @since Pen 1.0.0 * @return string */ function pen_post_excerpt( $more ) { $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), sprintf( /* Translators: %s: Name of current post */ __( 'Continue reading %s', 'pen' ), sprintf( '%1$s', get_the_title( get_the_ID() ) ) ) ); return ' …
' . $link; } add_filter( 'excerpt_more', 'pen_post_excerpt' ); } if ( ! function_exists( 'pen_post_sticky' ) ) { /** * Sends sticky posts to the top of the lists. * * @param WP_Posts $posts An instance of WP_Post. * * @since Pen 1.0.0 */ function pen_post_sticky( $posts ) { $is_sticky = array(); foreach ( $posts as $key => $post ) { if ( is_sticky( $post->ID ) ) { $is_sticky[] = $post; unset( $posts[ $key ] ); } } return array_merge( $is_sticky, $posts ); } add_filter( 'the_posts', 'pen_post_sticky' ); } if ( ! function_exists( 'pen_post_meta' ) ) { /** * Custom post meta data fields. * * @param object $post An instance of the $post. * * @since Pen 1.0.0 * @return void */ function pen_post_meta( $post ) { $post_type = get_post_type(); ob_start( 'pen_compress_html' ); ?>

fields. * * @param integer $post_id The content ID. * @param string $setting_id The setting ID. * @param array $choices Choices. * @param array $default The default. * @param array $label Field label. * * @since Pen 1.0.8 * @return void */ function pen_post_meta_select( $post_id, $setting_id, $choices, $default, $label ) { $setting_id = 'pen_' . $setting_id . '_override'; $value = get_post_meta( $post_id, $setting_id, true ); $setting_id = esc_attr( $setting_id ); ?>
ID ) ) { return; } if ( ! current_user_can( 'edit_post', $post->ID ) ) { return; } // Honey pot. if ( pen_filter_input( 'POST', md5( NONCE_SALT . $post->ID . date( 'd' ) ) ) ) { return; } $options = pen_post_meta_options(); foreach ( $options as $option => $label ) { $new = pen_filter_input( 'POST', $option ); if ( $new ) { update_post_meta( $post->ID, $option, $new ); } else { delete_post_meta( $post->ID, $option ); } } } add_action( 'save_post', 'pen_post_meta_save' ); } if ( ! function_exists( 'pen_post_meta_box' ) ) { /** * Adds the meta box. * * @param object $post An instance of the $post. * * @since Pen 1.0.0 * @return void */ function pen_post_meta_box( $post ) { if ( in_array( (string) get_post_type(), array( 'page', 'post' ), true ) ) { add_meta_box( 'pen_meta_box', __( 'Options', 'pen' ), 'pen_post_meta', get_post_type(), 'normal', 'high' ); } } add_action( 'add_meta_boxes', 'pen_post_meta_box' ); } if ( ! function_exists( 'pen_post_meta_scripts' ) ) { /** * Adds post meta JavaScripts. * * @param string $hook_suffix The file name. * * @since Pen 1.0.0 * @return void */ function pen_post_meta_scripts( $hook_suffix ) { if ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) { wp_enqueue_script( 'pen-postmeta-js', get_template_directory_uri() . '/assets/js/pen-backend.js', array( 'jquery' ), PEN_THEME_VERSION, true ); wp_localize_script( 'pen-postmeta-js', 'pen_backend_js', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'text' => array( 'pen_theme' => __( 'Pen', 'pen' ), 'nothing_selected' => __( 'Please select an item.', 'pen' ), 'toggle' => __( 'Toggle panel: Pen Options', 'pen' ), ), ) ); wp_enqueue_style( 'pen-postmeta-css', get_template_directory_uri() . '/assets/css/pen-backend.css', array(), PEN_THEME_VERSION ); } } add_action( 'admin_enqueue_scripts', 'pen_post_meta_scripts' ); } if ( ! function_exists( 'pen_content_title_background' ) ) { /** * Returns background image URL for content header. * * @param bool $is_singular Result of is_singular(), for better performance. * @param int $post_id The post ID. * * @since Pen 1.1.1 * @return string */ function pen_content_title_background( $is_singular, $post_id ) { $background_image_dynamic = ''; if ( $is_singular ) { $thumbnail_as_background = get_post_meta( $post_id, 'pen_content_background_image_content_title_dynamic_override', true ); if ( ! $thumbnail_as_background || 'default' === $thumbnail_as_background ) { $thumbnail_as_background = pen_option_get( 'background_image_content_title_dynamic' ); } } else { $thumbnail_as_background = get_post_meta( $post_id, 'pen_list_background_image_content_title_dynamic_override', true ); if ( ! $thumbnail_as_background || 'default' === $thumbnail_as_background ) { $thumbnail_as_background = pen_option_get( 'background_image_content_title_dynamic' ); } } if ( $thumbnail_as_background ) { $thumbnail = esc_url( get_the_post_thumbnail_url( null, 'large' ) ); if ( $thumbnail ) { $background_image_dynamic = $thumbnail; } } return $background_image_dynamic; } }