0

I am creating an wordpress custom theme.I have created a top bootstrap menu that contains my pages.I have added the pages to the menu using functions.php.Here is the code for menu. require_once('wp_bootstrap_navwalker.php');

register_nav_menus( array(
    'primary' => __( 'Main Menu', 'News of Bangla' ),
    ) );

<nav class="Row navbar navbar-inverse navbar-fixed-top" role="navigation"> <!-- Top Navigation Menu Starts -->
        <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
        </button>
        </div>
        <?php
        wp_nav_menu( array(
                    'menu'              => 'Main Menu',
                    'theme_location'    => 'primary',
                    'depth'             => 2,
                    'container'         => 'div',
                    'container_class'   => 'collapse navbar-collapse navbar-ex1-collapse',
                    'menu_class'        => 'nav navbar-nav',
                    'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                    'walker'            => new wp_bootstrap_navwalker())
                );
        ?>
    </nav> <!-- Main Navigation Menu Ends-------- -->

Now i want to go to page.php when i click on the menu.I also want to get all the posts of that category under that page i have clicked.How can i do that?

1 Answers1

0

you want to use a wordpress page template for this.

First copy the page.php file from the twentyfourteen theme to your theme directory or use one of the examples on the page linked above.

then add all your custom code to this file to get your custom content from the loop and add a header to it that tells wordpress how that page is called:

<?php
/*
Template Name: Contact
*/
?>

after you did that you can assign this template to any page in the admin interface.

the button then would just turn into a link leading to the page you assigned the template to.

  • But if i want to create a custom link in index page that redirects to a custom page in the theme,how can i do that then?????? – Jayonta Sarkar Mar 14 '14 at 18:56
  • insert: link text where you want the link to be. if you want a button to link: http://stackoverflow.com/questions/2906582/how-to-create-an-html-button-that-acts-like-a-link you can also create a menu out of the link and add the menu to the page. you could also get the link of the page through a [function call](https://codex.wordpress.org/Function_Reference/get_post_permalink) – Jascha Ehrenreich Mar 14 '14 at 20:09