我有一个名为Jobs(https://www.bap.cc/jobs/)的Wordpress页面。 我想要显示两种不同的后期类型(Jobs& Jobsangbote)。
除了我的php中的活动功能外,一切都运行良好。第一个块“Wir suchen”没关系,“Wir bieten”活动功能不起作用。不知道为什么......
<?php
get_header(); ?>
<div class="overflow-y ios blur"><article class="article barba- container"><div id="agenturtext" class="text overflow firefox">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
echo '<header>';
the_title('<h1 id="agenturheader">','</h1>');
echo '</header>';
the_content();
// Include the page content template.
//get_template_part( 'content', 'page' );
// End the loop.
endwhile;
?>
</div>
<div id="float" class="overflow jobs firefox">
<div class="agenturbild">
<?php
$id=get_the_ID();
$thumbnail_id=get_post_thumbnail_id($id);
$tablet=wp_get_attachment_image_src($thumbnail_id, 'tablet')[0];
$srcset=wp_get_attachment_image_srcset($thumbnail_id);
$alt=get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true );
echo '<img src="' . $tablet . '" srcset="' . $srcset . '" alt="' . ($alt?$alt:' ') . '" class="lazyload"></div>' /*sizes="(max-width: 920px) 33vw, (max-width: 1200px) 50vw, (max-width: 1500px) 60vw, (max-width:2000px) 70vw, 80vw"*/; ?>
<div id="jobmenu">
<?php $args = array( 'post_type' => 'jobs', 'posts_per_page' => -1, 'orderby'=>'date', 'order'=>'DESC' );
$loop = new WP_Query( $args );
$a=0;
if ($loop->found_posts>1){
echo '
<div class="jobueberschrift"><h2 class="jobtitel">Wir suchen:</h2></div>';
$ID=get_the_ID();
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div><a href="' . get_the_permalink() . '" class="joblink' . (get_the_ID()===$ID?' jobactive':'') . '">';the_title('<h2>','</h2>');echo '</a></div>';
// Include the page content template.
get_template_part( 'content', 'page' );
// End the loop.
endwhile;
}
wp_reset_query();
?>
<?php $argsangebote = array( 'post_type' => 'jobsangebote', 'posts_per_page' => -1, 'orderby'=>'date', 'order'=>'DESC' );
$loop = new WP_Query( $argssangebote );
$a=0;
if ($loop->found_posts>1){
echo '
<div class="jobueberschrift" style="margin-top:52px !important;"> <h2 class="jobtitel">Wir bieten:</h2></div>';
$ID=get_the_ID();
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div><a href="' . get_the_permalink() . '" class="joblink' . (get_the_ID()===$ID?' jobactive':'') . '">';the_title('<h2>','</h2>');echo '</a></div>';
// Include the page content template.
get_template_part( 'content', 'page' );
// End the loop.
endwhile;
}
?>
</div>
</article></div>
<?php get_footer(); ?>