hi,
please from the faq section:
i would like to totally remove the from the dom
You could do something like this:
1) Add this function to your functions.php file on you current theme
function return_page_title_html_block($post) { $is_page_title_active = get_post_meta($post->ID, $key = 'toggle_page_title', $single = true); if($is_page_title_active == '' || $is_page_title_active) return '
' . $post->post_title . '
'; return ' '; }
2) In your page.php file replace the title with the h1 tags to a call to echoing out the above function –
print return_page_title_html_block($post);
hope this helps 🙂
Yes, I found this but don’t understand it. I added the function to functions.php in my child theme. Can you explain part 2 more clearly in very simple terms? This is what I currently have in page.php in my child theme:
<?php
/**
* @package firmasite
*/
global $firmasite_settings;
get_header();
?>
<div id="primary" class="content-area clearfix <?php echo $firmasite_settings["layout_primary_class"]; ?>">
<?php if ( have_posts() ) : ?>
<?php do_action( 'open_content' ); ?>
<?php do_action( 'open_page' ); ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Type-specific template for the content.
If you want to support Post-Format, i suggest customize loop files with switch()
*/
global $post;
get_template_part( 'templates/single', $post->post_type );
?>
<?php endwhile; ?>
<?php do_action( 'close_page' ); ?>
<?php do_action( 'close_content' ); ?>
<?php else : ?>
<?php get_template_part( 'templates/no-results', 'index' ); ?>
<?php endif; ?>
</div><!-- #primary .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
hi,
take a look at:
get_template_part( 'templates/single', $post->post_type );
so if the post type is page, then under the folder templates you will probably have a file named single-page.php you need to edit this file, and replace the title with the h1 tags to a call that will echo out the new function you added to you’r functions.php. something like:
print return_page_title_html_block($post);
you can even change the original function to this:
function return_page_title_html_block($post) {
$is_page_title_active = get_post_meta($post->ID, $key = 'toggle_page_title', $single = true);
if ($is_page_title_active == '' || $is_page_title_active)
return '<h1 class="entry-title">' . $post->post_title . '</h1>';
return ' ';
}
and then replace all of the section including the h1 tags.
avner.
OK, so in single-page.php I find this
<header class="entry-header">
<h1 class="page-header page-title">
<strong><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'firmasite' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></strong>
<?php if (!empty($post->post_excerpt)){ ?>
<small><?php the_excerpt(); ?></small>
<?php } ?>
</h1>
</header>
and I should replace all of that with:
print return_page_title_html_block($post);
and change the function you asked me to add to functions.php to the new one you posted above?
hi,
sorry for the late replay, i was seek the past week.
did you managed to do it?
Yes, my colleague managed to fix it. I don’t know if he followed your instructions but it’s now resolved. Thanks for your help.