Change header template from Divi theme - wordpress

I have this template(header.php). Now i'm working on a site, and i want to to some changes in this template. According to this template i get 2 menu locations, but i want to change the order of them.
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<?php
elegant_description();
elegant_keywords();
elegant_canonical();
/**
* Fires in the head, before {#see wp_head()} is called. This action can be used to
* insert elements into the beginning of the head before any styles or scripts.
*
* #since 1.0
*/
do_action( 'et_head_meta' );
$template_directory_uri = get_template_directory_uri();
?>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<script type="text/javascript">
document.documentElement.className = 'js';
</script>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php
$product_tour_enabled = et_builder_is_product_tour_enabled();
$page_container_style = $product_tour_enabled ? ' style="padding-top: 0px;"' : ''; ?>
<div id="page-container"<?php echo et_core_intentionally_unescaped( $page_container_style, 'fixed_string' ); ?>>
<?php
if ( $product_tour_enabled || is_page_template( 'page-template-blank.php' ) ) {
return;
}
$et_secondary_nav_items = et_divi_get_top_nav_items();
$et_phone_number = $et_secondary_nav_items->phone_number;
$et_email = $et_secondary_nav_items->email;
$et_contact_info_defined = $et_secondary_nav_items->contact_info_defined;
$show_header_social_icons = $et_secondary_nav_items->show_header_social_icons;
$et_secondary_nav = $et_secondary_nav_items->secondary_nav;
$et_top_info_defined = $et_secondary_nav_items->top_info_defined;
$et_slide_header = 'slide' === et_get_option( 'header_style', 'left' ) || 'fullscreen' === et_get_option( 'header_style', 'left' ) ? true : false;
?>
<?php if ( $et_top_info_defined && ! $et_slide_header || is_customize_preview() ) : ?>
<?php ob_start(); ?>
<div id="top-header"<?php echo $et_top_info_defined ? '' : 'style="display: none;"'; ?>>
<div class="container clearfix">
<?php if ( $et_contact_info_defined ) : ?>
<div id="et-info">
<?php if ( '' !== ( $et_phone_number = et_get_option( 'phone_number' ) ) ) : ?>
<span id="et-info-phone"><?php echo et_core_esc_previously( et_sanitize_html_input_text( $et_phone_number ) ); ?></span>
<?php endif; ?>
<?php if ( '' !== ( $et_email = et_get_option( 'header_email' ) ) ) : ?>
<span id="et-info-email"><?php echo esc_html( $et_email ); ?></span>
<?php endif; ?>
<?php
if ( true === $show_header_social_icons ) {
get_template_part( 'includes/social_icons', 'header' );
} ?>
</div> <!-- #et-info -->
<?php endif; // true === $et_contact_info_defined ?>
<div id="et-secondary-menu">
<?php
if ( ! $et_contact_info_defined && true === $show_header_social_icons ) {
get_template_part( 'includes/social_icons', 'header' );
} else if ( $et_contact_info_defined && true === $show_header_social_icons ) {
ob_start();
get_template_part( 'includes/social_icons', 'header' );
$duplicate_social_icons = ob_get_contents();
ob_end_clean();
printf(
'<div class="et_duplicate_social_icons">
%1$s
</div>',
et_core_esc_previously( $duplicate_social_icons )
);
}
if ( '' !== $et_secondary_nav ) {
echo et_core_esc_wp( $et_secondary_nav );
}
et_show_cart_total();
?>
</div> <!-- #et-secondary-menu -->
</div> <!-- .container -->
</div> <!-- #top-header -->
<?php
$top_header = ob_get_clean();
/**
* Filters the HTML output for the top header.
*
* #since 3.10
*
* #param string $top_header
*/
echo et_core_intentionally_unescaped( apply_filters( 'et_html_top_header', $top_header ), 'html' );
?>
<?php endif; // true ==== $et_top_info_defined ?>
<?php if ( $et_slide_header || is_customize_preview() ) : ?>
<?php ob_start(); ?>
<div class="et_slide_in_menu_container">
<?php if ( 'fullscreen' === et_get_option( 'header_style', 'left' ) || is_customize_preview() ) { ?>
<span class="mobile_menu_bar et_toggle_fullscreen_menu"></span>
<?php } ?>
<?php
if ( $et_contact_info_defined || true === $show_header_social_icons || false !== et_get_option( 'show_search_icon', true ) || class_exists( 'woocommerce' ) || is_customize_preview() ) { ?>
<div class="et_slide_menu_top">
<?php if ( 'fullscreen' === et_get_option( 'header_style', 'left' ) ) { ?>
<div class="et_pb_top_menu_inner">
<?php } ?>
<?php }
if ( true === $show_header_social_icons ) {
get_template_part( 'includes/social_icons', 'header' );
}
et_show_cart_total();
?>
<?php if ( false !== et_get_option( 'show_search_icon', true ) || is_customize_preview() ) : ?>
<?php if ( 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) { ?>
<div class="clear"></div>
<?php } ?>
<form role="search" method="get" class="et-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
printf( '<input type="search" class="et-search-field" placeholder="%1$s" value="%2$s" name="s" title="%3$s" />',
esc_attr__( 'Search …', 'Divi' ),
get_search_query(),
esc_attr__( 'Search for:', 'Divi' )
);
?>
<button type="submit" id="searchsubmit_header"></button>
</form>
<?php endif; // true === et_get_option( 'show_search_icon', false ) ?>
<?php if ( $et_contact_info_defined ) : ?>
<div id="et-info">
<?php if ( '' !== ( $et_phone_number = et_get_option( 'phone_number' ) ) ) : ?>
<span id="et-info-phone"><?php echo et_core_esc_previously( et_sanitize_html_input_text( $et_phone_number ) ); ?></span>
<?php endif; ?>
<?php if ( '' !== ( $et_email = et_get_option( 'header_email' ) ) ) : ?>
<span id="et-info-email"><?php echo esc_html( $et_email ); ?></span>
<?php endif; ?>
</div> <!-- #et-info -->
<?php endif; // true === $et_contact_info_defined ?>
<?php if ( $et_contact_info_defined || true === $show_header_social_icons || false !== et_get_option( 'show_search_icon', true ) || class_exists( 'woocommerce' ) || is_customize_preview() ) { ?>
<?php if ( 'fullscreen' === et_get_option( 'header_style', 'left' ) ) { ?>
</div> <!-- .et_pb_top_menu_inner -->
<?php } ?>
</div> <!-- .et_slide_menu_top -->
<?php } ?>
<div class="et_pb_fullscreen_nav_container">
<?php
$slide_nav = '';
$slide_menu_class = 'et_mobile_menu';
$slide_nav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'echo' => false, 'items_wrap' => '%3$s' ) );
$slide_nav .= wp_nav_menu( array( 'theme_location' => 'secondary-menu', 'container' => '', 'fallback_cb' => '', 'echo' => false, 'items_wrap' => '%3$s' ) );
?>
<ul id="mobile_menu_slide" class="<?php echo esc_attr( $slide_menu_class ); ?>">
<?php
if ( '' === $slide_nav ) :
?>
<?php if ( 'on' === et_get_option( 'divi_home_link' ) ) { ?>
<li <?php if ( is_home() ) echo( 'class="current_page_item"' ); ?>><?php esc_html_e( 'Home', 'Divi' ); ?></li>
<?php }; ?>
<?php show_page_menu( $slide_menu_class, false, false ); ?>
<?php show_categories_menu( $slide_menu_class, false ); ?>
<?php
else :
echo et_core_esc_wp( $slide_nav ) ;
endif;
?>
</ul>
</div>
</div>
<?php
$slide_header = ob_get_clean();
/**
* Filters the HTML output for the slide header.
*
* #since 3.10
*
* #param string $top_header
*/
echo et_core_intentionally_unescaped( apply_filters( 'et_html_slide_header', $slide_header ), 'html' );
?>
<?php endif; // true ==== $et_slide_header ?>
<?php ob_start(); ?>
<header id="main-header" data-height-onload="<?php echo esc_attr( et_get_option( 'menu_height', '66' ) ); ?>">
<div class="container clearfix et_menu_container">
<?php
$logo = ( $user_logo = et_get_option( 'divi_logo' ) ) && ! empty( $user_logo )
? $user_logo
: $template_directory_uri . '/images/logo.png';
ob_start();
?>
<div class="logo_container">
<span class="logo_helper"></span>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" data-height-percentage="<?php echo esc_attr( et_get_option( 'logo_height', '54' ) ); ?>" />
</a>
</div>
<?php
$logo_container = ob_get_clean();
/**
* Filters the HTML output for the logo container.
*
* #since 3.10
*
* #param string $logo_container
*/
echo et_core_intentionally_unescaped( apply_filters( 'et_html_logo_container', $logo_container ), 'html' );
?>
<div id="et-top-navigation" data-height="<?php echo esc_attr( et_get_option( 'menu_height', '66' ) ); ?>" data-fixed-height="<?php echo esc_attr( et_get_option( 'minimized_menu_height', '40' ) ); ?>">
<?php if ( ! $et_slide_header || is_customize_preview() ) : ?>
<nav id="top-menu-nav">
<?php
$menuClass = 'nav';
if ( 'on' === et_get_option( 'divi_disable_toptier' ) ) $menuClass .= ' et_disable_top_tier';
$primaryNav = '';
$primaryNav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => 'top-menu', 'echo' => false ) );
if ( empty( $primaryNav ) ) :
?>
<ul id="top-menu" class="<?php echo esc_attr( $menuClass ); ?>">
<?php if ( 'on' === et_get_option( 'divi_home_link' ) ) { ?>
<li <?php if ( is_home() ) echo( 'class="current_page_item"' ); ?>><?php esc_html_e( 'Home', 'Divi' ); ?></li>
<?php }; ?>
<?php show_page_menu( $menuClass, false, false ); ?>
<?php show_categories_menu( $menuClass, false ); ?>
</ul>
<?php
else :
echo et_core_esc_wp( $primaryNav );
endif;
?>
</nav>
<?php endif; ?>
<?php
if ( ! $et_top_info_defined && ( ! $et_slide_header || is_customize_preview() ) ) {
et_show_cart_total( array(
'no_text' => true,
) );
}
?>
<?php if ( $et_slide_header || is_customize_preview() ) : ?>
<span class="mobile_menu_bar et_pb_header_toggle et_toggle_<?php echo esc_attr( et_get_option( 'header_style', 'left' ) ); ?>_menu"></span>
<?php endif; ?>
<?php if ( ( false !== et_get_option( 'show_search_icon', true ) && ! $et_slide_header ) || is_customize_preview() ) : ?>
<div id="et_top_search">
<span id="et_search_icon"></span>
</div>
<?php endif; // true === et_get_option( 'show_search_icon', false ) ?>
<?php
/**
* Fires at the end of the 'et-top-navigation' element, just before its closing tag.
*
* #since 1.0
*/
do_action( 'et_header_top' );
?>
</div> <!-- #et-top-navigation -->
</div> <!-- .container -->
<div class="et_search_outer">
<div class="container et_search_form_container">
<form role="search" method="get" class="et-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
printf( '<input type="search" class="et-search-field" placeholder="%1$s" value="%2$s" name="s" title="%3$s" />',
esc_attr__( 'Search …', 'Divi' ),
get_search_query(),
esc_attr__( 'Search for:', 'Divi' )
);
?>
</form>
<span class="et_close_search_field"></span>
</div>
</div>
</header> <!-- #main-header -->
<?php
$main_header = ob_get_clean();
/**
* Filters the HTML output for the main header.
*
* #since 3.10
*
* #param string $main_header
*/
echo et_core_intentionally_unescaped( apply_filters( 'et_html_main_header', $main_header ), 'html' );
?>
<div id="et-main-area">
<?php
/**
* Fires after the header, before the main content is output.
*
* #since 3.10
*/
do_action( 'et_before_main_content' );
In practice the secondary menu appears first, before primary menu. How to change the ordering for displaying:
FIRST: Primary menu;
SECOND: Secondary menu;
Who knows how could i change the order, for displaying the same order that i described above?

