Showing option when page is frontpage

Try if ( ‘page’ == get_option( ‘show_on_front’ ) ) {}. Edit but I’ve tried adding and replacing <?php endwhile; endif; elseif (is_home()): ?> with both of your code. Could you perhaps include your snippet with mine? I’m not sure why you would do that. I was specifically answering this question: But what if a page … Read more

ID of Front-Page

This should do the trick. global $wp_query; $post = $wp_query->get_queried_object(); $post->ID; This’ll give you the ID for each page you’re on. get_option( ‘page_on_front’ ) should’ve worked though.

How to Display a Plugin function (content) on frontpage using index.php

Your plugin inserts its feelbox widget by filtering the_content: if ($options[‘showinpostsondefault’] == ‘on’) { add_filter(‘the_content’, ‘add_feelbox_widget_to_posts’); } But your index page doesn’t display the_content, just Title, featured thumbnail, an excerpt and, number of comments. The plugin code you’ve shown us doesn’t include a print_feelbox_widget() function. Does such a function actually exist in your plugin? (Also, … Read more

Displaying recent post excerpts on static front page

I’ve found the solution. According to https://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior, one must add global $more; $more = 0; before the call to the_content(). So now my inner loop reads: <?php $recent_posts_query = new WP_Query(array(‘post_type’ => ‘post’, ‘posts_per_page’ => 5)); while ($recent_posts_query->have_posts()) { $recent_posts_query->the_post(); ?> <div class=”post”> <h3><?php echo the_title(); ?></h3> <p>by <?php the_author(); ?></p> <?php global $more; $more … Read more

Loop first six posts in carousel, next eight in grid

Use WP_Query with offset like this <?php $offset = 6; $post_args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => $offset, ); $slider_blog_posts = new WP_Query( $post_args ); ?> <?php if ( $slider_blog_posts->have_posts() ): ?> <div class=”carousel”> <?php while( $slider_blog_posts->have_posts() ): $slider_blog_posts->the_post(); ?> <?php get_carousel_slide( get_the_ID, true); ?> <?php endwhile; ?> </div> <?php endif; ?> <?php wp_reset_postdata(); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)