Slider dissapears in phone/tablet version - php

I have a Wordpress site built with a theme in which the slider dissappears when you open on phone or Tablet. I've tried several different slider plugins, I tried deactivating all plugins and installing all of them one by one, but the problem persists, so I think that it is a PHP problem with the theme, but I can't seem to find a solution for it. When opening on phones or tablet the slider seems to load but it suddenly dissapears but the rest of the page is still there, I think it might take users to a new page when they open it from phones. Anyone could help me out, please?
Thank you!
http://www.lapinatasd.com
Thank you so much!
<?php /* Template Name: Home Page */ ?>
<?php get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- BEGIN HOME SLIDER SECTION -->
<section id="home-slider">
<?php putRevSlider( 'home' ); ?>
</section>
<!-- END HOME SLIDER SECTION -->
<?php endwhile; ?>
<?php $back = $post //backup post data?>
<?php $child_sections = new WP_Query(array('post_type' => 'page', 'post_parent' => $post->ID, 'orderby' => 'menu_order', 'order' =>'ASC', 'posts_per_page' => -1)); ?>
<?php while ($child_sections->have_posts() ) : $child_sections->the_post(); ?>
<?php $bg = rwmb_meta( '_jellythemes_section_bg', 'type=image', get_the_ID() ); foreach ($bg as $bg_image) : $bg_url = $bg_image['full_url']; endforeach; ?>
<?php $bg2 = rwmb_meta( '_jellythemes_section_bg2', 'type=image', get_the_ID() ); foreach ($bg2 as $bg_image2) : $bg_url2 = $bg_image2['full_url']; endforeach; ?>
<?php $video = get_post_meta( $post->ID, '_jellythemes_parallax_video', true ); ?>
<?php if (empty($video)): ?>
<section id="<?php echo esc_attr($post->post_name); ?>" class="section <?php echo get_post_meta( $post->ID, '_jellythemes_section_type', true ); ?> <?php echo get_post_meta( $post->ID, '_jellythemes_section_color', true ); ?>" style="background-color:<?php echo get_post_meta( $post->ID, '_jellythemes_bg_color', true ); ?>; <?php echo (!empty($bg_url) ? 'background-image: url(' . $bg_url . ')' . (!empty($bg_url2) ? ', url(' . $bg_url2 . ')' : '') . ';' : ''); ?>">
<div class="<?php echo get_post_meta( $post->ID, '_jellythemes_section_width', true ); ?>">
<?php the_content(); ?>
</div>
</section>
<?php else: ?>
<section id="<?php echo esc_attr($post->post_name); ?>" class="player section" data-property="{videoURL:'<?php echo esc_js($video); ?>',containment:'self',autoPlay:true, mute:true, startAt:0,opacity:1,ratio:'4/3', addRaster:true}">
<div class="overlay"></div>
<?php $logos = rwmb_meta('_jellythemes_bg_logo', 'type=image', $post->ID ); ?>
<?php foreach ($logos as $logo) : ?>
<img class="video-img" src="<?php echo esc_url($logo['full_url']); ?>" alt="video">
<?php endforeach; ?>
</section>
<?php endif ?>
<?php $bg_url=''; ?>
<?php endwhile; ?>
<?php $post = $back //restore post data?>
<?php get_footer(); ?>
</body>
</html>

I think you are using some responsive theme and the area you are using is configured to be hidden on small screen devices. For example, when using bootstrap, there is class hidden-sm-down. Check if this class is applied to the container you are working in. This will make the div invisible in small and xtra-small devices. Refer to enter link description here
For better help us understand the issue, attach the HTML of the page as well.

Related

Post Archive page - If else statement advanced custom fields

I am using Advanced Custom Fields and Facet WP.
Currently there is a directory listing showing on a page that shows a business preview by displaying a business title, image and an excerpt - the same as you typically see from a post archive page.
I have added a new ACF checkbox field 'Are you ready to publish' and would like to amend the php so the Title, excerpt an image will only show for user profile listings that have checked 'yes' to publish.
I am fairly new to php and ACF and cannot get it to work.
I have tried to variations:
<?php
global $post;
?>
<div class="business-directory-results">
<?php if( get_field('ready_to_publish') == 'yes' ) { ?>
<?php while ( have_posts() ): the_post(); ?>
<a class="business-directory-result box-shadow" href="/member-profile/<?php the_field('user_login');?>/">
<img src="<?php echo wp_get_attachment_image_src(get_post_meta( $post->ID, 'meta-business_featured_image', true ), "full")[0];?>" />
<div class="business-directory-result-content">
<h2><?php the_field('meta-business_name');?></h2>
<?php $excerpt = wp_trim_words( get_field('meta-business_profile_content' ), $num_words = 25, $more = '...' ); ?>
<p><?php echo $excerpt; ?></p>
</div>
</a>
<?php endwhile; ?>
<?php else { ?>
<!-- do nothing -->
<?php } ?>
</div>
and
<?php
global $post;
?>
<div class="business-directory-results">
<?php while ( have_posts() ): the_post(); ?>
<?php if( get_field('ready_to_publish') == 'yes' ) { ?>
<a class="business-directory-result box-shadow" href="/member-profile/<?php the_field('user_login');?>/">
<img src="<?php echo wp_get_attachment_image_src(get_post_meta( $post->ID, 'meta-business_featured_image', true ), "full")[0];?>" />
<div class="business-directory-result-content">
<h2><?php the_field('meta-business_name');?></h2>
<?php $excerpt = wp_trim_words( get_field('meta-business_profile_content' ), $num_words = 25, $more = '...' ); ?>
<p><?php echo $excerpt; ?></p>
</div>
</a>
<?php else { ?>
<!-- do nothing -->
<?php } ?>
<?php endwhile; ?>
</div>
If you create posts first and then add an additional ACF field, they will not work. To make it work, you will need to update all your posts after adding an ACF field. In your case, you will need update each user profile and only then they will have the ACF field attached with them.
Don't place the condition outside of the loop. That means your second variation is correct.
<?php
global $post;
?>
<div class="business-directory-results">
<?php while ( have_posts() ): the_post(); ?>
<?php if( get_field('ready_to_publish') == 'yes' ) { ?>
<a class="business-directory-result box-shadow" href="/member-profile/<?php the_field('user_login');?>/">
<img src="<?php echo wp_get_attachment_image_src(get_post_meta( $post->ID, 'meta-business_featured_image', true ), "full")[0];?>" />
<div class="business-directory-result-content">
<h2><?php the_field('meta-business_name');?></h2>
<?php $excerpt = wp_trim_words( get_field('meta-business_profile_content' ), $num_words = 25, $more = '...' ); ?>
<p><?php echo $excerpt; ?></p>
</div>
</a>
<?php else { ?>
<!-- do nothing -->
<?php } ?>
<?php endwhile; ?>
</div>

bootstrap v4 tab nav-item data-toggle not changing tab-pane in if statement

While the nav-item's a class changes to display an active class on click as desired, the tab-pane's active class does not change to reflect the click therefore causing the tabs to not work properly. Using Twitter Bootstrap v4. Help much appreciated. TY!
note: this does work as desired hardcoded(static) without the if statements.
update: i've updated the code a bit, also included a screenshot of the output from dev tools.
<ul class="roster-list" role="tablist">
<?php
$args = array(
'post_type' => 'post',
'cat' => 6,
'order' => 'DSC'
);
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post();
$tabRosterPostID = get_the_ID();
?>
<li class="nav-item">
<?php
// This works
$tabRosterPostIDCount == 0;
if ($tabRosterPostIDCount == 0) {
echo "<a class='active' data-toggle='tab' href='#$tabRosterPostID $tabRosterPostIDCount' role='tab'>";
} else {
echo "<a class='' data-toggle='tab' href='#$tabRosterPostID $tabRosterPostIDCount' role='tab'>";
}
$tabRosterPostIDCount++;
?>
<?php the_post_thumbnail(); ?>
</a>
</li><!-- /.nav-item -->
<?php
endwhile; endif;
wp_reset_query();
?>
</ul><!-- /.roster-list -->
<div class="tab-content">
<?php
$args = array(
'post_type' => 'post',
'cat' => 6,
'order' => 'DSC'
);
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post();
$tabContentPostID = get_the_ID();
$rosterBigImage = get_post_meta( get_the_ID(), 'roster-big-image', true );
$rosterMusicEmbed = get_post_meta( get_the_ID(), 'roster-music-embed', true );
// This does not work
$tabContentPostIDCount == 0;
if ($tabContentPostIDCount == 0) {
echo "<div class='tab-pane active' id='$tabContentPostID $tabContentPostIDCount' role='tabpanel'>";
} else {
echo "<div class='tab-pane' id='$tabContentPostID $tabContentPostIDCount' role='tabpanel'>";
}
$tabContentPostIDCount++;
?>
<div class="team-member clearfix">
<img src="<?php echo $rosterBigImage; ?>">
<div class="member-copy">
<?php
the_title( '<h1>', '</h1>' );
the_content();
?>
<div class="sounds">
<?php echo $rosterMusicEmbed; ?>
</div><!-- /.sounds -->
</div><!-- /.member-copy -->
</div><!-- /.team-member -->
</div><!-- /.tab-pane -->
<?php
endwhile; endif;
wp_reset_query();
?>
</div><!-- /.tab-content -->
screenshot of the output from dev tools
Be sure html ID attributes are valid, otherwise things may not work as desired.
The fix here was to set:
$tabRosterPostID = sanitize_title(get_the_title());
$tabContentPostID = sanitize_title(get_the_title());
instead of:
$tabRosterPostID = get_the_ID();
$tabContentPostID = get_the_ID();

WordPress Avada Theme Fatal Error: Call to a member function add_style() on a non-objet in ~/themes/Avada/page.php on line 2

I do not know whether it is a new update of Avada theme that broke the program, but the site was working just fine until I was notified by the user that the page is getting an error message. So here is the code of page.php
<?php get_header(); ?>
<div id="content" <?php Avada()->layout->add_style( 'content_style' ); ?>>
<?php
while( have_posts() ): the_post();
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php echo avada_render_rich_snippets_for_pages(); ?>
<?php if( ! post_password_required($post->ID) ): // 1 ?>
<?php if(!Avada()->settings->get( 'featured_images_pages' ) ): // 2 ?>
<?php
if( avada_number_of_featured_images() > 0 || get_post_meta( $post->ID, 'pyre_video', true ) ): // 3
?>
<div class="fusion-flexslider flexslider post-slideshow">
<ul class="slides">
<?php if(get_post_meta($post->ID, 'pyre_video', true)): ?>
<li>
<div class="full-video">
<?php echo get_post_meta($post->ID, 'pyre_video', true); ?>
</div>
</li>
<?php endif; ?>
<?php if( has_post_thumbnail() && get_post_meta( $post->ID, 'pyre_show_first_featured_image', true ) != 'yes' ): ?>
<?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
<?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
<?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?>
<li>
<img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" />
</li>
<?php endif; ?>
<?php
$i = 2;
while($i <= Avada()->settings->get( 'posts_slideshow_number' )):
$attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'page');
if($attachment_new_id):
?>
<?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?>
<?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?>
<?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?>
<li>
<img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo get_post_meta($attachment_new_id, '_wp_attachment_image_alt', true); ?>" />
</li>
<?php endif; $i++; endwhile; ?>
</ul>
</div>
<?php endif; // 3 ?>
<?php endif; // 2 ?>
<?php endif; // 1 password check ?>
<div class="post-content">
<?php the_content(); ?>
<?php avada_link_pages(); ?>
</div>
<?php if( ! post_password_required($post->ID) ): ?>
<?php if(class_exists('WooCommerce')): ?>
<?php
$woo_thanks_page_id = get_option('woocommerce_thanks_page_id');
if( ! get_option('woocommerce_thanks_page_id') ) {
$is_woo_thanks_page = false;
} else {
$is_woo_thanks_page = is_page( get_option( 'woocommerce_thanks_page_id' ) );
}
?>
<?php if(Avada()->settings->get( 'comments_pages' ) && !is_cart() && !is_checkout() && !is_account_page() && ! $is_woo_thanks_page ): ?>
<?php
wp_reset_query();
comments_template();
?>
<?php endif; ?>
<?php else: ?>
<?php if(Avada()->settings->get( 'comments_pages' )): ?>
<?php
wp_reset_query();
comments_template();
?>
<?php endif; ?>
<?php endif; ?>
<?php endif; // password check ?>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
<?php do_action( 'fusion_after_content' ); ?>
<?php get_footer();
// Omit closing PHP tag to avoid "Headers already sent" issues.
Line 2 is:
<div id="content" <?php Avada()->layout->add_style( 'content_style' ); ?>>
I think I understand from similar posts and questions that the solution would be to register layout, which appears as a non-object right now. But how do I go about registering it?
It turns out that even WordPress had noticed some missing files in the theme. I am not really sure what stole them from the system that was working just fine until they went missing.
The rather simplistic solution to this issue turned out to be a fresh install of the theme. I wiped out the existing files of the Avada theme and downloaded new ones for a fresh installation. The Avada theme authors narrowed down the issue a missing class-avada.php in the /wp-content/themes/avada/includes directory. To solve the issue, they too suggested a fresh install of all the files.
According to WordPress, the stylesheet was missing.
Warning: If you had customized the theme with custom code, please remember to save your custom files before uninstalling and erasing the entire theme folder.
Note: Considering that this type of issue needs a specific solution to the specific problem being encountered and considering that the problem I faced is a generic issue in PHP with non-generic solution, I thought it better to post as answer what actually solved my problem.

Wordpress showing a default image on single.php

I was hoping someone might be able to help with an issue I'm having...
I'm currently building a Wordpress site and I'm putting together the posts section. Everything seems ok, when using a featured image on a post, it displays nicely in a thumbnail here: http://5.10.105.45/~learningforsusta/index.php/education-for-sustainable-development/ and then nicely inside the single post here: http://5.10.105.45/~learningforsusta/index.php/efsc-post/example-post-1/
However, on a post which doesn't have a featured image specified, it seems to be displaying a default image...
My question is, how can I get rid of the default image, if there is no featured image, I would like it to not display anything...
Here's the code I'm using to pull it all through:
<div class="container">
<div class="row">
<div class="col-md-9">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="page-header">
<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
$thumbnail_meta = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true);
?>
<p class="featured-image"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php echo $thumbnail_meta; ?>"></p>
<p><em>
By <?php the_author(); ?>
on <?php echo the_time('l, F jS, Y');?>
in <?php the_category( ', ' ); ?>.
<?php comments_number(); ?>
</em></p>
</div>
<?php the_content(); ?>
<hr>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<div class="page-header">
<h1>Oh no!</h1>
</div>
<p>No content is appearing for this page!</p>
<?php endif; ?>
</div>
<?php get_sidebar( 'blog' ); ?>
</div>
and here's the code from the functions.php file that relates to the thumbnails...
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size(150, 120, true);
I'm sure I'm missing something simple, but I've tried altering things and i just can't figure it out!
Any help would be greatly appreciated...
Thanks,
Shaun
Make sure that you don't have any function attached to post_thumbnail_html filter, take a look at your functions.php (the best option would be to search in a whole wp-content directory, apply *.php filter to reduce result set)
Make sure you don't have any third-party plugin which can do this behind the scenes, e.g. this one.
You can try by using has_post_thumbnail() function and display with the_post_thumbnail()
<?php if ( has_post_thumbnail()): // Check if thumbnail exists ?>
<p class="featured-image">
<?php the_post_thumbnail('post-thumbnails'); ?>
</p>
<?php endif; ?>
Just check for existence of featured image before outputting it:
<?php
if( has_post_thumbnail() ):
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
$thumbnail_meta = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true);?>
<p class="featured-image"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php echo $thumbnail_meta; ?>"></p>
<?php endif;?>

Wordpress: Infinite Re-direct Loop Error on Custom Theme

I have a set-up a custom theme on my wordpress install. I have been developing with it locally and everything was working fine.
I uploaded to my server tonight and was setting up the fresh wordpress install. I turned on permalinks and all of a sudden my custom category pages are causing infinite re-direct loops.
My .htaccess is writable so I don't think its that problem (I have seen this mentioned a lot online).
The code from one of my custom pages is below - it pulls from a specific category - does anyone know how to fix this issue?
<?php get_header(); ?>
<?php
/*
Template Name: Podcasts
*/
?>
<ul class="mcol">
<?php
query_posts("cat=1");
while(have_posts()) : the_post(); ?>
<li class="article" id="post-<?php the_ID(); ?>">
<?php
if ( has_post_thumbnail() ) { ?>
<?php
$imgsrcparam = array(
'alt' => trim(strip_tags( $post- >post_excerpt )),
'title' => trim(strip_tags( $post->post_title )),
);
$thumbID = get_the_post_thumbnail( $post->ID, array(200,200), $imgsrcparam ); ?>
<div class="preview"><?php echo "$thumbID"; ?><div class="front-titles"><?php the_title(); ?></div></div>
<?php } else {?>
<div class="preview"><img src="<?php bloginfo('template_url'); ?>/images/default-thumbnail.jpg" alt="<?php the_title(); ?>" /></div>
<?php } ?>
<div class="article-over">
</div>
</li> <?php ?>
<?php endwhile;
//Reset Query
wp_reset_query();
?>
</ul>
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php else : ?>
<h1 id="error"><?php _e("Sorry, but you are looking for something that isn’t here."); ?></h1>
<?php endif; ?>
<div class="pagination"><?php previous_posts_link('<< Newer Entries', 0) ?> <?php next_posts_link('Older Entries >>', 0); ?> </div>
<?php get_footer(); ?>
Anyone any ideas? I'm quite new to this so am unsure as to what the problem might be...
What your doing is weird.
query_posts is meant to alter the main loop.
You have 2 loops with different syntax on the same page.
The second loop is not doing anything, so remove it, and use get_posts or WP Query for your custom query.

Categories