justeducation 1 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 با سلام میخواستم ببینم چطور میشود تعداد بازدیدهای هر پست که توسط افزونه WP-Statistics شمارش شده است رو به محتوای بالای پست ها اضافه کنم. به بعضی از سایت ها که مراجعه کردم، چنین کدی رو بدست آوردم: wp_statistics_pages('total', "", $post_id) ولی وقتی کد بالارو با استفاده از echo به فایل Single.php قالب اضافه میکنم، در بالای صفحه (نه پست) یک عدد ثابت نمایش داده میشه و روی هر پست همین مقدار هست و تغییری نمیکنه. ممنون میشم جواب بنده رو بدید. با تشکر نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 سلام <?= wp_statistics_pages("total", "", get_the_ID()); ?> 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 با تشکر فراوان از اینکه سریع پاسخ میدهید. فقط یک سوال دیگه. این کد رو باید کجا قرار بدم که در محتوای بالای پست قرار بگیره؟ تشکر دوباره نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 در 9 دقیقه قبل، justeducation گفته است : با تشکر فراوان از اینکه سریع پاسخ میدهید. فقط یک سوال دیگه. این کد رو باید کجا قرار بدم که در محتوای بالای پست قرار بگیره؟ تشکر دوباره این کد رو میتونید توی هر یک از حلقه های وردرپس قرار بدید. مثلا حلقه فایل single.php میشه این: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> // کد رو باید اینجا بذارید <?php endwhile; endif; ?> حالا اینکه دقیقا باید کجای حلقه بذارید بستگی به طراحی قالبتون داره. 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 فکر کنم منظورتون page.php هست. چون این کد رو داخل single.php پیدا نکردم. ببخشید مثل اینکه بنده واضح سوالمو مطرح نکردم. میخواهم در قسمتی که مشخصه های پست یا Meta قرار داده شده (همانطور که در تصویر زیر نشون دادم) نمایان بشه. نه داخل پست. ظاهرا این کدی رو که فرمودید فرق میکنه. ضمنا کد رو داخل page.php قرار دادم ولی چیزی نشون داده نشد. با تشکر فراوان نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 والا نگاه کنید وقتی میگید اونجا میخوام نمایش بدم من که کد قالب شما رو حفظ نیستم باید کد رو ببینم تا بتونم بگم باید چیکار کنید. نقل قول ضمنا کد رو داخل page.php قرار دادم ولی چیزی نشون داده نشد. احتمالا فایل single.php قالبتون پیچیده است که نتونستید حلقه رو توش پیدا کنید. 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 (ویرایش شده) بله درست میفرمایید. کدهارو همینجا میگذارم. واقعا متشکرم از اینکه وقت میگذارید. کد فایل single.php: <?php //Page settings $d_breacrumb = get_post_meta(get_the_ID(), 'mom_disbale_breadcrumb', true); $PS = get_post_meta(get_the_ID(), 'mom_page_share', true); $PC = get_post_meta(get_the_ID(), 'mom_page_comments', true); //Page Layout $custom_page = get_post_meta(get_the_ID(), 'mom_custom_page', true); $layout = get_post_meta(get_the_ID(), 'mom_page_layout', true); if ($layout == '') { $layout = mom_option('posts_layout');} $right_sidebar = get_post_meta(get_the_ID(), 'mom_right_sidebar', true); $left_sidebars = get_post_meta(get_the_ID(), 'mom_left_sidebar', true); ?> <?php get_header(); ?> <div class="inner"> <?php if (mom_option('post_top_ad') != '') { echo do_shortcode('[ad id="'.mom_option('post_top_ad').'"]'); echo do_shortcode('[gap height="20"]'); } ?> <?php if ($layout == 'fullwidth') { ?> <?php if ($d_breacrumb != true) { ?> <div class="category-title"> <?php mom_breadcrumb(); ?> </div> <?php } ?> <?php if ($custom_page) { ?> <?php mom_single_post_content(); ?> <?php } else { ?> <?php mom_single_post_content(); ?> <?php } // end cutom page ?> <?php } else { //if not full width ?> <div class="main_container"> <div class="main-col"> <?php if ($d_breacrumb != true) { ?> <div class="category-title"> <?php mom_breadcrumb(); ?> </div> <?php } ?> <?php if ($custom_page) { mom_single_post_content(); } else { ?> <?php mom_single_post_content(); ?> <?php } ?> </div> <!--main column--> <?php get_sidebar('secondary'); ?> <div class="clear"></div> </div> <!--main container--> <?php get_sidebar(); ?> <?php }// end full width ?> </div> <!--main inner--> <?php get_footer(); ?> کد page.php: <?php if (function_exists('is_bbpress') && is_bbpress()) { if (function_exists('is_buddypress') && is_buddypress()) { get_template_part( 'buddypress', 'page' ); } else { get_template_part( 'bbpress', 'page' ); } } elseif (function_exists('is_buddypress') && is_buddypress()) { get_template_part( 'buddypress', 'page' ); } else { ?> <?php //Page settings $d_breacrumb = get_post_meta(get_the_ID(), 'mom_disbale_breadcrumb', true); $hpt = get_post_meta(get_the_ID(), 'mom_hide_pagetitle', true); $PS = get_post_meta(get_the_ID(), 'mom_page_share', true); $PC = get_post_meta(get_the_ID(), 'mom_page_comments', true); //Page Layout $custom_page = get_post_meta(get_the_ID(), 'mom_custom_page', true); $layout = get_post_meta(get_the_ID(), 'mom_page_layout', true); $right_sidebar = get_post_meta(get_the_ID(), 'mom_right_sidebar', true); $left_sidebars = get_post_meta(get_the_ID(), 'mom_left_sidebar', true); /* ========================================================================== * unique posts variable ========================================================================== */ $unique_posts = ''; $unique_posts = get_post_meta(get_queried_object_id(), 'mom_unique_posts', true); ?> <?php get_header(); ?> <div class="inner"> <?php if ($layout == 'fullwidth') { ?> <?php if ($d_breacrumb != true) { ?> <div class="category-title"> <?php mom_breadcrumb(); ?> </div> <?php } ?> <?php if ($custom_page) { ?> <?php while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'theme' ), 'after' => '</div>' ) ); ?> <?php endwhile; // end of the loop. ?> <?php wp_reset_query(); ?> <?php } else { ?> <div class="base-box page-wrap"> <?php if ($hpt != true) { ?><h1 class="page-title"><?php the_title(); ?></h1><?php } ?> <div class="entry-content"> <?php while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'theme' ), 'after' => '</div>' ) ); ?> <?php endwhile; // end of the loop. ?> <?php wp_reset_query(); ?> <?php if ($PS == true) mom_posts_share(get_the_ID(), get_permalink()); ?> </div> <!-- entry content --> </div> <!-- base box --> <?php if ($PC == true) comments_template(); ?> <?php } // end cutom page ?> <?php } else { //if not full width ?> <div class="main_container"> <div class="main-col"> <?php if ($d_breacrumb != true) { ?> <div class="category-title"> <?php mom_breadcrumb(); ?> </div> <?php } ?> <?php if ($custom_page) { ?> <?php while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'theme' ), 'after' => '</div>' ) ); ?> <?php endwhile; // end of the loop. ?> <?php wp_reset_query(); ?> <?php } else { ?> <div class="base-box page-wrap"> <?php if ($hpt != true) { ?><h1 class="page-title"><?php the_title(); ?></h1><?php } ?> <div class="entry-content"> <?php while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'theme' ), 'after' => '</div>' ) ); ?> <?php endwhile; // end of the loop. ?> <?php wp_reset_query(); ?> <?php if ($PS == true) mom_posts_share(get_the_ID(), get_permalink()); ?> </div> <!-- entry content --> </div> <!-- base box --> <?php if ($PC == true) comments_template(); ?> <?php } ?> </div> <!--main column--> <?php get_sidebar('secondary'); ?> <div class="clear"></div> </div> <!--main container--> <?php get_sidebar(); ?> <?php }// end full width ?> </div> <!--main inner--> <?php get_footer(); ?> <?php } ?> page.php single.php ویرایش شده شهریور 96 توسط justeducation اضافه کردن پیوست نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 (ویرایش شده) تابع mom_single_post_content رو توی فایل functions.php پیدا کنید و در اینجا قرارش بدید. ویرایش شده شهریور 96 توسط mehran-b 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 (ویرایش شده) چنین تابعی درون فایل functions وجود ندارد. ولی در یک فایل دیگه که در روت /framework/functions/goodnews.php بود، این تابع وجود داشت: function mom_single_post_content () { while ( have_posts() ) : the_post(); $item_type = 'itemscope itemtype="http://schema.org/Article'; ?> <div <?php post_class('base-box blog-post p-single bp-horizontal-share'); echo $item_type; ?>"> <?php //post settings $DPS = get_post_meta(get_the_ID(), 'mom_blog_ps', true); if (mom_option('post_share') != 1) { $DPS = 1; } $DPN = get_post_meta(get_the_ID(), 'mom_blog_np', true); if (mom_option('post_np') != 1) { $DPN = 1; } $DAB = get_post_meta(get_the_ID(), 'mom_blog_ab', true); if (mom_option('post_ab') != 1) { $DAB = 1; } $DRP = get_post_meta(get_the_ID(), 'mom_blog_rp', true); if (mom_option('post_rp') != 1) { $DRP = 1; } $DPC = get_post_meta(get_the_ID(), 'mom_blog_pc', true); if (mom_option('post_dc') == 1) { $DPC = 1; } $format = get_post_format(); ?> <?php if (mom_option('post_feature_position') == 0) mom_single_post_format($format); ?> <h1 class="post-tile entry-title" itemprop="name"><?php the_title(); ?></h1> <?php mom_posts_meta('single-post-meta'); ?> <?php if (mom_option('post_feature_position') == 1) mom_single_post_format($format); ?> <div class="entry-content"> <?php $chat_top_content = ''; $chat_bottom_content = ''; if ($format == 'chat') { global $posts_st; $extra = get_post_meta(get_the_ID(), $posts_st->get_the_id(), TRUE); $chat_top_content = isset($extra['chat_post_top_content']) ? $extra['chat_post_top_content'] : ''; $chat_bottom_content = isset($extra['chat_post_bottom_content']) ? $extra['chat_post_bottom_content'] : ''; } ?> <?php echo $chat_top_content; ?> <?php the_content(); ?> <?php echo $chat_bottom_content; ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'theme' ), 'after' => '</div>' ) ); ?> <?php if (mom_option('post_tags') == 1) { if (has_tag()) { ?> <div class="post-tags"> <span class="pt-title"><?php _e('Tags:','theme'); ?> </span> <?php the_tags('', ''); ?> </div> <!-- post tags --> <?php } } ?> <?php if (mom_option('post_bottom_content_ad') != '') { echo do_shortcode('[ad id="'.mom_option('post_bottom_content_ad').'"]'); //echo do_shortcode('[gap height="20"]'); } if ($DPS != 1) {mom_posts_share(get_the_ID(), get_permalink());} ?> </div> <!-- entry content --> </div> <!-- base box --> <?php if ($DPN != 1) {mom_post_nav();} if (mom_option('post_bottom_ad') != '') { echo do_shortcode('[ad id="'.mom_option('post_bottom_ad').'"]'); //echo do_shortcode('[gap height="20"]'); } if ($DAB != 1) {mom_author_box();} if ($DRP != 1) {mom_related_posts();} if ($DPC != 1) {comments_template();} endwhile; wp_reset_query(); } با تشکر goodnews.php functions.php ویرایش شده شهریور 96 توسط justeducation مشکل در نمایش Syntax نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 درسته. همینه. آدرس سایتتون هم قرار بدید. 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 بفرمایید: http://yon.ir/educating نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 تابع mom_posts_meta هم بگردید ببینید توی کدوم فایله قرارش بدید. 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 داخل روت: /framework/functions/momizat_functions.php کد: // mom_post_meta function mom_posts_meta ($class = '', $display = null) { $num_comments = get_comments_number(); // get_comments_number returns only a numeric value if ( comments_open() ) { if ( $num_comments == 0 ) { $comments = __('No Comments', 'theme'); } elseif ( $num_comments > 1 ) { $comments = $num_comments .' '. __(' Comments', 'theme'); } else { $comments = __('1 Comment', 'theme'); } $write_comments = '<a href="' . get_comments_link() .'">'. $comments.'</a>'; } else { //$write_comments = __('Comments off', 'theme'); $write_comments = ''; } $author_link = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); if (class_exists('userpro_api')) { global $userpro; $author_link = $userpro->permalink(get_the_author_meta( 'ID' )); } $categories = get_the_category(); $separator = ', '; $cats = ''; if($categories){ foreach($categories as $category) { $cats.= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s", 'theme' ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator; } } $output = '<div class="mom-post-meta '.$class.'">'; $author = mom_option('post_meta-author') == 1 ? '<span class="author vcard">'.__('Posted By:', 'theme').' <span class="fn"><a href="'.$author_link.'">'.get_the_author().'</a></span></span>': ''; $date = mom_option('post_meta-date') == 1 ? '<span>'.__('on:', 'theme').' <time datetime="'.get_the_time('c').'" itemprop="datePublished" class="updated">'.get_mom_date_format().'</time></span>': ''; //$date = mom_option('post_meta-date') == 1 ? '<span>'.__('The last Update:', 'theme').' <time datetime="'.get_the_time('c').'" itemprop="datePublished" class="updated">'. get_post_modified_time(mom_option('date_format')).'</time></span>': ''; $cat = mom_option('post_meta-cat') == 1 ? '<span>'.__('In', 'theme').': '.trim($cats, $separator).'</span>': ''; $comments = mom_option('post_meta-comments') == 1 ? '<span>'.$write_comments.'</span>': ''; if ($display == 'date_comments') { $output .= $date.$comments; } else { $output .= $author.$date.$cat.$comments; } if(function_exists('the_views')) { $output .= '<span>'.__('Views:', 'theme').' '.the_views(false).'</span>'; } $output .= get_mom_show_review_score(); if (is_single()) { if (mom_option('post_meta-tools') == true) { $output .= '<div class="post-tools">'; $output .= '<a href="javascript:window.print()" rel="nofollow" class="print"><i class="fa-icon-print"> </i>'.__('Print').'</a>'; $output .= '<a href="mailto:?subject='.get_the_title().'&body='.get_the_title().' '.get_permalink().'" rel="nofollow" class="email"><i class="fa-icon-envelope"> </i>'.__('Email', 'theme').'</a>'; $output .= '</div>'; } } $output .= '</div>'; echo $output; } با تشکر momizat_functions.php نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 تابع mom_posts_meta رو به شکل زیر جایگزین کنید. // mom_post_meta function mom_posts_meta ($class = '', $display = null) { $num_comments = get_comments_number(); // get_comments_number returns only a numeric value if ( comments_open() ) { if ( $num_comments == 0 ) { $comments = __('No Comments', 'theme'); } elseif ( $num_comments > 1 ) { $comments = $num_comments .' '. __(' Comments', 'theme'); } else { $comments = __('1 Comment', 'theme'); } $write_comments = '<a href="' . get_comments_link() .'">'. $comments.'</a>'; } else { //$write_comments = __('Comments off', 'theme'); $write_comments = ''; } $author_link = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); if (class_exists('userpro_api')) { global $userpro; $author_link = $userpro->permalink(get_the_author_meta( 'ID' )); } $categories = get_the_category(); $separator = ', '; $cats = ''; if($categories){ foreach($categories as $category) { $cats.= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s", 'theme' ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator; } } $output = '<div class="mom-post-meta '.$class.'">'; $author = mom_option('post_meta-author') == 1 ? '<span class="author vcard">'.__('Posted By:', 'theme').' <span class="fn"><a href="'.$author_link.'">'.get_the_author().'</a></span></span>': ''; $date = mom_option('post_meta-date') == 1 ? '<span>'.__('on:', 'theme').' <time datetime="'.get_the_time('c').'" itemprop="datePublished" class="updated">'.get_mom_date_format().'</time></span>': ''; //$date = mom_option('post_meta-date') == 1 ? '<span>'.__('The last Update:', 'theme').' <time datetime="'.get_the_time('c').'" itemprop="datePublished" class="updated">'. get_post_modified_time(mom_option('date_format')).'</time></span>': ''; $cat = mom_option('post_meta-cat') == 1 ? '<span>'.__('In', 'theme').': '.trim($cats, $separator).'</span>': ''; $comments = mom_option('post_meta-comments') == 1 ? '<span>'.$write_comments.'</span>': ''; if ($display == 'date_comments') { $output .= $date.$comments; } else { $output .= $author.$date.$cat.$comments; } if(function_exists('the_views')) { $output .= '<span>'.__('Views:', 'theme').' '.the_views(false).'</span>'; } if(function_exists('wp_statistics_pages')) { $output .= '<span>'.__('Views:', 'theme').' '.wp_statistics_pages('total', '', get_the_ID()).'</span>'; } $output .= get_mom_show_review_score(); if (is_single()) { if (mom_option('post_meta-tools') == true) { $output .= '<div class="post-tools">'; $output .= '<a href="javascript:window.print()" rel="nofollow" class="print"><i class="fa-icon-print"> </i>'.__('Print').'</a>'; $output .= '<a href="mailto:?subject='.get_the_title().'&body='.get_the_title().' '.get_permalink().'" rel="nofollow" class="email"><i class="fa-icon-envelope"> </i>'.__('Email', 'theme').'</a>'; $output .= '</div>'; } } $output .= '</div>'; echo $output; } 1 نقل قول لینک به ارسال
justeducation 1 ارسال شده در شهریور 96 مالک گزارش بازنشر ارسال شده در شهریور 96 با تشکر فراوان از راهنمایی های جنابعالی و "وردپرس پارسی". با آرزوی موفقیت. 1 نقل قول لینک به ارسال
mehran-b 2,385 ارسال شده در شهریور 96 گزارش بازنشر ارسال شده در شهریور 96 در هم اکنون، justeducation گفته است : با تشکر فراوان از راهنمایی های جنابعالی و "وردپرس پارسی". خواهش میکنم. نقل قول با آرزوی موفقیت. پاینده باشید 1 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .