How to add anchor tag at the top of posts, past the header and nav bar?

my site is here: http://wedding.chloe-nguyen.com/

I am using the default Twenty Fourteen theme, modifying in a child theme (my first).

Read More

Scroll down and click one of the featured posts. You get taken to the single post page at the top of the page. I would like it to scroll down past the castle, past the nav bar, to the top of the title of the post. I would like my readers to get to the content while keeping the full-screen announcement on every page. I’ll add a secondary nav in the right sidebar via a widget.

I found this: http://wordpress.org/support/topic/automatically-scroll-down-to-content?replies=6 but I don’t know JS and the OP’s site is no longer a header followed by the post(s).

On my site, the div that holds the content is <div id="main" class="site-main">
(I did not change this; it is the default code in the Twenty Fourteen theme)

Therefore, I think the answer is to make the links that go to posts have #main at the end, but I don’t know how.

Here’s the featured-content.php code:

<?php
/**
 * The template for displaying featured content
 *
 * @package WordPress
 * @subpackage Twenty_Fourteen
 * @since Twenty Fourteen 1.0
 */
?>

<div id="featured-content" class="featured-content">
    <div class="featured-content-inner">
    <?php
        /**
         * Fires before the Twenty Fourteen featured content.
         *
         * @since Twenty Fourteen 1.0
         */
        do_action( 'twentyfourteen_featured_posts_before' );

        $featured_posts = twentyfourteen_get_featured_posts();
        foreach ( (array) $featured_posts as $order => $post ) :
            setup_postdata( $post );

             // Include the featured content template.
            get_template_part( 'content', 'featured-post' );
        endforeach;

        /**
         * Fires after the Twenty Fourteen featured content.
         *
         * @since Twenty Fourteen 1.0
         */
        do_action( 'twentyfourteen_featured_posts_after' );

        wp_reset_postdata();
    ?>
    </div><!-- .featured-content-inner -->
</div><!-- #featured-content .featured-content -->

Of course, this doesn’t include the next post / previous post links, links to posts from the calendar, etc. I just thought I would start with the ft posts. How do I say, “on every post link, add #main at the end”? Am I looking in the wrong place?

I saw this: Appending anchor tag to next post which is the closest discussion thread I can find to what I need. I found the add_filter function in the WP Codex but I am unsure about what to put in the parentheses and single quote marks.

Thank you in advance.

Sincerely,

Chloe

Related posts

Leave a Reply