Need to add excerpt in recent post WP widget - wordpress

I'm using a premium theme on my wp website but I'm trying to add a recent post widget on home page sidebar, this widget just shows posts title and date but no excerpt. I am a beginner don't know how to customize this widget, I just think these are the codes of the recent post widget.
<?php
/*-----------------------------------------------------------------------------------
Plugin Name: Custom Blog Widget
Plugin URI: http://www.premiumpixels.com
Description: A widget that allows the display of blog posts.
Version: 1.0
Author: Orman Clark
Author URI: http://www.premiumpixels.com
-----------------------------------------------------------------------------------*/
// Add function to widgets_init that'll load our widget.
add_action( 'widgets_init', 'tz_blog_widgets' );
// Register widget.
function tz_blog_widgets() {
register_widget( 'TZ_Blog_Widget' );
}
// Widget class.
class tz_blog_widget extends WP_Widget {
/*-----------------------------------------------------------------------------------*/
/* Widget Setup
/*-----------------------------------------------------------------------------------*/
function __construct() {
/* Widget settings. */
$widget_ops = array( 'classname' => 'tz_blog_widget', 'description' => __('A widget that displays your latest posts with a short excerpt.', 'Creativo') );
/* Widget control settings. */
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'tz_blog_widget' );
/* Create the widget. */
parent::__construct( 'tz_blog_widget', __('Custom Recent Posts Widget', 'Creativo'), $widget_ops, $control_ops );
//$this->WP_Widget( 'tz_blog_widget', __('Custom Recent Posts Widget', 'Creativo'), $widget_ops, $control_ops );
}
/*-----------------------------------------------------------------------------------*/
/* Display Widget
/*-----------------------------------------------------------------------------------*/
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title'] );
/* Our variables from the widget settings. */
$number = $instance['number'];
/* Before widget (defined by themes). */
echo $before_widget;
/* Display Widget */
?>
<?php /* Display the widget title if one was input (before and after defined by themes). */
if ( $title )
echo $before_title . $title . $after_title;
?>
<?php
$query = new WP_Query();
$query->query( array(
'posts_per_page' => $number,
'ignore_sticky_posts' => 1
));
?>
<?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
<div class="latest-posts">
<?php
if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<div class="latest-posts-thumb"><?php the_post_thumbnail('related-img'); ?></div>
<h2><?php the_title(); ?></h2>
<span><?php the_time( get_option('date_format') ); ?></span>
<div class="clr"></div>
<?php
}
else{?>
<div class="latest-posts-thumb"><img src="<?php bloginfo( 'template_url' ); ?>/images/no-image.jpg" /></div>
<h2><?php the_title(); ?></h2>
<span><?php the_time( get_option('date_format') ); ?></span>
<div class="clr"></div>
<?php
}
?>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
<?php
/* After widget (defined by themes). */
echo $after_widget;
}
/*-----------------------------------------------------------------------------------*/
/* Update Widget
/*-----------------------------------------------------------------------------------*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip tags to remove HTML (important for text inputs). */
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['number'] = strip_tags( $new_instance['number'] );
/* No need to strip tags for.. */
return $instance;
}
/*-----------------------------------------------------------------------------------*/
/* Widget Settings
/*-----------------------------------------------------------------------------------*/
function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array(
'title' => __('Take a look behind the scenes.','Creativo'),
'number' => 4
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<!-- Widget Title: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'Creativo') ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
</p>
<!-- Widget Title: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e('Amount to show:', 'Creativo') ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" value="<?php echo $instance['number']; ?>" />
</p>
<?php
}
}
?>

//change this
if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>
<div class="latest-posts-thumb"><?php the_post_thumbnail('related-img'); ?></div>
<h2><?php the_title(); ?></h2>
<span><?php the_time(get_option('date_format')); ?></span>
<div class="clr"></div>
<?php
}
//to
if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>
<div class="latest-posts-thumb"><?php the_post_thumbnail('related-img'); ?></div>
<h2><?php the_title(); ?></h2>
<p class="post-excerpt"><?php the_excerpt(); ?></p>
<span><?php the_time(get_option('date_format')); ?></span>
<div class="clr"></div>
<?php
}
the_excerpt() is used to get post excerpt

Related

