WordPress Theme code

By
Advertisement
WordPRess theme

<?php bloginfo('template_url' ); ?>/images/logo.jpg

WP MENU
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>

SITE URL
<?php bloginfo('url'); ?>

SHORTCODE
<?php echo do_shortcode('[shortcode]'); ?>

FUNCTIONS.PHP => CTRL+F => SIDEBAR => COPY PASTE WIDGET CODE
name => (change name)
ID => (change ID)
description => (change DESC)

/* <?php dynamic_sidebar('ID'); ?> */
<?php dynamic_sidebar('sidebar-4'); ?>

FUNCTIONS.PHP => FIND => MENU
<? register_nav_menu('footer_menu'__( 'Footer Menu', 'twentytwelve')); ?>
IN FOOTER ADD THIS TO SHOW FOOTER MENU 
<?PHP wp_nav_menu(array('theme_location' => 'footer_menu')); ?>

CODE FOR POSTS LOOP
<?php
$posts = new WP_Query(array(
 'posts_per_page' => 5, //-1 for unlimited posts
 'offset' => 0, //starting posts from zero
 'category_name' => 'events', //events is category slug
 'post_type' => 'post',
 'post_status' => 'publish'
 ));
if($posts -> have_posts()):
 while ($posts -> have_posts()): $posts -> the_post(); ?>
  <h2><?php the_title(); ?></h2>
  <?php the_excerpt(); ?>
  <?php the_post_thumbnail(); ?>
  <a href="<?php the_permalink(); ?>">Read more</a>
 <?php endwhile;
 
else:
echo "No posts here";

endif;
wp_reset_query();
?>

0 comments:

Post a Comment