Small, Efficient WordPress Plugins

O2go2 WordPress Plugin

O2Go2 WordPress Plugin
Last Updated On : 31-Jul-2022

O2go2 is a go to plugin for use primarily with WordPress sites themed using the Oxygen Builder plugin. I put it together for my wife Liz who requested the features in the plugin. I offer it here in case it helps you. O2go2 provides a number of shortcodes to inject content in to Oxygen templates.

Features

  • includes various shortcodes for displaying postmeta data such as post dates, authors, categories, etc that can be include din Oxygen reusable parts
  • includes other miscellaneous features to make an Oxygen site builder's life easier

Shortcodes

The following shortcodes are included in the plugin :

o2author

Returns the author of the current post or page.

Parameters

  • author
    Set author to the id of the author whose name you want to return, instead of the actual author of the post. Omit this parameter if you want the author of the current post's name to appear.
  • link
    Set link to "true" if you want the author name to also be linked to the author page. Omit this parameter if you want the author name to appear unlinked, in plain text.

Examples

o2avatar

Returns the avatar of the author of the current post or page.

Parameters

  • author
    Set author to the id of the author whose name you want to return, instead of the actual author of the post. Omit this parameter if you want the author of the post's name to appear.
  • image
    Set image to "true" if you want an image to be returned and not just the URL of the image. The image size is the defaullt of 96 pixels square.

Examples

o2category

Returns the category of the current post.

Parameters

  • link
    Set link to "on" if you want the category name to also be linked to the category archive page. Omit this parameter if you want the category name to appear unlinked in plain text.
  • post
    Set post to the post id if you are using the shortcode outside of the loop (and hence the post_id needs to be provided as the current post is not provided by WordPress).

Examples

o2copyright

Returns a copyright string that can be placed for example, in footers on a website.

Parameters

  • prefix
    This is the text placed before the year range. It defaults to the copyright symbol, ©, if you leave this parameter out
  • start
    This parameter is the start year of the copyright. If you omit the parameter the copyright shows just the current year and not the range from the start year to the current year..
  • suffix
    This is the text placed after the year range which is normally set to be the copyright owner.

Examples

o2datemodified

Returns the modified date of the current page or post

Parameters

  • format
    Specify the format of the modified date. By default it is d-M-Y but you can use any PHP date string.
  • post
    Specify the post id of the post whose modified date you want to display. The default is the current post.

Examples

o2datepublished

Returns the publish date of the current page or post

Parameters

  • format
    Specify the format of the published date. By default it is d-M-Y but you can use any PHP date string.
  • post
    Specify the post id of the post whose published date you want to display. The default is the current post.

Examples

Returns the edit link of the current post or page. By default the edit link text will be "(Edit)" but you can override this using the text parameter.

Parameters

  • text
    Provide the text you want to see linked to the edit page. Note that if you choose to use the text parameter you must provide all the text you want to see, including brackets if required.

Examples

o2pastebin

Embeds a Pastebin code excerpt. The default shows no PasteBin header.

Parameters

  • header
    Set the header parameter to "on" if you wish to show the full Pastebin header on the embed.

Examples

o2template

Show the Oxygen template being used on the current page or post. By default this only appears for logged in admin users You might want to use this for debugging purposes

Parameters

  • prefix
    Text before the template name. The default value is "Template"
  • show_always
    Set to 1 if you want to show the template name to all users; not just logged in administrators. The default value is 0

Examples

o2wistia

Embeds a Wistia video inline. The embed code is contained in a div with a CSS class of wistia-video to allow for styling of the div. Please note that any section or div that places a Wistia video must be set to display block, and not flex.

Parameters

  • video
    This is a required parameter and must be set to the id of the Wistia video.

Examples

Miscellaneous Features

Editor Width

By default, Gutenberg operates with a rather wee editor window. While we like wee plugins, we do not like wee editors. Use this feature to make use of whatever space is available on your screen, for the Gutenberg editor.

Amazon Disclaimer Insertion

If you're using Amazon affiliate links, then this feature will place the Amazon disclaimer in an aside on any page that contains an Amazon link. It places the link at the foot of the page to avoid any negative SEO impact of placing this non keyword related text at the start of the page content. Javascript is used to move the text to a more prominent position to make the text more visible the visitor and ensure compliance with Amazon terms.

404 Redirection

You can set up all 404s to a dedicated 404 page. You can also set the HTTP status to be something other than a 404 if this temporarily suits your needs (e.g. just after major site moves or reorganizations).

Numeric URI Redirects

Liz prefers to use post_id/postname permalink structure for posts. This has certain advantages - it means you can change the slug for on-page SEO purposes whenever you want to, without having to set up redirects between the old slug and the new slug.

You can also refer to posts and pages with a short URL that specifies the postid only. This can be very convenient. The plugin allows for the automatic redirection of the short version of the URL to the long version.