は、ヒーローは私のワードプレスのサイト(私が「イントロ」というカスタムポストタイプを移入)のブログセクションに表示されますコードです:変更Wp_queryの引数
<?php
$args = array('post_type' => 'intro', 'posts_per_page' => 1);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post(); ?>
---more code here---
<?php endwhile; ?>
私は何かがあれば、私がホームページとして選んだどのページでも効果が出るように、2行目で何が変わるのだろうと思っています。
おかげ
編集1:あなたはそこに何も変更する必要はありません
<?php /* Template Name: eFrontpage */ ?>
<?php
$args = array('post_type' => 'intro', 'posts_per_page' => 1);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post(); ?>
<div class="point-1"></div>
<div class="home-intro" style="background-image: url(<?php
the_field('background-image'); ?>)">
<div class="home-intro-inside">
<h1 class="<?php the_field('intro_text_color'); ?>">
<?php the_field('intro-text'); ?>
</h1>
<a class="scroll-down <?php the_field('button_text_color'); ?>"
style="background-color: <?php the_field('button-background-color');
?>">
<?php the_field('button-text'); ?>
</a>
</div>
</div>
<div class="space"></div>
<script>
jQuery("body").addClass("intro-is");
</script>
<?php get_header(); ?>
<div id="primary" class="content-area container">
<main id="main" class="site-main" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('content', 'page'); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if (comments_open() || '0' != get_comments_number()) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
私は本当にあなたが何を望んでいるのかわかりませんが、このコードをフロントページだけにしたい場合は、このコードをfront-page.phpに配置できます。 –