Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter tplove74

    (@tplove74)

    In my page.php why does ‘the loop’ come before the <article> tag?…

    Thread Starter tplove74

    (@tplove74)

    I’m not exactly sure how to restructure the php from the sample page…

    Here is the code from the page.php:

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages and that other
     * 'pages' on your WordPress site will use a different template.
     *
     * @package WordPress
     * @subpackage Twenty_Thirteen
     * @since Twenty Thirteen 1.0
    
     */
    
    get_header(); ?>
    
    <div id="primary" class="content-area">
    <div id="content" class="site-content" role="main">
    
    <?php /* The loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    <header class="entry-header">
    <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
    <div class="entry-thumbnail">
    <?php the_post_thumbnail(); ?>
    </div>
    <?php endif; ?>
    
    <?php if(is_page(2) ){
    
    }elseif( is_page(29)){} elseif( is_page(36)){}else{?>
    
    <h1 class="entry-title"><?php the_title(); ?></h1>
    
    <?php    }?>
    
    </header><!-- .entry-header -->
    
    <div class="entry-content">
    <?php the_content(); ?>
    
    <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
    
    </div><!-- .entry-content -->
    
    <footer class="entry-meta" style="margin-top:-60px">
    
    <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
    </footer><!-- .entry-meta -->
    </article><!-- #post -->
    <?php //comments_template(); ?>
    <?php endwhile; ?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    <?php //get_sidebar(); ?>
    <?php get_footer(); ?>

    [code fixed]

    Thread Starter tplove74

    (@tplove74)

    If I create a custom template as suggested above…Should ‘the loop’ be removed from the other page.php in my theme folder? Or will everything work without conflicts?

    Thread Starter tplove74

    (@tplove74)

    OK, Great! I’ll give those suggestions a try.

    This is my 1st time developing a wordpress site & its been like a reality show of survivors! But these forums has been a life-saver & I dearly appreciate the “give-free-receive-free” spirit here. Thank you both.

    I’ll be sure to pay it forward if & when I can.

    Thanks Guys.

    Thread Starter tplove74

    (@tplove74)

    Thanks ‘Pioneer Valley Web Design’!,

    I actually have a page named Blog now, how do I assign the custom page template to the Blog page?

    & yes I’m actually using a child theme from Twenty Thirteen. Does that mean that if certain files aren’t present/specified in the child theme it defaults to using the Twenty Thirteen theme?

    Thread Starter tplove74

    (@tplove74)

    Thanks esmi,

    I read thru the link & it seems to be in the general area/sense of what I’m looking for, But as I mentioned, I’m really new to php & was looking for an example a little more specific that I could more clearly see how to structure the php.

    I’ve included the html for the slider as a reference below:

    The slider features 4 panels, listed below as id=”tbtm-zero, one, two, three”. <img> displays the graphic, <h1> displays the title, <p> displays info & <a> is the link.

    Can I write code that basically says: for <h1> display the title of most recent wordpress post, for <p> grab description, etc…?

    <div id="tbtm_rotate">
      <div id="tbtm_zero">
    <section>									<img src="Site-images/Elijah3rdPlace.jpg" height="294" width="495">								<h1>TEAM MEMBER: ELIJAH WINS 3rd PLACE</h1>								<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p>
    
    </a><a href="#"></a>							</section>
    </div>
    
    <div id="tbtm_one">							<section>								<img src="Site-images/CrickTeamPhoto.jpg" height="294" width="495">								<h1>CRICK'S RACING FABRICATION</h1>									<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p>								<a href="#"></a>							</section>
    </div>
    
    <div id="tbtm_two">							<section>								<img src="Site-images/CortexRacing.jpg" height="294" width="495">								<h1>CORTEX RACING S197 XTREME GRIP <strong>SUSPENSION</strong></h1>								<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p>								<a href="#"></a>							</section>
    </div>
    
    <div id="tbtm_three">								<section>								<img src="Site-images/SonomaDriftNASA.jpg" height="294" width="495">								<h1>SONOMA DRIFT NASA TURN 11 DEMO</h1>								<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p>									<a href="#"></a>								</section>
    </div>
    
    </div>
    <a href="#"><</a>
    <a href="#">></a>
    </div><!-- //#tbtm_team_header  -->

    [Please use the code buttons when posting code]

    Thread Starter tplove74

    (@tplove74)

    Thank you MarkRH! I’m new to wordpress & still trying to sift thru the mountain of info. I will try that!

    Thread Starter tplove74

    (@tplove74)

    Ok. Understood. Thank you ‘leejosepho’ & ‘WPyogi’. The parent theme is actually “Twenty Thirteen’. So I believe youre right WPyogi, that the next update for that theme will wipe out my changes & break the layout of my site again. How can I override a “line-height” rule?

    Thread Starter tplove74

    (@tplove74)

    OK. That does look better! Thanks alot.

    So I will continue to reference my standard css files in header.php as normal. But should the “theme_name_scripts” function be located inside:

    • functions.php -or-
    • header.php?…
    Thread Starter tplove74

    (@tplove74)

    Can I revise the code above as follows:

    if( is_page( 'tbtm-about-page' ) ) {
    function theme_name_scripts() {
    	wp_enqueue_style( 'style-name', get_stylesheet_uri() );
    	wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
    }
    
    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
    }
    
    Thread Starter tplove74

    (@tplove74)

    Thanks alot! I’ve read so many conflicting articles you’ve confirmed my ideas.

    But you said that if I’m doing this on a page-by-page basis theres no point in registering the css/js files, but isnt registering/enqueueing the files a recommended practice?

    The register/enqueue statements go in function.php correct?

    & the ‘if’ statements goes into the header.php correct?

    Also should I structure them as separate if statements or if, else, elseif?…

    Thread Starter tplove74

    (@tplove74)

    Durgé,

    I’mmmmmmmmmm baaaaaaaaaaaaack!!! Anyways just wanted to give you an update on the code you referred me to in the posts above. I’m also new to php so I setup my wordpress site in Dreamweaver with php code-hinting & it seems there is an error with your suggestion, so I thought I’d post the code for your review…let me know what u think..(Also in the 1st line I replaced “is_page();” with: “is_page_template()(;” but that also threw an error)????

    <?php if ( is_page_template ( ‘tbtm-home-page.php’ ) ; ?>
    <link type=”text/css” rel=”stylesheet” href=”<?php bloginfo(‘template_url’) ?>/css/tbtm-homepage.css” />

    <?php if ( is_page ( ‘tbtm-about-page’ ); ?>
    <link type=”text/css” rel=”stylesheet” href=”<?php bloginfo(‘template_url’) ?>css/tbtm-about.css” />

    <?php if ( is_page ( ‘tbtm-team-page’ ); ?>
    <link type=”text/css” rel=”stylesheet” href=”<?php bloginfo(‘template_url’) ?>/css/tbtm-team.css” />
    <script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/tbtm-team-functions.js”></script>

    <?php if ( is_page ( ‘tbtm-contact-page’ ); ?>
    <link type=”text/css” rel=”stylesheet” href=”<?php bloginfo(‘template_url’) ?>css/tbtm-contact.css” />
    <script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/tbtm-sliding.form.js”></script>
    <script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/main.js”></script>

    Thread Starter tplove74

    (@tplove74)

    Thank you so much Durgé, your advice was excellent! I’m currently setting up the site with your suggestions…I’ll let u know how it turns out

    Thread Starter tplove74

    (@tplove74)

    Wow Thank you Durgé! I’ll try this one for sure.

    Also should the code you specified above be placed in “page.php”, “header.php” -or- “functions.php”?….

    Thread Starter tplove74

    (@tplove74)

    I also read on wp.tutsplus.com (https://wp.tutsplus.com/articles/how-to-include-javascript-and-css-in-your-wordpress-themes-and-plugins/) that the wordpress codex recommends using the “wp_register_script” function for js files & “wp_register_script” function for css files. & that the code can be placed in “functions.php”.

    However I’ve also read that custom fields should be used for setting up page specific css & js (https://www.designlessbetter.com/blogless/posts/page-specific-css-and-javascript-using-wordpress-custom-fields)

    But I would hope that your way, simple & clean would work just the same….any thoughts?…

Viewing 15 replies - 1 through 15 (of 17 total)