Hello i was trying change the footer of my wordpress site to somthing else. I thought i was just changing the words but i some how messed up the code. I don't know enough about php to fix was i did
Error is on line 40
<?php if ( 'on' == et_get_option( 'divi_back_to_top', 'false' ) ) : ?>
<span class="et_pb_scroll_top et-pb-icon"></span>
<?php endif;
if ( ! is_page_template( 'page-template-blank.php' ) ) : ?>
<footer id="main-footer">
<?php get_sidebar( 'footer' ); ?>
<?php
if ( has_nav_menu( 'footer-menu' ) ) : ?>
<div id="et-footer-nav">
<div class="container">
<?php
wp_nav_menu( array(
'theme_location' => 'footer-menu',
'depth' => '1',
'menu_class' => 'bottom-nav',
'container' => '',
'fallback_cb' => '',
) );
?>
</div>
</div> <!-- #et-footer-nav -->
<?php endif; ?>
<div id="footer-bottom">
<div class="container clearfix">
<?php
if ( false !== et_get_option( 'show_footer_social_icons', true ) ) {
get_template_part( 'includes/social_icons', 'footer' );
}
?>
<p id="footer-info"><?php printf( __( (changed this) %1$s | Powered by %2$s', 'Divi' ), 'Elegent themes (and this) ', 'WordPress' ); ?></p>
</div> <!-- .container -->
</div>
</footer> <!-- #main-footer -->
</div> <!-- #et-main-area -->
<?php endif; // ! is_page_template( 'page-template-blank.php' ) ?>
</div> <!-- #page-container -->
<?php wp_footer(); ?>
</body>
</html>
I really have no idea what is wrong. I understand html. Thanks for any help.
You have missing single quote in the code, please use following code, I have fixed the code by restoring to original Divi code line
<?php if ( 'on' == et_get_option( 'divi_back_to_top', 'false' ) ) : ?>
<span class="et_pb_scroll_top et-pb-icon"></span>
<?php endif;
if ( ! is_page_template( 'page-template-blank.php' ) ) : ?>
<footer id="main-footer">
<?php get_sidebar( 'footer' ); ?>
<?php
if ( has_nav_menu( 'footer-menu' ) ) : ?>
<div id="et-footer-nav">
<div class="container">
<?php
wp_nav_menu( array(
'theme_location' => 'footer-menu',
'depth' => '1',
'menu_class' => 'bottom-nav',
'container' => '',
'fallback_cb' => '',
) );
?>
</div>
</div> <!-- #et-footer-nav -->
<?php endif; ?>
<div id="footer-bottom">
<div class="container clearfix">
<?php
if ( false !== et_get_option( 'show_footer_social_icons', true ) ) {
get_template_part( 'includes/social_icons', 'footer' );
}
?>
<p id="footer-info"><?php printf( __( 'Designed by %1$s | Powered by %2$s', 'Divi' ), 'Elegant Themes', 'WordPress' ); ?></p>
</div> <!-- .container -->
</div>
</footer> <!-- #main-footer -->
</div> <!-- #et-main-area -->
<?php endif; // ! is_page_template( 'page-template-blank.php' ) ?>
</div> <!-- #page-container -->
Specifically you have omitted the single quote from this line
<p id="footer-info"><?php printf( __( 'Designed by
See single quote just after __( , that you had omitted from your original code.
Related
I'm using WordPress with Writee theme activated. However, When I checked my H1 its displayed as blank and my post title is classified as H2. I tried checking header.php file and I found this.
<?php
/*************************************************************/
## Theme header style . It's header style, part of the theme.
/*************************************************************/
?>
<header id="site-header" class="site-header">
<div class="site-header-top">
<div class="site-container">
<div class="site-row">
<div class="site-header-top-left site-column-9">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav class="primary-navigation" id="primary-navigation">
<?php
$writtyNav = array(
'theme_location' => 'primary',
'menu' => '',
'container' => false,
'container_class' => '',
'container_id' => '',
'menu_class' => '',
'menu_id' => '',
'echo' => true,
'fallback_cb' => '',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => 0,
);
wp_nav_menu($writtyNav);
?>
</nav>
<?php endif ?>
</div>
<?php writee_get_social(); ?>
</div>
</div>
</div>
<div class="site-header-bottom">
<div class="site-container">
<div class="site-row">
<div class="site-header-middle-center">
<div class="site-brand">
<?php
$writee_header_text = esc_attr(get_theme_mod('header_text'));
if ($writee_header_text): ?>
<?php if(!is_single()):
echo '<h1 class="site-heading">';
else:
echo '<h2 class="site-heading">';
endif; ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?>
</a>
<?php if(!is_single()): echo '</h1>'; else: echo '</h2>'; endif; ?>
<?php
elseif(has_custom_logo()):
?>
<?php if(!is_single()): echo '<h1 class="site-logo">'; else: echo '<h2 class="site-logo">'; endif; ?>
<?php the_custom_logo(); ?>
<?php if(!is_single()): echo '</h1>'; else: echo '</h2>'; endif; ?>
<?php
else:
?>
<?php if(!is_single()): echo '<h1 class="site-heading">'; else: echo '<h2 class="site-heading">'; endif; ?>
<?php bloginfo( 'name' ); ?>
<?php if(!is_single()): echo '</h1>'; else: echo '</h2>'; endif; ?>
<?php if(get_bloginfo( 'description' ) != '') : ?>
<p class="site-tagline"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php if($writee_header_text && get_bloginfo( 'description' ) != ''): ?>
<p class="site-tagline"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</header><!-- / header -->
How can I solve this? I want my H1 be displayed normally as H1.
You would have to rework the if statements. I removed the h2 tags and kept all the h1 tags.
<header id="site-header" class="site-header">
<div class="site-header-top">
<div class="site-container">
<div class="site-row">
<div class="site-header-top-left site-column-9">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav class="primary-navigation" id="primary-navigation">
<?php
$writtyNav = array(
'theme_location' => 'primary',
'menu' => '',
'container' => false,
'container_class' => '',
'container_id' => '',
'menu_class' => '',
'menu_id' => '',
'echo' => true,
'fallback_cb' => '',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => 0,
);
wp_nav_menu($writtyNav);
?>
</nav>
<?php endif ?>
</div>
<?php writee_get_social(); ?>
</div>
</div>
</div>
<div class="site-header-bottom">
<div class="site-container">
<div class="site-row">
<div class="site-header-middle-center">
<div class="site-brand">
<?php
$writee_header_text = esc_attr(get_theme_mod('header_text'));
if ($writee_header_text): ?>
<?php if(!has_custom_logo()): ?>
<h1 class="site-heading">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?>
</a>
</h1>
<?php
elseif(has_custom_logo()):
?>
<?php if(!is_single()): echo '<h1 class="site-logo">'; else: echo '<h2 class="site-logo">'; endif; ?>
<?php the_custom_logo(); ?>
<?php if(!is_single()): echo '</h1>'; else: echo '</h2>'; endif; ?>
<?php
else:
?>
<h1 class="site-heading">
<?php bloginfo( 'name' ); ?>
</h1>
<?php if(get_bloginfo( 'description' ) != '') : ?>
<p class="site-tagline"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php if($writee_header_text && get_bloginfo( 'description' ) != ''): ?>
<p class="site-tagline"><?php bloginfo( 'description' ); ?></p>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</header><!-- / header -->
I am working on a search. I am trying to search the product by tag or category. I tried the below code but it's not working. I am getting
Nothing Found
Also, the Below code is working only with title and content.
Would you help me out with this?
<?php
/**
* The template for displaying search results pages
*
* #link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* #package CoolPickings
*/
get_header();
?>
<section id="primary" class="content-area mainSearch">
<main id="main" class="site-main">
<div class="equalPadding">
<div class="cp-seeWrapper">
<?php
if ( have_posts() ) :
?>
<div class="row">
<?php
while (have_posts()){the_post();?>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-xs-12 ">
<div class="cp-shadow cp-seeSinglePostWrapper">
<?php the_post_thumbnail();?>
<div class="bg-white single-post-box">
<div class="d-flex cp-CategoryList">
<div class="seeDate"><?php echo get_the_date('F j, Y'); ?></div>
<div class="cp_cat_list">
<?php $cat = get_the_category();
?>
<?php echo $cat[0]->cat_name?><?php //the_category('');
?>
</div>
</div>
<div class="cp-b-content"><h2><?php echo wp_trim_words(get_the_title(), 12, '...'); ?></h2></div>
<p><?php echo wp_trim_words(get_the_excerpt(), 25, '...'); ?></p>
</div>
</div>
</div>
<?php } ?>
<?php //endwhile;
//the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</div>
</div>
</div>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_sidebar();
get_footer();
Try the following code below. The only difference is using terms as an array.
$getSearch=get_search_query();
$args = array(
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'product_tag',
'field' => 'slug',
'terms' => array($getSearch) // Using the terms as an array
),
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array($getSearch) // Using the terms as an array
)
),
'post_type' => 'product'
);
$the_query = new WP_Query( $args );
// ... functions.php
add_action( 'pre_get_posts', 'my_search_exclude' );
function my_search_exclude( $query )
{
if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
$query->set( 's', '' );
}
}
You can find more info here: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
I'm creating a Wordpress theme for a graphic portfolio website, and I'm utilizing the sidebar.php for a hero image on the index page that is not meant to appear on other pages. While this works for all static inside pages, I have two custom post categories, and the sidebar section has started appearing above those posts.
I should note that this hasn't always been a problem, and started cropping up for no apparent reason while working on something else.
On index.php, the sidebar is called as follows:
<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile; ?>
<nav>
<ul class="pager">
<li><?php next_posts_link( 'Previous' ); ?></li>
<li><?php previous_posts_link( 'Next' ); ?></li>
</ul>
</nav>
<?php endif;?>
<?php get_footer(); ?>
While page.php is similar but lacks the php line calling the sidebar, as follows:
<?php get_header(); ?>
<div class="row">
<div class="col-sm-12">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile; endif;?>
</div> <!-- /.col -->
</div> <!-- /.row -->
<?php get_footer(); ?>
page-fine-art.php also lacks that php line, as follows:
<div class="row">
<div class="col-sm-12">
<?php
$args = array(
'post_type' => 'fine-art',
'orderby' => 'menu_order',
'order' => 'ASC'
);
$custom_query = new WP_Query( $args );
while ($custom_query->have_posts()) : $custom_query->the_post(); ?>
<div class="blog-post">
<h2 class="blog-post-title"><? php the_title(); ?></h2>
<p class="blog-post-meta"><?php the_date(); ?> by <?php the_author(); ?></p>
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
<?php the_excerpt(); ?>
<?php endwhile; ?>
</div> <!-- /.col -->
</div> <!-- /.row -->
<?php get_footer(); ?>
The function creating the the custom posts for "fine art" goes:
function create_my_custom_posts() {
register_post_type( 'fine-art',
array(
'labels' => array(
'name' => __( 'Fine Art' ),
'singular_name' => __( 'Fine Art' ),
),
'public' => true,
'has_archive' => true,
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields'
)
));
I don't see where sidebar.php is being called in the final example, or where else it could be coming from.
I'm trying to add a widget area to the main body of page.php, so that I can place unique widgets on each page of my site. I've followed the instructions here: http://codex.wordpress.org/Widgetizing_Themes
I added this to functions.php in my theme:
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Main widget',
'id' => 'main_widget_area',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
and this is page.php:
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( is_active_sidebar( 'main_widget_area' ) ) : ?>
<div id="main-widget" class="widget-area main-widget">
<?php dynamic_sidebar( 'main_widget_area' ); ?>
</div><!-- #primary-sidebar -->
<?php endif; ?>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<div class="entry-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
<?php comments_template(); ?>
<?php endwhile; ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
(I added the top section, with main_widget_area)
However when I edit the page I see no way to drop in a widget. I'm not sure if I'm missing a step, or if I'm just not editing the page in the right way.
Take a look at the "Widgets" menu underneath "Appearance" in the WordPress backend. There will be a list of widgets on the left side of the page and a list of available sidebars on the right. Just drag-and-drop the widget you want into the sidebar you registered and you should be good to go.
My dynamic sidebar does not show standard widgets like recent posts or archives but the individual content I put into the sidebar.php
This is the sidebar-part from my functions.php:
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
register_sidebar( array(
'name' => __( 'Primäre Sidebar' ),
'id' => 'sidebar-main',
'description' => __( 'Rechte Hauptsidebar für Werbeflächen und Meta' ),
'before_title' => '<h4>',
'after_title' => '</h4>',
) );
and this is the code from sidebar.php:
<aside id="sidebar-main">
<div id="widgetarea">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : endif; ?>
<h4>TESTESTEST</h4>
<p>HALLOHALLO</p>
</div>
</aside>
As always, I call the sidebar by <?php get_sidebar(); ?> in my theme.
How come the other stuff is being displayed but not the widgets? I have no clue.
Edit: I already tried deactivating plugins - no change.
Your call to your sidebar is wrong. This
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : endif; ?>
should be
<?php if ( is_active_sidebar( 'sidebar-main' ) ) : ?>
<?php dynamic_sidebar( 'sidebar-main' ); ?>
<?php endif; ?>
try this in sidebar.php:
<aside id="sidebar-main">
<div id="widgetarea">
<?php dynamic_sidebar('Primäre Sidebar') ?>
</div>
</aside>