Critical Error on wordpress php code when listing custom posts from a category

Recently having problems probably because of a wordpress update. This was working and now it isn't. I am using advanced custom fields to grab the category id. Any one know what is going on here?
<?php
$args = array(
'post_type' => 'messages_single',
'posts_per_page' => 10,
'cat' => '' . get_field('category') . '',
'order' => ASC,
);
$q = new WP_Query( $args);
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post(); ?>
<div class="series-item">
<div class="series-thumb">
<?php if ( has_post_thumbnail() ) { ?>
<img src="<?php the_post_thumbnail_url( 'full' ); ?>" alt="<?php the_title(); ?>" class="zoom" /></div>
<?php
}
else { ?>
<img src="/img/image-holder.png" alt="<?php the_title(); ?>" /></div>
<?php } ?>
<div class="series-info">
<h3><?php the_title(); ?></h3>
<div class="mspeaker">
<?php
if(get_field('other_speaker'))
{
echo '' . get_field('other_speaker') . '';
}
else {
echo '' . get_field('speaker') . '';
}
?>
</div>
</div><!-- .series-item-->
<?php }
wp_reset_postdata();
}
?>

WordPress search results only showing if admin is logged in

WordPress search results only showing if admin is logged in.
I tried deactivating plug-ins and that didn't work. Here is the code from the search.php file (below). Not sure if this is where the problem could be or somewhere else.
If it is in the function.php file:
<?php
/**
* The template for displaying search results pages.
*
* #link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* #package Wowmall
*/
get_header();
$col = 'col-xl-12';
$post_col = 'col-xl-3 col-lg-4 col-md-6 col-sm-12 col-xs-12';
$template = '';
global $wp_query,$wowmall_options;
if( ! empty( $wowmall_options['blog_layout_type'] ) && ! in_array( $wowmall_options['blog_layout_type'], array( 'grid', 'masonry' ) ) ) {
$col = 'col-xl-10 col-lg-9 col-md-8';
$post_col = 'col-xs-12';
$template = '-list';
}
?>
<div class="container">
<header class=page-header>
<h1 class="page-title page-title-search"><?php printf( esc_html__( 'Search Results for %s', 'wowmall' ), '<span class=wowmall-search-query-title>'' . get_search_query() . ''</span>' ); ?></h1>
</header><!-- .page-header -->
<div class="row">
<main id=primary class="content-area site-main <?php echo esc_attr( $col ); ?>">
<?php if ( have_posts() ) : ?>
<div class="page-content">
<div class="row posts-<?php echo count( $wp_query->posts ); ?>">
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="<?php echo esc_attr( $post_col ); ?>">
<?php
/**
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'template-parts/content', '' );
?>
</div>
<?php endwhile; ?>
</div>
</div>
<?php the_posts_pagination( array(
'prev_text' => '<i class=myfont-left-open-2></i>',
'next_text' => '<i class=myfont-right-open-2></i>',
'type' => 'list',
) ); ?>
<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
</main>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>

Ajax add to cart not updating cart content untill after refresh

The ajax add to cart function of woocommerce doesn't seem to update the cart untill after I manually refresh the website.
This is the function for the cart widget I edited, and it seems to be working fine. It just doesn't refresh automatically.
class GeminiCart extends WP_Widget {
public function __construct() {
parent::__construct(
'gb_woocommerce_dropdown_cart',
esc_html__('Gemini Bracelet Woocommerce Dropdown Cart', 'depot'),
array( 'description' => esc_html__( 'Display a shop cart icon with a dropdown that shows products that are in the cart', 'depot' ), )
);
$this->setParams();
}
protected function setParams() {
$this->params = array(
array(
'type' => 'textfield',
'name' => 'woocommerce_dropdown_cart_margin',
'title' => esc_html__('Icon Margin', 'depot'),
'description' => esc_html__('Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'depot')
),
array(
'type' => 'dropdown',
'name' => 'woocommerce_enable_cart_info',
'title' => esc_html__('Enable Cart Info', 'depot'),
'options' => depot_mikado_get_yes_no_select_array(false),
'description' => esc_html__('Enabling this option will show cart info (products number and price) at the right side of dropdown cart icon', 'depot')
),
);
}
/**
* Generate widget form based on $params attribute
*
* #param array $instance
*
* #return null
*/
public function form($instance) {
if(is_array($this->params) && count($this->params)) {
foreach($this->params as $param_array) {
$param_name = $param_array['name'];
${$param_name} = isset($instance[$param_name]) ? esc_attr($instance[$param_name]) : '';
}
foreach($this->params as $param) {
switch($param['type']) {
case 'textfield':
?>
<p>
<label for="<?php echo esc_attr($this->get_field_id($param['name'])); ?>"><?php echo
esc_html($param['title']); ?>:</label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id($param['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($param['name'])); ?>" type="text" value="<?php echo esc_attr(${$param['name']}); ?>"/>
<?php if(!empty($param['description'])) : ?>
<span class="mkd-field-description"><?php echo esc_html($param['description']); ?></span>
<?php endif; ?>
</p>
<?php
break;
case 'dropdown':
?>
<p>
<label for="<?php echo esc_attr($this->get_field_id($param['name'])); ?>"><?php echo
esc_html($param['title']); ?>:</label>
<?php if(isset($param['options']) && is_array($param['options']) && count($param['options'])) { ?>
<select class="widefat" name="<?php echo esc_attr($this->get_field_name($param['name'])); ?>" id="<?php echo esc_attr($this->get_field_id($param['name'])); ?>">
<?php foreach($param['options'] as $param_option_key => $param_option_val) {
$option_selected = '';
if(${$param['name']} == $param_option_key) {
$option_selected = 'selected';
}
?>
<option <?php echo esc_attr($option_selected); ?> value="<?php echo esc_attr($param_option_key); ?>"><?php echo esc_attr($param_option_val); ?></option>
<?php } ?>
</select>
<?php } ?>
<?php if(!empty($param['description'])) : ?>
<span class="mkd-field-description"><?php echo esc_html($param['description']); ?></span>
<?php endif; ?>
</p>
<?php
break;
}
}
} else { ?>
<p><?php esc_html_e('There are no options for this widget.', 'depot'); ?></p>
<?php }
}
/**
* #param array $new_instance
* #param array $old_instance
*
* #return array
*/
public function update($new_instance, $old_instance) {
$instance = array();
foreach($this->params as $param) {
$param_name = $param['name'];
$instance[$param_name] = sanitize_text_field($new_instance[$param_name]);
}
return $instance;
}
public function widget( $args, $instance ) {
extract( $args );
global $woocommerce;
$icon_styles = array();
if ($instance['woocommerce_dropdown_cart_margin'] !== '') {
$icon_styles[] = 'padding: ' . $instance['woocommerce_dropdown_cart_margin'];
}
$icon_class = 'mkd-cart-info-is-disabled';
if (!empty($instance['woocommerce_enable_cart_info']) && $instance['woocommerce_enable_cart_info'] === 'yes') {
$icon_class = 'mkd-cart-info-is-active';
}
$cart_description = depot_mikado_options()->getOptionValue('mkd_woo_dropdown_cart_description');
?>
<div class="mkd-shopping-cart-holder <?php echo esc_html($icon_class); ?>" <?php depot_mikado_inline_style($icon_styles) ?>>
<div class="mkd-shopping-cart-inner">
<?php $cart_is_empty = sizeof( $woocommerce->cart->get_cart() ) <= 0; ?>
<a itemprop="url" class="mkd-header-cart" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>">
<span class="mkd-cart-icon-text"><?php esc_html_e('CART', 'depot'); ?></span>
<span class="mkd-cart-info">
<span class="mkd-cart-info-total">( <?php echo wp_kses($woocommerce->cart->get_cart_contents_count()); ?> )</span>
</span>
</a>
<?php if ( !$cart_is_empty ) : ?>
<div class="mkd-shopping-cart-dropdown">
<ul>
<?php foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) :
$_product = $cart_item['data'];
// Only display if allowed
if ( ! $_product->exists() || $cart_item['quantity'] == 0 ) {
continue;
}
// Get price
if ( version_compare( WOOCOMMERCE_VERSION, '3.0' ) >= 0 ) {
$product_price = get_option( 'woocommerce_tax_display_cart' ) == 'excl' ? wc_get_price_excluding_tax( $_product ) : wc_get_price_including_tax( $_product );
} else {
$product_price = get_option( 'woocommerce_tax_display_cart' ) == 'excl' ? $_product->get_price_excluding_tax() : $_product->get_price_including_tax();
}
?>
<li>
<div class="mkd-item-image-holder">
<a itemprop="url" href="<?php echo esc_url(get_permalink( $cart_item['product_id'] )); ?>">
<?php echo wp_kses($_product->get_image(), array(
'img' => array(
'src' => true,
'width' => true,
'height' => true,
'class' => true,
'alt' => true,
'title' => true,
'id' => true
)
)); ?>
</a>
</div>
<div class="mkd-item-info-holder">
<h5 itemprop="name" class="mkd-product-title"><a itemprop="url" href="<?php echo esc_url(get_permalink( $cart_item['product_id'] )); ?>"><?php echo apply_filters('depot_mikado_woo_widget_cart_product_title', $_product->get_title(), $_product ); ?></a></h5>
<span class="mkd-quantity"><?php echo esc_html($cart_item['quantity']); ?></span>
<?php echo apply_filters( 'depot_mikado_woo_cart_item_price_html', wc_price( $product_price ), $cart_item, $cart_item_key ); ?>
<?php echo apply_filters( 'depot_mikado_woo_cart_item_remove_link', sprintf('<span class="icon-arrows-remove"></span>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), esc_html__('Remove this item', 'depot') ), $cart_item_key ); ?>
</div>
</li>
<?php endforeach; ?>
<div class="mkd-cart-bottom">
<div class="mkd-subtotal-holder clearfix">
<span class="mkd-total"><?php esc_html_e( 'TOTAL:', 'depot' ); ?></span>
<span class="mkd-total-amount">
<?php echo wp_kses($woocommerce->cart->get_cart_subtotal(), array(
'span' => array(
'class' => true,
'id' => true
)
)); ?>
</span>
</div>
<?php if(!empty($cart_description)) { ?>
<div class="mkd-cart-description">
<div class="mkd-cart-description-inner">
<span><?php echo esc_html($cart_description); ?></span>
</div>
</div>
<?php } ?>
<div class="mkd-btn-holder clearfix">
<a itemprop="url" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>" class="mkd-view-cart" data-title="<?php esc_html_e('VIEW CART','depot'); ?>"><span><?php esc_html_e('VIEW CART','depot'); ?></span></a>
</div>
<div class="mkd-btn-holder clearfix">
<a itemprop="url" href="<?php echo esc_url($woocommerce->cart->get_checkout_url()); ?>" class="mkd-view-cart" data-title="<?php esc_html_e('CHECKOUT','depot'); ?>"><span><?php esc_html_e('CHECKOUT','depot'); ?></span></a>
</div>
</div>
</ul>
</div>
<?php else : ?>
<div class="mkd-shopping-cart-dropdown">
<ul>
<li class="mkd-empty-cart"><?php esc_html_e( 'No products in the cart.', 'depot' ); ?></li>
</ul>
</div>
<?php endif; ?>
</div>
</div>
<?php
}
}
I already implemented this function to make it update; but it doesn't change anything:
add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 );
function iconic_cart_count_fragments( $fragments ) {
$fragments['mkd-header-cart'] = '<span class="mkd-cart-icon-text"><?php esc_html_e(\'CART\', \'depot\'); ?></span>
<span class="mkd-cart-info">
<span class="mkd-cart-info-total">( <?php echo wp_kses($woocommerce->cart->get_cart_contents_count()); ?> )</span>
</span>';
return $fragments;
}
In wordpress itself I enabled the AJAX add to cart.
The add to cart button also has the class add_to_cart_button
The code that reloads those fragments can be found here: \plugins\woocommerce\assets\js\frontend\cart-fragments.js
To refresh WooCommerce widget you have to copy the code below
var $fragment_refresh = {
url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_refreshed_fragments' ),
type: 'POST',
success: function( data ) {
if ( data && data.fragments ) {
$.each( data.fragments, function( key, value ) {
$( key ).replaceWith( value );
});
if ( $supports_html5_storage ) {
sessionStorage.setItem( wc_cart_fragments_params.fragment_name, JSON.stringify( data.fragments ) );
set_cart_hash( data.cart_hash );
if ( data.cart_hash ) {
set_cart_creation_timestamp();
}
}
$( document.body ).trigger( 'wc_fragments_refreshed' );
}
}
};
and to trigger the event you do this: $.ajax( $fragment_refresh ); OR jQuery.ajax( $fragment_refresh );

Can't display values in my page ......ACF

Hi Guys my name is Fotis and i am a junior web developer.
The reason i need your help is because i am trying to create this gallery http://www.elliotcondon.com/creating-an-image-gallery-with-advanced-custom-fields/ and i am using custom fields and the add on repeater.
But i can’t see anything on my browser and in my home page. Why this is happening ? what i am doing wrong?
Please anyone who know to help me
Thank you for reading my request!
Here is my index.php code
<?php
get_header(); ?>
<div id="content">
<div id="main">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php endwhile; else: endif; ?>
<?php query_posts('category_name='.get_the_title().'&post_status=publish,future');?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?>
<?php endwhile; else: endif; ?>
<!-- Slider -->
<?php if(get_field('images')): ?>
<div id="slider">
<?php while(the_repeater_field('images')): ?>
<?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
<?php $thumb = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail'); ?>
<img src="<?php echo $image[0]; ?>" alt="<?php the_sub_field('title');?>" rel="<?php echo $thumb[0]; ?>" />
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
</div>
The problem is solved by making a frontpage .php ,in which you include all the index .php code.Then in settings you set front page the home page you've made and posts page the blank blog page. And so simple you can fix the problem.Here is the frontpage.php i made and i solved my problem.
<?php
/**
* Template Name: front-page.php Template
*/
get_header(); ?>
<?php
$args = array( 'posts_per_page' => 10 );
$lastposts = get_posts( $args );
foreach ( $lastposts as $post ) :
setup_postdata( $post ); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endforeach;
//for each category, show 3 posts
$cat_args=array(
'orderby' => 'name',
'order' => 'ASC'
);
$categories=get_categories($cat_args);
foreach($categories as $category) {
$args=array(
'showposts' => 3,
'category__in' => array($category->term_id),
'caller_get_posts'=>1
);
$posts=get_posts($args);
if ($posts) {
echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
foreach($posts as $post) {
setup_postdata($post); ?>
<p><?php the_title(); ?></p>
<?php
} // foreach($posts
} // if ($posts
} // foreach($categories
wp_reset_postdata(); ?>
<?php global $post;
$pid = $post->ID;
get_field('slide',$pid);
?>
<!-- Slider -->
<div class="flexslider">
<ul class="slides">
<?php
$rows = get_field('slide');
if($rows) {
foreach($rows as $row) {
// retrieve size 'large' for background image
$bgimg = $row['bg_image']['sizes']['large'];
$output = "<li style='background-image: url(". $bgimg .");'>\n";
$output .= " <div class='slide-text'>\n";
$output .= " <h2>". $row['slide_heading'] ."</h2>\n";
$output .= " " . $row['slide_text'];
$output .= " </div>\n";
$output .= "</li>\r\n\n";
$output .= " " . $row['slide_link'];
echo $output;
}
}
?>
</ul>
</div>
</div>
</div>
<?php get_footer(); ?
Here is the functions.php file in which you set the template for each page.
<?php
/***********************************************************************************************/
/* Define Constants */
/***********************************************************************************************/
define('THEMEROOT', get_stylesheet_directory_uri());
define('IMAGES', THEMEROOT.'/images');
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );
// Add support for featured images
add_theme_support( 'post-thumbnails' );
function get_future_posts($post_type, $require_featured, $number_posts=1) {
$today = current_time( 'timestamp' );
$posts = get_posts(array(
'posts_per_page' => $number_posts,
'post_type' => $post_type,
'meta_key' => 'date_time',
'meta_compare' => '>=',
'meta_value' => $today,
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'featured_event',
'value' => $require_featured
)
)
));
return $posts;
}
add_action('init', 'my_custom_init');
function my_custom_init() {
// remember add first parameter post type as 'page'
add_post_type_support( 'page', 'page-attributes' );
}
// Load our scripts
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
?>
And of course the header.php
<head>
<!-- Page Meta -->
<meta http-equiv="content-type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />
<title><?php wp_title( '-', true, 'right' ); echo esc_html( get_bloginfo('name'), 1 ); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('stylesheet_url') ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('stylesheet_url') ?>/css/flexislider.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/js/jquery.flexislider.js"type="text/javascript"></script>
<script>
(function($) {
$(window).load(function() {
$('.flexslider').flexslider({
animation: 'slide',
controlsContainer: '.flex-container'
});
});
})(jQuery)
</script>
<?php wp_head(); ?>
</head>
<nav>
<div class="container">
<ul class="nav-list">
<li>Αρχική</li>
<li>Χρήσιμα</li>
<li>Κοινωνικά</li>
<li>Διάφορα</li>
<li>Αθλητικά</li>
<li>Ειδήσεις</li>
<li>Εκδηλώσεις</li>
</ul>
</div>
</nav>
</header>
And finally this is the code in order to develop a flexi slider with ACF Repeater.
Enjoy!

