Skip to content

HRandt/Polylang-Shortcodes-for-Oxygen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Polylang Shortcodes for Oxygen

This wordpress plugin accomplish five purposes:

  • Create a Gutenberg Shortcode access to Polylang strings, so you can use it anywhere. This include Oxygen templates!
  • Register new strings to translate without the need to edit functions.php nor installing a pluging to launch snippets.
  • Load custom CSS and JS files in WordPress but withouth editing functions.php.
  • Create a Gutenberg Shortcode access to add a Language switcher.
  • Customize the Language switcher.
  • Register a condition that you can use in Oxygen to show/hide content based on the language string in the URL.

If you are wondering what's the problem with functions.php: Oxygen doesn't make use of functions.php since this builder desactivate wordpress themes. So if you need to add PHP functions, you have to put it in a plugin.

About the code

I created this plugin because I wanted a simple way to manage the translation and customization of my website without adding a third-party plugin to handle code snippets.

This plugin is based in the code of the following good people:

Thank you.

Installation

  1. Click on the Download ZIP button at the right to download the plugin.
  2. Go to Plugins > Add New in your WordPress admin. Click on Upload Plugin and browse for the zip file.
  3. Activate the plugin.

Usage

Edit plugin.php and use the commented sample code as an example to register new Polylang strings, add enqueue or other site-specific code.

Use shortcode [polylang_langswitcher] to add a language switcher.

Use [pll_translate text="$text"] or [pll_translate text="$text" lang="$lang"] to add Polylang strings to anywhere.

Changelog

1.0.0

  • Initial Release

1.1.0

  • Create Oxygen condition by language.
  • Create Language switcher that can be use by shortcode.
  • CSS to modify the look of the Language switcher.
  • Enqueue CSS and JS

About

This wordpress plugin creates shortcodes to access Polylang strings from Oxygen templates.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 97.6%
  • CSS 2.4%