رفتن به مطلب

ho3ein

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

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

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

نوشته‌ها ارسال شده توسط ho3ein

  1. سلام دوستان من برای یک پوسته یک پست سفارشی product اضافه کردم با استفاده از کد زیر : 

    function custom_post_type() {
        // Set UI labels for Custom Post Type
        $labels = array(
        'name'                => _x( 'products', 'Post Type General Name', 'twentythirteen' ),
        'singular_name'       => _x( 'product', 'Post Type Singular Name', 'twentythirteen' ),
        'menu_name'           => __( 'Products', 'twentythirteen' ),
        'parent_item_colon'   => __( 'Parent Product', 'twentythirteen' ),
        'all_items'           => __( 'All products', 'twentythirteen' ),
        'view_item'           => __( 'View Product', 'twentythirteen' ),
        'add_new_item'        => __( 'Add New Product', 'twentythirteen' ),
        'add_new'             => __( 'Add New', 'twentythirteen' ),
        'edit_item'           => __( 'Edit Product', 'twentythirteen' ),
        'update_item'         => __( 'Update Product', 'twentythirteen' ),
        'search_items'        => __( 'Search Product', 'twentythirteen' ),
        'not_found'           => __( 'Not Found', 'twentythirteen' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'twentythirteen' ),
        );
        // Set other options for Custom Post Type
        $args = array(
        'label'               => __( 'products', 'twentythirteen' ),
        'description'         => __( 'product news and reviews', 'twentythirteen' ),
        'labels'              => $labels,
        // Features this CPT supports in Post Editor
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields','tags' ),
        // You can associate this CPT with a taxonomy or custom taxonomy.
        'taxonomies'          => array( 'genres' ),
        /* A hierarchical CPT is like Pages and can have
        * Parent and child items. A non-hierarchical CPT
        * is like Posts.
        */
        'hierarchical'        => true,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'page',
        );
        // Registering your Custom Post Type
        register_post_type( 'products', $args );
        }
        /* Hook into the 'init' action so that the function
        * Containing our post type registration is not
        * unnecessarily executed.
        */
        register_post_type( 'products' , $args );
        register_taxonomy("categories", array("products"), array("hierarchical" => true, "label" => "Categories", "singular_label" => "Category", "rewrite" => array( 'slug' => 'products', 'with_front'=> false )));
        add_action( 'init', 'custom_post_type', 0 );

    و با استفاده از کد زیر میخوام مطالب بعضی از دسته های این پست سفارشی رو نمایش بده :

     

    $cat_posts= new WP_Query(array( 'post_type'=>'products','post_status'=>'publish','order'=>'DESC','orderby'=>'ID','cat'=>'17','posts_per_page'=>'10')); 
    if($cat_posts->have_posts()):
    while($cat_posts->have_posts()): $cat_posts->the_post();?>
    <?php the_title();?>
    <?php endwhile; endif; wp_reset_query();

     

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

  2. سلام خسته نباشید من ی اسکریپت نیاز دارم ک ایمیل بفرسته برام نوشتمش اما وقتی ویرایشگر متن میزارم دیگه متن رو به ایمیل ارسال نمیکنه

    اینم کد


    <?php
    $ok = $_POST['send'];
    if($ok){
    $email = $_POST['email'];
    $listmail = file_get_contents("list.txt");
    $allmail = explode("\n", $listmail);
    $message = $_POST['message'];
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    foreach ($allmail as $value)
    {
    mail($value, $_POST['subject'], $message, $headers);
    }
    echo "<br /><b>ایمیل ارسال شد </b><br />";
    }
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="js/editor.js"></script>
    <script>
    $(document).ready(function() {
    $("#txtEditor").Editor();
    });
    </script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link href="js/editor.css" type="text/css" rel="stylesheet"/>
    <title>Email Pranks</title>
    </head>
    <body>
    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
    <b>From Name:</b><br>
    <input type="text" class="form-control" name="fromname" size="50"><br>
    <br><b>From Email:</b><br>
    <input type="text" class="form-control" name="fromemail" size="50"><br>
    <br><b>Subject:</b><br>
    <input type="text" class="form-control" name="subject" size="74"><br>
    <br><b>Your Message:</b><br>
    <textarea id="txtEditor" name="message" rows="5" cols="50">
    </textarea><br>
    <input type="submit" name="send" class="btn btn-success" value="Send">
    <input type="reset" class="btn btn-danger" value="Reset">
    </form>
    <?php if (isset($_GET['msg'])) { echo "<font color=\"red\"><h3 align=\"center\"> $_GET[msg] </h3></font>"; } ?>
    </body>
    </html>

  3. منظور من رو اصن متوجه نشدید بببینید فرض کنیم تو صفحه اصلی سه تا باکس داریم

    تو سه تا باکس سه تا موضوع مختلف هستش من میخوام مثلا 10 مطلب اخر هر دسته رو تو باکس نشون بدم حالا میخوام ی صفحه بندی باشه ، صفحه ک رد شد یعنی زدیم صفحه 10 مطلب بعدی هر سه دسته رو نشون بده

  4. یعنی میخاین توی صفحه اصلی سه تا لیست مطلب باشه که هرکدوم برای خودش صفحه بندی داشته باشه؟ اگر اینطور هست میتونید با کمی تغییر بازم ازکدی که دادم همراه ajax برای زیبایی استفاده کنید .

    با ایجکس چطور میتونم مطالب هر موضوع رو عوض کنم ؟!

  5. سلام خسته نباشید دوستان وقتتون بخیر من برای یک قسمت یک پست سفارشی پیاده کردم با این کد


    // Set UI labels for Custom Post Type
    $labels = array(
    'name' => _x( 'گالری ویدئو', 'Post Type General Name', 'twentythirteen' ),
    'singular_name' => _x( 'ویدئو', 'Post Type Singular Name', 'twentythirteen' ),
    'menu_name' => __( 'گالری ویدئو', 'twentythirteen' ),
    'parent_item_colon' => __( 'Parent Movie', 'twentythirteen' ),
    'all_items' => __( 'همه ی ویدئو ها', 'twentythirteen' ),
    'view_item' => __( 'View Movie', 'twentythirteen' ),
    'add_new_item' => __( '', 'twentythirteen' ),
    'add_new' => __( 'اضافه کردن', 'twentythirteen' ),
    'edit_item' => __( 'ویرایش ویدئو', 'twentythirteen' ),
    'update_item' => __( 'Update Movie', 'twentythirteen' ),
    'search_items' => __( 'Search Movie', 'twentythirteen' ),
    'not_found' => __( 'Not Found', 'twentythirteen' ),
    'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ),
    );

    // Set other options for Custom Post Type

    $args = array(
    'label' => __( 'گالری ویدئو', 'twentythirteen' ),
    'description' => __( '', 'twentythirteen' ),
    'labels' => $labels,
    // Features this CPT supports in Post Editor
    'supports' => array( 'title','thumbnail' ),
    // You can associate this CPT with a taxonomy or custom taxonomy.
    'taxonomies' => array( 'genres' ),
    /* A hierarchical CPT is like Pages and can have
    * Parent and child items. A non-hierarchical CPT
    * is like Posts.
    */
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'show_in_admin_bar' => true,
    'menu_position' => 5,
    'can_export' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'capability_type' => 'page',
    );

    // Registering your Custom Post Type
    register_post_type( 'video_gallery', $args );
    /* Hook into the 'init' action so that the function
    * Containing our post type registration is not
    * unnecessarily executed.
    */
    add_action( 'init', 'custom_post_type', 0 );

    من اگه قخواسته باشم تو همین منو یک زیر منو دیگه تعریف کنم باید کد رو چطور تغییر بدم ؟ یعنی مثلا الان منو پست سفارشی شامل ویدئو ها و افزودن هستش . من میخوام گزینه های دیگه مثل عکس . ویدئو . پاکدست تو یک منو باشه باید چیکار کنم ؟

  6. سلام من دوتا دامنه دارم ک روی یک هاست ست شده تو یکی از دامنه ها فونت ها لود نمیشن


    @font-face {
    font-family: 'yekan';
    src: url('fonts/yekan.otf') format('truetype'), /* IE6–8 */
    url('fonts/yekan.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
    url('fonts/yekan.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
    }

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

  7. سلام خسته نباشید تو یک برگه ک ساختم وقتی افزونه شماره صفحات رو فراخوانی میکنم مشکل داره و صفحه ها وقتی کلیک میکنم روش محتوای قبلی میاد. فک کنم تداخل داره با کوئری


    <!-- LEFT CONTAINER -->
    <section class="leftcontainer">
    <!-- POST -->
    <?php
    $select_blog = of_get_option('blog_category', '1' );
    query_posts("cat=$select_blog&post_status=publish");
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <article class="post">
    <figure>
    <a href="<?php the_permalink();?>">
    <?php if ( has_post_thumbnail()) the_post_thumbnail('blog'); else { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/default-image.jpg" alt="<?php the_title(); ?>" /><?php } ?> </a>
    <figcaption>
    <h2><?php the_title();?></h2>
    <div class="post-date"><?php the_time(__('d F Y ','')) ?></div>
    </figcaption>
    </figure>
    <?php the_content();?>
    <a href="<?php the_permalink();?>">ادامه مطلب...</a>

    </article>
    <hr/>
    <?php
    endwhile; else:
    endif;
    //Reset Query
    wp_reset_query();
    wp_pagenavi();
    ?>
    <!-- POST -->
    <!-- VIEW ALL BUTTON -->
    </section>

×
×
  • اضافه کردن...