Assuming that the 'blog'
slug is correct, your code would work. I would suggest making a separate template for the page, namely page-blog.php (see http://codex.wordpress.org/images/1/18/Template_Hierarchy.png and http://codex.wordpress.org/Template_Hierarchy) where you set up the structure and appearance of the page exactly as you want it to be.
WordPress will automatically look for the file when opening a page with the name of 'blog'
(that is, the slug must be 'blog'
). Also, the code you posted above would normally go in loop.php, granted that you are using the default template-setup.
Related Posts:
- display most popular tags in two columns
- dynamic sidebar not showing anything
- WordPress widget/sidebar dividers?
- Missing sidebar parameter “fix” – before_content
- Dynamic Sidebars & Echo
- How to determine if the sidebar is empty? Or not active?
- Add a select-option to the default widgets
- Stuck with sidebar registering
- Retrieve the whole widget sidebar and pass it inside an html
- Loading Widgets Via Child Theme
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- How to list categories by page id in wordpress
- how to run a php code in widget?
- My custom widget won’t stay in the widget area after I refresh the widget page
- Archives shortcode displaying above widget title
- Widgets in the loop if active
- Show latest posts in a plain HTML website custom widget [closed]
- if statement with is_active_sidebar()
- How to make widget title accept php?
- Is it bad to add html to a widget by closing and reopening the php tags?
- Widget back end radio button issue
- Sidebar not appearing in footer, but it appears everywhere else!
- Hook called before text widget save
- Styling the second sidebar
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- How to remove sidebar primary widget on Mobile on category page [closed]
- Widgets not showing on custom theme
- My website is not showing Footer section
- WordPress widget and customize.php not working in Ubuntu16.04 VPS
- Correctly Using checked function of WordPress
- How can I display Custom Post type Custom Columns and its Content in a Dashboard Widget?
- Removing sidebar on category pages
- How to get post category list as select in front-end?
- Simple php in wordpress widget [closed]
- How to use title attributes in sidebar widget?
- Output column number according to active sidebars
- Show different website layout if no sidebar added
- display specific widget to a page
- Why the dynamic_sidebar() call is putted into an ul tag?
- Dynamically display font icons in widget
- Correct code to use php in text widget
- random reason on refresh
- Display Custom Field in Sidebar if Value is Present
- Some problems in custom widget
- WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6
- How do you create a custom category widget that you can style?
- How a HTML form can trigger a PHP function?
- How to use wp_get_attachment_image or wp_get_attachment_image_src instead of $instance[‘single_feature_image_uri’]
- How to stop hiding buttons forward / backward in pagination?
- Inserting a class on before_widget if checkbox is checked
- Current WordPress Page Title as Search Parameter into A Tag
- How to create a widget with a populated dropdown?
- Force Sidebar on Full Width page
- dashboard widget form not submit mails
- Add widget area from visual editor
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- How to make a “page-option” in WordPress
- Priority call methods – PHPMailer->addAddress(NULL)
- I need to edit a widget, with no dashboard access
- Blog Image and Title in Right Sidebar
- is_user_logged_in() not working in homepage
- Dynamic_sidebar load in string makeup
- missing admin bar and widget in a template
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- Featured Products not showing up in “Featured” area of homepage
- (Who to follow) Twitter widget
- My own theme’s custom widget areas are not working
- What image is this pulling?
- Widget Logic – display on page and all child
- Add disclaimer before certain posts and pages
- Widget Update problems using a for loop
- Beyond widget side menu editing, with the php page, custom template
- PHP: Why does my code work in index.php but not a widget?
- Adding a sidebar to wp-login.php
- Non-static method error when trying to use class in widgets
- Are WordPress widgets cached?
- Widget edit and add in any page
- widget: input the px value from user and use it as inline style in widget function
- Slider from different widgets
- Even with PHP plugin get_posts not working in widget area
- Update title of every instance of widget using text field
- Are widget arguments always set inside My_Widget::widget()?
- Cannot access variables within a widget
- WP_Widget dynamic field array with external AJAX
- if conditional in sidebar plugin Password content shortcode
- WordPress – registering sidebar and adding a button directly after .textwidget
- List sibling pages widget, exclude current page
- Template from scratch: Sidebars not showing widget
- Name Input from widget displays Sidebar name instead of saved data
- WordPress – show number of comments for each post in widget
- Using existing widget code! [closed]
- Widget header unique classes
- Banner editable from backend
- key( $GLOBALS[‘wp_registered_sidebars’] ) is always showing the same value
- how to remove sidebar from particular one page
- Listing current pages subp page in list items in the sidebar
- How to change links in the 3 main categories, on widget category, to a javascript function call
- Using a loop to build and update widgets
- How to display different widgets on specific pages, hide from other pages
- PHP Widget and do_shortcode