0
votes
0answers
83 views

Using Post ID and Page ID in same function

I've written a function to display a custom sidebar, which is outputted as a sidebar. On some pages, I have a Custom Field called 'show_sidebar', which I can assign as 'false' on pages which I do not ...
0
votes
0answers
156 views

Get ID of the page where shortcode is included

I have a page with a shortcode that uses get_the_ID(). The shortcode displays custom fields from the current page. When I include that page within another page, get_the_ID() returns the ID of the ...
1
vote
1answer
77 views

Shortcode for a link and thumbnail

<?php // Add Shortcode function blog_shortcode( $atts ) { // Attributes extract( shortcode_atts( array( 'id' => '', ), $atts ) ); // Code if (has_post_thumbnail()) { $url ...
0
votes
1answer
136 views

Is there a way to show attachment IDs on the attachment info screen?

I want to use attachment IDs for shortcodes, but if the image is published with a permalink, it's harder to find the ID. I've found some functions online that can turn the attachment url into its ID, ...
0
votes
2answers
1k views

How to get ID of the page included with get_page()?

I'm rewriting the question, including exemplary code, I hope it will be easier to understand now. 1. My shortcode: function testid_shortcode( ) { global $post; return ...