How to display only an excerpt of the content with custom post types?

<?php /* Template Name: second */ ?> <?php get_header(); ?> <?php query_posts(array(‘post_type’=>’event’)); ?> <?php if(have_posts()) while(have_posts()) : the_post(); ?> <div id=”post-<?php the_ID(); ?>” class=”entry”> <div class=”thumbnail”><?php the_post_thumbnail(‘full’); ?></div> <h1 class=”title”><?php the_title(); ?></h1> <div class=”content page”> <?php the_content(); ?> <?php wp_link_pages(array(‘before’ => ‘<div class=”page-link”>’.__(‘Pages’, ‘cpotheme’).’:’, ‘after’ => ‘</div>’)); ?> </div> </div> <?php endwhile; ?> <?php get_sidebar(); … Read more

Template for slug

I am using the “Edit Author Slug” plugin to provide public profile pages on my site using the following structure: mysite.com/users/username. Now, I want to show a list of all users on mysite.com/users/. But this returns a 404 because the “users” path is only a slug created by the plugin. Does WP provide the possibility … Read more

how to create template path for external (include) .js file

from my header file i can create template path easily for any .js file: <?php $templateDirPath = get_bloginfo( ‘template_directory’ ) . “https://wordpress.stackexchange.com/”; ?> <script type=”text/javascript” src=”<?php echo $templateDirPath; ?>js/scripts.js”></script> but inside the ‘scripts.js’ file has some include .js files (same directory) like below: include(‘js/mathUtils.js’); include(‘js/superfish.js’); include(‘js/switcher.js’); include(‘js/jquery.mousewhe i just want to know is there any … Read more

Template default arguments

If I am allowed to do the following: template <typename T = int> class Foo{ }; Why am I not allowed to do the following in main? Foo me; But I must specify the following: Foo<int> me; C++11 introduced default template arguments and right now they are being elusive to my complete understanding. 6 Answers … Read more

How to check if a variable exists in a FreeMarker template?

I have a Freemarker template which contains a bunch of placeholders for which values are supplied when the template is processed. I want to conditionally include part of the template if the userName variable is supplied, something like: [#if_exists userName] Hi ${userName}, How are you? [/#if_exists] However, the FreeMarker manual seems to indicate that if_exists … Read more