Making images from single.php pointing to an attachment .php template

If I understand you correctly, you need to link your images not to the file, but to the attachment template (attachment.php). If so, then try the following code in your single.php: <?php if( has_post_thumbnail() ) { $attachment_page_url=””; $attachment_page_url = get_attachment_link( get_post_thumbnail_id() ); ?> <a href=”<?php echo $attachment_page_url; ?>” class=”featured-image”> <?php the_post_thumbnail(); ?> </a> <?php } … Read more

What content should go in index.php?

Index.php isn’t for a specific page, and that’s not how template files in themes work. You will need to understand the template heirarchy http://codex.wordpress.org/Template_Hierarchy WordPress uses the Query String — information contained within each link on your web site — to decide which template or set of templates will be used to display the page. … Read more

Dynamically assign same page template to child page as parent

Paste following code to your theme’s functions.php: add_action(‘save_post’,’changeTemplateOnSave’); function changeTemplateOnSave(){ global $post; $curr_tmp = get_post_meta($post->ID, ‘_wp_page_template’, true); $parent_tmp = get_post_meta($post->post_parent, ‘_wp_page_template’, true); if($post->post_parent) update_post_meta($post->ID,’_wp_page_template’,$parent_tmp,$curr_tmp); } This will force WordPress to change page template to it’s parent template on post save. Not tested but should work.

How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?

ok, this is my working solution: <?php $args=array( ‘post_type’ => ‘biblioteka’, ‘child_of’ => 0, ‘parent’ => ”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ => ”, ‘number’ => ”, ‘taxonomy’ => ‘kategoria-pozycji’, ‘pad_counts’ => false ); $categories=get_categories($args); foreach ( $categories as $category ) { if ( … Read more

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