How to Create Custom Homepage in Wordpress

Asked

Viewed 564 times

-1

I’m creating a classified site where there will be multisites for each different city. I would like when you access my home page, show only one menu dropdown for the user to choose which site to access.

So far so good, I already have a plugin that creates this menu. However, I wanted to replace the original homepage of the theme, by this custom home page. Some blank page so I can customize with logo and insert the PHP code that the plugin generates.

The page is the style of telephone operators that opens a page asking us to choose the state.

I have already created a new template from this code:

<?php
/* Template Name: Home Customizada */
?>

However, the created page goes along with the theme data with all the content as header, menus and footer. I just wanted a blank page with the dropdown form that the plugin generates.

Follow the code of my header.php @Matheus Ilário:

    <div class="header_top">

            <div class="header_top_res">

                    <p>
                            <?php echo cp_login_head(); ?>

                            <a href="<?php echo appthemes_get_feed_url(); ?>" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/icon_rss.gif" width="16" height="16" alt="rss" class="srvicon" /></a>

                            <?php if ( get_option('cp_twitter_username') ) : ?>
                                    &nbsp;|&nbsp;<a href="http://twitter.com/<?php echo get_option('cp_twitter_username'); ?>" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/icon_twitter.gif" width="16" height="16" alt="tw" class="srvicon" /></a>
                            <?php endif; ?>
                    </p>

            </div><!-- /header_top_res -->

    </div><!-- /header_top -->


    <div class="header_main">

            <div class="header_main_bg">

                    <div class="header_main_res">

                            <div id="logo">

                                    <?php if ( get_option('cp_use_logo') != 'no' ) { ?>

                                            <?php if ( get_option('cp_logo') ) { ?>
                                                    <a href="<?php echo home_url(); ?>"><img src="<?php echo get_option('cp_logo'); ?>" alt="<?php bloginfo('name'); ?>" class="header-logo" /></a>
                                            <?php } else { ?>
                                                    <a href="<?php echo home_url(); ?>"><div class="cp_logo"></div></a>
                                            <?php } ?>

                                    <?php } else { ?>

                                            <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
                                            <div class="description"><?php bloginfo('description'); ?></div>

                                    <?php } ?>

                            </div><!-- /logo -->

                            <div class="adblock">
                                <?php appthemes_advertise_header(); ?>
                            </div><!-- /adblock -->

                            <div class="clr"></div>

                    </div><!-- /header_main_res -->

            </div><!-- /header_main_bg -->

    </div><!-- /header_main -->


    <div class="header_menu">

            <div class="header_menu_res">

            <a href="<?php echo CP_ADD_NEW_URL; ?>" class="obtn btn_orange"><?php _e( 'Post an Ad', APP_TD ); ?></a>

            <?php wp_nav_menu( array('theme_location' => 'primary', 'fallback_cb' => false, 'container' => false) ); ?>

            <div class="clr"></div>


            </div><!-- /header_menu_res -->

    </div><!-- /header_menu -->

HTML code of index.php

