انجمن


نیاز به چند تگ  (۶ نوشته)

  • oshgool

    آفلاین
    عضو
    تعداد نوشته‌ها: ۵۹۳
    تشکر شده: ۶۵ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ اردیبهشت ۱۳۸۷ - ۰۰:۴۲

    سلام خدمت دوستان. من یه قالب اکی کردم فقط نیاز به چندتا تگ داشتم نمیخام از قسمت ابزارک ها اضافه کنم.
    یکی تگ آرشیو ماهانه فارسی هست. مثلا(فروردین- اردیبهشت.)
    یکی تگ برچسبها
    یکی هم تگ آخرین نظرات داده شده هست.
    ممنون میشم اینکارو بکنید.

  • behroooz

    آفلاین
    عضو
    تعداد نوشته‌ها: ۹۴
    تشکر شده: ۴۴ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ اردیبهشت ۱۳۸۷ - ۰۲:۳۹

    کد آرشیو ماهانه (البته به همراه دستور شرطی که اگه یه وقت افزونه فارسی ساز نصب نباشه آرشیو رو به صورت انگلیسی نشون میده)

    <?php if (function_exists('wp_get_jarchives')) { ?>
    <?php wp_get_jarchives('type=monthly&show_post_count=0'); ?>
    <?php } else { ?>
    <?php wp_get_archives('type=monthly&show_post_count=0'); ?>
    <?php } ?>

    کد برچسب ها

    <?php the_tags(' برچسب ها : ', ', ', ''); ?>

    برای آخرین نظرات داده شده یا می تونی پلاگین نصب کنی و بعدش از کد

    <?php if (function_exists('mdv_recent_comments')) { ?>
    <div class="LatestCom">
    <h3>آخرین نظرات</h3>
     <ul>
      <?php mdv_recent_comments('10'); ?>
     </ul>
    </div>
    <?php } ?>

    استفاده کنی و یا اینکه دستورات

    <?php
    /*
    Plugin Name: Simple Recent Comments
    Plugin URI: http://www.g-loaded.eu/2006/01/15/simple-recent-comments-wordpress-plugin/
    Description: Shows a list of recent comments.
    Version: 0.1.2
    Author: GNot
    Author URI: http://www.g-loaded.eu/
    */
    
    /*
    License: GPL
    Compatibility: All
    
    Installation:
    Place the simple_recent_comments.php file in your /wp-content/plugins/ directory
    and activate through the administration panel.
    
    Usage:
    This plugin returns an unordered list of the most recent comments.
    It provides a template function you can use:
    	src_simple_recent_comments(arg1, arg2, 'arg3', 'arg4')
    Arguments explanation:
    	arg1 (numeric): The number of comments to return. Default: 7
    	arg2 (numeric): The comment excerpt length. Default: 60
    	arg3 (alphanumeric): The HTML code to prepend to the list. Default: '<li><h2>Recent Comments</h2>'
    	arg4 (alphanumeric): The HTML code to append to the list. Default: '</li>'
    
    Of course it can be used without arguments. In this case the defaults will be used.
    The default usage of the template function is to place it in the sidebar.
    <?php src_simple_recent_comments(); ?>
    
    I would recommend to use the following way of placing the function in your template:
    	<?php if (function_exists('src_simple_recent_comments')) { src_simple_recent_comments(); } ?>
    This way, even if you de-activate the plugin in your administration panel, but you
    do not remove it from your templates, it would not produce any errors. The plugin simply will not
    function at all and will show nothing.
    */
    
    /*  Copyright (C) George Notaras (http://www.g-loaded.eu/)
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    /* Changelog
    * Wed Oct 04 2006 - v0.1.2
    - Plugin information update
    * Sun Apr 30 2006 - v0.1.1
    - Now works with non standard wordpress table names.
    * Sat Jan 14 2006 - v0.1
    - Initial release
    */
    
    function src_simple_recent_comments($src_count=7, $src_length=60, $pre_HTML='<li><h2> Recent Comments </h2>', $post_HTML='</li>') {
    	global $wpdb;
    
    	$sql = "SELECT DISTINCT ID, post_title, 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_password = ''
    		ORDER BY comment_date_gmt DESC
    		LIMIT $src_count";
    	$comments = $wpdb->get_results($sql);
    
    	$output = $pre_HTML;
    	$output .= "\n<ul>";
    	foreach ($comments as $comment) {
    		$output .= "\n\t<li><strong><a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID  . "\" title=\"on " . $comment->post_title . "\">" . $comment->comment_author . "</a></strong>: " . strip_tags($comment->com_excerpt) . "...</li>";
    	}
    	$output .= "\n</ul>";
    	$output .= $post_HTML;
    
    	echo $output;
    
    }
    
    ?>

    رو توی یک فایل به اسم simple_recent_comments.php ذخیره کنی و اونو توی فایلهای پوسته ای که ازش استفاده می کنی قرار بدی و بعدش از کد

    <?php include (TEMPLATEPATH . '/simple_recent_comments.php'); ?>
    	<?php if (function_exists('src_simple_recent_comments')) {
         src_simple_recent_comments(5, 60,'', ''); }
         ?>

    برای نشون دادن آخرین نظرات به همراه ۶۰ کاراکتر اون نظر استفاده کنید

    کاربران زیر به‌خاطر این نوشته تشکر کرده‌اند:
    Tazekar
  • oshgool

    آفلاین
    عضو
    تعداد نوشته‌ها: ۵۹۳
    تشکر شده: ۶۵ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ اردیبهشت ۱۳۸۷ - ۱۳:۲۳

    داداش دمت گرم خیلی حال دادی.
    ببین أرشیو ماهانه فروردین اردیبهشت رو میخوام دادا.
    من قالب رو جوری دستکاری کردم که نمیتونم ابزارک اضافه کنم به سایدبار قالب.

  • مهرداد

    آفلاین
    ناظم
    تعداد نوشته‌ها: ۲۶۶
    تشکر شده: ۱۳ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ اردیبهشت ۱۳۸۷ - ۱۴:۵۴

    برای آرشیو شمسی از این تگ استفاده کن

    <?php wp_get_jarchives('type=monthly'); ?>

  • behroooz

    آفلاین
    عضو
    تعداد نوشته‌ها: ۹۴
    تشکر شده: ۴۴ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ اردیبهشت ۱۳۸۷ - ۱۵:۴۸

    ببین أرشیو ماهانه فروردین اردیبهشت رو میخوام دادا.

    <?php if (function_exists('wp_get_jarchives')) { ?>
    <?php wp_get_jarchives('type=monthly&show_post_count=0'); ?>
    <?php } else { ?>
    <?php wp_get_archives('type=monthly&show_post_count=0'); ?>
    <?php } ?>

    این دقیقا همین کارو انجام میده :-)

    البته دستوری که Mehrdad عزیز گذاشتن دقیقا دستور آرشیو ماهیانه فارسی هست ولی به این صورت این مشکل رو داره که اگه شما افزونه wp-jalali رو نصب نکرده باشین یا خاموش باشه ، دیگه حتی لینک آرشیو رو نشون هم نمی ده و خطا میگیره *-:)

    من قالب رو جوری دستکاری کردم که نمیتونم ابزارک اضافه کنم به سایدبار قالب.

    منظورتون رو متوجه نمیشم 8-| چون توی هیچ کدوم از این دستورات من حرفی از ابزارک نزدم

  • Tazekar

    آفلاین
    عضو
    تعداد نوشته‌ها: ۶۶
    تشکر شده: ۱۹ بار
    # نوشته شده: ۱۲ سال پیش
    ۱۳ شهریور ۱۳۹۰ - ۲۲:۳۵

    ببخشید این تاپیک قدیمیو میارم بالا ولی برای من هیچ کدوم از کد هایی که برای نظرات گذاشتید کار نمیکنه

درباره‌ی این موضوع



برچسب‌ها