Posts by katstar01

2 posts
  • Bought between 1 and 9 items
  • Has been a member for 0-1 years
katstar01 says

So I’m trying to develop a single page theme for my own site, and for the most part I have all the pages displaying on one page, and I have all the links changed from mysite.com/link to mysite.com/#link. however, I am struggling to try to anchor these on the same page. btw sorry the format looks weird.

here’s the code to set the links in functions.php

<?php class description_walker extends Walker_Nav_Menu{ function start_el(&$output, $item, $depth, $args){ global $wp_query; $indent = ( $depth ) ? str_repeat( ”\t”, $depth ) : ’’; $class_names = $value = ’’; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ’ ’, apply_filters( ‘nav_menu_css_class’, array_filter( $classes ), $item ) ); $class_names = ’ class=”’. esc_attr( $class_names ) . ’”’; $output .= $indent . ‘

  • ’; $attributes = ! empty( $item->attr_title ) ? ’ title=”’ . esc_attr( $item->attr_title ) .’”’ : ’’; $attributes .= ! empty( $item->target ) ? ’ target=”’ . esc_attr( $item->target ) .’”’ : ’’; $attributes .= ! empty( $item->xfn ) ? ’ rel=”’ . esc_attr( $item->xfn ) .’”’ : ’’; if($item->object == ‘page’) { $varpost = get_post($item->object_id); if(is_home()){ $attributes .= ’ href=”#’ . $varpost->post_name . ’”’; }else{ $attributes .= ’ href=”’.home_url().’/#’ . $varpost->post_name . ’”’; } } else $attributes .= ! empty( $item->url ) ? ’ href=”’ . esc_attr( $item->url ) .’”’ : ’’; $item_output = $args->before; $item_output .= ‘’; $item_output .= $args->link_before . apply_filters( ‘the_title’, $item->title, $item->ID ); $item_output .= $args->link_after; $item_output .= ‘’; $item_output .= $args->after; $output .= apply_filters( ‘walker_nav_menu_start_el’, $item_output, $item, $depth, $args ); } }

    ?>

    This is the code I have to call the pages in front-page.php. Also, I want the order of the pages to display menu order, but the code I have doesn’t work. any suggestions would be a plus

    <?php if (($locations = get_nav_menu_locations()) && $locations[‘primary’] ) { $menu = wp_get_nav_menu_object( $locations[‘primary’] ); $menu_items = wp_get_nav_menu_items($menu->term_id); $pageID = array(); foreach($menu_items as $item) { if($item->object == ‘page’) $pageID[] = $item->object_id; } query_posts( array( ‘post_type’ => ‘page’,’post__in’ => $pageID, ‘posts_per_page’ => count($pageID), ‘orderby’=>’menu_order’,’order’=>’ASC’ ) ); } while(have_posts() ) : the_post();

    ?>
    <!-start the loop->
    <article <?php post_class() ?> id="post-<?php the_ID(); ?>">
            <header>
                

    <?php the_title(); ?>

    <?php reverie_entry_meta(); ?> </header> <?php the_content(); ?> <footer> <?php wp_link_pages(array('before' => '<nav id="page-nav">

    ' . __('Pages:', 'reverie'), 'after' => '

    </nav>' )); ?>

    <?php the_tags(); ?>

    </footer> <?php comments_template(); ?> </article> <!-end loop->

    <?php endwhile;?>

    my code was based off of this tutorial: http://www.themevan.com/build-an-one-page-portfolio-website-with-wordpress/

    Your help is much appreciated!

  • 2 posts
    • Bought between 1 and 9 items
    • Has been a member for 0-1 years
    katstar01 says

    if you have, how do you like it? Do you think it would be a suitable framework for selling templates? Would it play well with wordpress?

    by
    by
    by
    by
    by
    by