Template Overrides

Template Overrides

Customize how references appear on your site by overriding plugin templates in your theme.

Template Override System

Academic References uses a template hierarchy similar to WooCommerce. Plugin templates can be overridden by placing modified copies in your theme.

Template Locations

Plugin Templates

Original templates are in:

wp-content/plugins/academic-references/templates/

Theme Overrides

Copy templates to your theme:

wp-content/themes/your-theme/academic-references/

Or in a child theme:

wp-content/themes/your-theme-child/academic-references/

Available Templates

Archive Templates

TemplateDescription
archive-reference.phpReference archive page
archive-collection.phpCollection archive page
category-reference.phpReference category archive

Single Templates

TemplateDescription
single-reference.phpSingle reference page
single-collection.phpSingle collection page

Content Templates

TemplateDescription
content-reference.phpReference content in loops
content-reference-card.phpCard layout for references
content-reference-list.phpList layout for references

Component Templates

TemplateDescription
citation.phpInline citation output
bibliography.phpBibliography block output
bibliography-entry.phpSingle bibliography entry

Frontend Templates

TemplateDescription
dashboard.phpUser dashboard container
dashboard-references.phpReference list in dashboard
dashboard-collections.phpCollections in dashboard
submission-form.phpFrontend submission form

Creating an Override

Step 1: Locate the Original

Find the template you want to override in:

wp-content/plugins/academic-references/templates/

Step 2: Copy to Theme

Copy to your theme’s academic-references folder:

mkdir -p wp-content/themes/your-theme/academic-references/
cp wp-content/plugins/academic-references/templates/single-reference.php \
   wp-content/themes/your-theme/academic-references/

Step 3: Modify the Template

Edit the copied template. Your changes will be used instead of the plugin version.

Step 4: Verify

Visit the relevant page to confirm your template is being used.

Template Structure

Basic Template



" >

Using Template Parts

Load sub-templates with:

abt_template_part( 'part-name' );
abt_template_part( 'part-name', array( 'data' => $value ) );

Template Variables

Templates have access to these variables:

In Single Reference

// Reference post object
$post

// Reference data array (CSL format)
$reference = abt_get_reference_data( get_the_ID() );

// Formatted citation
$citation = abt_get_formatted_citation( get_the_ID() );

// Reference meta
$doi = get_post_meta( get_the_ID(), '_abt_doi', true );
$url = get_post_meta( get_the_ID(), '_abt_url', true );

In Archive/Loop

// Query object
$wp_query

// Current reference in loop
$post

// Reference data
$reference = abt_get_reference_data( get_the_ID() );

In Dashboard

// Current user
$current_user

// User's references
$user_references = abt_get_user_references( $current_user->ID );

// Reading status
$reading_status = abt_get_user_reading_status( $current_user->ID, $reference_id );

Template Functions

Display Functions

// Output formatted citation
abt_the_citation( $reference_id, $style = null );

// Output reference title
abt_the_reference_title();

// Output authors
abt_the_reference_authors();

// Output abstract
abt_the_reference_abstract();

// Output reference link
abt_the_reference_link( $reference_id, $text = '' );

// Output reference metadata
abt_the_reference_meta( $field );

Get Functions (return values)

// Get reference data
$data = abt_get_reference_data( $reference_id );

// Get formatted citation
$citation = abt_get_formatted_citation( $reference_id, $style );

// Get reference permalink
$url = abt_get_reference_permalink( $reference_id );

// Get reference type label
$type = abt_get_reference_type_label( $reference_id );

Conditional Functions

// Check if viewing reference
if ( abt_is_reference() ) { }

// Check if reference has DOI
if ( abt_reference_has_doi( $reference_id ) ) { }

// Check if reference has abstract
if ( abt_reference_has_abstract( $reference_id ) ) { }

Example Overrides

Custom Single Reference





Custom Bibliography Entry



Custom Card Template



">

CSS Classes

Templates use consistent CSS classes:

Containers

  • .abt-reference – Single reference wrapper
  • .abt-reference-archive – Archive wrapper
  • .abt-bibliography – Bibliography wrapper
  • .abt-citation – Citation wrapper
  • .abt-dashboard – Dashboard wrapper

Components

  • .abt-reference-title – Reference title
  • .abt-reference-authors – Authors display
  • .abt-reference-abstract – Abstract text
  • .abt-reference-metadata – Metadata section
  • .abt-bibliography-entry – Individual bib entry

States

  • .abt-favorite – Favorited reference
  • .abt-reading-{status} – Reading status class
  • .abt-type-{type} – Reference type class

Best Practices

  1. Start with copy – Never edit plugin templates directly
  2. Use child themes – Overrides survive theme updates
  3. Check versions – Plugin updates may change template structure
  4. Use hooks first – Prefer hooks for small changes
  5. Test thoroughly – Check all reference types and views

Troubleshooting

Template not being used

  • Verify file path is correct
  • Check file name matches exactly
  • Clear any caching

Missing data in template

  • Verify variable names
  • Check if data exists for reference
  • Use var_dump() to debug

Styling issues

  • Check CSS class names
  • May need to add theme styles
  • Plugin CSS may have higher specificity

Next Steps

Last updated: January 31, 2026