Making text appear above the static picture slider on the Alt homepage, with static slider template on Wordpress

Basically I'm making a site on Wordpress using the Wordpress theme "Restaurateur". As you can see on the demo home page here http://wprestaurateur.com/ using the Alt homepage with static slider template, below the navigation is the picture slider and then below that some text. I've basically completed the site except I want the text to show up first and then have the picture slider below it. I've tried all I can think of with no luck. Any suggestions? Thanks.
EDIT: Added the .php file for the template im using for the home page.
<div id="content" class="clearfix">
<div id="main" class="clearfix sldr" role="main">
<div id="slide-wrap">
<?php if ( have_posts() ) : ?>
<div id="load-cycle"></div>
<div class="cycle-slideshow alt-static" <?php
if ( get_theme_mod('restaurateur_slider_effect') ) {
echo 'data-cycle-fx="' . wp_kses_post( get_theme_mod('restaurateur_slider_effect') ) . '" data-cycle-tile-count="10"';
} else {
echo 'data-cycle-fx="scrollHorz"';
}
?> data-cycle-slides="> div.slides" <?php
if ( get_theme_mod('restaurateur_slider_timeout') ) {
$slider_timeout = wp_kses_post( get_theme_mod('restaurateur_slider_timeout') );
echo 'data-cycle-timeout="' . $slider_timeout . '000"';
} else {
echo 'data-cycle-timeout="3000"';
}
?> >
<div class="cycle-pager"></div>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_shortcode( $post->post_content, 'gallery' ) ) : ?>
<?php
$gallery = get_post_gallery( $post, false );
$ids = explode( ",", $gallery['ids'] );
$hasgallery = 1;
foreach( $ids as $id ) {
$title = get_post_field('post_title', $id);
$meta = get_post_field('post_excerpt', $id);
$link = wp_get_attachment_url( $id );
$image = wp_get_attachment_image( $id, array( 1000, 640 ));
?>
<div class="slides">
<div id="post-<?php the_ID(); ?>" <?php post_class('post-theme'); ?>>
<div class="slide-thumb"><?php echo $image; ?></div>
</div>
</div><!-- .slides -->
<?php } ?>
<?php else : ?>
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) { ?>
<div class="slides">
<div id="post-<?php the_ID(); ?>" <?php post_class('post-theme'); ?>>
<div class="slide-thumb"><?php echo wp_get_attachment_image( $attachment->ID, array( 1000, 640 ), false, '' ); ?></div>
</div>
</div>
<?php }
} else {
?>
<div class="no-slide-image"><?php _e('Images added to this page will appear here', 'restaurateur'); ?></div>
<?php
} ?>
<?php endif; ?>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
<?php $content = restaurateur_content(9999); ?>
<?php $content = preg_replace(array('{<a[^>]*><img}','{/></a>}'), array('<img','/>'), $content); ?>
<?php $content = preg_replace('/<img[^>]+./', '', $content); ?>
<?php $content = preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content); ?>
<div class="intro-content">
<?php echo $content; ?>
</div>
</div> <!-- end #main -->
</div> <!-- end #content -->
Well we need to see the php file for your homepage to be able to help. But there will be a function that calls the slider, and you'll need to move it below the text content area. Or you can just add some text ahead of that slider function yourself.

Resources