Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

Footer not showing on taxonomy of custom post type template

$
0
0

So I have page named "Footer" where all the info is stored for the footer, also I have category.php which is a template I use for custom taxonomy I made for custom post type I made. Query that outputs data for footer works on all other pages just not on the pages for custom taxonomies. I tried multiple things but seems like something is preventing footer query to run on the category.php template for some reason. Here's the code

footer.php

<?php$args = array('page_id' => 21);$footerQuery = new WP_Query($args);if ($footerQuery->have_posts()) {    // Loop through the posts (in this case, just one)    while ($footerQuery->have_posts()) {        $footerQuery->the_post();?><footer class=""><div class="container mx-auto"><div class="footerGrid grid lg:grid-cols-3 gap-4 py-10 mx-10"><!-- Left side --><div class="col-span-2"><div class="logoWrapper"><a href="<?php echo site_url(); ?>"><?php                             $custom_logo_id = get_theme_mod( 'custom_logo' );                            $logo = wp_get_attachment_image_src( $custom_logo_id , 'logo-size' );                            if ( has_custom_logo() ) {                                echo '<img class="logo" src="' . esc_url( $logo[0] ) . '" alt="' . get_bloginfo( 'name' ) . '">';                            } else {                                echo '<h1>' . get_bloginfo('name') . '</h1>';                            }                        ?></a></div><div class="footer_leftSide_content max-w-[420px]"><?php if( have_rows('footer_content_left_side') ): ?><?php while( have_rows('footer_content_left_side') ): the_row();                             // Get sub field values.                            $heading = get_sub_field('footer_content_left_side_heading');                            $subheading = get_sub_field('footer_content_left_side_subheading');                            ?><h3 class="text-white font-prompt font-normal text-2xl mt-12 mb-4"><?php echo $heading; ?></h3><h4 class="text-white font-prompt font-normal text-lg"><?php echo $subheading; ?></h4><a class="getInTouch_button py-2 px-5 bg-green text-brown font-jost font-normal text-lg rounded-lg mt-6" type="button" href="<?php echo site_url('/contact')?>" target="_blank">Get in touch &#8594;</a><?php endwhile; ?><?php endif; ?></div></div><!-- Right side --><div class="hidden lg:block col-span-1 mx-auto my-auto"><div class="footer_rightSide_content"><?php if( have_rows('footer_content_right_side') ): ?><?php while( have_rows('footer_content_right_side') ): the_row();                             // Get sub field values.                            $email = get_sub_field('footer_content_right_side_email');                            $phoneNumber = get_sub_field('footer_content_right_side_phone_number');                            ?><a href="mailto:<?php echo $email; ?>" class="footerLinks text-white font-prompt font-normal text-lg my-1"><?php echo $email; ?></a><a href="tel:<?php echo $phoneNumber; ?>" class="footerLinks text-white font-prompt font-normal text-lg"><?php echo $phoneNumber; ?></a><div class="footerRight_socialMedia flex justify-start mt-5"><?php                            if( have_rows('footer_content_right_side_social_media_icons') ):                                while( have_rows('footer_content_right_side_social_media_icons') ) : the_row();                                    $socialMedia_icon = get_sub_field('footer_content_right_side_repeater_icon');                                    $socialMedia_link = get_sub_field('footer_content_right_side_repeater_link');                                    $size = 'social-media-icons';                                    if( $socialMedia_icon ) { ?><a href="<?php echo $socialMedia_link; ?>" target="_blank"><?php echo wp_get_attachment_image( $socialMedia_icon, $size ); ?></a><?php                                     }                                endwhile;                            endif;                            ?></div><?php endwhile; ?><?php endif; ?></div></div></div></div></footer><?php        }    } else {        // No posts found        echo '<p>Page not found.</p>';    }    wp_reset_postdata();?><?php wp_footer(); ?></body></html>

category.php

<?php get_header(); ?><!-- Projects Heading Section --><section id="aboutUs_heading"><div class="container mx-auto"><div class="mx-10"><div class="aboutUs_heading__wrapper pt-24 pb-1"><h1 class="thentwrktheme_page__heading text-center lg:text-left text-white font-prompt lg:ml-14">Work</h1></div></div></div></section><!-- Project Categories Section --><section id="projectCategories"><div class="container mx-auto"><div class="mx-10"><div class="projectCategories_wrapper flex justify-between lg:justify-start text-center lg:text-left items-center my-10"><a class="cat-list_item text-white cat-list_item text-white mx-1 lg:mx-3 py-1.5 px-3 lg:px-5 bg-zinc-500 uppercase font-jost" href="<?php echo get_post_type_archive_link('project');?>">All</a><?php                     $cat_args = get_terms(array('taxonomy' => 'category','order' => 'DSC',                    ));                    $categories = $cat_args;                    $current_category_slug = get_queried_object()->slug;                    foreach ($categories as $term) :                         $active_class = ($current_category_slug === $term->slug) ? 'active' : '';                    ?><li class="project_categories__wrapper w-fit"><a class="cat-list_item text-white mx-1 lg:mx-3 py-1.5 px-3 lg:px-5 bg-zinc-500 uppercase font-jost <?= $active_class; ?>" href="<?php echo site_url('/category/' . $term->slug)?>"><?= $term->name; ?></a></li><?php                     endforeach;                 ?></div></div></div></section><!-- Project Posts Section --><section id="projectPosts" class="my-10"><div class="container mx-auto"><div class="mx-10"><div class="grid-wrapper"><?php                $i = 0;                // The WordPress Loop                $category = get_queried_object(); // Get the current category object                $args = array('post_type'      => 'post', // Change to your custom post type if needed'posts_per_page' => -1, // Display all posts in the category'category_name'  => $category->slug, // Use category slug for query                );                $categoryQuery = new WP_Query($args);                if ($categoryQuery->have_posts()) :                    while ($categoryQuery->have_posts()) : $categoryQuery->the_post();                        $thumb = get_the_post_thumbnail_url();                         ?><div class="workGrid-item projectPosts_post__card-<?php echo $i; ?> relative" style="background-image: url('<?php echo $thumb;?>')"><h3 class="projectCard_title font-prompt text-white absolute bottom-3 left-5 z-20"><?php the_title(); ?></h3><a href="<?php the_permalink(); ?>" target="_blank" class="w-full h-full absolute z-30"></a></div><?php                        $i++;                    endwhile;                else :                    ?><p>No posts found</p><?php endif;                 wp_reset_postdata();                ?></div></div></div></section><?php get_footer() ?>

Viewing all articles
Browse latest Browse all 11661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>