If the GPX file is attached to the current page you can find it with get_attached_media()
, e.g.
$gpx_files = get_attached_media( 'application/gpx+xml' );
if ( count( $gpx_files ) >= 1 ) {
echo do_shortcode ('[sgpx gpx="' . wp_get_attachment_url( $gpx_files[0]->ID ) . '"]');
} else {
echo '<p class="warning">No GPX file attached!</p>';
}
Related Posts:
- Issue running db create table query from static method
- Activate my plugins via FTP
- Duplicate results are displayed in a custom plugin [closed]
- Check if variable is set in filter
- WPDB: Update table
- Why is my custom post type not being activated on plug-in activation?
- How to add apply_filter for a class property in plugin
- execute function after one completed
- How to make multiple admin pages for one plugin?
- Include a php file from another plugin
- Integrating boxtal PHP library into a custom WordPress Plugin
- How to redirect to same page after form submission
- A server-side hook failed when committing plugin code to SVN
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- How do I add $_SESSION[”] to my wordpress page?
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Plugin onclick button activate other plugin
- I receive taxonomy id
- output html on post or page from custom plugin [closed]
- Loop in elementor custom widget not working
- How to create plugin/ page that reads from database
- Save user total active time after login in wordpress [closed]
- Built a second plugin but it overwrote the first one
- Creating a functionality plugin to edit seriously simple podcasting
- How WordPress core manage the plugin installation
- Switch from wp-cron to a server cron job
- Asynchronous request in wordpress
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Make plugin php file called directly aware of WordPress?
- Why is it important to check for isset and is_array before checking in_array in this example?
- How to add/change (woocommerce) product tab icon
- 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?
- Way to send multiple values for column to MySQL?
- Using meta_query in a WP_Query not working for numbers properly
- Calling a save function from a “submit” button
- Wp Debug Enabled True Notices and Warning
- How to call external functions from a PHP script in a WordPress plugin?
- How to write to a separate PHP file in plugin settings
- Displaying data from another database
- Create “new pages” within the admin section of plugin
- Next Previous Post in wordpress with previous / next link with title?
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- 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
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- can’t unzip file
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- Creating a user ‘add custom field’ section
- How can I insert a record into a custom table from my custom form in my custom admin page?
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Plugin Hook: Get posts
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- Plugin Breaking WordPress Login
- How to get site homepage from plugin?
- How to add a handler for a button in plugin?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Doing action based on input from options menu
- Undefined variable _POST
- Help me with my first very basic plugin
- Load my plugin before cache
- How use Dynamic hyperlink on each wordpress post?
- Unable to show 4 products in a row
- How to fix ‘Call to undefined function do_settings()’ error?
- What is the source outline for a basic word press plugin?
- My wordpress website admin panel loads very slow, what can i do about that? [closed]
- Submit posts in two different post types with the same form
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- how to search through plugin in wordpress cimy-user-extra-fields?
- How to create post comparison in wordpress
- Get all the related data from WordPress DB
- What can I do to customize a widget provided with this plugin? from where have I to start?
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- How to add custom html to the Media > Attachment Details modal?
- Displaying Category Feature image on loop
- Function not being called on form submit, only blank admin-post.php page
- wp_handle_upload – specified file failed upload test
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- How to override plugin function in code snippets WordPress
- How to make a Template page to show the information of different things Shop and Product page?
- How to create a “Most Popular” & “Latest” TAB in WordPress
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- WordPress Throwing Deprecated Errors on its own Files
- public custom posts not showing in my wordpress plugin
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class
- plugin doesn’t retrieve data from database
- Accessing Correct Database to Create REST API Endpoint
- Mixed results with is_page() WordPress function, when using $this, or self
- add_action() not working for admin
- REST API – filters not working inside plugin class