To enable comment:
functions.php function comment_scripts(){if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'comment_scripts' );
To enable featured image:
functions.php
add_theme_support( 'post-thumbnails', array( 'post' ) );
To enable crop feature:
functions.php
set_post_thumbnail_size( 200, 200, true );add_image_size( 'post-image', 150, 150, true );
Using Featured Image:
functions.php
add_theme_support( 'post-thumbnails', array( 'post' ) );<?php the_post_thumbnail('post-general-thumb', array('class' => 'img-responsive ')); ?>
single.php in WordPress:
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?><?php the_title(); ?>
<?php the_content(); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; ?>
<?php else : ?>
<?php _e('404 Error: Not Found'); ?>
<?php endif; ?>
archive.php in WordPress:
for Archive & Archive Post List
<h1><?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<?php _e('Archive for the'); ?> '< ?php echo single_cat_title(); ?>' < ?php _e('Category'); ?>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<?php _e('Archive for the'); ?> < ?php single_tag_title(); ?> Tag
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<?php _e('Archive for'); ?> < ?php the_time('F jS, Y'); ?>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<?php _e('Archive for'); ?> < ?php the_time('F, Y'); ?>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<?php _e('Archive for'); ?> < ?php the_time('Y'); ?>
<?php /* If this is a search */ } elseif (is_search()) { ?>
<?php _e('Search Results'); ?>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<?php _e('Author Archive'); ?>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<?php _e('Blog Archives'); ?>
<?php } ?>
For archive post query: <?php get_template_part( 'post-excerpt' ); // Post Excerpt (post-excerpt.php) ?>
If no post in archive or 404:
<?php else : ?> <h3>< ?php _e('404 Error: Not Found'); ?><?php endif; ?>
404.php in WordPress:
<h2>404 Error: Not Found<p>Sorry, but the page you are trying to reach is unavailable or does not exist.< /p >
Post Query in index.php:
<?php if(have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<div class="some">...............</div>
<?php endwhile; ?>
<?php endif; ?>
Pagination in index.php:
<div class="nav-previous"><?php next_posts_link( __( '< span class="meta-nav">← Older posts') ); ?>
</div>< div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→') ); ?>
</div>
Activate Option Tree:
functions.php
add_filter( 'ot_show_pages', '__return_false' );add_filter( 'ot_show_new_layout', '__return_false' );
add_filter( 'ot_theme_mode', '__return_true' );
include_once( 'option-tree/ot-loader.php' );
include_once( 'includes/theme-options.php' );
No comments:
Post a Comment