本文整理汇总了PHP中comments_open函数的典型用法代码示例。如果您正苦于以下问题:PHP comments_open函数的具体用法?PHP comments_open怎么用?PHP comments_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了comments_open函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: square_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function square_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$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('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
$byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
$comment_count = get_comments_number();
// get_comments_number returns only a numeric value
if (comments_open()) {
if ($comment_count == 0) {
$comments = __('No Comments', 'square');
} elseif ($comment_count > 1) {
$comments = $comment_count . __(' Comments', 'square');
} else {
$comments = __('1 Comment', 'square');
}
$comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
} else {
$comment_link = __(' Comment Closed', 'square');
}
echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
// WPCS: XSS OK.
}
示例2: fave_theme_scripts
/**
* Register jQuery scripts and
* CSS Styles only for the front-end
*
* @package Magzilla
* @since Magzilla 1.0
**/
function fave_theme_scripts()
{
global $ft_option;
/**
* Register CSS styles
*/
wp_register_style('fave-owl.carousel.all.min', get_template_directory_uri() . '/css/owl.carousel.all.min.css', array(), '2.0.0', 'all');
wp_register_style('fave-bootstrap.min', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '', 'all');
wp_register_style('fave-bootstrap-theme.min', get_template_directory_uri() . '/css/bootstrap-theme.min.css', array(), '', 'all');
wp_register_style('fave-font-awesome.min', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.5.0', 'all');
wp_register_style('fave-jquery.jscrollpane', get_template_directory_uri() . '/css/jquery.jscrollpane.css', array(), '', 'all');
wp_register_style('fave-magnific-popup', get_template_directory_uri() . '/css/magnific-popup.css', array(), '1.0.0', 'all');
wp_register_style('fave-main', get_template_directory_uri() . '/css/main.css', array(), '', 'all');
wp_register_style('fave-options', get_template_directory_uri() . '/css/options.css', array(), '', 'all');
wp_enqueue_style('fave-bootstrap.min');
wp_enqueue_style('fave-bootstrap-theme.min');
wp_enqueue_style('fave-font-awesome.min');
wp_enqueue_style('fave-jquery.jscrollpane');
wp_enqueue_style('fave-owl.carousel.all.min');
wp_enqueue_style('fave-magnific-popup');
wp_enqueue_style('fave-main');
wp_enqueue_style('fave-options');
wp_enqueue_style('style', get_stylesheet_uri(), array(), '1', 'all');
if (is_rtl()) {
wp_enqueue_style('magzilla-rtl', get_template_directory_uri() . "/css/rtl.css", array(), '1', 'screen');
}
wp_enqueue_script('fave-bootstrap.min', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), THEME_VERSION, true);
wp_enqueue_script('fave-plugins', get_template_directory_uri() . '/js/plugins.js', array('jquery'), THEME_VERSION, true);
wp_enqueue_script('fave-custom.min', get_template_directory_uri() . '/js/custom.min.js', array('jquery'), THEME_VERSION, true);
if ((is_singular('post') || is_singular('gallery') || is_singular('video')) && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
示例3: ultra_posted_on
/**
* Prints HTML with meta information for the current post-date/time, author, comment count and categories.
*/
function ultra_posted_on()
{
echo '<div class="entry-meta-inner">';
if (is_sticky() && is_home() && !is_paged()) {
echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>';
}
if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) {
echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>';
}
if (is_single() && siteorigin_setting('blog_post_date')) {
echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>';
}
if (siteorigin_setting('blog_post_author')) {
echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>';
}
if (comments_open() && siteorigin_setting('blog_post_comment_count')) {
echo '<span class="comments-link">';
comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra'));
echo '</span>';
}
echo '</div>';
if (is_single() && siteorigin_setting('navigation_post_nav')) {
the_post_navigation($args = array('prev_text' => '', 'next_text' => ''));
}
}
示例4: spacious_scripts_styles_method
/**
* Register jquery scripts
*/
function spacious_scripts_styles_method()
{
/**
* Loads our main stylesheet.
*/
wp_enqueue_style('spacious_style', get_stylesheet_uri());
if (of_get_option('spacious_color_skin', 'light') == 'dark') {
wp_enqueue_style('spacious_dark_style', SPACIOUS_CSS_URL . '/dark.css');
}
/**
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
/**
* Register JQuery cycle js file for slider.
*/
wp_register_script('jquery_cycle', SPACIOUS_JS_URL . '/jquery.cycle.all.min.js', array('jquery'), '2.9999.5', true);
// wp_register_style( 'google_fonts', 'http://fonts.googleapis.com/css?family=Lato' );
/**
* Enqueue Slider setup js file.
*/
if (is_home() || is_front_page() && of_get_option('spacious_activate_slider', '0') == '1') {
wp_enqueue_script('spacious_slider', SPACIOUS_JS_URL . '/spacious-slider-setting.js', array('jquery_cycle'), false, true);
}
wp_enqueue_script('spacious-navigation', SPACIOUS_JS_URL . '/navigation.js', array('jquery'), false, true);
wp_enqueue_script('spacious-custom', SPACIOUS_JS_URL . '/spacious-custom.js', array('jquery'));
wp_enqueue_style('google_fonts');
$spacious_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (preg_match('/(?i)msie [1-8]/', $spacious_user_agent)) {
wp_enqueue_script('html5', SPACIOUS_JS_URL . '/html5.js', true);
}
}
示例5: localedge_scripts_and_styles
function localedge_scripts_and_styles()
{
global $wp_styles;
// call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
// modernizr (without media query polyfill)
wp_enqueue_script('localedge-modernizr', '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js', false, null);
// respondjs
wp_enqueue_script('localedge-respondjs', '//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js', false, null);
// register main stylesheet
wp_enqueue_style('localedge-stylesheet', get_stylesheet_directory_uri() . '/css/style.css', array(), '', 'all');
// ie-only style sheet
wp_enqueue_style('localedge-ie-only', get_stylesheet_directory_uri() . '/css/ie.css', array(), '');
$wp_styles->add_data('localedge-ie-only', 'conditional', 'lt IE 9');
// add conditional wrapper around ie stylesheet
//Magnific Popup (LightBox)
wp_enqueue_script('localedge-magnific-popup-js', '//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js', array('jquery'), '0.9.9', true);
//Font Awesome (icon set)
wp_enqueue_style('localedge-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3');
// iCheck (better radio and checkbox inputs)
wp_enqueue_script('localedge-icheck', '//cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.1/icheck.min.js', array('jquery'), '1.0.1', true);
//Chosen - http://harvesthq.github.io/chosen/
wp_enqueue_script('chosen-js', '//cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.jquery.min.js', array('jquery'), '1.1.0', true);
// comment reply script for threaded comments
if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
//adding scripts file in the footer
wp_enqueue_script('localedge-js', get_stylesheet_directory_uri() . '/js/scripts.js', array('jquery'), '', true);
}
示例6: widget
public function widget($args, $instance)
{
if (!is_singular()) {
return;
}
$the_id = get_the_ID();
if (!comments_open($the_id)) {
return;
} else {
$html = $args['before_widget'];
if (!empty($instance['title'])) {
$html .= $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$api_url = esc_url(home_url('/')) . 'wp-json/wp/v2/comments';
$author = __('NAME:', 'rest-api-widgets');
$mailaddress = __('MAIL:', 'rest-api-widgets');
$content = __('COMMENTS:', 'rest-api-widgets');
$send_btn = __('SEND', 'rest-api-widgets');
$success_text = __('Success! Reload now.', 'rest-api-widgets');
$fail_text = __('Fail :(', 'rest-api-widgets');
$html .= "<form action={$api_url} method='post' id='rest-api-widgets-comment'>";
$html .= '<dl>';
$html .= "<dt>{$author}</dt><dd><input name='author_name' value=''></dd>";
$html .= "<dt>{$mailaddress}</dt><dd><input name='author_email' value=''></dd>";
$html .= "<dt>{$content}</dt><dd><textarea name='content' id=' cols='30' rows='10'></textarea></dd>";
$html .= '</dl>';
$html .= "<input type='hidden' name='post' value='{$the_id}'>";
$html .= "<input type='hidden' name='success_text' value='{$success_text}'>";
$html .= "<input type='hidden' name='fail_text' value='{$fail_text}'>";
$html .= "<button>{$send_btn}</button>";
$html .= '</form>';
}
echo $html . $args['after_widget'];
}
示例7: comments
function comments()
{
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()) {
comments_template();
}
}
示例8: _s_scripts
/**
* Enqueue scripts and styles.
*/
function _s_scripts()
{
/**
* If WP is in script debug, or we pass ?script_debug in a URL - set debug to true.
*/
$debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true || isset($_GET['script_debug']) ? true : false;
/**
* If we are debugging the site, use a unique version every page load so as to ensure no cache issues.
*/
$version = '1.0.0';
/**
* Should we load minified scripts? Also enqueue live reload to allow for extensionless reloading.
*/
$suffix = '.min';
if (true === $debug) {
$suffix = '';
wp_enqueue_script('live-reload', '//localhost:35729/livereload.js', array(), $version, true);
}
wp_enqueue_style('_s-google-font', _s_font_url(), array(), null);
wp_enqueue_style('_s-style', get_stylesheet_directory_uri() . '/style' . $suffix . '.css', array(), $version);
wp_enqueue_script('_s-project', get_template_directory_uri() . '/assets/js/project' . $suffix . '.js', array('jquery'), $version, true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
示例9: roots_scripts
/**
* Scripts and stylesheets
*
* Enqueue stylesheets in the following order:
* 1. /theme/assets/css/main.css
*
* Enqueue scripts in the following order:
* 1. jquery-1.11.1.min.js via Google CDN
* 2. /theme/assets/js/vendor/modernizr.min.js
* 3. /theme/assets/js/scripts.js (in footer)
*
* Google Analytics is loaded after enqueued scripts if:
* - An ID has been defined in config.php
* - You're not logged in as an administrator
*/
function roots_scripts()
{
/**
* The build task in Grunt renames production assets with a hash
* Read the asset names from assets-manifest.json
*/
if (WP_ENV === 'development') {
$assets = array('css' => '/assets/css/main.css', 'js' => '/assets/js/scripts.js', 'modernizr' => '/assets/vendor/modernizr/modernizr.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js');
} else {
$get_assets = file_get_contents(get_template_directory() . '/assets/manifest.json');
$assets = json_decode($get_assets, true);
$assets = array('css' => '/assets/css/main.min.css' . '?' . $assets['assets/css/main.min.css']['hash'], 'js' => '/assets/js/scripts.min.js' . '?' . $assets['assets/js/scripts.min.js']['hash'], 'modernizr' => '/assets/js/vendor/modernizr.min.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');
}
wp_enqueue_style('roots_css', get_template_directory_uri() . $assets['css'], false, null);
/**
* jQuery is loaded using the same method from HTML5 Boilerplate:
* Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline
* It's kept in the header instead of footer to avoid conflicts with plugins.
*/
if (!is_admin() && current_theme_supports('jquery-cdn')) {
wp_deregister_script('jquery');
wp_register_script('jquery', $assets['jquery'], array(), null, false);
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
}
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false);
wp_enqueue_script('jquery');
wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true);
}
示例10: enqueue_scripts
/**
* Register the stylesheets for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_scripts()
{
wp_enqueue_script('platypuslocal-script', trailingslashit(get_template_directory_uri()) . 'assets/public/js/main.js', array('jquery'), false, true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
示例11: airballoon_display_postmeta
function airballoon_display_postmeta()
{
?>
<span class="meta-date">
<?php
printf('<a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date()));
?>
</span>
<span class="meta-author">
<?php
printf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'airballoon-lite'), get_the_author())), get_the_author());
?>
</span>
<?php
if (comments_open()) {
?>
<span class="meta-comments">
<?php
comments_popup_link(__('Leave a comment', 'airballoon-lite'), __('One comment', 'airballoon-lite'), __('% comments', 'airballoon-lite'));
?>
</span>
<?php
}
edit_post_link(__('Edit Post', 'airballoon-lite'));
}
示例12: twentytwelve_scripts_styles
/**
* Enqueue scripts and styles for front-end.
*/
function twentytwelve_scripts_styles()
{
global $wp_styles;
/*
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
// Adds JavaScript for handling the navigation menu hide-and-show behavior.
wp_enqueue_script('twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true);
$font_url = twentytwelve_get_font_url();
if (!empty($font_url)) {
wp_enqueue_style('twentytwelve-fonts', esc_url_raw($font_url), array(), null);
}
// Loads our main stylesheet.
wp_enqueue_style('twentytwelve-style', get_stylesheet_uri());
// Loads the Flexslider
wp_enqueue_style('twentytwelve-flex', get_template_directory_uri() . '/css/flexslider.css', array('twentytwelve-style'), '20121010');
// Loads the Colorbox
wp_enqueue_style('twentytwelve-color', get_template_directory_uri() . '/css/colorbox.css', array('twentytwelve-style'), '20121010');
// Loads the Internet Explorer specific stylesheet.
wp_enqueue_style('twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array('twentytwelve-style'), '20121010');
$wp_styles->add_data('twentytwelve-ie', 'conditional', 'lt IE 9');
}
示例13: joints_scripts_and_styles
function joints_scripts_and_styles()
{
global $wp_styles;
// Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
if (!is_admin()) {
$theme_version = wp_get_theme()->Version;
// Removes WP version of jQuery
wp_deregister_script('jquery');
// Loads jQuery from bower_components
wp_enqueue_script('jquery', get_template_directory_uri() . '/bower_components/foundation/js/vendor/jquery.js', array(), '2.1.3', true);
// Modernizr from bower_components
wp_enqueue_script('modernizr', get_template_directory_uri() . '/bower_components/foundation/js/vendor/modernizr.js', array(), '2.8.3', true);
// Adding Foundation scripts file in the footer
wp_enqueue_script('foundation-js', get_template_directory_uri() . '/assets/js/min/foundation.min.js', array('jquery'), '', true);
// Adding scripts file in the footer
wp_enqueue_script('site-js', get_template_directory_uri() . '/assets/js/min/scripts.min.js', array('jquery'), '', true);
// Register main stylesheet
wp_enqueue_style('site-css', get_template_directory_uri() . '/assets/css/style.css', array(), '', 'all');
// Register foundation icons
// wp_enqueue_style( 'foundation-icons', get_template_directory_uri() . '/assets/css/icons/foundation-icons.css', array(), '3.0', 'all' );
// Comment reply script for threaded comments
if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
wp_enqueue_script('comment-reply');
}
}
}
示例14: tie_register
function tie_register()
{
## Register Main style.css file
wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
wp_enqueue_style('tie-style');
## Register All Scripts
wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
wp_register_script('tie-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), false, true);
## Get Global Scripts
wp_enqueue_script('tie-scripts');
## Register WooCommerce css file
wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
if (class_exists('Woocommerce')) {
wp_enqueue_style('tie-woocommerce');
}
## Get Validation Script
if (tie_get_option('comment_validation') && (is_page() || is_single()) && comments_open()) {
wp_enqueue_script('tie-validation');
}
## For facebook & Google + share
if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
tie_og_data();
}
}
示例15: themonic_scripts_styles
function themonic_scripts_styles()
{
global $wp_styles;
/*
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
/*
* Adds Selectnav.js JavaScript for handling the navigation menu and creating a select based navigation for reposive layout.
*/
wp_enqueue_script('themonic-mobile-navigation', get_template_directory_uri() . '/js/selectnav.js', array(), '1.0', true);
/*
* Loads the awesome readable ubuntu font CSS file for Iconic One.
*/
if ('off' !== _x('on', 'Ubuntu font: on or off', 'themonic')) {
$subsets = 'latin,latin-ext';
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array('family' => 'Ubuntu:400,700', 'subset' => $subsets);
wp_enqueue_style('themonic-fonts', add_query_arg($query_args, "{$protocol}://fonts.googleapis.com/css"), array(), null);
}
/*
* Loads Themonic's main stylesheet and the custom stylesheet.
*/
wp_enqueue_style('themonic-style', get_stylesheet_uri());
wp_enqueue_style('custom-style', get_template_directory_uri() . '/custom.css');
/*
* Loads the Internet Explorer specific stylesheet.
*/
wp_enqueue_style('themonic-ie', get_template_directory_uri() . '/css/ie.css', array('themonic-style'), '20130305');
$wp_styles->add_data('themonic-ie', 'conditional', 'lt IE 9');
}