Posts

Showing posts from April, 2016

WP Slider

functions.php register_post_type('zboom',array( 'labels' => array( 'name' => 'zBoomSlider', 'add_new_item' => 'Slider Addition' ), 'public' => true, 'supports' => array( 'title','thumbnail' ) )); index.php <?php $slider_itm = new WP_Query(array( 'post_type' => 'zboom' )); ?> <?php while($slider_itm->have_posts()) : $slider_itm->the_post();?> <li><?php the_post_thumbnail(); ?></li> <?php endwhile; ?>

comments_popup_link();

comments_popup_link("","","","",""); 1. " "    "No Comments" {If there is not comments will show the message} 2. " "    "Single Comment" {If there is single comment will show the message} 3. " "    "% Comments" {% will show how many comments} 4. " "    "class" {Add Class to change design} 5. " "    "Comments Disable" {For disable comments}

WP read more

index.php <?php read_more(10); ?>.... <a href="<?php the_permalink(); ?>">read more</a> functions.php function read_more($limit){ $contents = explode(' ', get_the_content()); $less_contents = array_slice($contents, 0, $limit); echo implode(" ", $less_contents); }

Some WP Functions

comments_popup_link(); the_time(); the_title(); the_content(); dynamic_sidebar(); add_action();

WP time function

<?php the_time('d F, Y | g : i a'); ?>

Code for WP Sidebar

functions.php <?php function newx(){ register_sidebar(array( 'name' => 'left sidebar', 'description' => 'You can add widget here', 'id' => 'leftsidebar', 'before_title' => '<h3>', 'after-title' => '</h3>', 'before_widget' => '', 'after_widget' => '' )); register_sidebar(array( 'name' => 'Right sidebar', 'description' => 'You can add right widget here', 'id' => 'rightsidebar' )); } add_action('widgets_init','newx'); ?> index.php <?php dynamic_sidebar('leftsidebar'); ?>

https://getcomposer.org/

installation directory xampp/php/php.exe install ctrl+shift right button php -S localhost:8000

HTML Code Format

http://www.freeformatter.com/html-formatter.html

the_post_thumbnail

functions.php           <?php               add_theme_support('post-thumbnails');           ?> index.php           <?php               the_post_thumbnail();           ?>

WP Menu

functions.php         <?php load_theme_textdomain('wp_dev', get_template_directory_uri().'/languages'); register_nav_menus(array( 'primarymenu' => __('Main Menu','wp_dev'), 'footermenu' => __('Footer Menu','wp_dev') ));         ?> header.php        <?php             wp_nav_menu(array(                 'theme_location' => 'primarymenu'                 ));         ?>

important !!!!!!!

#bar ul li:hover a, #bar ul .current-menu-item a{ background: linear-gradient(#4D0017,#8B002A); }

How to make dynamic WordPress Content

    <?php while(have_posts()) : the_post(); ?>         <div class="articleTitle"><?php the_title(); ?></div>         <div class="articleContent">               <p><?php the_content(); ?></p>     </div>     <?php endwhile; ?>