Last active
November 15, 2019 08:40
-
-
Save wadadanet/b7e74ff2cdee3fa56caff013daba1784 to your computer and use it in GitHub Desktop.
新着情報一覧表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<?php if ( have_posts() ): ?> | |
<?php while ( have_posts() ) : the_post();?> | |
<?php get_template_part( 'template-parts/item', 'news' ); ?> | |
<?php endwhile; ?> | |
<?php endif;?> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $news_query = new WP_Query('post_type=news'); ?> | |
<ul> | |
<?php if ( $news_query->have_posts() ): ?> | |
<?php while ( $news_query->have_posts() ) : $news_query->the_post();?> | |
<?php get_template_part( 'template-parts/item', 'news' ); ?> | |
<?php endwhile; ?> | |
<?php endif;?> | |
<a href="<?= get_post_type_archive_link('news') ?>">新着情報一覧</a> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// template-parts/items-news.phpファイルです。 | |
$link_active = get_field("link-active"); | |
if($link_active) { | |
$url = get_field("url"); | |
} else { | |
$url = get_permalink(); | |
} | |
?> | |
<li> | |
<a href="<?= $url ?>"><?= the_title(); ?></a> | |
</li> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment