post_content, 'academiccrew_publications_list' ) ) { return; } wp_enqueue_style( 'academiccrew-member-profile', ACADEMICCREW_URL . 'assets/css/member-profile.css', [ 'fusion-stylesheet', 'tabler-icons' ], ACADEMICCREW_VERSION ); wp_enqueue_script( 'academiccrew-member-profile', ACADEMICCREW_URL . 'assets/js/member-profile.js', [], ACADEMICCREW_VERSION, true ); } public function render( array $atts ): string { $atts = shortcode_atts( [ 'member_id' => '', 'per_page' => 10, 'type' => '', 'year' => '', ], $atts, 'academiccrew_publications_list' ); $member_id = (int) $atts['member_id']; if ( ! $member_id ) { return '
' . esc_html__( 'Please specify a member_id attribute.', 'academiccrew' ) . '
'; } wp_enqueue_style( 'academiccrew-member-profile', ACADEMICCREW_URL . 'assets/css/member-profile.css', [ 'fusion-stylesheet', 'tabler-icons' ], ACADEMICCREW_VERSION ); wp_enqueue_script( 'academiccrew-member-profile', ACADEMICCREW_URL . 'assets/js/member-profile.js', [], ACADEMICCREW_VERSION, true ); $rest_url = rest_url( "academiccrew/v1/members/{$member_id}/publications" ); if ( $atts['type'] ) { $rest_url = add_query_arg( 'type', sanitize_key( $atts['type'] ), $rest_url ); } if ( $atts['year'] ) { $rest_url = add_query_arg( 'year', sanitize_text_field( $atts['year'] ), $rest_url ); } wp_localize_script( 'academiccrew-member-profile', 'ACADEMICCREW_PROFILE', [ 'memberId' => $member_id, 'restUrl' => $rest_url, 'filtersUrl' => rest_url( "academiccrew/v1/members/{$member_id}/publications/filters" ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'perPage' => (int) $atts['per_page'], 'i18n' => [ 'publications' => __( 'Publications', 'academiccrew' ), 'inPress' => __( 'In press', 'academiccrew' ), 'searchPlaceholder' => __( 'Search title or venue...', 'academiccrew' ), 'all' => __( 'All', 'academiccrew' ), 'noResults' => __( 'No publications match these filters.', 'academiccrew' ), 'loading' => __( 'Loading...', 'academiccrew' ), 'sortYearDesc' => __( 'Year ↓', 'academiccrew' ), 'sortYearAsc' => __( 'Year ↑', 'academiccrew' ), 'sortCitations' => __( 'Citations', 'academiccrew' ), 'sortTitle' => __( 'Title A–Z', 'academiccrew' ), 'doi' => 'DOI', 'pdf' => 'PDF', 'corresponding' => __( 'Corresponding author', 'academiccrew' ), 'featuredOnly' => __( 'Featured only', 'academiccrew' ), 'allTags' => __( 'All tags', 'academiccrew' ), 'typeLabels' => [ 'journal-article' => __( 'Journal', 'academiccrew' ), 'conference-paper' => __( 'Conference', 'academiccrew' ), 'book-chapter' => __( 'Book chapter', 'academiccrew' ), 'preprint' => __( 'Preprint', 'academiccrew' ), 'book' => __( 'Book', 'academiccrew' ), 'thesis' => __( 'Thesis', 'academiccrew' ), 'report' => __( 'Report', 'academiccrew' ), 'other' => __( 'Other', 'academiccrew' ), ], ], ] ); ob_start(); ?>