page-loader page-loader page-loader
web logo

" Bir yolun yalnız yolcusu… "

hızmetler
X : / Kod / WordPress /

2023-01-20


WordPress Custom Theme Single

 logo

WordPress Custom Theme Single

WordPress Custom Theme Single. Bu yazımızda wordpress custom tema yaparken single kısmında kullanılan kod listesi bulunmaktadır. Bu kodlar ile single kısmını yapabilirsiniz.

<?php  get_header();?>

<content>
	<div class="content">



		<h1 class="c_text">
			<?php the_title(); ?>
		</h1>
		<h2>
			<?php 
				$categories = array_reverse(get_the_category());
				$separator = ' / ';
				$output = '';
				if ( ! empty( $categories ) ) {
				foreach( $categories as $category ) {
					$output .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
				}
				echo '<br><div class="cntrxo"><p>=> '.$output.'</p><p>'.get_the_date().'</p></div>';
				}
			?>
		</h2>

		<hr class="space_2">

		<div id="img-container">
			<!-- #################################### -->



				<span class="blogbox">

					<?php if (has_post_thumbnail()): ?>
						<img src="<?php the_post_thumbnail_url() ?>" alt="logo">
					<?php endif ?>

					<?php if (have_posts()) : while (have_posts()) : the_post() ?>
						<div>
							<?php the_content(); ?>
						</div>
					<?php endwhile; endif; ?>


					<?php if( has_tag() ) : ?>
					    <?php 
					    echo '
						<div>
						<strong>
							Etiketler :
						</strong>
						<hr>
						<p>
					    ';				
					    echo get_the_tag_list('#',' , #','');
					    echo '
					    </p>
						</div>
					    <hr>
					    ';
					    ?>
					<?php endif; ?>
					</span>

					<div>
					<?php 
					if (get_previous_post()) {
						echo '<span>' . get_previous_post_link() . '</span>';
					}
					if (get_next_post()) {
						echo '<span>' . get_next_post_link() . '</span>';
					}
					?>
					</div>

					<hr>
					<h3>YORUMLAR</h3>
					<hr>
					<div>
						<ol class="commentlist comment_top">
							<?php
								wp_list_comments( 
									array( 
										'type' => 'comment', 
										'callback' => 'custom_comments' 
									)
									,get_comments(
										array( 
											'post_id' => $post->ID,
											// 'status' => 'approve'
										)
									)
								);
							?>


						</ol>
						<?php comments_template(); ?>

					</div>
					<hr>
				</span>


		</div>


	</div>
</content>

<?php  get_footer();?>

WORDPRESS KONULARI


Okumak ilerlemenin bir parçasıdır.

– EW

YORUMLAR



Bir cevap yaz


E-posta hesabınız yayımlanmayacak. Gerekli alanlar işaretlendi *