By putting your own php code inside the post editor to select posts and render them, you are evading all mechanisms that WordPress has to do this for you.
By the time you get to do_shortcode('[Social9_Share]')
you have echoed a post, but does Social9 know which one? No. As far as Social9 is concerned you want to share the parent post, the one within which you have included the php code. You may run through ten posts inside your foreach
loop, but everytime Social9 will echo a button trying to share the parent post.
If that parent post is your homepage, that’s what you are sharing.
Moral: NEVER EVER use php in your posts. Use pre_get_posts
in combination with is_page
to select a certain range of posts on certain pages.
Update: the latter should be included in the functions.php
file of your (child) theme.
Related Posts:
- Social share buttons text shows up on post excerpts
- Why is it important to check for isset and is_array before checking in_array in this example?
- Adding a simple Javascript file with a plugin
- WordPress custom post type image in RSS
- How to add/change (woocommerce) product tab icon
- How to delete a theme using AJAX
- speed up pagination for huge database
- dynamically create callback functions inside a for loop
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- I want to generate the pdf and save it in library?
- Profile / benchmark wordpress on apache?
- Way to send multiple values for column to MySQL?
- Using meta_query in a WP_Query not working for numbers properly
- Add the_post_thumbnail_url to a shortcode in function.php
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Add key and value to an array in another file
- Calling a save function from a “submit” button
- File Uploader – Upload without adding to Media Library
- ACF – How to set the menu order for the relationship field
- Creating an admin meta box to save post as pending
- Custom search search does not work?
- Must use Plugin not updating HTML code in head
- Wierd site output [closed]
- Wp Debug Enabled True Notices and Warning
- How to call external functions from a PHP script in a WordPress plugin?
- How to change layout of shop page in wordpress? [closed]
- How to write to a separate PHP file in plugin settings
- Pagination shows Same posts
- Add logo to admin menu in my plugin
- same user role or copy the user role to be same as the other role
- Trying to make a simple wordpress plugin, having difficulties understanding how to make it?
- Plugin not working locally, but works on server
- Disable Checkbox depending on state of another checkbox
- Passing PHP Variables to AJAX Loaded Pages
- Custom meta box with jQuery.sortable custom post type list
- preg_replace() No ending delimiter ‘.’ found [closed]
- Building a plugin into a theme
- 2 wordpress site same database
- How to redirect to a page after the form is submitted
- “Allowed memory size” problem [closed]
- Echo out element to another page.
- Equivalent of admin.php for public pages
- Get data from wp_posts of mysql in to variables of wordpress-php script
- WordPress plugin won’t create custom tables
- Retrieve Plugin Settings and insert into XML string
- wordpress plugin license issue -New plugin development
- Create “new pages” within the admin section of plugin
- Passing value as hidden parameter to next page
- Trying to include files in plugin isn’t working
- Next Previous Post in wordpress with previous / next link with title?
- Cannot access empty property error in Advanced Access Manager
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- How can I show registration form inside modal?
- WordPress truncate posts question (plugin related)
- Different registration form for different roles
- Trying to get property of non-object wordpress error message
- Theme Functions run a function upon activation or preview
- Is this plugin safe to run?
- Adding a Tag Parameter / Filter to My Shortcode
- More gentle way to hook WordPress custom url
- Categories from front-end, checkbox selection doesn’t work
- Apply html elements in php statement
- How to display results from a data table with an encrypted user id?
- How to add custom function to pluggable.php
- WordPress Post HTML after Posting
- Settings options not showing up on Sub Menu page in WordPress plugin
- WordPress Stats Plugin: Display Post Views [closed]
- Pagination not working
- Advertising: Every page refresh counts as 3 ad impressions
- exec-PHP shows output at bottom of page
- Somehow adding to “Insert Into URL” posts are contradicting each other
- Pasting this PHP breaks my page. Why?
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- Modify pages widget and make a plugin?
- Can you echo PHP code from a variable?
- Cannot Access Console
- eaccelerator PHP error
- Looking for a good way to include php code in posts, but using special include markup rather than direct php code
- Plugin error after installation
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- WP Subtitle Plugin Problem
- WP Insert Post If user refreshes override new post
- add_action for publish_post doesn’t work
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- How to proper escape echo inside a javascript tag
- Plugin Admin panel checkbox unchecked after submit
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- Custom Plugin scripts from admin working in frontend
- WordPress Cache delete on plugin uninstall
- How to create repeater field manually, without plugin (ACF Pro)?
- Code for unique user visit count on every page WordPress
- Getting URL GET parameter with Code snippets and storing it in database?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- Searching a tab/space delimited text file based upon form criteria and returning a ‘record’ into a word press results page
- Ajax call not working in wordpress through a plugin
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- can’t unzip file
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- Get product categories and add them to a custom taxonomy