github-info-card

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
usernamestringGitHub username or organization name
repostringGitHub 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)
styledarkDark theme
stylelightLight theme
stylebwBlack and White theme
stylepurplePurple theme
stylecolorfulColorful theme
stylecustomUse 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:

{% code title=”Comfortable Margin with Bottom Spacing” overflow=”wrap” %}

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

{% endcode %}

Color Customization Attributes

{% hint style=”warning” %} The style attribute must be custom for custom colors to register. {% endhint %}

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:

{% code title=”Custom Style with Custom Background Color” overflow=”wrap” %}

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

{% endcode %}

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:

{% code title=”Shortcode with hiding the top bar” overflow=”wrap” %}

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

{% endcode %}

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
overridebuttonurlstringCustom button URL when override is enabled and buttontype is custom

Sample shortcode:

{% code overflow=”wrap” %}

[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)

{% endcode %}

Content Override Attributes

AttributeTypeDefaultDescription
nameoverridestringOverride the repository name display
loginoverridestringOverride the username display
versionoverridestringOverride the version information
sponsorsurloverridestringOverride the sponsors URL
organizationurloverridestringOverride the organization URL
homepageurloverridestringOverride the homepage URL
avatarimageurlstringOverride the avatar image URL

Sample shortcode:

{% code title=”Name override” overflow=”wrap” %}

[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)

{% endcode %}

{% code title=”Override the Organization Name” overflow=”wrap” %}

[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)

{% endcode %}

{% code title=”Override the Avatar” overflow=”wrap” %}

[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)

{% endcode %}

CSS Classes

AttributeTypeDefaultDescription
classstringAdditional 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:

{% code title=”CSS default variables.” %}

: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)

{% endcode %}

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