Site logo

[Resolved] Add #top to dynamic links

Home Forums Support [Resolved] Add #top to dynamic links

Home Forums Support Add #top to dynamic links

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2512297
    Anders Nielsen

    Hi there

    I’m using the dynamic data in generateblocks..

    Is there a hack or something I can do to add a #top to the post links?

    See video in private section

    #2512366
    Ying
    Staff
    Customer Support

    Hi Anders,

    1. Try using the Dynamic data option in the editor’s sidebar instead of the option from the floating bar.

    2. Try adding a CSS class to that headline block of the link, eg. anchor-link,

    3. Add this PHP snippet:

    add_filter('generateblocks_dynamic_url_output','add_html_anchor_to_dynamic_link', 10,2);
    function add_html_anchor_to_dynamic_link($url , $attributes) {
    	if( ! empty( $url ) && ! empty( $attributes['className'] ) &&  'anchor-link'  === $attributes['className'] )  {
    		$url = $url.'/#top'; 
    	}
    	return $url;
    }
    #2512396
    Anders Nielsen

    Brilliant @ying

    It is working perfect 🙂

    #2512401
    Ying
    Staff
    Customer Support

    Awesome 🙂

    #2512403
    Anders Nielsen

    Is there any way I can add a “before text” like the option in the floating bar

    #2512407
    Ying
    Staff
    Customer Support

    You can use another headline block before the link, and set both headline block toinline-wdith.

    #2512410
    Anders Nielsen

    Thx 🙂

    #2512413
    Ying
    Staff
    Customer Support

    No Problem 🙂

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