Since the DOM elements on the frontpage will never change once the site is finished, the solution I came up with, was to find the div that I wanted to follow with my plugin content using javascript, and then just append my html content to the end of div like the following:
$imageMap = "<div style="width:1080; margin:0 auto;position:relative;top:20px;margin-bottom:20px"><img src="https://wordpress.stackexchange.com/questions/275794/$url"></div>";
echo '<script>
document.addEventListener("DOMContentLoaded", function(event) {
var el = document.getElementById("main-content").getElementsByTagName("div")[1];
el.innerHTML += "'.$imageMap.'";
});
</script>';
Related Posts:
- Difference Between Filter and Action Hooks?
- Which hook should be used to add an action containing a redirect?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How Do I Load My Action Earlier Enough?
- Does WP fire delete_post when trashed posts are automatically deleted?
- What’s the earliest point I can get the queried object ID?
- How do I Make a Theme “plugin-ready”?
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Is it possible to create an action hook using do_action() within add_action()?
- How can I hook into existing WordPress Bulk actions?
- Define a function outside a class and call the function using action or filter hook
- Create a plugin to change the action to which a function is hooked
- Modifying values with add_action to be sent to db
- Woocommerce – Hide a Column in Cart Table
- Hook to get image filename when it is uploaded
- Which are the hooks run before/after when a category’s deletion?
- Should action callbacks start with a verb?
- Execute Hook on the footer or header after activating a plugin
- Namespaced action and filter tags
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- I have 2 plugins using the same wp_login action hook and one is not working
- How dynamic action login_form_{action} is working
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- How to get all queries’s results after they have executed?
- Bug: Post needs to be updated twice when adding action for save_post hook
- When does save_post hook fire on post save/update
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- How to find list of all functions bind to a particular hook from my plugin?
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- remove different admin menu for specific users
- add_option_{$option} action hook not being called
- Does WordPress have something like timer hook?
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- Apply function on all action hooks?
- Ninja Forms: Front-End Forms, Post ID?
- How many times will this code run? (or, how rich is grandma?)
- add_action hook for completely new post?
- WordPress Hook for user register
- Which action for triggering cron “wp”or “init”?
- Using filters and actions for plugin API?
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Actions or filters fired when data is saved in a custom table
- In a plugin, why is add_action(‘init’) not executed before the plugin is activated?
- How to check if certain plugin exists and in expected version
- Earliest WP Hook to Safely and Reliably Redirect
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- Synchronize Custom post type tags to WordPress default posts tags
- Order of Operation for these three hooks
- save_post hook not triggered in WP v3.6.1
- How to redirect to action on custom page within admin section
- Is it possible to delay execution of shortcode output callback?
- What are the benefit in adding hook in the init() hook?
- How to display a message about updates in the plugin list
- How to run an add_action hook for specific page
- Why my database table not created on activation?
- Which action is triggered when a theme was modified?
- wp_transition_post_status does not change the status of the post
- How to delete an user including data from custom database tables
- action hook wp_head higher priority as all other plugins/hooks
- Is there any way to allow a plugin to write over a previous version?
- What filter should I use to insert a button inside on Media>Add New
- Issue plugin commands in admin settings page
- My plugin class doesn’t work! [closed]
- get_current_screen() return null
- add_action not calling back to function
- Tried in different ways but sidebar not working?
- How to use a hook to override an update_post_meta call in a plugin?
- External Authentication, session_tokens not destroyed on logout
- correct way to call javascript into hook function
- How to get all of the activate_plugin action parameters?
- Send push when new post is published in a certain category
- Force HTTPS 301 redirect with hook
- use of do_action() without any functions attached
- Plugin uninstall function is not working
- Bind a function with its own argument to show something dynamically after every content
- What’s the hook for filtering every texts of site?
- Update variable value via add_filter
- hook update_option/updated_option empty $old_value and $value
- How to enhance a self developed plugin by its own plugin architecture
- `registration_errors` filter doesn’t seem to be called
- How to grab data after wp user search is complete
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Nested Hooks with do_action for performance reasons – safe/necessary?
- do_action from within a class does not seem to work
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- plugin modal/popup integration best practice
- action callback, for action dispatched as reported by hook sniffer, not called
- Plugin Hook: Get posts
- Get user logged in status from within a plugin. $current_user not defined
- get_term_by() returning null on plugin
- Execute callback after REST API request completes + Response is sent