Editing the Wordpress Footer Widgets Section - php

I'm currently working on a Wordpress site, using the Rhythm theme - it's default template has four columns built into the footer, and I'd like to only have three.
So in my child theme, I went into the widget section and removed a column from the php code, so it looks like this:
if (ts_get_opt('footer-widgets-enable') == 1): ?>
<!-- Divider -->
<hr class="mt-0 mb-0"/>
<!-- End Divider -->
<!-- Widgets Section -->
<section class="footer-sidebar page-section">
<div class="container relative">
<div class="row multi-columns-row">
<div class="col-sm-8 col-md-4 col-lg-4">
<?php if (is_active_sidebar( ts_get_custom_sidebar('footer-1', 'footer-sidebar-1') )): ?>
<?php dynamic_sidebar( ts_get_custom_sidebar('footer-1', 'footer-sidebar-1') ); ?>
<?php endif; ?>
</div>
<div class="col-sm-8 col-md-4 col-lg-4">
<?php if (is_active_sidebar( ts_get_custom_sidebar('footer-2', 'footer-sidebar-2') )): ?>
<?php dynamic_sidebar( ts_get_custom_sidebar('footer-2', 'footer-sidebar-2') ); ?>
<?php endif; ?>
</div>
<div class="col-sm-8 col-md-4 col-lg-4">
<?php if (is_active_sidebar( ts_get_custom_sidebar('footer-3', 'footer-sidebar-3') )): ?>
<?php dynamic_sidebar( ts_get_custom_sidebar('footer-3', 'footer-sidebar-3') ); ?>
<?php endif; ?>
</div>
</div>
</div>
</section>
<!-- End Widgets Section -->
The problem I'm having is that the page is still referencing the code with four columns instead. So I'm guessing my issue is in my footer.php file, or the template-parts.php file and that it's not pointing to the proper file.
My biggest concern is that I didn't set up my child theme correctly, and now the coding is trying to reference two different themes.

Related

Displaying wordpress page full contents

Here is LINK I am working on it. The About Us section is not displaying full contents and showing more button to go to next page whereas I want to show full contents of About Us page instead of short summary.
I checked a lot but not found any option in the theme to fix it
UPDATE:
I found this in (page-template/custom-home-page.php)
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="row">
<div class="col-lg-8 col-md-7">
<h3><?php the_title(); ?></h3>
<hr>
<p><?php the_excerpt(); ?></p>
<div class="more-btn">
<?php esc_html_e('MORE','vw-one-page'); ?>
</div>
</div>
<div class="col-lg-4 col-md-5">
<img src="<?php the_post_thumbnail_url('full'); ?>"/>
</div>
</div>
<?php $i++; endwhile;
wp_reset_postdata();?>
<?php else : ?>
<div class="no-postfound"></div>
<?php endif;
endif;?>
</div>
</section>
Best regards
That code inside your theme with high probability.
Try to search inside theme files "/wp-content/themes/your_theme_name", something like that:
<div class="col-lg-8 col-md-7">
<h3>About Us</h3> <!-- Or <?php the_title(); ?> -->
<hr>
<?php the_exerpt(); ?>
<div class="more-btn">
MORE <!-- Or something like <?php the_permalink( ... ) ?> -->
</div>
</div>
This is an example. After all, I can't know how it is done in your theme.
Then <?php the_exerpt(); ?> change to <?php the_content(); ?>. and remove or hide:
<div class="more-btn">
...
</div>
But if this is not your personal WordPress theme, then it is better to do through Child Theme

the_field in wordpress not outputting in html depending on the order of pages

