garyleatherman + coding   43

Adding Javascript To WordPress Themes The Right Way
function myprefix_add_inline_script() {
wp_add_inline_script( 'my-inline-js', 'alert("hello world");' );
}
add_action( 'wp_enqueue_scripts', 'myprefix_add_inline_script' );
wordpress  template  javascript  coding 
february 2017 by garyleatherman
Dynamic Copyright Revisited | WP First AidWP First Aid
a function to generate a dynamic copyright to display in themes.
wordpress  theme  coding  examples 
april 2015 by garyleatherman
WP_Query how to display posts from a specific Category
<div id="home-post-content" class="half-width half-right">
                <?php
                $category_id = get_cat_ID('featured');
                $catquery = new WP_Query( 'cat=' .$category_id. '&posts_per_page=1' );
                while($catquery->have_posts()) : $catquery->the_post();
                ?>
                <h2><?php the_title(); ?></h2>
                 
                <?php the_content(); ?>
                 
                <?php endwhile; ?>
                                 
                                <?php comments_template( '', true ); ?>
                 
            </div>
wordpress  theme  coding  webdev  tutorial 
april 2015 by garyleatherman

Copy this bookmark:



description:


tags: