Check out the OnePress Plus version for full control over the section styling which includes background color, image, video, parallax effect, custom style and more ...
', 'onepress' )
)
));
}
}
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function onepress_customize_register( $wp_customize ) {
// Load custom controls.
$path = get_template_directory();
require $path. '/inc/customizer-controls.php';
// Remove default sections.
// Custom WP default control & settings.
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
/**
* Hook to add other customize
*/
do_action( 'onepress_customize_before_register', $wp_customize );
$pages = get_pages();
$option_pages = array();
$option_pages[0] = esc_html__( 'Select page', 'onepress' );
foreach( $pages as $p ){
$option_pages[ $p->ID ] = $p->post_title;
}
$users = get_users( array(
'orderby' => 'display_name',
'order' => 'ASC',
'number' => '',
) );
$option_users[0] = esc_html__( 'Select member', 'onepress' );
foreach( $users as $user ){
$option_users[ $user->ID ] = $user->display_name;
}
/**
* Load Customize Configs
* @since 2.1.0
*/
// Site Identity.
require_once $path. '/inc/customize-configs/site-identity.php';
//Site Options
require_once $path. '/inc/customize-configs/options.php';
require_once $path. '/inc/customize-configs/options-global.php';
require_once $path. '/inc/customize-configs/options-colors.php';
require_once $path. '/inc/customize-configs/options-header.php';
require_once $path. '/inc/customize-configs/options-navigation.php';
require_once $path. '/inc/customize-configs/options-sections-navigation.php';
require_once $path. '/inc/customize-configs/options-page.php';
require_once $path. '/inc/customize-configs/options-blog-posts.php';
require_once $path. '/inc/customize-configs/options-single.php';
require_once $path. '/inc/customize-configs/options-footer.php';
/**
* @since 2.1.1
* Load sections if enabled
*/
$sections = Onepress_Config::get_sections();
foreach( $sections as $key => $section ) {
if ( Onepress_Config::is_section_active( $key ) ) {
$file = $path. '/inc/customize-configs/section-'.$key.'.php';
if ( file_exists( $file ) ) {
require_once $file;
}
}
}
/*
// Section Hero
require_once $path. '/inc/customize-configs/section-hero.php';
// Section Hero
require_once $path. '/inc/customize-configs/section-about.php';
// Video Popup
require_once $path. '/inc/customize-configs/section-videolightbox.php';
// Section Gallery
require_once $path. '/inc/customize-configs/section-gallery.php';
// Section Features
require_once $path. '/inc/customize-configs/section-features.php';
// Section Services
require_once $path. '/inc/customize-configs/section-services.php';
// Section Counter
require_once $path. '/inc/customize-configs/section-counter.php';
// Section Team
require_once $path. '/inc/customize-configs/section-team.php';
// Section News
require_once $path. '/inc/customize-configs/section-news.php';
// Section Contact
require_once $path. '/inc/customize-configs/section-contact.php';
*/
// Section Up sell
require_once $path. '/inc/customize-configs/section-upsell.php';
/**
* Hook to add other customize
*/
do_action( 'onepress_customize_after_register', $wp_customize );
/**
* Move WC Panel to bottom
* @since 2.1.1
*/
if ( onepress_is_wc_active() ) {
$wp_customize->get_panel( 'woocommerce' )->priority = 300;
}
}
add_action( 'customize_register', 'onepress_customize_register' );
/**
* Selective refresh
*/
require get_template_directory() . '/inc/customizer-selective-refresh.php';
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function onepress_customize_preview_js() {
wp_enqueue_script( 'onepress_customizer_liveview', get_template_directory_uri() . '/assets/js/customizer-liveview.js', array( 'customize-preview', 'customize-selective-refresh' ), false, true );
}
add_action( 'customize_preview_init', 'onepress_customize_preview_js', 65 );
add_action( 'customize_controls_enqueue_scripts', 'opneress_customize_js_settings' );
function opneress_customize_js_settings(){
if ( ! class_exists( 'Onepress_Dashboard' ) ) {
return;
}
$actions = Onepress_Dashboard::get_instance()->get_recommended_actions();
$number_action = $actions['number_notice'];
wp_localize_script( 'customize-controls', 'onepress_customizer_settings', array(
'number_action' => $number_action,
'is_plus_activated' => class_exists( 'OnePress_Plus' ) ? 'y' : 'n',
'action_url' => admin_url( 'themes.php?page=ft_onepress&tab=recommended_actions' ),
) );
}
/**
* Customizer Icon picker
*/
function onepress_customize_controls_enqueue_scripts(){
wp_localize_script( 'customize-controls', 'C_Icon_Picker',
apply_filters( 'c_icon_picker_js_setup',
array(
'search' => esc_html__( 'Search', 'onepress' ),
'fonts' => array(
'font-awesome' => array(
// Name of icon
'name' => esc_html__( 'Font Awesome', 'onepress' ),
// prefix class example for font-awesome fa-fa-{name}
'prefix' => 'fa',
// font url
'url' => esc_url( add_query_arg( array( 'ver'=> '4.7.0' ), get_template_directory_uri() .'/assets/css/font-awesome.min.css' ) ),
// Icon class name, separated by |
'icons' => 'fa-glass|fa-music|fa-search|fa-envelope-o|fa-heart|fa-star|fa-star-o|fa-user|fa-film|fa-th-large|fa-th|fa-th-list|fa-check|fa-times|fa-search-plus|fa-search-minus|fa-power-off|fa-signal|fa-cog|fa-trash-o|fa-home|fa-file-o|fa-clock-o|fa-road|fa-download|fa-arrow-circle-o-down|fa-arrow-circle-o-up|fa-inbox|fa-play-circle-o|fa-repeat|fa-refresh|fa-list-alt|fa-lock|fa-flag|fa-headphones|fa-volume-off|fa-volume-down|fa-volume-up|fa-qrcode|fa-barcode|fa-tag|fa-tags|fa-book|fa-bookmark|fa-print|fa-camera|fa-font|fa-bold|fa-italic|fa-text-height|fa-text-width|fa-align-left|fa-align-center|fa-align-right|fa-align-justify|fa-list|fa-outdent|fa-indent|fa-video-camera|fa-picture-o|fa-pencil|fa-map-marker|fa-adjust|fa-tint|fa-pencil-square-o|fa-share-square-o|fa-check-square-o|fa-arrows|fa-step-backward|fa-fast-backward|fa-backward|fa-play|fa-pause|fa-stop|fa-forward|fa-fast-forward|fa-step-forward|fa-eject|fa-chevron-left|fa-chevron-right|fa-plus-circle|fa-minus-circle|fa-times-circle|fa-check-circle|fa-question-circle|fa-info-circle|fa-crosshairs|fa-times-circle-o|fa-check-circle-o|fa-ban|fa-arrow-left|fa-arrow-right|fa-arrow-up|fa-arrow-down|fa-share|fa-expand|fa-compress|fa-plus|fa-minus|fa-asterisk|fa-exclamation-circle|fa-gift|fa-leaf|fa-fire|fa-eye|fa-eye-slash|fa-exclamation-triangle|fa-plane|fa-calendar|fa-random|fa-comment|fa-magnet|fa-chevron-up|fa-chevron-down|fa-retweet|fa-shopping-cart|fa-folder|fa-folder-open|fa-arrows-v|fa-arrows-h|fa-bar-chart|fa-twitter-square|fa-facebook-square|fa-camera-retro|fa-key|fa-cogs|fa-comments|fa-thumbs-o-up|fa-thumbs-o-down|fa-star-half|fa-heart-o|fa-sign-out|fa-linkedin-square|fa-thumb-tack|fa-external-link|fa-sign-in|fa-trophy|fa-github-square|fa-upload|fa-lemon-o|fa-phone|fa-square-o|fa-bookmark-o|fa-phone-square|fa-twitter|fa-facebook|fa-github|fa-unlock|fa-credit-card|fa-rss|fa-hdd-o|fa-bullhorn|fa-bell|fa-certificate|fa-hand-o-right|fa-hand-o-left|fa-hand-o-up|fa-hand-o-down|fa-arrow-circle-left|fa-arrow-circle-right|fa-arrow-circle-up|fa-arrow-circle-down|fa-globe|fa-wrench|fa-tasks|fa-filter|fa-briefcase|fa-arrows-alt|fa-users|fa-link|fa-cloud|fa-flask|fa-scissors|fa-files-o|fa-paperclip|fa-floppy-o|fa-square|fa-bars|fa-list-ul|fa-list-ol|fa-strikethrough|fa-underline|fa-table|fa-magic|fa-truck|fa-pinterest|fa-pinterest-square|fa-google-plus-square|fa-google-plus|fa-money|fa-caret-down|fa-caret-up|fa-caret-left|fa-caret-right|fa-columns|fa-sort|fa-sort-desc|fa-sort-asc|fa-envelope|fa-linkedin|fa-undo|fa-gavel|fa-tachometer|fa-comment-o|fa-comments-o|fa-bolt|fa-sitemap|fa-umbrella|fa-clipboard|fa-lightbulb-o|fa-exchange|fa-cloud-download|fa-cloud-upload|fa-user-md|fa-stethoscope|fa-suitcase|fa-bell-o|fa-coffee|fa-cutlery|fa-file-text-o|fa-building-o|fa-hospital-o|fa-ambulance|fa-medkit|fa-fighter-jet|fa-beer|fa-h-square|fa-plus-square|fa-angle-double-left|fa-angle-double-right|fa-angle-double-up|fa-angle-double-down|fa-angle-left|fa-angle-right|fa-angle-up|fa-angle-down|fa-desktop|fa-laptop|fa-tablet|fa-mobile|fa-circle-o|fa-quote-left|fa-quote-right|fa-spinner|fa-circle|fa-reply|fa-github-alt|fa-folder-o|fa-folder-open-o|fa-smile-o|fa-frown-o|fa-meh-o|fa-gamepad|fa-keyboard-o|fa-flag-o|fa-flag-checkered|fa-terminal|fa-code|fa-reply-all|fa-star-half-o|fa-location-arrow|fa-crop|fa-code-fork|fa-chain-broken|fa-question|fa-info|fa-exclamation|fa-superscript|fa-subscript|fa-eraser|fa-puzzle-piece|fa-microphone|fa-microphone-slash|fa-shield|fa-calendar-o|fa-fire-extinguisher|fa-rocket|fa-maxcdn|fa-chevron-circle-left|fa-chevron-circle-right|fa-chevron-circle-up|fa-chevron-circle-down|fa-html5|fa-css3|fa-anchor|fa-unlock-alt|fa-bullseye|fa-ellipsis-h|fa-ellipsis-v|fa-rss-square|fa-play-circle|fa-ticket|fa-minus-square|fa-minus-square-o|fa-level-up|fa-level-down|fa-check-square|fa-pencil-square|fa-external-link-square|fa-share-square|fa-compass|fa-caret-square-o-down|fa-caret-square-o-up|fa-caret-square-o-right|fa-eur|fa-gbp|fa-usd|fa-inr|fa-jpy|fa-rub|fa-krw|fa-btc|fa-file|fa-file-text|fa-sort-alpha-asc|fa-sort-alpha-desc|fa-sort-amount-asc|fa-sort-amount-desc|fa-sort-numeric-asc|fa-sort-numeric-desc|fa-thumbs-up|fa-thumbs-down|fa-youtube-square|fa-youtube|fa-xing|fa-xing-square|fa-youtube-play|fa-dropbox|fa-stack-overflow|fa-instagram|fa-flickr|fa-adn|fa-bitbucket|fa-bitbucket-square|fa-tumblr|fa-tumblr-square|fa-long-arrow-down|fa-long-arrow-up|fa-long-arrow-left|fa-long-arrow-right|fa-apple|fa-windows|fa-android|fa-linux|fa-dribbble|fa-skype|fa-foursquare|fa-trello|fa-female|fa-male|fa-gratipay|fa-sun-o|fa-moon-o|fa-archive|fa-bug|fa-vk|fa-weibo|fa-renren|fa-pagelines|fa-stack-exchange|fa-arrow-circle-o-right|fa-arrow-circle-o-left|fa-caret-square-o-left|fa-dot-circle-o|fa-wheelchair|fa-vimeo-square|fa-try|fa-plus-square-o|fa-space-shuttle|fa-slack|fa-envelope-square|fa-wordpress|fa-openid|fa-university|fa-graduation-cap|fa-yahoo|fa-google|fa-reddit|fa-reddit-square|fa-stumbleupon-circle|fa-stumbleupon|fa-delicious|fa-digg|fa-pied-piper-pp|fa-pied-piper-alt|fa-drupal|fa-joomla|fa-language|fa-fax|fa-building|fa-child|fa-paw|fa-spoon|fa-cube|fa-cubes|fa-behance|fa-behance-square|fa-steam|fa-steam-square|fa-recycle|fa-car|fa-taxi|fa-tree|fa-spotify|fa-deviantart|fa-soundcloud|fa-database|fa-file-pdf-o|fa-file-word-o|fa-file-excel-o|fa-file-powerpoint-o|fa-file-image-o|fa-file-archive-o|fa-file-audio-o|fa-file-video-o|fa-file-code-o|fa-vine|fa-codepen|fa-jsfiddle|fa-life-ring|fa-circle-o-notch|fa-rebel|fa-empire|fa-git-square|fa-git|fa-hacker-news|fa-tencent-weibo|fa-qq|fa-weixin|fa-paper-plane|fa-paper-plane-o|fa-history|fa-circle-thin|fa-header|fa-paragraph|fa-sliders|fa-share-alt|fa-share-alt-square|fa-bomb|fa-futbol-o|fa-tty|fa-binoculars|fa-plug|fa-slideshare|fa-twitch|fa-yelp|fa-newspaper-o|fa-wifi|fa-calculator|fa-paypal|fa-google-wallet|fa-cc-visa|fa-cc-mastercard|fa-cc-discover|fa-cc-amex|fa-cc-paypal|fa-cc-stripe|fa-bell-slash|fa-bell-slash-o|fa-trash|fa-copyright|fa-at|fa-eyedropper|fa-paint-brush|fa-birthday-cake|fa-area-chart|fa-pie-chart|fa-line-chart|fa-lastfm|fa-lastfm-square|fa-toggle-off|fa-toggle-on|fa-bicycle|fa-bus|fa-ioxhost|fa-angellist|fa-cc|fa-ils|fa-meanpath|fa-buysellads|fa-connectdevelop|fa-dashcube|fa-forumbee|fa-leanpub|fa-sellsy|fa-shirtsinbulk|fa-simplybuilt|fa-skyatlas|fa-cart-plus|fa-cart-arrow-down|fa-diamond|fa-ship|fa-user-secret|fa-motorcycle|fa-street-view|fa-heartbeat|fa-venus|fa-mars|fa-mercury|fa-transgender|fa-transgender-alt|fa-venus-double|fa-mars-double|fa-venus-mars|fa-mars-stroke|fa-mars-stroke-v|fa-mars-stroke-h|fa-neuter|fa-genderless|fa-facebook-official|fa-pinterest-p|fa-whatsapp|fa-server|fa-user-plus|fa-user-times|fa-bed|fa-viacoin|fa-train|fa-subway|fa-medium|fa-y-combinator|fa-optin-monster|fa-opencart|fa-expeditedssl|fa-battery-full|fa-battery-three-quarters|fa-battery-half|fa-battery-quarter|fa-battery-empty|fa-mouse-pointer|fa-i-cursor|fa-object-group|fa-object-ungroup|fa-sticky-note|fa-sticky-note-o|fa-cc-jcb|fa-cc-diners-club|fa-clone|fa-balance-scale|fa-hourglass-o|fa-hourglass-start|fa-hourglass-half|fa-hourglass-end|fa-hourglass|fa-hand-rock-o|fa-hand-paper-o|fa-hand-scissors-o|fa-hand-lizard-o|fa-hand-spock-o|fa-hand-pointer-o|fa-hand-peace-o|fa-trademark|fa-registered|fa-creative-commons|fa-gg|fa-gg-circle|fa-tripadvisor|fa-odnoklassniki|fa-odnoklassniki-square|fa-get-pocket|fa-wikipedia-w|fa-safari|fa-chrome|fa-firefox|fa-opera|fa-internet-explorer|fa-television|fa-contao|fa-500px|fa-amazon|fa-calendar-plus-o|fa-calendar-minus-o|fa-calendar-times-o|fa-calendar-check-o|fa-industry|fa-map-pin|fa-map-signs|fa-map-o|fa-map|fa-commenting|fa-commenting-o|fa-houzz|fa-vimeo|fa-black-tie|fa-fonticons|fa-reddit-alien|fa-edge|fa-credit-card-alt|fa-codiepie|fa-modx|fa-fort-awesome|fa-usb|fa-product-hunt|fa-mixcloud|fa-scribd|fa-pause-circle|fa-pause-circle-o|fa-stop-circle|fa-stop-circle-o|fa-shopping-bag|fa-shopping-basket|fa-hashtag|fa-bluetooth|fa-bluetooth-b|fa-percent|fa-gitlab|fa-wpbeginner|fa-wpforms|fa-envira|fa-universal-access|fa-wheelchair-alt|fa-question-circle-o|fa-blind|fa-audio-description|fa-volume-control-phone|fa-braille|fa-assistive-listening-systems|fa-american-sign-language-interpreting|fa-deaf|fa-glide|fa-glide-g|fa-sign-language|fa-low-vision|fa-viadeo|fa-viadeo-square|fa-snapchat|fa-snapchat-ghost|fa-snapchat-square|fa-pied-piper|fa-first-order|fa-yoast|fa-themeisle|fa-google-plus-official|fa-font-awesome|fa-handshake-o|fa-envelope-open|fa-envelope-open-o|fa-linode|fa-address-book|fa-address-book-o|fa-address-card|fa-address-card-o|fa-user-circle|fa-user-circle-o|fa-user-o|fa-id-badge|fa-id-card|fa-id-card-o|fa-quora|fa-free-code-camp|fa-telegram|fa-thermometer-full|fa-thermometer-three-quarters|fa-thermometer-half|fa-thermometer-quarter|fa-thermometer-empty|fa-shower|fa-bath|fa-podcast|fa-window-maximize|fa-window-minimize|fa-window-restore|fa-window-close|fa-window-close-o|fa-bandcamp|fa-grav|fa-etsy|fa-imdb|fa-ravelry|fa-eercast|fa-microchip|fa-snowflake-o|fa-superpowers|fa-wpexplorer|fa-meetup'
),
)
)
)
);
}
add_action( 'customize_controls_enqueue_scripts', 'onepress_customize_controls_enqueue_scripts' );
PK ! T template-tags.phpnu [ 'custom-logo',
'itemprop' => 'logo',
);
$image_retina_url = false;
$retina_id = false;
$retina_url = sanitize_text_field( get_theme_mod( 'onepress_retina_logo' ) );
if ( $retina_url ) {
$retina_id = attachment_url_to_postid( $retina_url );
if ( $retina_id ) {
$image_retina_url = wp_get_attachment_image_src( $retina_id, 'full' );
if ( $image_retina_url ) {
$custom_logo_attr['srcset'] = $image_retina_url[0] . ' 2x';
}
}
}
if ( ! $custom_logo_id ) {
$custom_logo_id = $retina_id;
}
$t_logo_html = '';
if ( onepress_is_transparent_header() ) {
$t_logo = sanitize_text_field( get_theme_mod( 'onepress_transparent_logo' ) );
$t_logo_r = sanitize_text_field( get_theme_mod( 'onepress_transparent_retina_logo' ) );
$t_logo_attr = array(
'class' => 'custom-logo-transparent',
'itemprop' => 'logo',
);
if ( $t_logo_r ) {
$t_logo_r = attachment_url_to_postid( $t_logo_r );
if ( $t_logo_r ) {
$image_tr_url = wp_get_attachment_image_src( $t_logo_r, 'full' );
if ( $image_tr_url ) {
$t_logo_attr['srcset'] = $image_tr_url[0] . ' 2x';
}
}
}
if ( $t_logo ) {
$t_logo = attachment_url_to_postid( $t_logo );
}
if ( ! $t_logo ) {
$t_logo = $t_logo_r;
}
if ( $t_logo ) {
$t_logo_html = wp_get_attachment_image( $t_logo, 'full', false, $t_logo_attr );
}
}
// We have a logo. Logo is go.
if ( $custom_logo_id ) {
/*
* If the logo alt attribute is empty, get the site title and explicitly
* pass it to the attributes used by wp_get_attachment_image().
*/
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
if ( empty( $image_alt ) ) {
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
}
if ( ! $t_logo_html ) {
$class = ' no-t-logo';
} else {
$class = ' has-t-logo';
}
/*
* If the alt attribute is not empty, there's no need to explicitly pass
* it because wp_get_attachment_image() already adds the alt attribute.
*/
$html = sprintf(
'%2$s',
esc_url( home_url( '/' ) ),
wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ) . $t_logo_html
);
}
return $html;
}
add_filter( 'get_custom_logo', 'onepress_add_retina_logo', 15 );
if ( ! function_exists( 'onepress_site_logo' ) ) {
function onepress_site_logo() {
$classes = array();
$html = '';
$classes['logo'] = 'no-logo-img';
if ( function_exists( 'has_custom_logo' ) ) {
if ( has_custom_logo() ) {
$classes['logo'] = 'has-logo-img';
$html .= '
';
do_action( 'onepress_header_section_start' );
if ( $pos == 'below_hero' ) {
if ( is_page_template( 'template-frontpage.php' ) ) {
do_action( 'onepress_header_end' );
}
}
$hide_header = false;
$page_id = false;
if ( is_singular() || is_page() ) {
$page_id = get_the_ID();
}
if ( onepress_is_wc_active() ) {
if ( is_shop() ) {
$page_id = wc_get_page_id( 'shop' );
}
}
if ( $page_id ) {
$hide_header = get_post_meta( $page_id, '_hide_header', true );
}
if ( ! $hide_header ) {
/**
* Hooked: onepress_site_header
*
* @see onepress_site_header
*/
do_action( 'onepress_site_start' );
}
if ( $pos != 'below_hero' ) {
if ( is_page_template( 'template-frontpage.php' ) ) {
do_action( 'onepress_header_end' );
}
}
do_action( 'onepress_header_section_end' );
echo '';
}
}
if ( ! function_exists( 'onepress_posted_on' ) ) {
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function onepress_posted_on() {
$time_string = '';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
esc_html_x( 'Posted on %s', 'post date', 'onepress' ),
'' . $time_string . ''
);
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'onepress' ),
'' . esc_html( get_the_author() ) . ''
);
echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK.
}
}
if ( ! function_exists( 'onepress_entry_footer' ) ) {
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function onepress_entry_footer() {
ob_start();
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'onepress' ) );
if ( $categories_list && onepress_categorized_blog() ) {
printf( '' . esc_html__( 'Posted in %1$s', 'onepress' ) . '', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'onepress' ) );
if ( $tags_list ) {
printf( '' . esc_html__( 'Tagged %1$s', 'onepress' ) . '', $tags_list ); // WPCS: XSS OK.
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
comments_popup_link( esc_html__( 'Leave a comment', 'onepress' ), esc_html__( '1 Comment', 'onepress' ), esc_html__( '% Comments', 'onepress' ) );
echo '';
}
$content = ob_get_contents();
ob_clean();
ob_end_flush();
if ( $content ) {
echo '';
}
}
}
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function onepress_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'onepress_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories(
array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
)
);
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = ( ! is_wp_error( $all_the_cool_cats ) && is_array( $all_the_cool_cats ) && ! empty( $all_the_cool_cats ) ) ? count( $all_the_cool_cats ) : 1;
set_transient( 'onepress_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so onepress_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so onepress_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in onepress_categorized_blog.
*/
function onepress_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'onepress_categories' );
}
add_action( 'edit_category', 'onepress_category_transient_flusher' );
add_action( 'save_post', 'onepress_category_transient_flusher' );
if ( ! function_exists( 'onepress_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own onepress_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @return void
*/
function onepress_comment( $comment, $args, $depth ) {
switch ( $comment->comment_type ) :
case 'pingback':
case 'trackback':
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
%1$s %2$s',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
( $comment->user_id === $post->post_author ) ? '' . __( 'Post author', 'onepress' ) . '' : ''
);
printf(
'',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
get_comment_date()
);
comment_reply_link(
array_merge(
$args,
array(
'reply_text' => __( 'Reply', 'onepress' ),
'after' => '',
'depth' => $depth,
'max_depth' => $args['max_depth'],
)
)
);
edit_comment_link( __( 'Edit', 'onepress' ), '', '' );
?>
comment_approved ) : ?>
<# var cond_v; #>
<# for ( i in data ) { #>
<# if ( ! data.hasOwnProperty( i ) ) continue; #>
<# field = data[i]; #>
<# if ( ! field.type ) continue; #>
<# if ( field.type ){ #>
<#
if ( ! _.isEmpty( field.required ) ) {
#>
<#
} else {
#>
<#
}
#>
<# if ( field.type !== 'checkbox' ) { #>
<# if ( field.title ) { #>
<# } #>
<# if ( field.desc ) { #>