Pay money and get answers for your WordPress questions (more info)

Remove menu/header from blog page template

  • SOLVED

If i could edit the blog template (keep a backup of original of course) to not have the header (with menu etc) and footer or siderbar and apply that instead of the default blog template.

This would be applied to only the blog page (including blog category page, uses same template) so when viewed in the iframes on [[LINK href="http://www.strausshosting.com.au/~energeti/testing/"]]this page [[/LINK]]

I want to make you only see the posts, no menu/header, sidebars or footer.

See attached image for desired result (i used google chromes inspect element to delete the sidebar div, header div and footer div)

Here is the code for the blog template, however i cant see where the header, footer and sidebar are inserted

<?php
/*
* This file is a template part
* produces WordPress Loop for use in index.php (posts page)
* moved to theme root from contents folder @since version 2.6
*/

$ka_blogtitle = get_option('ka_blogtitle');
$ka_searchbar = get_option('ka_searchbar');
$ka_crumbs = get_option('ka_crumbs');
$ka_blogbutton = get_option('ka_blogbutton');
$ka_blogauthor = get_option('ka_blogauthor');
$ka_related_posts = get_option('ka_related_posts');
$ka_related_posts_title = get_option('ka_related_posts_title');
$ka_related_posts_count = get_option('ka_related_posts_count');
$ka_posted_by = get_option('ka_posted_by');
$ka_post_date = get_option('ka_post_date');
if ($ka_post_date != "false"){ $ka_post_date_result = 'style="background:none !important;"';}else{$ka_post_date_result = '';}
$ka_dragshare = get_option('ka_dragshare');
$blog_image_frame = get_option('ka_blog_image_frame');

if (have_posts()) : while (have_posts()) : the_post();

//retrieve all post meta of posts in the loop.

$linkpost = get_post_meta($post->ID, "_jcycle_url_value", $single = true);
$external_image_url = get_post_meta($post->ID,'truethemes_external_image_url',true);
$video_url = get_post_meta($post->ID,'truethemes_video_url',true);
$permalink = get_permalink($post->ID);
//prepare to get image
$thumb = get_post_thumbnail_id();
$image_width = 190;
$image_height = 111;

//use truethemes image croping script, function moved to truethemes_framework/global/basic.php
$image_src = truethemes_crop_image($thumb,$external_image_url,$image_width,$image_height);

?>

<?php
//required by theme check plugin
//need to use post_class() http://codex.wordpress.org/Template_Tags/post_class
//or http://codex.wordpress.org/Function_Reference/get_post_class
//these are special style class, use browser view source to see.
$array_post_classes = get_post_class();
$post_classes = '';
foreach($array_post_classes as $post_class){
$post_classes .= " ".$post_class;
}
?>
<div class="blog_wrap <?php echo $post_classes;?>">

<div class="post_title">

<?php truethemes_begin_post_title_hook();// action hook, see truethemes_framework/global/hooks.php ?>

