You can use the GitHub card shortcode to display GitHub cards anywhere shortcodes are supported.

Here is an example of the shortcode in use, using default settings.

[github-info-card username="dlxplugins" repo="highlight-and-share"]Code language: JSON / JSON with Comments (json)

The following are the parameters for the shortcode:

Required Attributes

AttributeTypeDefaultDescription
usernamestring–GitHub username or organization name
repostring–GitHub repository name

Layout & Display Attributes

AttributeTypeDefaultDescription
layoutstringlargeCard layout style (options: large, card)
alignstringcenterBlock alignment (options: center``, wide, full)
horizontalalignstringcenterHorizontal alignment (Options: left, center, right)
stylestringlightStyle slug (options: dark, light, bw, purple, colorful, custom)
style – darkDark theme
style – lightLight theme
style – bwBlack and White theme
style – purplePurple theme
style – colorfulColorful theme
style – customUse custom colors

Sample shortcodes:

[github-info-card username="dlxplugins" repo="highlight-and-share" style="bw" layout="card"]
Code language: JSON / JSON with Comments (json)
[github-info-card username="dlxplugins" repo="highlight-and-share" style="dark" layout="large"]
Code language: JSON / JSON with Comments (json)

Spacing & Margin Attributes

AttributeTypeDefaultDescription
marginspacingstringnoneMargin spacing style (options: none, compact, comfortable, spacious,extreme)
marginspacingtargetstringbothTarget for margin spacing (options: both, top, bottom)

Sample shortcode with a comfortable margin on the bottom:

[github-info-card username="dlxplugins" repo="highlight-and-share" style="dark" layout="large" marginspacing="comfortable" marginspacingtarget="bottom"]Code language: JSON / JSON with Comments (json)

Color Customization Attributes

AttributeTypeDefaultDescription
backgroundcolorstring#fffCard background color
textcolorstring#24292fMain text color
iconcolorstring#666Icon color
iconcolorhoverstring#111827Icon color on hover
bordercolorstring#d0d7deBorder color
languagebgcolorstring#24292fProgramming language badge background
languagetextcolorstring#fffProgramming language badge text color
sponsorscolorstring#bf3989Sponsors section color
buttonbgcolorstring#1a7f37Button background color
buttonbgcolorhoverstring#2c974bButton background color on hover
buttontextcolorstring#fffButton text color
buttontextcolorhoverstring#fffButton text color on hover

Sample shortcode:

[github-info-card username="dlxplugins" repo="highlight-and-share" style="custom" layout="large" marginspacing="comfortable" backgroundcolor="#DDD"]Code language: JSON / JSON with Comments (json)

Display Toggle Attributes

AttributeTypeDefaultDescription
showtopbarbooleantrueShow the top information bar
showauthorbarbooleantrueShow the author information section
showstatsbarbooleantrueShow the statistics bar (stars, forks, etc.)
showlastupdatedbooleantrueShow the last updated timestamp

Sample shortcode:

[github-info-card username="dlxplugins" repo="highlight-and-share" style="purple" layout="large" marginspacing="comfortable" showtopbar="false"]Code language: JSON / JSON with Comments (json)

Button Configuration Attributes

AttributeTypeDefaultDescription
buttontypestringgithubType of button to display (options: github, website, sponsor, download,star, custom)
overridebuttonbooleanfalseWhether to override the default button
overridebuttontextstringView on GitHubCustom button text when override is enabled
overridebuttonurlstring–Custom button URL when override is enabled and buttontype is custom

Sample shortcode:

[github-info-card username="dlxplugins" repo="highlight-and-share" style="bw" overridebutton="true" overridebuttontext="View" overridebuttonurl="https://dlxplugins.com" buttontype="custom"]Code language: JSON / JSON with Comments (json)

Content Override Attributes

AttributeTypeDefaultDescription
nameoverridestring–Override the repository name display
loginoverridestring–Override the username display
versionoverridestring–Override the version information
sponsorsurloverridestring–Override the sponsors URL
organizationurloverridestring–Override the organization URL
homepageurloverridestring–Override the homepage URL
avatarimageurlstring–Override the avatar image URL

Sample shortcode:

[github-info-card username="dlxplugins" repo="highlight-and-share" style="light" layout="large" marginspacing="comfortable" nameoverride="Highlight and Share"]Code language: JSON / JSON with Comments (json)
[github-info-card username="dlxplugins" repo="highlight-and-share" style="light" layout="large" marginspacing="comfortable" loginoverride="DLX Plugins"]Code language: JSON / JSON with Comments (json)
[github-info-card username="dlxplugins" repo="highlight-and-share" style="light" layout="large" marginspacing="comfortable" loginoverride="DLX Plugins" avatarimageurl="https://secure.gravatar.com/avatar/b1f98471cbb84ddeb26979e992e4492775c4cbd8ee643454790c7a8f42c67e38?s=200&d=mm&r=g"]Code language: JSON / JSON with Comments (json)

CSS Classes

AttributeTypeDefaultDescription
classstring–Additional CSS classes for custom styling
uniqueidstringauto-generatedUnique identifier for the card needed for custom colors and styles (auto-generated if not provided)

CSS Customization

The shortcodes generate CSS custom properties (variables) that you can override in your theme:

:root {
    --wppic-gap-sm: 8px;
    --wppic-gap-md: 16px;
    --wppic-gap-lg: 24px;
    --wppic-grid-col-gap: 24px;
    --wppic-grid-row-gap: 24px;
}
:root {
    --wppic-github-background-color: #fff;
    --wppic-github-text-color: #24292f;
    --wppic-github-icon-color: #666;
    --wppic-github-icon-color-hover: #111827;
    --wppic-github-border: #d0d7de;
    --wppic-github-language-bg: #24292f;
    --wppic-github-language-color: #fff;
    --wppic-github-sponsors-color: #bf3989;
    --wppic-github-button-bg: #1a7f37;
    --wppic-github-button-bg-hover: #2c974b;
    --wppic-github-button-text-color: #fff;
    --wppic-github-button-text-color-hover: #fff;
}Code language: CSS (css)

Browser Compatibility

  • Modern browsers with CSS Grid support
  • Responsive design that works on mobile and desktop
  • Graceful fallbacks for older browsers

Was this article helpful?

Leave a Reply