[wp-hackers] Menu that links to specific content

MarvinC marvinc at gmail.com
Tue Nov 3 18:37:54 UTC 2009


Don't mean to seem scattered but I came across the WP-TOC plugin which works
in that it detects the Headings and displays a TOC based upon the [toc]
short-code. The problem is that it only works when placed on the page. So
image a really long page with a narrow width and a TOC box sitting in it. I
don't see anything in the Readme that states it can be used as a widget so
I've fired off an email to the author to confirm.

I would like to have a specific page template and tried to create a new
template file but think I may have done something wrong. Here are my steps:
1. Create new file: Test.php
2. Get errors after adding the following code to the beginning of the file:

<?php /*
Template Name:Test
*/ ?>
<?php get_header();?>

<?php include (TEMPLATEPATH . "/toc.php"); ?> or <?php include (TEMPLATEPATH
. "/wp-toc.php"); ?>

?>

Am I missing the obvious?

tia


On Tue, Nov 3, 2009 at 12:47 PM, mccormicky <mccormicky at gmail.com> wrote:

> As long as the ids of the TOC are unique go ahead and place the new CSS to
> style the TOC menu in the main WP stylesheet
> You could make a separate stylesheet for the TOC menu but some people frown
> on too many external stylesheets (tho'  it is lightweight enough not to
> matter really either way).
>
> As for including the TOC menu in only certain pages you could make special
> page templates and include the TOC just like you'd include a sidebar
>
> <?php /*
> Template Name:Special Page Template
> */ ?>
> <?php get_header();?>
>
> <?php include (TEMPLATEPATH . "/toc.php"); ?>
>
> etc
>
> ?>
>
>
> On Tue, Nov 3, 2009 at 12:33 PM, MarvinC <marvinc at gmail.com> wrote:
>
> > Thanks for the reply. SHould the CSS section be added to the style sheet?
> > I'm wondering how this would work in WP if I wanted to widgetize the TOC
> or
> > have the TOC to appear in a widget that only appears on select pages.
> >
> > On Tue, Nov 3, 2009 at 12:18 PM, Jason Benesch
> > <jason at realestatetomato.com>wrote:
> >
> > > In your header.php add this menu:
> > >
> > > <ul id="menu">
> > > <li><a href="#overview">Overview></a></li>
> > > <li><a href="#history">History</a></li>
> > > <li><a href="#middleofpage">Middle</a></li>
> > > <li><a href="#last"> Last</a></li>
> > > </ul>
> > >
> > > <style type="text/css">
> > > #menu li { float:left; }
> > > #menu li a { float:left; padding: 3px 8px; }
> > > </style>
> > >
> > >
> > >
> > > Then in your index.php file, or your archive.php file, or your page.php
> > > file
> > > or any main body template file, add some more anchors:
> > >
> > > <a name="overview">This is the overview section</a>
> > > ...... Stuff about the overview.......
> > >
> > > <a name="history">This is the history section</a>
> > > ...... Stuff about the history.......
> > >
> > >
> > >
> > > <a name="last">This is the last section</a>
> > > ...... Stuff about the last section of the page.......
> > >
> > > On Tue, Nov 3, 2009 at 5:49 AM, MarvinC <marvinc at gmail.com> wrote:
> > >
> > > > I understand this may be considered OT to the list but I'm "not
> getting
> > > > it".
> > > > Is there any way to clarify how this would work in Wordpress? Would I
> > > place
> > > > the code in the header.php file? It looks simple but since it's a
> first
> > > for
> > > > me I'm not seeing the big picture.
> > > > Any responses appreciated.
> > > >
> > > > On Thu, Oct 29, 2009 at 9:56 AM, mccormicky <mccormicky at gmail.com>
> > > wrote:
> > > >
> > > > > LINKS MENU:
> > > > > <a href="#overview">Overview</a>
> > > > > <a href="#history">History</a>
> > > > > <a href="#middleofpage">Middle</a>
> > > > > <a href="#last"> Last</a>
> > > > >
> > > > >
> > > > > CONTENT w/ANCHOR links
> > > > >
> > > > > <h3 id="overview">Overview</h3>
> > > > > <h3 id="history">History</h3>
> > > > > <p id="middleofpage">middle paragraph</p>
> > > > > <p id="last">End of page</p>
> > > > >
> > > > >
> > > > > On Thu, Oct 29, 2009 at 10:31 AM, Simon Blackbourn <
> > piemanek at gmail.com
> > > > > >wrote:
> > > > >
> > > > > > 2009/10/29 MarvinC <marvinc at gmail.com>
> > > > > >
> > > > > > > My apologies in advance if this isn't a "hack request" but I'm
> in
> > > > need
> > > > > of
> > > > > > a
> > > > > > > way to create a menu containing links that point to specific
> > > content
> > > > on
> > > > > a
> > > > > > > page. The content on most of the pages on a client site is long
> > so
> > > > what
> > > > > > > they
> > > > > > > request is the ability for the user to click to be taken to a
> > > > specific
> > > > > > area
> > > > > > > of the page, like so:
> > > > > > > Link 1: Overview
> > > > > > > Link 2: History
> > > > > > > Link 3: Middle of Page
> > > > > > > Link 4: Last Paragraph of Page
> > > > > > >
> > > > > > >
> > > > > > http://hackadelic.com/solutions/wordpress/toc-boxesautomatically
> > > > > > generates
> > > > > > a 'table of contents' for a post/page from the headers (h1, h2,
> > etc)
> > > in
> > > > > the
> > > > > > content.
> > > > > > _______________________________________________
> > > > > > wp-hackers mailing list
> > > > > > wp-hackers at lists.automattic.com
> > > > > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > > > > >
> > > > > _______________________________________________
> > > > > wp-hackers mailing list
> > > > > wp-hackers at lists.automattic.com
> > > > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > > > >
> > > > _______________________________________________
> > > > wp-hackers mailing list
> > > > wp-hackers at lists.automattic.com
> > > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > > >
> > >
> > >
> > >
> > > --
> > > Jason Benesch
> > >
> > > Real Estate Tomato
> > > Co-owner
> > > www.realestatetomato.com
> > > (619) 770-1950
> > > jason at realestatetomato.com
> > >
> > > ListingPress
> > > Owner, Founder
> > > www.listingpress.com
> > > (619) 955-7465
> > > jason at listingpress.com
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list