Ez a bővítmény nem lett tesztelve a WordPress legutóbbi 3 fő kiadásával. Lehetséges, hogy már nincs karbantartva, frissítve és a használata gondot jelenthet a frissebb WordPress verziókkal.

codeSnips

Leírás

Own your snippets! No longer require the use of a cloud service to host your snippets for you when you can host them right on your own WordPress site! codeSnips allows you to quickly add and embed code snippets to your website with syntax highlighting available for 124 languages! codeSnips uses custom post types where you create a new snippet post, select the programming language, enter the code snippet and publish the post. You then can either access the snippet post directly for sharing, or embed it into another post using the shortcode.

View all of your snippets in an archived list, or even on the snippet page itself – without embedding into a new post. You can access all your snippets using a customizable pretty URL permalink. For example: http://yoursite.com/snippets

You can also view the raw plain text snippet directly, which is ideal for copy & pasting.

Features:

  • Quickly add new snippets with syntax highlighting available in 124 programming languages.
  • Plain text snippets are supported.
  • Syntax highlighting changes dynamically if you select a new code language from the dropdown while editing.
  • Embed the snippets using a shortcode that has many options.
  • You can embed multiple snippets per post.
  • Access a snippet post directly via URL.
  • Access a plain text raw view of the snippet directly via URL. Ideal for copying snippets.
  • Set a description for the snippet post that will display right on the snippet post page.
  • Change the URL slug for the list of snippets to suit your site.
  • Work with a particular code language a lot? Select a default snippet code language.
  • Each snippet also has a filename field that you can use as a reference for that snippet.
  • Uninstalling the plugin will clean up all data it has stored in the WordPress database.

The default list of snippets will display as a post archive list using your theme. You can customize the way this list looks by simply adding a file in your theme called „archive-snippets.php”. Likewise, if you add a theme file called „single-snippets.php” it allows you to customize the way the direct snippet pageis rendered. There are examples located included with the plugin under the „templates” folder.

Képernyőmentések

  • Snippets embedded in a post.
  • List of all snippets in an archive list. The list can be customized to your theme.
  • The direct snippet post itself. Not embedded.
  • List of all snippets in wp-admin.
  • Editing an existing snippet post type.
  • General settings page for codeSnips.
  • Editor specific settings for the Ace Editor.
  • Usage tips to help out.

Telepítés

Install

Installing codeSnips can be done from inside your WordPress admin panel by going to Plugins > Add New and searching for „codeSnips”.

  1. You can also manually install it by downloading the plugin from wordpress.org/plugins
  2. Upload the entire codesnips folder to the /wp-content/plugins/ directory
  3. A bővítmény bekapcsolása a WordPress „Bővítmények” menü részénél lehetséges
  4. Customize the plugin from the menu by selecting codeSnips > Settings.

Uninstall

  1. Deactivate the plugin from the Plugins menu
  2. Select „codeSnips” from the list and select „Delete”
  3. This will delete all files from the server and all settings from the WordPress database.

GYIK

Installation Instructions

Install

Installing codeSnips can be done from inside your WordPress admin panel by going to Plugins > Add New and searching for „codeSnips”.

  1. You can also manually install it by downloading the plugin from wordpress.org/plugins
  2. Upload the entire codesnips folder to the /wp-content/plugins/ directory
  3. A bővítmény bekapcsolása a WordPress „Bővítmények” menü részénél lehetséges
  4. Customize the plugin from the menu by selecting codeSnips > Settings.

Uninstall

  1. Deactivate the plugin from the Plugins menu
  2. Select „codeSnips” from the list and select „Delete”
  3. This will delete all files from the server and all settings from the WordPress database.
How do I embed a snippet into my post?

It’s easy. Once you’ve created your snippet, you need to know the snippet ID. Easiest way is to go back to the „All Snippets” page in the Admin Dashboard. Then just copy and paste the shortcode that’s next to your post. For example, you would copy [snippet id=5] to your post, and that’s it!

Can I have private or password protected snippets?

You can! Just set the status of the post when you create your snippet. An important item to understand is that if your snippet is password protected or private, then it will not show when you use the shortcode. The snippet will also not be available in the view raw mode.

What if I want to hide (or show) the snippet meta bar?

The snippet meta bar is enabled by default. The meta bar contains the filename and the code language. If you want to disable the snippet bar globally, you can do so in the codeSnips Settings page. Likewise, if you want to disable it for just a single snippet embed at a time, you can add meta="false" to your shortcode. For example, [snippet id="15" meta="false"] would show the snippet ID 15 with the description but no meta bar.

What if I want to show the snippet description?

The descriptions are disabled by default. To enable them, you must type in a description in the snippet edit page, then check the checkbox for it to display on the single snippet post. To add a description for an embedded post, just add desc="true" to your shortcode. For example, [snippet id=20 desc="true"] would show the snippet ID 20 and it’s description if it had one.

How do I change the look of the snippet box?

Just edit the frontend.css file located under CSS folder. You can remove the border, or even change the way the gutter and everything looks (without changing the built-in editor Themes)

How many options are available using the shortcode?

You can see all the documented options under the codeSnips > Settings menu, then select the Usage tab.

Can I help you translate the plugin?

Yes please! As of 1.1 the POT file is available. If you translate it, let me know and I’ll include it in a maintenenace release!

Vélemények

2016.09.03.
I create a lot of internal documentation for my team, including examples of code. I've tried several other solutions to keep the visual editor from eating or poorly formatting my code, but all have had their issues or quirks. This plugin has made adding code so much quicker, easier, and less prone to breakage 🙂 The only suggestion I can make would be to add categories for organizing codeSnips. This would be a nice to have feature for those of us with a LOT of codeSnips. Thank you!
2016.09.03. 1 reply
I like the approach, It allows to have more readable post tutorials writing process, by outsourcing the code snippets (than can sometimes can be long) on their own post types. More, it allows to have archive and shortcode if you want to use it somewhere else. Pretty nice !
2016.09.03. 1 reply
A very good plugin to maintain a code listing. Well conceive and Jetpack Markdown compatible.
4 (az összes) vélemény olvasása

Közreműködők és fejlesztők

“codeSnips” egy nyílt forráskódú szoftver. A bővítményhez a következő személyek járultak hozzá:

Közreműködők

“codeSnips” fordítása a saját nyelvünkre.

Érdekeltek vagyunk a fejlesztésben?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Változási napló

1.2

  • Upgrades to the latest version of Ace Editor
  • Fixes the height of the code box
  • General code cleanup

1.1.6

  • Fixes a bug where the snippet slug was reset to default on deactivate/reactivate.
  • Update where all new snippets have the „Show Snippet Description” enabled by default.

1.1.5

  • Fixes another small bug found with CPT post update messages.

1.1.4

  • Fixed a small bug with the CPT post update messages.

1.1.3

  • Added Jetpack Markdown capability in the snippet description. Fixed missing language settings, too.

1.1.2

  • Some changes to the plugin’s Settings page structure

1.1.1

  • Removed some CSS from admin.css, which was altering items it didn’t need to.

1.1

  • Added internationalization options for the text fields. Interested in translating this plugin? Let me know!

1.0.2

  • Further updates on how the custom post type sample URL is being displayed on the General Settings page.

1.0.1

  • Found a small bug with the custom post type URL being displayed incorrectly on the General Settings page.

1.0

  • Initial release