You are using the default page loop and it will output the current page attributes like title or other. You should create your own loop with custon query instead. See WP_Query or get_posts.
Example
$query = new WP_Query(array(
'post_type' => 'post',
'posta_status' => 'publish',
));
if($query->have_posts()){
while($query->have_posts()){
$query->the_post();
echo get_the_title();
}
wp_reset_postdata();
}
Related Posts:
- Filter get_the_title to remove certain characters?
- Is there any difference between get_the_title() and single_post_title()?
- Trim Titles Only On Some Pages
- Why this Read More Not working in Php?
- What is PHPSESSID?
- start_lvl Ignored in Custom walker_nav_menu
- PHP Catchable fatal error: Object of class WP_Error could not be converted to string
- What would be a PHP command to erase all posts from category X from the last month?
- Load custom field value into div with AJAX
- Get the title before comma
- Accessing a random image via ajax
- wp enqueue style and style sheet depth
- Display 4 chronological posts starting with a random post
- Duplicates with WP_Query loop
- my function doesn’t return my post from today
- using add_action for a header hook that has an additional parameter
- Template part inside shortcode, unexpected reult
- How to enqueue CSS and JS only on specific template?
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Prevent Indexing of 404 Page
- How to show a dynamic_sidebar if main content content’s height is > a set amount?
- Custom location for attached images
- Cannot add javascript to footer
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Accessing data from a non-WP database/table within a page content
- WP Query with custom Shortcode
- How to display posts by current user in a drop down
- How to add a php custom page to WordPress
- How to Add Extra Search terms with WordPress Search keyword term?
- How do I add custom bulk actions to multiple custom post types?
- Colon is Missing In My Website Url in WordPress
- Ubuntu Server/PHP: How do I ensure WP uses the latest PHP version on my server?
- How to register javascript variables in wp_localize_script?
- Post + form + action + results on the same page
- Commenting out unwated CSS/scripts in HTML with PHP
- How do I limit the number of forms a user can create in gravity forms?
- Creating sub-categories via php
- How can i display a jquery slide on front page
- Add post with approval by the admin
- Widget back end radio button issue
- Count posts on multisite with blog id
- Troll the hackers by redirecting them
- Putting php inside an echo php shortcode
- GET problem in WordPress
- Almost Done… Post Format Code
- How to unserialize data from MySQL
- if ( ! function_exists
- Exclude product attributes from taxonomy terms loop
- WP All Import / Update stock quantity from multiple XML files
- Split site title and apply different classes
- Alter Woocommerce product archive structure
- Pass get data from anchor URL [closed]
- WordPress İmages Upload & Delete Error
- Shortcode won’t execute
- Dynamic CSS through PHP issue
- posts_nav_link pulling in multiple post types
- security concerns if using html data-* attribute for l10n?
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- php_gd2 extension not loading on Windows
- How to check a variable Changes
- Products listing check if meta checkbox is checked
- Check if user had autologin & if so, logout
- White screen after migrating site, but wp-admin works fine. Disabling all plugins, applying default theme and enabling debug mode does nothing
- Executing php on button press
- How do I change the “login” label in My Account page to “Registered Customer”
- Edit a function to take different actions based on user role
- How to have different headers.php files based on the display page
- Customize the “Available for back order” text for specific variation
- If user has clicked link add class and store using PHP/WordPress
- How to put 2 php codes in functions.php without site crashing
- Site infected by link
- Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields
- How to create an Email Subscription input in WordPress?
- autocomplete in wordpress using ajax with json-data
- Using previous_post_link next_post_link but with a filter on a custom field
- How to filter specific element of an array in wordpress/php?
- wp-login.php?redirect_to=https problem
- Right path for renaming a file in uploads folder
- View tag description on page
- Fatal Error cannot log into wordpress and website disappeared
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- changing static link to relative link
- Trying send mail from Theme page
- AJAX Not Working With WordPress Database properly
- How can I put a custom field as the link of a button shortcode?
- WordPress: Create A Widget to Accompany Plugin
- Fix My Custom Function: Remove Automatic
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- Adding placeholder text field to woocommerce checkout [closed]
- Cannot modify header information – headers already sent
- WP Debug enabled Undefined index error in a widget
- Can I have a php site on subdirectory of WordPress?
- How would I split the results into two columns [closed]
- is there away to hide php code in wordpress not to show in PAGES
- Millennial Media PHP Setup ( Code Integration )
- Insert into db with foreach problem
- How can I change the URL via add_rewrite_rule()
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress