Skip to content

Instantly share code, notes, and snippets.

@LaxusCroco
Created November 28, 2023 12:27
Show Gist options
  • Save LaxusCroco/68d1acd899fc64bc038757cce15153aa to your computer and use it in GitHub Desktop.
Save LaxusCroco/68d1acd899fc64bc038757cce15153aa to your computer and use it in GitHub Desktop.
Returns 1 if post is sticky
<?php
add_action( 'jet-engine/register-macros', function(){
class Is_Sticky extends \Jet_Engine_Base_Macros {
public function macros_tag() {
return 'is_sticky';
}
public function macros_name() {
return esc_html__( 'Is Sticky', 'jet-engine' );
}
public function macros_args() {
return array();
}
public function macros_callback( $args = array() ) {
$post_id = jet_engine()->listings->data->get_current_object_id();
return is_sticky( $post_id );
}
}
new Is_Sticky();
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment