Writing code is the step taken within the code editor window of the code block, and is what carries out the functionality that’s intended to be performed by the block.

CJT is providing users with a number of tools for writing code. One of these powerful tools is the Advanced Code Editor (ACE) with syntax highlighting and error checking. The editor can also support a majority of the modern functions that’s currently being used by a lot of code editors like: folding, unfolding, collapsing and expanding code regions.

More helpful tools that can be utilised include: restore block revisions, switch editor languages, switch editor themes, full-width and full-screen mode, adjust font sizing, and the Code Auto Complete (CAC) extension.

Before writing HTML, JavaScript, CSS or PHP code, it is advised to set the editor to your chosen language. This way you will get the benefits from language-dependant features such as syntax highlighting and error checking. CJT is currently not doing that automatically for you. Although that said, in our development pipeline is a feature called a Multiple Code Files Block that should be able to handle those things automatically.

The following languages are currently being supported:

  • CSS (Cascading Style Sheet)
  • HTML (HyperText Markup Language)
  • JS (JavaScript)
  • PHP (PHP: Hypertext Preprocessor)

CJT is not going to insert any tags or wrappers for any language. Setting the editor language is currently a conduit for syntax highlighting and error checking. CJT does not alter the code at all, so users have the ability and freedom to do whatever they like while writing code.

CJT provides two types of code block – Global Block and Metabox Block.

  • Global Block – this occurs in the main CSS & Javascript Toolbox dashboard page, where you can create multiple blocks and assign them to WordPress requests. Global Blocks can even be ordered so that blocks override other blocks. Additionally, blocks can be Activated/Deactivated and output in different locations. Global Blocks are used for providing shortcode support to block scripts, and also for assigning blocks to multiple WordPress requests.
  • Metabox Block – this occurs at the edit Page/Post level as a metabox, and when permitted in the Security settings, will show below the Visual/Text editor. Metabox Blocks will only affect the specific WordPress page or post it is attached to.

CJT Code Blocks are the basic unit for writing code and assigning it to specific WordPress requests (e.g. for a Page, Post, Category, Blog index, Expression, etc). It is the main gateway for interaction, allowing users to have their codes assigned. In general, blocks should always be created when you need to assign a piece of code with specific requests.

CJT is very flexible, allowing you to create multiple blocks, while:

  • assigning each block to different requests
  • assigning each block to the same request

You can assign multiple blocks to the same request, and allow multiple requests to share the same block (or blocks). The possibilities are endless.

CJT Blocks require only two steps in order to get them involved with the request. The first is to tell CJT where this block should be assigned (to the request), and the second is to write the code that needs to be assigned. 

Blocks can be arranged in different levels. This includes the Global Block Level and the Page/Post Level (Metabox Block).