رفتن به مطلب

حذف پیام Not Found از صفحه اصلی بخاطر نبود مطلب


پست های پیشنهاد شده

باسلام و خسته نباشید

قالب سایتم discover هست توی صفحه اصلی نوشته ها رو مخی کردم ولی در دسته ها نمایش داده میشه

ولی در صفحه اصلی پیام خطای

Not Found

Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.

رو میده

چطور این پیام رو کامل بردارم؟

باتشکر

لینک به ارسال

میتونید یه صفحه اختصاصی بسازید و به آپاچی دستور بدید تا هر وقت خواست error 404 not found بده این صفحه رو نمایش بده...

در مثال زیر میخوایم صفحه ی 404.html واقع در پوشه ی errors برای این خطا نشون بده :

کد زیر را در .htaccess خودتون قرار بدید :


ErrorDocument 404 /errors/404.html

ویرایش شده توسط nimait70
لینک به ارسال

عزیز جان

شما سوال من رو دوباره بخونید من اصلا منظورم این نبود

آقا من میگم صفحه اصلی سایت ایرور 404 میده بخاطری که مطالب سایت رو من از صفحه اصلی سایت مخفی کردم

من نمیخوام این ایرور رو بده

ایرور به این شکله

vx8sz4106q5j418g554.png

لینک به ارسال

خب این باید در فایل index.php یا home.php باشه... اگه بلدید خودتون حذف کنید ،اگر نیستید کدشرون رو اینجا بزارید...

لینک به ارسال

محتویات index.php


<?php get_header(); ?>
<?php if(!is_front_page()) { ?>
<div id="subhead_container">

<div class="row">
<div class="twelve columns">


<?php
?>

<h1><?php if ( is_category() ) {
single_cat_title();
} elseif (is_tag() ) {
echo (__( 'Archives for ', 'discover' )); single_tag_title();
} elseif (is_author() ) {
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
echo (__( 'Archives for ', 'discover' )); echo $curauth->nickname;
} elseif (is_archive() ) {
echo (__( 'Archives for ', 'discover' )); single_month_title(' ', true);
} else {
wp_title('',true);
} ?></h1>

</div>

</div></div>

<?php } ?>

<!-- slider -->
<?php if(is_front_page()) { ?>
<div id="slider_container">
<div class="row">

<div class="four columns">

<h1><?php if(esc_html(of_get_option('welcome_head')) != NULL){ echo esc_html(of_get_option('welcome_head'));} else echo "Write your welcome headline here." ?></h1>
<p><?php if(esc_textarea(of_get_option('welcome_text')) != NULL){ echo esc_textarea(of_get_option('welcome_text'));} else echo "Nullam posuere felis a lacus tempor eget dignissim arcu adipiscing. Donec est est, rutrum vitae bibendum vel, suscipit non metus." ?></p>

<?php if(of_get_option('wel_button') != "off") { ?>

<?php if(esc_html(of_get_option('welcome_button')) != NULL){ ?>
<a class="button large" href="<?php if(esc_url(of_get_option('welcome_button_link')) != NULL){ echo esc_url(of_get_option('welcome_button_link'));} ?>"><?php echo esc_html(of_get_option('welcome_button')); ?></a>
<?php } else { ?> <a class="button large" href="<?php if(esc_url(of_get_option('welcome_button_link')) != NULL){ echo esc_url(of_get_option('welcome_button_link'));} ?>"> <?php echo "Download Now!" ?></a> <?php } ?>

<?php } ?>

</div>
<div class="eight columns">
<?php get_template_part( 'element-slider', 'index' ); ?>
</div>

</div>
</div>
<?php } ?> <!-- slider end -->

<!-- home boxes -->
<?php if(is_front_page()) { ?>

<div class="row" id="box_container">
<?php get_template_part( 'element-boxes', 'index' ); ?>
</div>

<!-- home boxes end -->
<div class="clear"></div>
<?php } ?>
<!--content-->
<div class="row" id="content_container">

<!--left col--><div class="eight columns">

<div id="left-col">

<?php get_template_part( 'loop', 'index' ); ?>
</div> <!--left-col end-->
</div> <!--column end-->
<?php get_sidebar(); ?>
</div>
<!--content end-->

<?php get_footer(); ?>

محتویات template-home.php


<?php
/*
Template Name: Home
*/
?>
<?php get_header(); ?>
<!-- slider -->
<div id="slider_container">
<div class="row">

<div class="four columns">

<h1><?php if(esc_html(of_get_option('welcome_head')) != NULL){ echo esc_html(of_get_option('welcome_head'));} else echo "Write your welcome headline here." ?></h1>
<p><?php if(esc_textarea(of_get_option('welcome_text')) != NULL){ echo esc_textarea(of_get_option('welcome_text'));} else echo "Nullam posuere felis a lacus tempor eget dignissim arcu adipiscing. Donec est est, rutrum vitae bibendum vel, suscipit non metus." ?></p>

<?php if(esc_html(of_get_option('welcome_button')) != NULL){ ?>
<a class="button large" href="<?php if(esc_url(of_get_option('welcome_button_link')) != NULL){ echo esc_url(of_get_option('welcome_button_link'));} ?>"><?php echo esc_html(of_get_option('welcome_button')); ?></a>
<?php } else { ?> <a class="button large" href="<?php if(esc_url(of_get_option('welcome_button_link')) != NULL){ echo esc_url(of_get_option('welcome_button_link'));} ?>"> <?php echo "Download Now!" ?></a> <?php } ?>

</div>
<div class="eight columns">
<?php get_template_part( 'element-slider', 'index' ); ?>
</div>

</div>
</div>
<!-- slider end -->

<!-- home boxes -->

<div class="row" id="box_container">
<?php get_template_part( 'element-boxes', 'index' ); ?>
</div>

<!-- home boxes end -->
<div class="clear"></div>

<?php get_footer(); ?>

لینک به ارسال

قایل loop.php یا template-loop.php یا کلا هرچی که loop داره رو اینجا بزارید..از اونجا احتمالا داره فراخوانی میکنه...

لینک به ارسال

کلا یه لوپ داشتم اونم اینه


<?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( ! have_posts() ) : ?>
<h1><?php _e( 'Not Found', 'discover' ); ?></h1>
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'discover' ); ?></p>
<?php get_search_form(); ?>
<?php endif; ?>
<!--loop starts here-->
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post-head">

<h1><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'discover' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if ( get_the_title() == '' ) { _e( '(No title)', 'discover' ); } else { the_title(); } ?></a></h1>

</div><!--post-heading end-->

<div class="meta-data">

<?php discover_posted_on(); ?> <?php _e('in', 'discover'); ?> <?php the_category(', '); ?> | <?php comments_popup_link( __( 'Leave a comment', 'discover' ), __( '1 Comment', 'discover' ), __( '% Comments', 'discover' ) ); ?>

</div><!--meta data end-->
<div class="clear"></div>
<div class="post-entry">
<?php if ( is_archive() || is_search() ) : ?>

<?php the_content( '<span class="read-more">'.__('Read More', 'discover').'</span>' ); ?>
<div class="clear"></div>
<?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'discover' ), 'after' => '' ) ); ?>

<?php else : ?>

<?php if ( has_post_thumbnail() ) { ?> <div class="entry-thumbnail"> <?php the_post_thumbnail(array(620,240)); ?> </div> <?php } ?>


<?php the_content( '<span class="read-more">'.__('Read More', 'discover').'</span>' ); ?>
<div class="clear"></div>
<?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'discover' ), 'after' => '' ) ); ?>
<?php endif; ?>

<!--clear float--><div class="clear"></div>


</div><!--post-entry end-->

<?php comments_template( '', true ); ?>
</div> <!--post end-->
<?php endwhile; // End the loop. Whew. ?>
<!--pagination-->
<div class="navigation">
<div class="alignleft"><?php next_posts_link( __( '← Older posts', 'discover' ) ); ?></div>
<div class="alignright"><?php previous_posts_link( __( 'Newer posts →', 'discover' ) ); ?></div>
</div>

لینک به ارسال

اگر اشتباه نکنم، این کد روباید حذف کنید..

<?php if ( ! have_posts() ) : ?>
<h1><?php _e( 'Not Found', 'discover' ); ?></h1>
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'discover' ); ?></p>
<?php get_search_form(); ?>
<?php endif; ?>

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

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