Category: WordPress

Install WordPress with WP-CLI

Download WordPress core files $ wp core download You can download WordPress in your language with adding option –locale=your_language_code to the command. Check the list of localizations for your locale. See documentation for all the other options. Create wp-config.php file $ wp core config –dbname=your_db –dbuser=your_db_user –dbpass=your_db_password –dbhost=your_db_host Required parameters are: dbname: Database name dbuser: […]

Add excerpt support to pages in WordPress

Add following code to your themes functions.php file.

Create additional image sizes in WordPress

Register additional image sizes Additional image sizes can be defined in your themes functions.php. In example

Full documentation can be found at WordPress Codex Displaying additional image sizes in your theme

Previously upload images do not have the new image size. Images can be generated with Regenerate Thumbnails plugin

Display custom post types in WordPress

Create your custom post type Custom post types declaration is added to your themes functions.php file. Plugin would prevent against breackage  when switching themes.

Create template for your post type Create template file page_my-custom-post-type.php

Upload newly created template file to your theme folder. Now “My Custom Post Type Page” will listed in the […]

Get translated permalink with WPML

For WPML 3.2+ correct version for translating permalinks is Documentation for wpml_object_id For versions older than 3.2 you can use version below Parameters for icl_object_id are: Term id for taxonomies, post id for posts and pages Element type ie. comment, post or page Return original value if translation is missing. Defaults to true Language code, […]

Add menu order attribute to WordPress posts

Add following code to your themes functions.php file.