• Resolved griefgrieving

    (@griefgrieving)


    Hi,
    How Can I Add A Call to Action Button Above my Latest Blog Post Page? with a link to another section of my web.

    I have just added some intro text above my latest blog post page, but now I am wondering how to add a Call to Action Button under that text? right above the latest blog posts.

    • This topic was modified 5 years, 9 months ago by griefgrieving.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    You can use the below code for displaying call to action button above the latest blog post.
    1. Create a call to action template under Theme Panel > My library and copy the template shortcode
    2. Add the below code to the fucntions.php file of the child theme to display it above the blog posts. Replace the template shortcode with your copied shortcode in the code –

    function prefix_blog_cta() {
        if ( is_home() ) {
            echo do_shortcode( '[oceanwp_library id="651"]' );
        }
    }
    add_action('ocean_before_content_inner','prefix_blog_cta');
    • This reply was modified 5 years, 9 months ago by Amit Singh.
    Thread Starter griefgrieving

    (@griefgrieving)

    Great, thank you so much! I got it,

    Now how can i add an echo ‘<h2>Add Your Text here</h2>’; just after the call to action button and just before the latest published post?

    i tried adding this code after the button code but it won′t work.

    function prefix_blog_content() {
        if ( is_home() ) {
            echo '<h2>Add Your Text here</h2>';
    ';
        }
    }
    add_action('ocean_before_content_inner','prefix_blog_content');

    I get the following:

    Cannot redeclare prefix_blog_content() (previously declared in wp-content/themes/oceanwp-child-theme-master/functions.php:51)

    Thread Starter griefgrieving

    (@griefgrieving)

    I got it! Thank you so much for your help.
    What I did was add the h2 in the button template ??

    • This reply was modified 5 years, 9 months ago by griefgrieving.

    Glad to hear that it is fixed!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How Can I Add A Call to Action Button Above my Latest Blog Post Page?’ is closed to new replies.