First of all, it is not advisable to change the order of the menu in the DIVI theme. Just rearranging the code will collapse the header.
So it is better to register a new Navigation Menu and then use it where you wanted.
Before making any changes to the theme files, make sure you are using Divi Child Theme. If you don't have one, You can download it here (Divi Child Theme Download Link)
Then you can copy your header.php file from Divi theme folder and paste it into the Child theme folder.
To register a custom menu, use the below code in the Functions.php file.
function wpb_custom_new_menu() {
register_nav_menu('my-custom-menu',__( 'My Custom Menu' ));
}
add_action( 'init', 'wpb_custom_new_menu' );
Now go to Appearance -> Menus and create a New Menu and assign it as "My Custom Menu".
To add this menu to the header, Add the below code in header.php where you want to display the menu.
'my-custom-menu',
'container_class' => 'custom-menu-class' ) );
?>
Then you can use the .custom_menu_class CSS class to style the menu.

Related

Search Result shows White Blank Page wordpress

My site link is: https://staging.buellairhorns.com/
When I try the search function, the search result page shows nothing but a white blank page. Can anyone help me figure out what's wrong?
This is my: search.php
<?php
$container_class = apply_filters( 'neve_container_class_filter', 'container', 'blog-archive' );
get_header();
$wrapper_classes = [ 'posts-wrapper' ];
if ( ! neve_is_new_skin() ) {
$wrapper_classes[] = 'row';
}
?>
<div class="<?php echo esc_attr( $container_class ); ?> archive-container">
<div class="row">
<?php do_action( 'neve_do_sidebar', 'blog-archive', 'left' ); ?>
<div class="nv-index-posts search col">
<?php
do_action( 'neve_page_header', 'search' );
if ( have_posts() ) {
/* Start the Loop. */
echo '<div class="' . esc_attr( join( ' ', $wrapper_classes ) ) . '">';
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content' );
}
echo '</div>';
if ( ! is_singular() ) {
do_action( 'neve_do_pagination', 'blog-archive' );
}
} else {
get_template_part( 'template-parts/content', 'none' );
}
?>
<div class="w-100"></div>
</div>
<?php do_action( 'neve_do_sidebar', 'blog-archive', 'right' ); ?>
</div>
</div>
<?php
get_footer();
This is my searchform.php
<?php
$form_classes = [ 'search-form' ];
$placeholder = array_key_exists( 'placeholder', $args ) ? $args['placeholder'] : __( 'Search for...', 'neve' );
if ( array_key_exists( 'additional_form_classes', $args ) && is_array( $args['additional_form_classes'] ) ) {
$form_classes = array_merge( $form_classes, $args['additional_form_classes'] );
}
$value = array_key_exists( 'value', $args ) ? $args['value'] : '';
$placeholder = apply_filters( 'nv_search_placeholder', $placeholder );
$aria_label = __( 'Search', 'neve' );
$home_url = home_url( '/' );
if ( function_exists( 'PLL' ) ) {
$pll_data = PLL();
if ( property_exists( $pll_data, 'links' ) && method_exists( $pll_data->links, 'get_home_url' ) ) {
$home_url = $pll_data->links->get_home_url( null, true );
}
}
?>
<form role="search"
method="get"
class="<?php echo esc_attr( implode( ' ', $form_classes ) ); ?>"
action="<?php echo esc_url( $home_url ); ?>">
<label>
<span class="screen-reader-text"><?php echo esc_html__( 'Search for...', 'neve' ); ?></span>
</label>
<input type="search"
class="search-field"
aria-label="<?php echo esc_attr__( 'Search', 'neve' ); ?>"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
value="<?php echo esc_attr( $value ); ?>"
name="s"/>
<button type="submit"
class="search-submit"
aria-label="<?php echo esc_attr( $aria_label ); ?>">
<span class="nv-search-icon-wrap">
<?php neve_search_icon( false, true ); ?>
</span>
</button>
<?php
if ( array_key_exists( 'post_type', $args ) ) {
echo '<input type="hidden" name="post_type" value="' . esc_attr( $args['post_type'] ) . '"/>';
}
?>
</form>
I'am using neve theme. I created a custom search result page using Elementor Pro but still not working.

Display child terms if there are posts on custom taxonomy template

I have a piece of code that shows child terms of a custom taxonomy of the current parent term in the taxonomy-term.php template file. I want to display html only when there are child terms present. Now the heading 2 is displayed even when there are no child terms. Here is the code:
<?php
$term_children = get_terms('onderwerp', array( 'parent' => get_queried_object_id(),));
if ( ! is_wp_error( $terms ) || ($term_children->count != 0) ) { ?>
<section>
<h2>Ik heb een vraag over:</h2>
<div class="onderwerp-links">
<?php
foreach ( $term_children as $child ) { ?>
<?php $img = get_term_meta( $term->term_id, 'ndftm_img', true ); ?>
<a href="<?php echo esc_url( get_term_link( $child ) ) ?>" style="background-image: url(<?php echo $img; ?>)">
<span><?php echo $child->name; ?></span>
</a><?php
}
?>
</div>
</section>
<?php
}
?>
I fixed it by adding
'hide_empty' => true
in the get terms array
and making the if statement like this:
if ( ! empty($term_children) )
Here's the code:
<?php
$term_children = get_terms('onderwerp', array( 'parent' => get_queried_object_id(), 'hide_empty' => true ));
if ( ! empty($term_children) ) { ?>
<section>
<h2>Ik heb een vraag over:</h2>
<div class="onderwerp-links">
<?php
foreach ( $term_children as $child ) { ?>
<?php $img = get_term_meta( $term->term_id, 'ndftm_img', true ); ?>
<a href="<?php echo esc_url( get_term_link( $child ) ) ?>" style="background-image: url(<?php echo $img; ?>)">
<span><?php echo $child->name; ?></span>
</a><?php
}
?>
</div>
</section>
<?php
}
?>