I have something that I just can't understand. I did a one page layout site in wordpress. It consist of one template-index.php that only have one mainContainer div and about 6 include_once template-. Then in the admin section of wordpress I used advanced custom fields to create the different fields all related to template-index.php.
Everything shows up just fine except for the text on the last frame or last include if you will. But here is the strange thing. If I change the order of the last two includes both text shows up just fine and then when I change the order back the last include loose it's text again.
I checked the code, every php tag is closed just fine, the include before also. I don't know. Did something like this ever happen to one of you? What could it be?
Thanks
edit:
here is a bit of code.
So the index page is pretty simple:
<?php
/* Template Name: index template */
?>
<?php get_header(); ?>
<div class="mainContainer"id='fullpage'>
<?php include_once 'template-about.php'; ?>
<?php include_once 'template-theDesign.php'; ?>
<?php include_once 'template-theApp.php'; ?>
<?php include_once 'template-getApp.php'; ?>
<?php include_once 'template-community.php'; ?>
<?php include_once 'template-contact.php'; ?>
</div>
<?php get_footer(); ?>enter code here
the last two includes look like this:
<?php
/* Template Name: Bob community template */
?>
<!-- <div id="section-5"> -->
<div class="sectionContainer community section" id='section_five'>
<div class="container main">
<div class="vertical100 firstSection col-md-12 topSection ">
<section class='worldMap animation col-md-6'>
<div class="imgContainer">
<div class="wordpressImg">
<img class='worldMap' src="<?php echo get_template_directory_uri(); ?>/img/worldmap.png" />
</div> <!-- wordpressImg -->
</div><!-- imgContainer -->
</section>
<section class="explications col-md-6">
<div class="communityExplication">
<div class="wordpressTexte">
<?php the_field('community_text'); ?>
<div class="stories">
<?php
$args = array( 'post_type' => 'stories', 'posts_per_page' => 8, 'orderby' => 'rand' );
$loop = new WP_Query($args);
$posts = $loop->posts;
if(have_posts()) {
$first = true; ?>
<div class="storieAligner">
<div class="stories-container ">
<?php
$count = 0;
while($loop->have_posts() ) : $loop->the_post();
$randomPost = $posts[$count];
$image = get_field('images');
$temoignage = get_field('temoignage');
?>
<!-- <div class="storiePhoto"> -->
<div class='storiesThumbs' style='background-image: url("<?php echo $image['url']; ?>")' data-temoignage="<?php echo $temoignage; ?>"></div>
<div class="categorie"></div>
<!-- </div> -->
<?php $count++; endwhile; ?>
</div> <!-- stories-container -->
<div class="fullStorie hiddenStorie">
<div class="back"></div>
<div class="leftDiv">
<div class="leftContent">
</div>
</div>
<div class="rightDiv">
<div class="rightContent"></div>
</div>
</div>
</div> <!-- storieAligner -->
<?php }; ?> <!-- if have_posts -->
</div> <!-- stories -->
<div class="linkContainer" ><a class='formToggle pinkButton roll' href="#" title="Wha you say"><span data-title='What you say'>What you say</span></a></div>
</div> <!-- wordpressTexte -->
</div> <!-- commnunityExplication -->
<!-- <div class="storiesFormContainer"> -->
<div class="storiesForm hidden">
<div class="formContainer">
<h1><?php echo __('Leave a Review of your app ', 'site'); ?></h1>
<?php echo do_shortcode('[contact-form-7 id="89" title="community-contact"]'); ?>
</div>
</div>
<!-- </div> storiesFormContainer -->
</section>
</div> <!-- get app -->
</div> <!-- main -->
and the contact template like this
<?php
/* Template Name: Contact-us template */
?>
<!-- section-6 -->
<div class="sectionContainer contact section" id='section_six'>
<div class="container main" >
<div class="vertical100 col-md-12 topSection ">
<section class='explications col-md-3'>
<div class="blockTexte">
<div class="wordpressTexte">
<?php the_field('questions'); ?>
<a class ='pinkButton roll' href="#" title="visit page"><span data-title='<?php echo __('visit page', 'site'); ?>'><?php echo __('visit page', 'site'); ?></span></a>
</div>
</div>
</section>
<section class="formulaire col-md-9">
<div class="formContainer">
<div class="wordpressForm">
<?php echo do_shortcode('[contact-form-7 id="44" title="contact-us"]'); ?>
</div>
</div>
</section>
</div> <!-- knowBob -->
</div>
So what could be wrong?
P.s. I know there's a bit a french and english in the code. I usually write what comes up first in my head.
You need to reset the post data to the original query using wp_reset_postdata after you're done looping through a custom query:
<div class="stories-container ">
<?php
$count = 0;
while($loop->have_posts() ) : $loop->the_post();
$randomPost = $posts[$count];
$image = get_field('images');
$temoignage = get_field('temoignage');
?>
<!-- <div class="storiePhoto"> -->
<div class='storiesThumbs' style='background-image: url("<?php echo $image['url']; ?>")' data-temoignage="<?php echo $temoignage; ?>"></div>
<div class="categorie"></div>
<!-- </div> -->
<?php $count++; endwhile; wp_reset_postdata(); ?><!-- this line here -->
</div> <!-- stories-container -->
Otherwise the $post object will remain the last post of the $loop query, causing any other behind the scenes requests for post data down the road (in your case get_field) to reference the wrong post until you hit the outer loop again.

Coding after WordPress loop not showing

