Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Zany90

    (@zany90)

    Below I have included the code in the index.php file and also comments.php .. Sorry this is quite lengthy but I cant really provide the link to the site as the site has been built for someone else so can’t really have comments posted on it as its not actually my site.. Below are my index.php loop and comments.php file… Possibly im missing a line of code to display replies? everything else is working perfectly.

    comments.php

    <?php
    	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Please do not load this page directly. Thanks!');
    
    	if ( post_password_required() ) { ?>
    		<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
    	<?php
    		return;
    	}
    ?>
    
    	<div id="comments">
    	<h3 style="margin-top: 20px; margin-bottom: 20px;"><?php comments_number('No Comments', '1 Comment', '% Comments' );?></h3>
    
    	<?php if ( have_comments() ) : ?>
    
    	<ol class="commentlist">
    		<?php wp_list_comments('avatar_size=64&type=comment'); ?>
    	</ol>
    
    	<style>
    		.commentlist {
    			list-style-type: none;
    		}
    
    		.commentlist li {
    			margin-bottom: 20px;
    			background: #f1f1f1;
    			box-sizing: border-box;
    			padding: 10px;
    		}
    	</style>
    
    	<?php if ($wp_query->max_num_pages > 1) : ?>
    	<div class="pagination">
    		<ul>
    			<li class="older"><?php previous_comments_link('Older') ?></li>
    			<li class="newer"><?php next_comments_link('Newer') ?></li>
    		</ul>
    	</div>
    	<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php if ( comments_open() ) : ?>
    
    	<div id="respond">
    		<h3 style="margin-top: 20px;">Leave a Response</h3>
    
    		<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" style="margin-top: 20px;">
    		<fieldset  style="border: none;">
    			<label for="author">Name:</label>
    			<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" /><br />
    
    			<label for="email">Email:</label>
    			<input type="email" name="email" id="email" value="<?php echo $comment_author_email; ?>" /><br />
    
    			<label for="url">Website:</label>
    			<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" /><br />
    
    			<label for="comment">Message:</label>
    			<textarea name="comment" id="comment" rows="" cols=""></textarea><br />
    
    			<input type="submit" class="commentsubmit" value="Submit Comment" id="commentsubmit" />
    
    			<?php comment_id_fields(); ?>
    			<?php do_action('comment_form', $post->ID); ?>
    		</fieldset>
    		</form>
    		<p class="cancel"><?php cancel_comment_reply_link('Cancel Reply'); ?></p>
    	</div>
    		<?php else : ?>
    			<h3>Comments are now closed.</h3>
    	<?php endif; ?>
    	</div>

    The loop from index.php

    <?php if (have_posts ()) : ?>
    			<?php while(have_posts()) : the_post(); ?>
    
    			<?php if(is_sticky()):?>
    				<article id="sticky_post"><?php the_content(); ?></article>
    			<?php elseif(!is_sticky()):?>
    
    				<article class="post">
    					<h2 class="post_title"><a class="blog_titles" style="color: #000000;" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    
    					<p class="date"><?php the_time('F jS, Y') ?><br />
    					Posted in: <?php the_category(', ') ?><br />
    					<span style="font-style: italic;"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></span></p>
    
    					<div class="grey"><?php the_content(''); ?></div>
    
    					<a href="<?php the_permalink() ?>" class="readmore">Read More...</a>
    				</article>
    
    			<?php endif;?>
    
    			<?php endwhile; ?>
    
    			<ul id="older_newer">
    
    				<li id="older"><?php next_posts_link('Older Posts') ?></li>
    				<li id="newer"><?php previous_posts_link('Newer Posts') ?></li>
    
    			</ul>
    
    			<?php else : ?>
    
    				<h2>Nothing Here!</h2>
    
    			<?php endif; ?>
    Thread Starter Zany90

    (@zany90)

    One thing im wondering… Could the fact the page templates arent split down into header.php, pagename.php and footer.php like when creating a blog theme be the problem? I simply have /* Template Name: djdkdkd */ at the top of my documents

    Thread Starter Zany90

    (@zany90)

    Thanks ?? and just to confirm, these “title” strings will refer to the title inputted in the title bar when creating the page, rather than the permalink?

    Thread Starter Zany90

    (@zany90)

    I had tried this but it didnt seem to work

    <?php
    $home = get_page_by_title( ‘Home’ );
    $about = get_page_by_title( ‘About’ );
    $services = get_page_by_title( ‘Services’ );
    $contact = get_page_by_title( ‘Contact’ );

    wp_list_pages( ‘exclude=’ . $home->ID, $about->ID, $services->ID, $contact->ID ); ?>

    Thread Starter Zany90

    (@zany90)

    Ive seen get_page_by_title, although im unsure how to use it to get multiple page id’s and subsequently exclude all of those id’s in wp_list_pages?

    I know that the following code will exclude one page, but how do i exclude all 4 pages mentioned using this method?

    <?php
    $page = get_page_by_title( ‘About’ );
    wp_list_pages( ‘exclude=’ . $page->ID );
    ?>

Viewing 5 replies - 1 through 5 (of 5 total)