WordPress CPT Numbered Pagination

I have a custom post type in WordPress.
The mobile archive page is a slider through ALL the posts.
The desktop archive page is a normal archive page, with numbered navigation and only shows 6 posts per page.
I see to have this working, however on the desktop, there should only be 3 pages, but instead, there are 4 pages, and the fourth page is empty.
I'm baffled as to what I've done wrong, so if anyone can take a look, that would be brill.
Thank you
archive-projects.php:
<?php
if ( !have_posts() ) {
// If no posts match the query
get_template_part( '404' );
return;
}
get_header();
?>
<div class="container">
<div class="content-area mobile" id="mobile-projects-slider">
<?php
$args = array(
'post_type' => 'projects',
'order-by' => 'date',
'order' => 'des',
'posts_per_page' => -1
);
$the_query = new WP_Query( $args );
if($the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
?>
<article <?php post_class( 'entry entry-archive' ); ?> data-aos="fade">
<?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
<div class="entry-image">
<a href="<?php the_permalink(); ?>">
<div class="post-image" style="background-image: url('<?php echo $backgroundImg[0]; ?>')"></div>
</a>
</div>
<div class="entry-content">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
See More
</div>
</article>
<?php
endwhile;
wp_reset_postdata();
else:
endif;
?>
</div>
<div class="content-area desktop" id="desktop-projects">
<?php
$args = array(
'post_type' => 'projects',
'order-by' => 'date',
'order' => 'des',
'paged' => $paged,
'posts_per_page' => 6
);
$the_query = new WP_Query( $args );
if($the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
?>
<article <?php post_class( 'entry entry-archive' ); ?> data-aos="fade">
<?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
<div class="entry-image">
<a href="<?php the_permalink(); ?>">
<div class="post-image" style="background-image: url('<?php echo $backgroundImg[0]; ?>')"></div>
</a>
</div>
<div class="entry-content">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
See More
</div>
</article>
<?php
endwhile;
wp_reset_postdata();
else:
endif;
?>
<?php
get_template_part( '_template-parts/page-navigation' );
?>
</div>
<!-- <div class="aside"> -->
<?php /* get_sidebar(); */ ?>
<!-- </div> -->
</div>
<?php
get_footer();
page-navigation.php:
<?php if ( is_singular() ) : ?>
<?php if( get_post_type() == 'projects' ) { ?>
<div id="navigation" data-aos="fade">
<div class="pagination pagination-singular">
<?php if ( get_next_post() ) { ?>
<div class="nav-next"><?php next_post_link( '%link', 'Previous Project' ) ?></div>
<?php } ?>
<?php if ( get_previous_post() ) { ?>
<div class="nav-previous"><?php previous_post_link( '%link', 'Next Project' ) ?></div>
<?php } ?>
</div>
</div>
<?php } else { ?>
<div id="navigation" data-aos="fade">
<div class="pagination pagination-singular">
<?php if ( get_next_post() ) { ?>
<div class="nav-next"><?php next_post_link( '%link', 'Previous Post' ) ?></div>
<?php } ?>
<?php if ( get_previous_post() ) { ?>
<div class="nav-previous"><?php previous_post_link( '%link', 'Next Post' ) ?></div>
<?php } ?>
</div>
</div>
<?php } ?>
<?php else : ?>
<?php
aa_numeric_posts_nav();
// located in includes > functions > theme-functions.php
?>
<?php endif; ?>
aa_posts_nav_function():
function aa_numeric_posts_nav() {
if( is_singular() )
return;
global $wp_query;
// $paged = 0;
/** Stop execution if there's only 1 page */
if( $wp_query->max_num_pages <= 1 )
return;
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = intval( $wp_query->max_num_pages );
/** Add current page to the array */
if ( $paged >= 1 )
$links[] = $paged;
/** Add the pages around the current page to the array */
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
//
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '<div id="navigation"><ul class="pagination numbered-pagination">' . "\n";
/** Previous Post Link */
if ( get_previous_posts_link() )
printf( '<li class="nav-prev">%s</li>' . "\n", get_previous_posts_link() );
/** Link to first page, plus ellipses if necessary */
if ( ! in_array( 1, $links ) ) {
$class = 1 == $paged ? ' class="active"' : '';
printf( '<li%s>%s</li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
if ( ! in_array( 2, $links ) )
echo '<li>…</li>';
}
/** Link to current page, plus 2 pages in either direction if necessary */
sort( $links );
foreach ( (array) $links as $link ) {
$class = $paged == $link ? ' class="active"' : '';
printf( '<li%s>%s</li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
}
/** Link to last page, plus ellipses if necessary */
if ( ! in_array( $max, $links ) ) {
if ( ! in_array( $max - 1, $links ) )
echo '<li>…</li>' . "\n";
$class = $paged == $max ? ' class="active"' : '';
printf( '<li%s>%s</li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );
}
/** Next Post Link */
if ( get_next_posts_link() )
printf( '<li class="nav-next">%s</li>' . "\n", get_next_posts_link() );
echo '</ul></div>' . "\n";
}
Fixed it. I removed the WP_Query completely for the desktop version (in archive- and added it using a separate function. This is what I have now and works:
archive-projects.php
<?php
if ( !have_posts() ) {
// If no posts match the query
get_template_part( '404' );
return;
}
get_header();
?>
<div class="container">
<div class="content-area mobile" id="mobile-projects-slider">
<?php
$args = array(
'post_type' => 'projects',
'order-by' => 'date',
'order' => 'des',
'posts_per_page' => -1
);
$the_query = new WP_Query( $args );
if($the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
?>
<article <?php post_class( 'entry entry-archive' ); ?> data-aos="fade">
<?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
<div class="entry-image">
<a href="<?php the_permalink(); ?>">
<div class="post-image" style="background-image: url('<?php echo $backgroundImg[0]; ?>')"></div>
</a>
</div>
<div class="entry-content">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
See More
</div>
</article>
<?php
endwhile;
wp_reset_postdata();
else:
endif;
?>
</div>
<div class="content-area desktop" id="desktop-projects">
<?php
if(have_posts() ) :
while ( have_posts() ) : the_post();
?>
<article <?php post_class( 'entry entry-archive' ); ?> data-aos="fade">
<?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
<div class="entry-image">
<a href="<?php the_permalink(); ?>">
<div class="post-image" style="background-image: url('<?php echo $backgroundImg[0]; ?>')"></div>
</a>
</div>
<div class="entry-content">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
See More
</div>
</article>
<?php
endwhile;
wp_reset_postdata();
else:
echo '<h2>No posts found!</h2>';
endif;
aa_numeric_posts_nav();
?>
</div>
<!-- <div class="aside"> -->
<?php /* get_sidebar(); */ ?>
<!-- </div> -->
</div>
<?php
get_footer();
aa_numeric_posts_nav(); function
function aa_numeric_posts_nav() {
if( is_singular() )
return;
global $wp_query;
// $paged = 0;
/** Stop execution if there's only 1 page */
if( $wp_query->max_num_pages <= 1 )
return;
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = intval( $wp_query->max_num_pages );
/** Add current page to the array */
if ( $paged >= 1 )
$links[] = $paged;
/** Add the pages around the current page to the array */
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
//
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '<div id="navigation"><ul class="pagination numbered-pagination">' . "\n";
/** Previous Post Link */
if ( get_previous_posts_link() )
printf( '<li class="nav-prev">%s</li>' . "\n", get_previous_posts_link() );
/** Link to first page, plus ellipses if necessary */
if ( ! in_array( 1, $links ) ) {
$class = 1 == $paged ? ' class="active"' : '';
printf( '<li%s>%s</li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
if ( ! in_array( 2, $links ) )
echo '<li>…</li>';
}
/** Link to current page, plus 2 pages in either direction if necessary */
sort( $links );
foreach ( (array) $links as $link ) {
$class = $paged == $link ? ' class="active"' : '';
printf( '<li%s>%s</li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
}
/** Link to last page, plus ellipses if necessary */
if ( ! in_array( $max, $links ) ) {
if ( ! in_array( $max - 1, $links ) )
echo '<li>…</li>' . "\n";
$class = $paged == $max ? ' class="active"' : '';
printf( '<li%s>%s</li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );
}
/** Next Post Link */
if ( get_next_posts_link() )
printf( '<li class="nav-next">%s</li>' . "\n", get_next_posts_link() );
echo '</ul></div>' . "\n";
}
function for posts per page CPT for my desktop:
function aa_order_cpt( $query ) {
// exit out if it's the admin or it isn't the main query
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
// order category archives by title in ascending order
if ( is_archive() ) {
$query->set( 'order' , 'desc' );
$query->set( 'orderby', 'date');
$query->set('posts_per_page', 6 );
}
return;
}
add_action( 'pre_get_posts', 'aa_order_cpt', 1 );

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 );

Wordpress seeking the full hosting absolute link instead of the domain's path

http://jakeruesink.com/hermes/bosweb/web166/b1664/ipg.jakeruesinkcom/wp-content/uploads/et_temp/designfeature-23171_240x240.jpg
This link is obviously incorrect, but if you take out the "hermes/bosweb/web166/b1664/ipg.jakeruesinkcom/" then it works. For some reason wordpress is getting the wrong path for these images on my http://jakeruesink.com/project-page/
The following is the code for that page, but I'm not sure if that is what needs fixing.
<?php
/*
Template Name: Filterable Portfolio
*/
?>
<?php get_header(); ?>
<?php get_template_part('includes/breadcrumbs', 'page'); ?>
<h1 class="page_title"><?php the_title(); ?></h1>
<div id="content-area" class="fullwidth clearfix">
<div class="post-content">
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<p><strong>'.esc_attr__('Pages','Flexible').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php edit_post_link(esc_attr__('Edit this page','Flexible')); ?>
<?php endwhile; ?>
</div> <!-- end .post-content -->
<?php
$et_ptemplate_settings = array();
$et_ptemplate_settings = get_post_meta($post->ID,'et_ptemplate_settings',true);
$et_ptemplate_projectcats = isset( $et_ptemplate_settings['et_ptemplate_projectcats'] ) ? (array) $et_ptemplate_settings['et_ptemplate_projectcats'] : array();
$portfolio_args = array(
'post_type' => 'project',
'showposts' => -1,
'tax_query' => array(
array(
'taxonomy' => 'project_category',
'field' => 'id',
'terms' => $et_ptemplate_projectcats,
'operator' => 'IN'
)
)
);
if ( empty( $et_ptemplate_projectcats ) ) unset ( $portfolio_args['tax_query'] );
$portfolio_query = new WP_Query( apply_filters( 'et_home_portfolio_args', $portfolio_args ) );
$categories = get_terms( 'project_category', array( 'include' => $et_ptemplate_projectcats ) );
if ( $categories ){
echo '<ul id="et_portfolio_sort_links">';
echo '<li class="active">' . '' . __( 'All', 'Flexible' ) . '' . '</li>';
foreach ( $categories as $category ){
echo '<li>' . '' . esc_html( $category->name ) . '' . '</li>';
}
echo '</ul>';
}
?>
<div id="portfolio-grid" class="clearfix">
<?php
while ( $portfolio_query->have_posts() ) : $portfolio_query->the_post();
get_template_part( 'includes/entry', 'portfolio' );
endwhile;
wp_reset_postdata();
?>
</div> <!-- end #portfolio-grid -->
This is the code for the portfolio page:
<?php
/*
Template Name: Portfolio Page
*/
?>
<?php
$et_ptemplate_settings = array();
$et_ptemplate_settings = maybe_unserialize( get_post_meta($post->ID,'et_ptemplate_settings',true) );
$fullwidth = true;
$et_ptemplate_showtitle = isset( $et_ptemplate_settings['et_ptemplate_showtitle'] ) ? (bool)
$et_ptemplate_settings['et_ptemplate_showtitle'] : false;
$et_ptemplate_showdesc = isset( $et_ptemplate_settings['et_ptemplate_showdesc'] ) ? (bool)
$et_ptemplate_settings['et_ptemplate_showdesc'] : false;
$et_ptemplate_detect_portrait = isset( $et_ptemplate_settings['et_ptemplate_detect_portrait'] ) ? (bool)
$et_ptemplate_settings['et_ptemplate_detect_portrait'] : false;
$gallery_cats = isset( $et_ptemplate_settings['et_ptemplate_gallerycats'] ) ? (array)
$et_ptemplate_settings['et_ptemplate_gallerycats'] : array();
$et_ptemplate_gallery_perpage = isset( $et_ptemplate_settings['et_ptemplate_gallery_perpage'] ) ? (int)
$et_ptemplate_settings['et_ptemplate_gallery_perpage'] : 12;
$et_ptemplate_portfolio_size = isset( $et_ptemplate_settings['et_ptemplate_imagesize'] ) ? (int)
$et_ptemplate_settings['et_ptemplate_imagesize'] : 2;
$et_ptemplate_portfolio_class = '';
if ( $et_ptemplate_portfolio_size == 1 ) $et_ptemplate_portfolio_class = ' et_portfolio_small';
if ( $et_ptemplate_portfolio_size == 3 ) $et_ptemplate_portfolio_class = ' et_portfolio_large';
?>
<?php get_header(); ?>
<?php get_template_part('includes/breadcrumbs', 'page'); ?>
<div id="content-area" class="clearfix<?php if ( $fullwidth ) echo ' fullwidth'; ?>">
<div id="left-area">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('entry clearfix'); ?>>
<h1 class="page_title"><?php the_title(); ?></h1>
<?php
$thumb = '';
$width = apply_filters('et_blog_image_width',640);
$height = apply_filters('et_blog_image_height',320);
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Blogimage');
$thumb = $thumbnail["thumb"];
?>
<?php if ( '' != $thumb && 'on' == et_get_option('flexible_page_thumbnails') ) { ?>
<div class="post-thumbnail">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
</div> <!-- end .post-thumbnail -->
<?php } ?>
<div class="post-content">
<?php the_content(); ?>
<div id="et_pt_portfolio_gallery" class="clearfix responsive<?php echo $et_ptemplate_portfolio_class; ?>">
<?php $gallery_query = '';
$portfolio_count = 1;
$et_open_row = false;
if ( !empty($gallery_cats) ) $gallery_query = '&cat=' . implode(",", $gallery_cats);
else echo '<!-- gallery category is not selected -->'; ?>
<?php
global $wp_embed;
$et_videos_output = '';
$et_paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
?>
<?php query_posts("showposts=$et_ptemplate_gallery_perpage&paged=" . $et_paged . $gallery_query); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $width = 260;
$height = 170;
if ( $et_ptemplate_portfolio_size == 1 ) {
$width = 140;
$height = 94;
$et_portrait_height = 170;
}
if ( $et_ptemplate_portfolio_size == 2 ) $et_portrait_height = 315;
if ( $et_ptemplate_portfolio_size == 3 ) {
$width = 430;
$height = 283;
$et_portrait_height = 860;
}
$et_auto_image_detection = false;
if ( has_post_thumbnail( $post->ID ) && $et_ptemplate_detect_portrait ) {
$wordpress_thumbnail = get_post( get_post_thumbnail_id($post->ID) );
$wordpress_thumbnail_url = $wordpress_thumbnail->guid;
if ( et_is_portrait($wordpress_thumbnail_url) ) $height = $et_portrait_height;
}
$titletext = get_the_title();
$et_portfolio_title = get_post_meta($post->ID,'et_portfolio_title',true) ? get_post_meta($post->ID,'et_portfolio_title',true) : get_the_title();
$et_videolink = get_post_meta($post->ID,'et_videolink',true) ? get_post_meta($post->ID,'et_videolink',true) : '';
if ( '' != $et_videolink ){
$et_video_id = 'et_video_post_' . $post->ID;
$et_videos_output .= '<div id="'. esc_attr( $et_video_id ) .'">' . $wp_embed->shortcode( '', $et_videolink ) . '</div>';
}
$thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,true,'et_portfolio');
$thumb = $thumbnail["thumb"];
if ( $et_ptemplate_detect_portrait && $thumbnail["use_timthumb"] && et_is_portrait($thumb) ) {
$height = $et_portrait_height;
} ?>
<?php if ( $portfolio_count == 1 || ( $et_ptemplate_portfolio_size == 2 && (!$fullwidth && ($portfolio_count+1) % 2 == 0) ) || ( $et_ptemplate_portfolio_size == 3 && (($portfolio_count+1) % 2 == 0) ) ) {
$et_open_row = true; ?>
<div class="et_pt_portfolio_row clearfix">
<?php } ?>
<div class="et_pt_portfolio_item">
<?php if ($et_ptemplate_showtitle) { ?>
<h2 class="et_pt_portfolio_title"><?php echo $et_portfolio_title; ?></h2>
<?php } ?>
<div class="et_pt_portfolio_entry<?php if ( $height == $et_portrait_height ) echo ' et_portrait_layout'; ?>">
<div class="et_pt_portfolio_image<?php if ($et_videolink <> '') echo ' et_video'; ?>">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>
<span class="et_pt_portfolio_overlay"></span>
<a class="et_portfolio_zoom_icon fancybox" title="<?php the_title(); ?>"<?php if ($et_videolink == '') echo ' rel="portfolio"'; ?> href="<?php if ($et_videolink <> '') echo esc_url( '#' . $et_video_id ); else echo($thumbnail['fullpath']); ?>"><?php esc_html_e('Zoom in','Flexible'); ?></a>
<a class="et_portfolio_more_icon" href="<?php the_permalink(); ?>"><?php esc_html_e('Read more','Flexible'); ?></a>
</div> <!-- end .et_pt_portfolio_image -->
</div> <!-- end .et_pt_portfolio_entry -->
<?php if ($et_ptemplate_showdesc) { ?>
<p><?php truncate_post(90); ?></p>
<?php } ?>
</div> <!-- end .et_pt_portfolio_item -->
<?php if ( ($et_ptemplate_portfolio_size == 2 && !$fullwidth && $portfolio_count % 2 == 0) || ( $et_ptemplate_portfolio_size == 3 && ($portfolio_count % 2 == 0) ) ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<?php if ( ($et_ptemplate_portfolio_size == 2 && $fullwidth && $portfolio_count % 3 == 0) || ($et_ptemplate_portfolio_size == 1 && !$fullwidth && $portfolio_count % 3 == 0) || ($et_ptemplate_portfolio_size == 1 && $fullwidth && $portfolio_count % 5 == 0) ) { ?>
</div> <!-- end .et_pt_portfolio_row -->
<div class="et_pt_portfolio_row clearfix">
<?php $et_open_row = true; ?>
<?php } ?>
<?php $portfolio_count++;
endwhile; ?>
<?php if ( $et_open_row ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<div class="page-nav clearfix">
<?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<?php get_template_part('includes/navigation'); ?>
<?php } ?>
</div> <!-- end .entry -->
<?php else : ?>
<?php if ( $et_open_row ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<?php get_template_part('includes/no-results'); ?>
<?php endif; wp_reset_query(); ?>
<?php if ( $et_open_row ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<?php if ( '' != $et_videos_output ) echo '<div class="et_embedded_videos">' . $et_videos_output . '</div>'; ?>
</div> <!-- end #et_pt_portfolio_gallery -->
<?php wp_link_pages(array('before' => '<p><strong>'.esc_attr__('Pages','Flexible').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php edit_post_link(esc_attr__('Edit this page','Flexible')); ?>
</div> <!-- end .post-content -->
</article> <!-- end .entry -->
<?php endwhile; // end of the loop. ?>
</div> <!-- end #left_area -->
<?php if ( ! $fullwidth ) get_sidebar(); ?>
</div> <!-- end #content-area -->
<?php get_footer(); ?>
Here is the code for entry.php:
<article id="post-<?php the_ID(); ?>" <?php post_class('entry clearfix'); ?>>
<h2 class="title"><?php the_title(); ?></h2>
<?php
$thumb = '';
$width = apply_filters('et_blog_image_width',640);
$height = apply_filters('et_blog_image_height',320);
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Blogimage');
$thumb = $thumbnail["thumb"];
?>
<?php if ( '' != $thumb && 'on' == et_get_option('flexible_thumbnails_index') ) { ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
</a>
</div> <!-- end .post-thumbnail -->
<?php } ?>
<div class="post-content">
<?php
$index_postinfo = et_get_option('flexible_postinfo1');
if ( $index_postinfo ){
echo '<p class="meta-info">';
et_postinfo_meta( $index_postinfo, et_get_option('flexible_date_format'), esc_html__('0 comments','Flexible'), esc_html__('1 comment','Flexible'), '% ' . esc_html__('comments','Flexible') );
echo '</p>';
}
if ( 'on' == et_get_option('flexible_blog_style') ) the_content('');
else echo '<p>' . truncate_post(360,false) . '</p>';
?>
<?php esc_html_e( 'Read More', 'Flexible' ); ?>
</div> <!-- end .post-content -->

Resources