How do I make the main page be the blog page and not a separate “home” page?

There are two possible settings for this in WordPress. Option A Your front page (http://twistedtalesoftimmy.com/) is dynamic and shows the latest blog posts. Option B Your front page (http://twistedtalesoftimmy.com/) is static and points to a regular page in WordPress. There is another page (e.g. http://twistedtalesoftimmy.com/blog/) that shows the latest blog posts. You can switch between … Read more

How to get the post’s parent ID?

WordPress 5.7 introduces a new helper function to more easily fetch the parent post’s ID: get_post_parent() This can also be used in conjunction with has_post_parent(), so you could have something like looks like: <?php if ( has_post_parent() ) : ?> <a href=”<?php the_permalink( get_post_parent() ); ?>”> <?php echo sprintf( esc_html__( ‘Back to parent page: %s’, … Read more

Custom excerpt length filter doesn’t work

For anyone wondering, as custom excerpts don’t get trimmed by the excerpt_length filter hook, try adding this filter: function trim_custom_excerpt($excerpt) { if (has_excerpt()) { $excerpt = wp_trim_words(get_the_excerpt(), apply_filters(“excerpt_length”, 55)); } return $excerpt; } add_filter(“the_excerpt”, “trim_custom_excerpt”, 999);

Keep WYSIWYG on Blog Page

Pre WP 4.9 if( ! function_exists( ‘fix_no_editor_on_posts_page’ ) ) { /** * Add the wp-editor back into WordPress after it was removed in 4.2.2. * * @param Object $post * @return void */ function fix_no_editor_on_posts_page( $post ) { if( isset( $post ) && $post->ID != get_option(‘page_for_posts’) ) { return; } remove_action( ‘edit_form_after_title’, ‘_wp_posts_page_notice’ ); add_post_type_support( … Read more

Trying to count the total number of paragraphs inside a blog article

I’m pretty sure that is_singular() is going to return false when you are inside the WP loop, since there are more than one posts being looped through. Try is_single() or just look at the post object and examine the post_type attribute. add_filter( ‘the_content’, ‘_some_func’, 15 ); function _some_func( $content ) { if( __check_paragraph_count_blog( $content ) … Read more

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