<?php if ($linkpost == ''){ ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php }else{ ?><h2><a href="<?php echo $linkpost; ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2><?php } ?>
<?php if ($ka_posted_by != "true") {?><p class="posted-by-text"><span><?php _e('Posted by:', 'truethemes_localize') ?></span> <?php the_author_posts_link(); ?></p><?php }else{}?>

<?php truethemes_end_post_title_hook();// action hook, see truethemes_framework/global/hooks.php ?>

</div><!-- end post_title -->


<div class="post_content" <?php echo $ka_post_date_result; ?>>

<?php truethemes_begin_post_content_hook();// action hook, see truethemes_framework/global/hooks.php ?>

<?php
//function to generate internal image, external image or video for content-blog.php, content-blog-single.php, and archive.php
//please find it in truethemes_framework/global/basic.php

$html = truethemes_generate_blog_image($image_src,$image_width,$image_height,$blog_image_frame,$linkpost,$permalink,$video_url);

echo $html;
?>

<?php limit_content(30, true, '');
get_template_part('theme-template-part-inline-editing','childtheme'); ?>
<a class="ka_button small_button" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><span><?php echo $ka_blogbutton; ?></span></a>
<?php if(function_exists('selfserv_shareaholic')) { selfserv_shareaholic(); } ?>

<?php if ($ka_post_date != "true"): ?>
<div class="post_date">
<span class="day"><?php the_time('j'); ?></span>
<br />
<span class="month"><?php echo strtoupper(get_the_time('M')); ?></span>
</div><!-- end post_date -->

<div class="post_comments">
<a href="<?php echo the_permalink().'#post-comments'; ?>"><span><?php comments_number('0', '1', '%'); ?></span></a>
</div><!-- end post_comments -->
<?php endif; ?>

<?php
global $post;
$post_title = get_the_title($post->ID);
$permalink = get_permalink($post->ID);
if ($ka_dragshare == "true"){ echo "<a class='post_share sharelink_small' href='$permalink' data-gal='prettySociable'>Share</a>"; }

?>


<?php truethemes_end_post_content_hook();// action hook, see truethemes_framework/global/hooks.php ?>

</div><!-- end post_content -->


<div class="post_footer">

<?php truethemes_begin_post_footer_hook();// action hook, see truethemes_framework/global/hooks.php ?>

<div class="post_cats"><p><span><?php _e('Categories:', 'truethemes_localize') ?></span> <?php the_category(', '); ?></p></div><!-- end post_cats -->

<?php if (get_the_tags()) : ?>
<div class="post_tags"><p><span><?php _e('Tags:', 'truethemes_localize') ?></span> <?php the_tags('', ', '); ?></p></div><!-- end post_tags -->
<?php endif; ?>

<?php truethemes_end_post_footer_hook();// action hook, see truethemes_framework/global/hooks.php ?>

</div><!-- end post_footer -->

</div><!-- end blog_wrap -->


<?php endwhile; else: ?>
<h2><?php _e('Nothing Found', 'truethemes_localize') ?></h2>
<p><?php _e('Sorry, it appears there is no content in this section.', 'truethemes_localize') ?></p>
<?php endif; ?>
<?php
if(function_exists('wp_pagenavi')) {
wp_pagenavi();
}else{
//not using this function, just for theme check plugin requirement.
//do not remove this..
paginate_links();
}
?>


Please point out what code needs to be removed/replaced to achieve this

Answers (2)

2013-02-05

Kiet Luong answers:

You should create new template file to achieve that instead of using iframe.
If possible please contact with me on skype: [[LINK href="http://www.wpquestions.com/user/profile/id/10125"]]kioluong[[/LINK]]

Regards !


tokenofhon comments:

the point of the iframes though is to display the 2 different blog pages on the same page (as the different pages have seperate category posts)

creating a new template is for the actual blog pages (2) that are being placed in the iframes


Kiet Luong comments:

you can use wordpress function <?php get_page( $page_id ) ?> to achieve what you want with


Return Values
(object|array)
mixed Page data.
[ID] => (integer)
[post_author] => (integer)
[post_date] => (YYYY-MM-DD HH:MM:SS)
[post_date_gmt] => (YYYY-MM-DD HH:MM:SS)
[post_content] => (all post content is in here)
[post_title] => (Post Title Here)
[post_excerpt] => (Post Excerpt)
[post_status] => (? | publish)
[comment_status] => (? | closed)
[ping_status] => (? | closed)
[post_password] => (blank if not specified)
[post_name] => (slug-is-here)
[to_ping] => (?)
[pinged] => (?)
[post_modified] => (YYYY-MM-DD HH:MM:SS)
[post_modified_gmt] => (YYYY-MM-DD HH:MM:SS)
[post_content_filtered] => (?)
[post_parent] => (integer)
[guid] => (a unique identifier that is not necessarily the URL to the Page)
[menu_order] => (integer)
[post_type] => (? | page)
[post_mime_type] => ()?)
[comment_count] => (integer)
[ancestors] => (object|array)
[filter] => (? | raw)


More infomation [[LINK href="http://codex.wordpress.org/Function_Reference/get_page"]]here[[/LINK]]


Kiet Luong comments:

The best way is create new template file use wordpress function to shown content and use css to style.

2013-02-05

Arnav Joy answers:

you do not need to create a new page , you can call page's specific areas with in iframe using style

i did something similar in this question , please read it and let me know if it is ok with you too

http://www.wpquestions.com/question/showChronoLoggedIn/id/7943


tokenofhon comments:

That could work, would you be able to provide something similar for my site? or can i just copy + paste from the other thread and swap the web address in the iframe

Also, width and height % doesnt work in html 5 as far as im aware, so ill change it to pixels?


tokenofhon comments:

i just tested applying your solution and this worked, however there is no scroll bar, how would i add that? (i tried scrolling="yes" in the iframe to no avail)

Also, would it be possible to make it a little largere in width? i tried adjusting the width in style (up to 80% and 100%) however it only changes the viewing box size, rather than the content size.


tokenofhon comments:

Sorry to triple post, just noticed it cuts down a little bit too far (missing first post)


Arnav Joy comments:

can you show a screenshot of how you would like to have it?

the link which i showed you is just for reference and not the actual solution you want , you have to adjust css to match the result you want.


tokenofhon comments:

Here is screenshot 1, showing how id like it, with the default blog page in the first iframe, and the 2nd iframe containing the events category (this is just done via different http: addresses in iframe, they will both need to scroll down the equal distance to the first post.