Skip to content

Instantly share code, notes, and snippets.

View akshay-sihag's full-sized avatar

Akshay Sihag akshay-sihag

View GitHub Profile
@akshay-sihag
akshay-sihag / primary_category_shortcode.php
Created January 14, 2020 21:04
Display Primary Category (Yoast's WordPress SEO) with the help of a shortcode
// Creating Shortcode to display Yoast SEO Primary Category
// Add Shortcode
function get_yoast_primary_cat() {
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.