I have been working on a custom archive page but I have run into some trouble. The pagination is shifting down into the footer area.
I have gone through my code several times and I cannot work out why this is happening. If I remove the loop, the template works correctly.
With the loop in place, the pagination shifts down to the footer and takes any coding below it (in the archive page) with it.
The archive page coding is:
<?php get_header(); ?>
<main role="main">
<section class="commissions">
<div class="commissions-section-one">
<h1>Commissions</h1>
<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('commissions-intro')) ?>
</div>
<?php get_template_part('single-commissions'); ?>
<?php get_template_part('pagination'); ?>
</section><!-- /section -->
</main><!--/ Main -->
<?php get_footer(); ?>
The custom loop code is:
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<div class="commission-wrapper">
<div class="commission-inner cf">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="commission-content-wrapper">
<div class="commission-content-inner">
<img src="<?php the_field('commissions-company-logo'); ?>" />
<h2 class="company-author"><?php the_title(); ?></h2>
<p class="company-location"><?php the_field('commissions-company-location'); ?></p>
<p class="company-description"><?php the_field('commissions-company-description'); ?></p>
<p class="company-date"><?php the_field('commissions-company-date'); ?></p>
<?php echo do_shortcode("[indeed-social-media sm_list='fb,tw,goo,li' sm_template='ism_template_10' sm_list_align='horizontal' sm_display_counts='false' sm_display_full_name='false ]");?>
</div><!--/ Commission Content Inner -->
</div><!--/ Commission Content Wrapper -->
</article><!--/ Article -->
<div class="commission-images">
<div class="row first cf">
<div class="left-column" style="background-image:url(<?php the_field('commissions-image-one'); ?>);"></div>
<div class="right-column" style="background-image:url(<?php the_field('commissions-image-two'); ?>);"></div>
</div><!--/ Row -->
<div class="row cf">
<div class="left-column" style="background-image:url(<?php the_field('commissions-image-three'); ?>);"></div>
<div class="right-column" style="background-image:url(<?php the_field('commissions-image-four'); ?>);"></div>
</div><!--/ Row -->
</div><!--/ Commission Images -->
</div><!--/ Commission Inner -->
</div><!--/ Commission Wrapper -->
<?php endwhile; ?>
<?php else: ?>
<!-- article -->
<article>
<h1><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h1>
</article>
<!-- /article -->
<?php endif; ?>
<?php get_footer(); ?>
I am using the HTML 5 blank theme and haven't added anything additional in regards to pagination.
I'm not sure what you're doing with this line...
<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('commissions-intro')) ?>
...since you're not outputting anything. I'd either get rid of it, or fix it so that it's a valid conditional (with an endif;).
It also looks like you're calling get_footer() twice...

Align sidebar with my main content bootstrap

I am using Bootstrap and WordPress to create a website. I have a my main content that is 8 columns and then my sidebar which is 4. On my normal pages I put them both in one row so they align correctly, however with this page, I used the WordPress loop to create many rows with content in, this means my sidebar is then not in the same row as my content and gets pushed to below it on the screen. Is it possible to align them horizontally?
Here is the code Iā€™m using.
<?php if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<div class="row case-studies">
<div id="page_content">
<div class="col-md-8">
<div class="case_summary_image col-md-4">
<?php the_post_thumbnail('casestudy img-responsive');?>
</div>
<div class="case_summary col-md-8"></a>
<a style="font-size:18px; line-height:30px; color:#666666; font-weight:bold; text-decoration:none" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
</div>
</div>
</div>
</div>
<!-- sidebar -->
<?php endwhile; endif; ?>
<div class="col-md-4">
<?php get_sidebar();?>
</div>
You still need a container or a row to encompass the content and sidebar for the columns to work like you want them to.
You must create loop main area and add class to this. So,
<div class="col-md-8">
<!-- your loop, wp query -->
</div>
<div class="col-md-4">
<!-- your theme sidebar -->
</div>
In summary, you must have one col-md-8 and one col-md-4.

Adding number of posts to custom post archive page.

I am using Wordpress and the Roots Template.
I have created an archive page to show member profiles. - its just index.php saved out as archive-members.php so it gets the member posts, but I don't know how to change the number it displays. I want it to display all.
its not using any custom post type query, its just an archive of this post-type slug
Here is my page code.
<div class="purple row">
<div class="container">
<div class="col-lg-12">
<?php get_template_part('templates/page', 'header'); ?>
</div>
</div>
</div>
<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
<?php _e('Sorry, no results were found.', 'roots'); ?>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<div class="row pagecontent">
<div class="container">
<?php while (have_posts()) : the_post(); ?>
<div class="col-sm-3">
<?php get_template_part('templates/members', get_post_format()); ?>
</div>
<?php endwhile; ?>
<?php if ($wp_query->max_num_pages > 1) : ?>
</div>
</div>
<div class="container">
<div class="col-lg-12">
<nav class="post-nav">
<ul class="pager">
<li class="next"><?php next_posts_link(__('Next Page ā†’', 'roots')); ?></li>
<li class="previous"><?php previous_posts_link(__('ā† Previous Page', 'roots')); ?></li>
</ul>
</nav>
</div>
</div>
<?php endif; ?>
I believe this question has already been answered here.
The answer in that thread links to the WordPress codex on using the query_post() function.
That, or as someone else in the thread states, you can try changing the settings in the admin interface (settings -> reading). There, you'll see a box that allows you to change how many posts are displayed on a page.

Categories