• Resolved fromb

    (@fromb)


    Hello,

    I’ve tried using the rank_math_contact_info shortcode to pull Local SEO data like the phone number for instance. Unfortunately the shortcode outputs html and other bloat as well.

    Is there a method of retrieving the number only, without type and markup?

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @fromb,

    Thank you for reaching out to us.

    You can include an attribute to the shortcode to display only the phone number.

    If you are using Organization for your Local SEO, use this:

    [rank_math_contact_info show=”phone”]

    If you are using Person, use this instead:

    [rank_math_contact_info show=”person_phone”]

    You can read more about the same here:
    https://rankmath.com/kb/local-seo/
    &
    https://rankmath.com/blog/local-seo/

    Hope that helps.

    Thread Starter fromb

    (@fromb)

    Thanks, but I already tried that, as mentioned above. Using the shortcode with phone attribute outputs a lot of html:

    <div class="rank-math-contact-info show-phone show-phone-only">
        <div class="rank-math-contact-section rank-math-contact-phone">
            <div class="rank-math-phone-number type-customersupport">
                <label>Customer Service:</label>
                <span>
                    <a href="tel://+xx (0) xxx xx xx xx" target="_blank">+xx (0) xxx xx xx xx</a>
                </span>
            </div>
        </div>
    </div>

    I just want the phone number, nothing else.

    • This reply was modified 1 year, 11 months ago by fromb.
    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @fromb,

    It’s not possible to output only the phone number with the usage of a shortcode from our Local SEO module.

    To get only the phone number, you would need to fetch it directly from the database by parsing the results of the option rank-math-options-titles and extracting the option from there.

    You can retrieve the phone numbers from the database with the following code:

    
    $options = get_option('rank-math-options-titles');
    $options['phone_numbers'];
    

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter fromb

    (@fromb)

    Thanks. I ended up creating a shortcode.

    • This reply was modified 1 year, 11 months ago by fromb.
    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @fromb,

    Glad that you were able to create a shortcode with the help of the code snippet shared.

    If you have any other questions don’t hesitate to get in touch.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘getting Local SEO values’ is closed to new replies.