Excerpts for Pages

Using the “more” tag does not create an excerpt. It simply creates a “Read More” link when displaying the_content() on index pages. Excerpts are created/displayed as follows: To display an excerpt, your template file needs to call “the_excerpt()” rather than “the_content()”. Note: you use the equivalent $post->post_excerpt, which should also work just fine. The “the_excerpt()” … Read more

Multiple Page Templates & CSS

This isn’t really WordPress specific, but from the server perspective it would add additional http requests for visitors to load additional css files, versus pulling the same site-wide css file from cache. From a css perspective, I prefer to keep it all in one file. Some people prefer to organize things differently, like all text … Read more

Running a loop with a custom query string on a custom page template

You should remove $query_string from the template. the Quesry string contains params specific to your page… your loop should look like this: <?php query_posts(“posts_per_page=10&cat=3&orderby=asc&paged=”.get_query_var(‘paged’)); if (have_posts()): while(have_posts()): the_post(); <!– your custom data here –> the_title(); the_content(); endwhile; endif; ?>

How do I pass data from page content to the underlying PHP template

If you want to produce a page in WordPress whose structure and content are dynamically generated independent of the regular posts handling mechanism then: Create a new page with title “My Custom Page“. This generates the page slug ‘my-custom-page‘ by default. In the root of your active theme folder eg. \wp-content\themes\twentyeleven\ create a page template … Read more

Create a loop that gets pages with their template

The snippet from codex is a bit redundant in your case. You can achieve what you need, by using snippets like these: index.php $mainpage = get_page_by_title( ‘ROOT’ ); $the_query = new WP_Query( array( ‘post_parent’ => $mainpage->ID, ‘post_type’ => ‘page’, ) ); $index = 0; while ( $the_query->have_posts() ) : $the_query->the_post(); echo ‘<section class=”page’ . get_the_ID() … Read more

Create Template for Custom Post Type same like for Page

It sounds like you are talking about this page display template: page-{slug}.php – If the page slug is recent-news, WordPress will look to use page-recent-news.php And you want single-{cpt-slug}-{slug}.php. If so, I believe you can approximate that page template handling with the following: function cpt_slug_template_wpse_117630($template) { global $post; $templ = locate_template(‘single-‘.$post->post_type.’-‘.$post->post_name.’.php’); if ( ‘book’ == … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)