Hi,
I found that you are using the wp car manager plugin.
Add this to your functions.php.
add_action('wpcm_after_single_vehicle','my_add_back_link');
function my_add_back_link(){
global $post;
$parent_id = $post->post_parent;
if ($parent_id) {
$parent = get_page($parent_id);
echo '<a href="'.get_permalink($parent->ID).'" title="">Back</a>';
}
}
Thread Starter
Bob
(@compumec)
Hello,
Thank you for your reply.
I added the code, and can see no effect.
I would like, if possible, to add the back link just above the Buick LeSabre 2003, top Left of page.
Example Page:
http://02ba63c.netsolhost.com/gngautosales/vehicle/buick-lesabre-2003/
Back To:
http://02ba63c.netsolhost.com/gngautosales/inventory/
Thank you,
Bob-
Hi,
Try adding this code to your child theme’s functions.php.
In the ideal case, the url should not be hardcoded. But, I want to check if this works.
add_action('wpcm_before_single_vehicle','my_add_back_link');
function my_add_back_link(){
echo '<a href="http://02ba63c.netsolhost.com/gngautosales/inventory/" title="">Back</a>';
}
Thread Starter
Bob
(@compumec)
Hello,
That did add the back link, but it is small, and just above the photo.
Is there a way to make it a h2 and have it located over the title, “Buick LeSabre 2003”
http://02ba63c.netsolhost.com/gngautosales/vehicle/buick-lesabre-2003/
Thank you,
Bob-
Try this, will you?
add_action('__before_loop','my_add_back_link');
function my_add_back_link(){
global $post;
if (get_post_type($post) == 'wpcm_vehicle')
echo '<h2><a href="http://02ba63c.netsolhost.com/gngautosales/inventory/" title="">Back</a></h2>';
}
Thread Starter
Bob
(@compumec)
Menaka,
Thank you for all your help!
I never would have figured it out on my own.
Here is the finished page.
http://02ba63c.netsolhost.com/gngautosales/vehicle/buick-lesabre-2003/
Bob-
Glad that you are happy. But this is not an elegant solution. Ideally, the url should not be hardcoded. I shall get back with the ideal code. You may choose what you want to use.
Thread Starter
Bob
(@compumec)
Sure, Id like to have it.
When ever you get a chance.
Thank you,
Bob-