رفتن به مطلب

محمد هادی

عضو سایت
  • تعداد ارسال‌ها

    24
  • تاریخ عضویت

  • آخرین بازدید

نوشته‌ها ارسال شده توسط محمد هادی

  1. سلام;)

    دوستان من سایت وردپرسی زدم که فقط از طریق WP REST API با json بتونم پستهاش رو دریافت کنم و ...، حالا ترجیحم این هست که ایندکس سایت و مشاهده مطالبش از طریق مرورگر در دسترس نباشه، به نظرتون راهکار چیه برای این مورد؟ مرسی :)

  2. سلام من كه همچين افزونه ايي نديدم فك نكنم باشه ! ولي منطقي ترين كار اينه خودتون بالاي كلاس تايتل مطلب هاتون ي كلاس درست كنيد و استايل مناسبي رو هم كه ميخواين بش بدين !‌ بعد هم اون مطلبتون داخل بزاريد ديگه !‌ هر دفعخه فقط بياين اين متن عوض كنيد !‌

    آخه دارم برای کسی میزنم، میخوام هر دفعه خواست از طریق یه برگه یا از طریق یه منو راحت عوض کنه چون اطلاعاتی تو این زمینه نداره

  3. ببینید کد رو که میزنم دورش یه کادر مستطیلی میاد که ادامه داره تا حدوده 800 900 پیکسل، فونتیم که مطالب رو میزنه arial هست فک کنم،میخوام اون مستطیله بره فونت هم بشه tahoma کلا ساده بشه، ولی کد css ای ندیدم و نمیدونم باید چجور تغییر ظاهر بدم بهش توی عکسی که این پست که زدم معلومه

  4. فک کنم جایی از کد ایراد داره، کدهای ابزارک آخر هستند:

    <?php function catch_that_image() {

    //for load the images in index

    global $post, $posts;

    $first_img = '';

    ob_start();

    ob_end_clean();

    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);

    $first_img = $matches [1] [0];

    if(empty($first_img)){ //Defines a default image

    $first_img = "http://localhost/xam...mages/img.jpg";

    }

    return $first_img;

    }

    add_filter('wp_default_editor', create_function('', 'return "html";'));

    add_filter('excerpt_length', 'ilc_excerpt_length');

    function ilc_excerpt_length( $length ){

    return 80;

    }

    // for popular posts whit out image

    function popularPosts($num) {

    global $wpdb;

    $posts = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $num");

    foreach ($posts as $post) {

    setup_postdata($post);

    $id = $post->ID;

    $title = $post->post_title;

    $count = $post->comment_count;

    if ($count != 0) {

    $popular .= '<a href="' . get_permalink($id) . '" title="' . $title . '">' . $title . '</a> ';

    }

    }

    return $popular;

    }

    // for popular posts whit out image

    function popularPosts2($num) {

    global $wpdb;

    $posts = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $num");

    foreach ($posts as $post) {

    setup_postdata($post);

    $id = $post->ID;

    $title = $post->post_title;

    $count = $post->comment_count;

    if ($count != 0) {

    $popular .= '<li><a href="' . get_permalink($id) . '" title="' . $title . '">' . $title . '</a></li> ';

    }

    }

    return $popular;

    }

    // for post date

    function timeago()

    {

    $days = round((date('U') - get_the_time('U')) / (60*60*24));

    if ($days==0) {

    echo " امروز منتشر شد";

    }

    elseif ($days==1) {

    echo "دیروز منتشر شد ";

    }

    else {

    echo "" . $days . " روز پیش";

    }

    }

    // for post view

    function getPostViews($postID){

    $count_key = 'post_views_count';

    $count = get_post_meta($postID, $count_key, true);

    if($count==''){

    delete_post_meta($postID, $count_key);

    add_post_meta($postID, $count_key, '0');

    return "بدون بازدید";

    }

    return $count.' بازدید';

    }

    // function to count views.

    function setPostViews($postID) {

    $count_key = 'post_views_count';

    $count = get_post_meta($postID, $count_key, true);

    if($count==''){

    $count = 0;

    delete_post_meta($postID, $count_key);

    add_post_meta($postID, $count_key, '0');

    }else{

    $count++;

    update_post_meta($postID, $count_key, $count);

    }

    }

    //for post view in wp admin

    add_filter('manage_posts_columns', 'posts_column_views');

    add_action('manage_posts_custom_column', 'posts_custom_column_views',5,2);

    function posts_column_views($defaults){

    $defaults['post_views'] = __('بازدید');

    return $defaults;

    }

    function posts_custom_column_views($column_name, $id){

    if($column_name === 'post_views'){

    echo getPostViews(get_the_ID());

    }

    }

    //for removie [...] in index

    function wpe_excerptlength_incats( $length ) {

    return 45;

    }

    function wpe_excerptlength_index( $length ) {

    return 70;

    }

    function wpe_excerptmore( $more ) {

    return '  . . .';

    }

    function wpe_excerpt( $length_callback = '', $more_callback = '' ) {

    if ( function_exists( $length_callback ) )

    add_filter( 'excerpt_length', $length_callback );

    if ( function_exists( $more_callback ) )

    add_filter( 'excerpt_more', $more_callback );

    $output = get_the_excerpt();

    $output = apply_filters( 'wptexturize', $output );

    $output = apply_filters( 'convert_chars', $output );

    $output = '<p>' . $output . '</p>'; // maybe wpautop( $foo, $br )

    echo $output;

    }

    //for block spam comments

    function delete_comment_link($id) {

    if (current_user_can('edit_post')) {

    echo '| <a href="'.admin_url("comment.php?action=cdc&c=$id").'" style="color:#f00;" >حذف</a> ';

    echo '| <a href="'.admin_url("comment.php?action=cdc&dt=spam&c=$id").'">جفنگ</a>';

    }

    }

    //delete url in comment-content

    // This will occur when the comment is posted

    function plc_comment_post( $incoming_comment ) {

    // convert everything in a comment to display literally

    $incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);

    // the one exception is single quotes, which cannot be #039; because WordPress marks it as spam

    $incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );

    return( $incoming_comment );

    }

    // This will occur before a comment is displayed

    function plc_comment_display( $comment_to_display ) {

    // Put the single quotes back in

    $comment_to_display = str_replace( ''', "'", $comment_to_display );

    return $comment_to_display;

    }

    add_filter( 'preprocess_comment', 'plc_comment_post', '', 1 );

    add_filter( 'comment_text', 'plc_comment_display', '', 1 );

    add_filter( 'comment_text_rss', 'plc_comment_display', '', 1 );

    add_filter( 'comment_excerpt', 'plc_comment_display', '', 1 );

    // This stops WordPress from trying to automatically make hyperlinks on text:

    remove_filter( 'comment_text', 'make_clickable', 9 );

    //baraye didgah haye to dar to

    function enable_threaded_comments(){

    if (!is_admin()) {

    if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))

    wp_enqueue_script('comment-reply');

    }

    }

    add_action('get_header', 'enable_threaded_comments');

    // delete generator in header

    add_filter('the_generator', create_function('', 'return "";'));

    // for show page number

    function wp_corenavi() {

    global $wp_query, $wp_rewrite;

    $pages = '';

    $max = $wp_query->max_num_pages;

    if (!$current = get_query_var('paged')) $current = 1;

    $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));

    $a['total'] = $max;

    $a['current'] = $current;

    $total = 1; //1 - display the text "Page N of N", 0 - not display

    $a['mid_size'] = 5; //how many links to show on the left and right of the current

    $a['end_size'] = 1; //how many links to show in the beginning and end

    $a['prev_text'] = '« قبلی'; //text of the "Previous page" link

    $a['next_text'] = 'بعدی »'; //text of the "Next page" link

    if ($max > 1) echo '<div class="navigation">';

    echo $pages . paginate_links($a);

    if ($max > 1) echo '</div>';

    }

    ?>

    <?php

    if ( function_exists('register_sidebar') )

    register_sidebar();

    ?>

    <?php

    if ( function_exists('register_sidebar') )

    register_sidebar(array('name'=>'Sidebar1',

    'before_widget' => '<div class="sidebar_bg ads_first">',

    'after_widget' => '</div>',

    'before_title' => '<h3>',

    'after_title' => '</h3>',

    ));

    register_sidebar(array('name'=>'Sidebar2',

    'before_widget' => '<div class="sidebar_bg ads_first">',

    'after_widget' => '</div>',

    'before_title' => '<h3>',

    'after_title' => '</h3>',

    ));

    ?>

  5. سلام

    بچه ها بعد زدن کد ابزارک تو قالب بعضی قسمت ها اررور زیر میاد:

    Warning: Cannot modify header information - headers already sent by (output started at /home/----/domains/-----/public_html/wp-content/themes/------/functions.php:209) in /home/------/domains/-------/public_html/wp-includes/pluggable.php on line 876

    مشکل از کجاست؟؟

  6. سلام

    وقتی برای فعال شدن ابزارک این کد رو در فانکشن قرار میدید :


    <?php
    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'ابزارک کناری',
    'id' => 'ابزارک کناری',
    'description' => 'ستون هایی که در نوار کنار قسمت وبلاگ نمایش داده می شوند',
    'before_widget' => '<div class="widget-container widget_categories">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>'
    ));
    }
    ?>

    باید کلاسی که برای کل ابزارک در نظر گرفتید رو جلوی before_widget درج کنید ، برای مثال اگر کل ابزارک در تگ <aside> قرار گرفته باید جلوی before_widget درج کنید . جلوی عبارت after_widget هم تگ پایانی که ابزارک رو در بر گرفته ( که در مثال من باید <aside/> درج کنید ) ... جلوی عبارت before_title هم باید تگی رو درج کنید که عنوان ابزارک رو در بر میگیره ... مثلا شما عنوان ابزارک که جست و جو هست رو بین دو تگ h3 گذاشتید .

    برای عنوان هم میتونم استایل قرار بدم دیگه درسته؟این دوتا منظورمه:

    'before_title' => '<h3>',

    'after_title' => '</h3>'

  7. سلاام

    بچه ها از طریق آموزشها قابلیت ابزارک دادم به قالب حالا مخیوام استایل بدم بهش، ولی وقتی واسش div تعریف میکنم داخل قالب دیو نمایش داده میشه،ولی میخوام فقط وقتی ابزارک رو فعال میکنم مشخص باشه،روش خاصی داری استایل دهی به ابزارک؟؟ ممنون میشم راهمنماییم کنید

    مثلا کد زیر رو چجور استایل میدید

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('Sidebar1') ) : ?>
    <?php endif; ?>

  8. سلام، دوستا اول این که من این کد رو گرفتم ویرایشش کردم ولی ظاهرا جاییش ایراد داره اگه کسی میتونه ممنون میشم اصلاح کنه برام:

    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe>

    و دوم این که اگر کدی شبیه عکس زیر دارید ممنون میشم بدید ^_^

    post-2095-0-91076700-1375879100.png

  9. منظور در مدیریت وردپرس هست

    بله میشه اما باید در هسته وردپرس تغییر ایجاد کنید!

    بله منظورم داخله مدیریت هست! اگه زیاد طولانی نیست ممنون میشم توضیح بدید چجوری، اگرم زمان گیره که هیچی :) ممنون

  10. اینجور که تو اون پست متوجه اون برای نمایش پست برای کاربرهاست، من منظورم برای زمانیه که دارم تو ادیتور مطلب میزنم و میخوام تگ وارد کنم

    مثلا به جای این که بنویسم:

    وردپرس,پارسی,ایران

    بنویسم:

    وردپرس-پارسی-ایران

    و enter بزنم و تگها جدا بشن :)

  11. سلام بچه ها نماز روزه هاتون قبول باشه انشالله :rolleyes:

    سوالم اینه که توی وردپرس میتونیم کاری کنیم که برای جدا کردن تگها به جای کاراکتر "," از یه کاراکتر دیگه مثل "-" استفاده کنیم موقع تایپ تگها وقتی رو زبان فارسی هستیم سخته هی بخوای واسه جدا کردن تغییر زبان بدی! B) مــرسی ;)

  12. سلام دوستان عزیز وردپرسی :D

    دوستان من تازه کارای آموزشی قلابهارو دارم یاد میگیرم، چندجا دیدم برای dreamweaver انگار پلاگینی هست که قالبهای وردپرس رو قشنگ نشون بده،درسته؟یکی پیدا کردم نصب کردم روی cs6 ولی جواب نداد، ممنون میشم اگر اطلاع دارید در اختیارم بزارید ممنون :wub:

    • امتیاز 2
×
×
  • اضافه کردن...