How do I put a wordpress blog into my html site?

Either install wordpress in a subdomain (blog.yoursite.com or sub folder (yoursite.com/blog) Design the WordPress site exactly like your current website to get a consistent design. Or make your entire website in WordPress. WordPress can be used for many other things than blogging.

Display sidebar if blog

There is no conditional tag for the blog page. You have to use both is_home() and is_front_page() to detect this page When you use is_home() and is_front_page(), you have to use them in the right order to avoid bugs and to test every user configuration: <?php if ( is_front_page() && is_home() ) { // blog … Read more

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