[Resolved] Slugs for Element Locations

Home Forums Support Slugs for Element Locations

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #828692
    Paul

    Is it possible to display page slugs instead of titles in Elements > Location? I have multiple “thank you” pages that use Thank You as the title (which I use for display in page headers) but it’s difficult to tell which page is which when the drop down uses titles instead of the page slug.

    See my screenshot. Here you can see I have two pages with the same title:

    Slugs not Titles

    GeneratePress 2.2.2
    GP Premium 1.7.8
    #828696
    Tom
    Lead Developer
    Lead Developer

    Hey Paul,

    Definitely an issue right now. Unfortunately there isn’t a fix unless you’re comfortable editing core code.

    In GPP 1.8, I’ve added a filter that allows you to show the ID next to the title. Let me know if you want instructions to make that change now.

    #828700
    Paul

    Hey Tom, yes, I’m interested in that code. TIA!

    FYI, my use case on this is building client landing pages using unique Facebook Lead Event pixels on each page and I need to be able to easily identify the pages. A page ID definitely is helpful in the meantime though.

    #828887
    Tom
    Lead Developer
    Lead Developer

    Open elements/assets/admin/metabox.js and find line 185:

    text: value.name

    Replace it with:

    text: elements.showID && value.id ? value.name + ': ' + value.id : value.name

    Then, open elements/class-metabox.php and find line 97. On the line below it, add this:

    'showID' => apply_filters( 'generate_elements_show_object_ids', false ),

    It should look like this:

    'choose' => __( 'Choose...', 'gp-premium' ),
    'showID' => apply_filters( 'generate_elements_show_object_ids', false ),

    Now you can add this function to your site:

    add_filter( 'generate_elements_show_object_ids', '__return_true' );

    #828911
    Paul

    Thanks Tom. That’s awesome. However, I’ll lose this with the next GPP update. Or will this be added to the next version?

    #828958
    Tom
    Lead Developer
    Lead Developer

    This is added to the next version 🙂

    #828961
    Paul

    OK, cool! Thanks a million.

    #829708
    Tom
    Lead Developer
    Lead Developer
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.