1. PROMO Get 60% OFF Lifetime Pro Membership & access all our Pro Divi Extensions, Divi Layouts, Divi AI Generator, Divi Block, etc.VIEW PRICING
Dismiss Notice
UPDATE Custom Color Scheme + Premade Divi Layouts - A perfect combination to boost productivity. New 'Gadget Repair' layout added.Try our Custom Color Layouts
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well.
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Second button to "Read more" Blog post

Discussion in 'Free Divi Community Forum' started by chriz122, Jun 28, 2024.

  1. chriz122

    chriz122 New Member

    first of all my native language is german so i hope you all understand me :D
    Im currently working on my Blog and i want to add a second button. Like next to the "read more" Button.
    The buttons function should be a link to refer to another tab/page.

    If i can even change the link in the editor always by hand would be amazing.

    thank you for help
    1. PRO MEMBER PERKS Divi Block Pro - Premade logo carousel design for your Divi site without using any plugins:View Demo
  2. chriz122

    chriz122 New Member

    i have managed with Chatgpt to get this in the functions.php right position:
    functionadd_custom_meta_box() {
            'custom_meta_box', // ID der Meta-Box
            'Kauf-Link', // Titel der Meta-Box
            'show_custom_meta_box', // Callback-Funktion
            'post', // Beitragstyp
            'normal', // Kontext
            'high'// Priorit├Ąt
    add_action('add_meta_boxes', 'add_custom_meta_box');
    functionshow_custom_meta_box($post) {
        $meta = get_post_meta($post->ID, 'buy_link', true);
        <inputtype="text"name="buy_link"value="<?phpecho$meta; ?>"style="width: 100%;"/>
    functionsave_custom_meta_box($post_id) {
        // Speichern der Meta-Box-Daten
        if (isset($_POST['buy_link'])) {
            update_post_meta($post_id, 'buy_link', esc_url($_POST['buy_link']));
    add_action('save_post', 'save_custom_meta_box');
    now i have this nice box here :


    GPT also said i have to put this in the Blog.php (child theme)
                'buy_now' => array(
    'label'           => esc_html__'Jetzt Kaufen''et_builder' ),
    'css'             => array(
    'main'  => "{$this->main_css_element} div.post-content a.buy-now-link",
    'hover' => "{$this->main_css_element} div.post-content a.buy-now-link:hover",
    'hide_text_align' => true,

    but now im stuck i dont know where i write/insert code to actually show the button now
  3. Divi Booster

    Divi Booster Divi Expert

    Hey chriz122,

    I've written up how to add a second button to the blog module in the past:


    I think it should do what you need, but give me a shout (either here or in the comments) if you have any questions about it.

    The first block of code ChatGPT gave you is adding a custom field to the posts. While you can do that, it's perhaps better just to use WordPress's built-in custom fields feature which is doing the same thing (and this is how my post handles it). Alternatively, the free Advanced Custom Fields plugin will let you add custom fields more flexibly (and the code in that post should be easy to modify to handle Advanced Custom Fields if you wish to use it).

    I don't think the second block of ChatGPT code will help you much. It's part of a bit of code for adding style options to a second button, but would require you to entirely override the blog module and prevent you from getting future updates to it, etc. The code in my post makes the second button inherit the styles from the read more button, but if you need it to be styled differently, let me know and I can advise you on how best to do that.
    chriz122 likes this.
    1. PRO MEMBER PERKS Beautifully crafted custom colored 'Digital Marketing' Divi layout for all Pro members:View Demo