Jump to content

Vinz

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Vinz

  1. Hi everyone!

    i hope someone here can help me.

    i use worpdress, and i need to get a url from a post to set into href button dynamically.

    i don't know if i can achieve this only with html or mixed with some php or js

    let me explain it further:

    i have a listing site which shows every listing in a grid style. the grid elements are clickable which redirects to the single listing post.

    but i added a button under each grid element, the href url is not known in advance, how can i retrieve that permalink for each single listing page to dynamically populate the href in a html button?

     

    for now i have icon with empty href

    <a href="#">[27-icon icon="fa fa-arrow-alt-circle-right"]</a>

    i was reading wordpress codex

    and there are php functions like:

    <?php get_post_permalink( $id, $leavename, $sample ); ?>

    get_permalink( int|WP_Post $post, bool $leavename = false )

    get_post_class( string|string[] $class = '', int|WP_Post $post_id = null )

    i'm not a developer, but i understand a bit what i'm reading in the php code, if i understand it good i could use css class maybe to point to the grid element and then use get function to auto retrieve the url of a post and populate my button href ???

    or is there another easy way ?

    If someone could explain me how to do this as i'm sure its used a lot on websites.

     

    Thanks to help me

     

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.