Created
August 6, 2017 13:44
-
-
Save ninjamonkno1/3af7f216a1faa09052814b359ec8bacf to your computer and use it in GitHub Desktop.
Get Permalink or post id in beaver builder Custom Post Layouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'fl_page_data_add_properties', function() { | |
FLPageData::add_post_property( 'permalink', array( | |
'label' => 'Post Permalink', | |
'group' => 'posts', | |
'type' => 'string', | |
'getter' => 'permalink_getter', | |
) ); | |
} ); | |
function permalink_getter() { | |
global $post; | |
return get_permalink($post->ID); | |
} | |
add_action( 'fl_page_data_add_properties', function() { | |
FLPageData::add_post_property( 'post_id', array( | |
'label' => 'Post ID', | |
'group' => 'posts', | |
'type' => 'string', | |
'getter' => 'id_getter', | |
) ); | |
} ); | |
function id_getter() { | |
global $post; | |
return $post->ID; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment