Stack Exchange
log in
users (58)
rooms (32)
faq
Vinod Dalvi
general
recent
conversations
Discussion between Nofel and G. M.
Imported from a comment discussion on
wordpress.stackexchange....
Vinod Dalvi
Sep 13, 2013 13:30
My skype id : vinod_dalvi2
Vinod Dalvi
Sep 13, 2013 13:29
Bye
Vinod Dalvi
Sep 13, 2013 13:29
I have some urgent work
Vinod Dalvi
Sep 13, 2013 13:29
I should leave now
Vinod Dalvi
Sep 13, 2013 13:29
OR you can use get_the_ID() in get_post_meta()
Vinod Dalvi
Sep 13, 2013 13:29
and use the title of that page
Vinod Dalvi
Sep 13, 2013 13:28
Then you will have to add it on second page
Vinod Dalvi
Sep 13, 2013 13:27
i mean from custom field
Vinod Dalvi
Sep 13, 2013 13:27
and changing url from meta box
Vinod Dalvi
Sep 13, 2013 13:27
You an do that by visiting this url
shellneverknow.com.au/wp-admin/post.php?post=6&action=edit
Vinod Dalvi
Sep 13, 2013 13:26
From front end?
Vinod Dalvi
Sep 13, 2013 13:25
then use above code
Vinod Dalvi
Sep 13, 2013 13:24
$page = get_page_by_title(Home');
echo get_post_meta($page->ID,'first image',true);
Vinod Dalvi
Sep 13, 2013 13:23
visit this url and tell me the page name
Vinod Dalvi
Sep 13, 2013 13:23
shellneverknow.com.au/wp-admin/post.php?post=6&action=edit
Vinod Dalvi
Sep 13, 2013 13:22
it's related with page
Vinod Dalvi
Sep 13, 2013 13:22
It's not related with custom field key
Vinod Dalvi
Sep 13, 2013 13:21
Slug
Vinod Dalvi
Sep 13, 2013 13:21
instead we should use page title or slug
Vinod Dalvi
Sep 13, 2013 13:20
But this is not right solution as we are using page id
Vinod Dalvi
Sep 13, 2013 13:20
yes
Vinod Dalvi
Sep 13, 2013 13:14
Yes
Vinod Dalvi
Sep 13, 2013 13:14
I think it should work
Vinod Dalvi
Sep 13, 2013 13:14
Try it
Vinod Dalvi
Sep 13, 2013 13:14
Use this now
Vinod Dalvi
Sep 13, 2013 13:14
echo get_post_meta(6,'first image',true);
Vinod Dalvi
Sep 13, 2013 13:11
No site url
Vinod Dalvi
Sep 13, 2013 13:10
Give me the url of your My First Page
Vinod Dalvi
Sep 13, 2013 13:10
We can try without modifying it
Vinod Dalvi
Sep 13, 2013 13:10
But let it be
Vinod Dalvi
Sep 13, 2013 13:09
"The function called by the shortcode should never produce output of any kind. Shortcode functions should return the text that is to be used to replace the shortcode. Producing the output directly will lead to unexpected results."
Vinod Dalvi
Sep 13, 2013 13:09
The code is not ok
Vinod Dalvi
Sep 13, 2013 13:08
$page = get_page_by_title('My First Page');
Vinod Dalvi
Sep 13, 2013 13:04
$page = get_page_by_title('My First Page');
echo get_post_meta($page->ID,'first image',true);
Vinod Dalvi
Sep 13, 2013 13:04
instead add whole code like this
Vinod Dalvi
Sep 13, 2013 13:04
echo get_post_meta($page->ID,'first image',true); ?>
Vinod Dalvi
Sep 13, 2013 13:04
@Nofel You have added this
Vinod Dalvi
Sep 13, 2013 13:03
@GM Yes but it is always unique therefore
Vinod Dalvi
Sep 13, 2013 12:57
Because If more that one page uses the same title, the page with the smallest ID will be returned.
Vinod Dalvi
Sep 13, 2013 12:56
I think this is more promising get_page_by_path('my-first-page')
Vinod Dalvi
Sep 13, 2013 12:53
then you should first get the id of first page
Vinod Dalvi
Sep 13, 2013 12:53
If you want to display meta data of first page on second page
Vinod Dalvi
Sep 13, 2013 12:52
I was referring to GM's point
Vinod Dalvi
Sep 13, 2013 12:52
Yeah i got your point
Vinod Dalvi
Sep 13, 2013 12:51
@Nofel What do you mean?
Vinod Dalvi
Sep 13, 2013 12:48
Then try what i have told you above
Vinod Dalvi
Sep 13, 2013 12:48
and access $post variable by global $post
Vinod Dalvi
Sep 13, 2013 12:48
If it does not return anything then instead of get_the_ID() use $post->ID
Vinod Dalvi
Sep 13, 2013 12:47
?
Vinod Dalvi
Sep 13, 2013 12:45
and tell me what does it echo?