<div class="content_botbg">

    <div class="content_res">

        <?php
            if ( file_exists(STYLESHEETPATH . '/featured.php') )
                include_once(STYLESHEETPATH . '/featured.php');
            else
                include_once(TEMPLATEPATH . '/featured.php');
        ?>


        <!-- left block -->
        <div class="content_left">


            <?php if ( get_option('cp_home_layout') == 'directory' ) : ?>

                <div class="shadowblock_out">

                    <div class="shadowblock">

                        <h2 class="dotted"><?php _e( 'Ad Categories', APP_TD ); ?></h2>

                        <div id="directory" class="directory <?php if ( get_option('cp_cat_dir_cols') == 2 ) echo 'twoCol'; else echo 'Col'; ?>">

                            <?php echo cp_create_categories_list( 'dir' ); ?>

                            <div class="clr"></div>

                        </div><!--/directory-->

                    </div><!-- /shadowblock -->

                </div><!-- /shadowblock_out -->

            <?php endif; ?>


            <div class="tabcontrol">

                <ul class="tabnavig">
                    <li><a href="#block1"><span class="big"><?php _e( 'Just Listed', APP_TD ); ?></span></a></li>
                    <li><a href="#block2"><span class="big"><?php _e( 'Most Popular', APP_TD ); ?></span></a></li>
                    <li><a href="#block3"><span class="big"><?php _e( 'Random', APP_TD ); ?></span></a></li>
                </ul>

                <?php
                    remove_action( 'appthemes_after_endwhile', 'cp_do_pagination' );
                    if ( get_option('permalink_structure') == '' )
                        $post_type_url = add_query_arg( array( 'post_type' => APP_POST_TYPE, 'paged' => 2 ), site_url('/') );
                    else
                        $post_type_url = get_bloginfo('url').'/'.get_option('cp_post_type_permalink').'/page/2/';
                ?>


                <!-- tab 1 -->
                <div id="block1">

                    <div class="clr"></div>

                    <div class="undertab"><span class="big"><?php _e( 'Classified Ads', APP_TD ); ?> / <strong><span class="colour"><?php _e( 'Just Listed', APP_TD ); ?></span></strong></span></div>

                    <?php
                        // show all ads but make sure the sticky featured ads don't show up first
                        $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
                        query_posts( array( 'post_type' => APP_POST_TYPE, 'ignore_sticky_posts' => 1, 'paged' => $paged ) );
                        $total_pages = max( 1, absint( $wp_query->max_num_pages ) );
                    ?>

                    <?php get_template_part( 'loop', 'ad_listing' ); ?>

                    <?php
                        if ( $total_pages > 1 ) {
                    ?>
                            <div class="paging"><a href="<?php echo $post_type_url; ?>"> <?php _e( 'Ver mais', APP_TD ); ?> </a></div>
                    <?php } ?>

                </div><!-- /block1 -->


                <!-- tab 2 -->
                <div id="block2">

                    <div class="clr"></div>

                    <div class="undertab"><span class="big"><?php _e( 'Classified Ads', APP_TD ); ?> / <strong><span class="colour"><?php _e( 'Most Popular', APP_TD ); ?></span></strong></span></div>

                    <?php get_template_part( 'loop', 'featured' ); ?>

                    <?php
                        global $cp_has_next_page;
                        if ( $cp_has_next_page ) {
                            $popular_url = add_query_arg( array( 'sort' => 'popular' ), $post_type_url );
                    ?>
                            <div class="paging"><a href="<?php echo $popular_url; ?>"> <?php _e( 'Ver mais', APP_TD ); ?> </a></div>
                    <?php } ?>

                    <?php wp_reset_query(); ?>

                </div><!-- /block2 -->


                <!-- tab 3 -->
                <div id="block3">

                    <div class="clr"></div>

                    <div class="undertab"><span class="big"><?php _e( 'Classified Ads', APP_TD ); ?> / <strong><span class="colour"><?php _e( 'Random', APP_TD ); ?></span></strong></span></div>

                    <?php
                        // show all random ads but make sure the sticky featured ads don't show up first
                        $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
                        query_posts( array( 'post_type' => APP_POST_TYPE, 'ignore_sticky_posts' => 1, 'paged' => $paged, 'orderby' => 'rand' ) );
                        $total_pages = max( 1, absint( $wp_query->max_num_pages ) );
                    ?>

                    <?php get_template_part( 'loop', 'ad_listing' ); ?>

                    <?php
                        if ( $total_pages > 1 ) {
                            $random_url = add_query_arg( array( 'sort' => 'random' ), $post_type_url );
                    ?>
                            <div class="paging"><a href="<?php echo $random_url; ?>"> <?php _e( 'Ver mais', APP_TD ); ?> </a></div>
                    <?php } ?>

                </div><!-- /block3 -->


            </div><!-- /tabcontrol -->

        </div><!-- /content_left -->


        <?php get_sidebar(); ?>


        <div class="clr"></div>

    </div><!-- /content_res -->

</div><!-- /content_botbg -->

  • Hello Renato, welcome to Sopt. You need to specify the problem better, and join the code that is in trouble. Apparently, the subject of your question is not within Sopt’s purview. I even edited it to get the little code you posted, but I don’t think it’ll do any good. For template customization questions, I suggest you look for a specific forum. To understand which subjects are on topic, please read this topic http://meta.pt.stackoverflow.com/questions/264/quais-assuntos-devem-fazer-do-nosso-foco-on-topic. If you think your question is in scope, try reformulating it.

1 answer

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.