Documentation

 

Hi! Thanks for purchasing (or checking out!) the WordPress for Concrete5 add-on.

Here are some fast links to help you get started:

 

Steps to Install

 

1. Install WordPress

This isn't as hard as it may sound, so don't worry.

If you already have WordPress installed, great! You can skip this step altogether.

You can download WordPress by going to http://www.wordpress.org/download. It is easy to install. Extract the ZIP file and upload it to a directory on your server.

Make sure that you install WordPress to an address you will not need for Concrete. For example, if your blog page will be at "/blog" on your server, do not put WordPress there! Use an alternate directory, like "/wordpress", or use another domain name, like "wp.mywebsite.com"

You may want to check Dashboard > Settings on your WordPress install, to confirm the URL for your install. If your site in Concrete uses "http://www.mysite.com", you may want to double-check that WordPress does not use "http://mysite.com". Using the same pattern will ensure a better fit between WordPress and Concrete.

Make sure that the "WordPress address (URL)" remains set to where you have your copy of WordPress installed. However, you may be able to experiment with changing the "Site address (URL)" to the address where your blog will be setup in Concrete.

You will need to configure the "wp-config.php" file to get WordPress up and operating. If you want, you can share the same database as Concrete. WordPress will add a "wp_" prefix to all its tables, so WordPress and Concrete won't overwrite each other. Otherwise, feel free to use a separate database than your Concrete install.

 

2. In WordPress, add the JSON API plugin

With WordPress installed, Go to (WordPress URL)/wp-admin to access the WordPress Dashboard. Go to Plugins > Add New and search for "JSON API". Install and activate the plugin.

You can test to make sure that the plugin is working properly. Go to (WordPress URL)?json=1 and see if it returns JSON data instead of the regular webpage. This is how Concrete will see data from WordPress.

 

3. In Concrete, install WordPress for Concrete5

You might have done this already. If you did, good for you!

Otherwise, make sure that your site is linked to the Concrete Marketplace. Go to your Dashboard, then Add Functionality, and check the column on the right.

If you already linked your site to Concrete, you may see the add-on. Click "Download" then "Install" to install it. Otherwise, click the link to sync your site with the Marketplace. If the add-on still does not appear, go to https://marketplace.concretecms.com/profile/projects/, click the name of your site, and assign your license of WordPress for Concrete5 to the site.

If you just linked your site or assigned the license, you can return to Dashboard > Add Functionality to download and install the add-on.

 

4. In Concrete, add a "WordPress Entries" block somewhere

Okay, ready to get started! Visit or create a page in Concrete, then add a "WordPress Entries" block. For the URL, use the same URL that you used in step 1 of the install process (for example, "http://www.mysite.com/wordpress")

If you would like to enable comments, create an account with Disqus, then enter the short name and URL in the block settings. Otherwise, you can leave comments unchecked.

 

5. (Optional) Add search, tags, categories or archives

If you want to show search, tags, categories or archives, add a "WordPress Search", "WordPress Tags", "WordPress Categories" or "WordPress Archives" block to the same page. These blocks will work together with your WordPress Entries block to navigate through your blog entries.

 

6. (Optional) Use "pretty" permalinks

By default, the add-on uses addresses like "http://www.mysite.com/blog/?p=123", similar to WordPress. However, if you have "pretty" URLs enabled in Concrete, it is possible to use "pretty" permalinks, also similar to WordPress, like "http://www.mysite.com/blog/2011/09/07/my-sample-post"

If you have Concrete 5.4.2 or later, and have "pretty" URLs enabled, you should be able to choose one of the "pretty" permalink styles in your "WordPress Entries" block.

If you are using an older version of Concrete, it is possible to support "pretty" permalinks by making a small patch to one of Concrete's core files.

Open the file "concrete/libraries/view.php" for editing off your web server, and add this code. The right spot to put it will be around line 604, but you can use the references below to help you find the right part of the file to paste it

if ($this->controller->getRenderOverride() != '') {
    $view = $this->controller->getRenderOverride ();
}

This is what it should look like before:

Events::fire('on_start', $this);

// Extract controller information from the view, and put it in the current context

if (!isset($this->controller)) {
    $this->controller = Loader::controller($view);
    $this->controller->setupAndRun();
}

...and this is what it will look like afterwards:

Events::fire('on_start', $this);

// Extract controller information from the view, and put it in the current context

if (!isset($this->controller)) {
    $this->controller = Loader::controller($view);
    $this->controller->setupAndRun();
}

if ($this->controller->getRenderOverride() != '') {
   $view = $this->controller->getRenderOverride ();
}

If you run into any trouble, please post on the Support forum or send me a private message. I would love to help you!

 

Customizing Your Own Template (Optional)

 

It is very easy to customize your own template for the WordPress for Concrete5 add-on. The add-on has been designed with a "template" system that lets you control the format of your blog entries without needing to write any code. In fact, this system makes it possible to take advantage of future updates to the add-on without losing your design.

To use a custom template, click on a WordPress Entries block (while in edit mode) and select "Custom Template". All of your templates will appear on the list.

There is an example already included in the add-on. Open "/packages/wordpress_for_concrete5/blocks/wordpress_entries/templates/just_another_wordpress.php" from your site or a downloaded ZIP of the add-on. There is a "template_default.php" file which is included that sets all of the templates to their default values. By importing this file, you only need to specify the templates you would like to change from their default values. You can look at "/packages/wordpress_for_concrete5/blocks/wordpress_entries/template_default.php" for reference, if you wish.

It is also possible to avoid using the "template_default.php" file in order to customize your add-on more deeply, but these changes may not allow you to take advantage of future improvements to the add-on. If this is your only solution, please contact me through Support or a private message, as I may be able to support your situation officially, so you don't need to worry about branching your own view.

Create a directory at "/blocks/wordpress_entries/templates/" on your server, then create a copy of "just_another_wordpress.php", using your own name. Concrete will perform capitalization automatically, so "just_another_wordpress" becomes "Just Another Wordpress" when editing your site.

Once you have created your own file, feel free to customize! If you need any help, tips, or more features, please contact me through Support or a private message. Here is a full reference of all of the templates and properties that are currently available:

 

post - Used when rendering blog entries (Used inside the "page_single_post" and "page_multiple_posts" templates)

%URL% - The permalink for the blog entry
%TITLE% - The title of the entry
%CONTENT% - The content of the entry. This will either be the excerpt, full post or blank
%CATEGORIES% - If a category is defined, the categories for the entry as defined by the "categories" template
%DAY% - The name of the day of the week when the entry was posted
%MONTH% - The name of the month when the entry was posted
%DATE% - The day of the month when the entry was posted, without leading zeros
%FULL_YEAR% - The four-digit year when the entry was posted
%DISQUS_COMMENT_COUNT - If comments are enabled, the Disqus comment count as defined by the "disqus_comment_count" template
%EDIT_POST% - If logged in as a user with editing rights, the edit post link as defined by the "edit_post" template
%AUTHOR_NAME% - The full name of the entry's author
%AUTHOR_NICKNAME% - The user name of the entry's author
%THUMBNAIL% - The thumbnail value of the post, as described by WordPress


categories - Used to render a set of categories for a blog post (Used inside the "post" template)

%ITEMS% - Where category items should be rendered, as defined by the "categories_item" and "categories_item_divider" templates


categories_item - Used to render a single category item (Used inside the "categories" template)

%URL% - The URL path to sort by the specified category
%TITLE% - The title of the category


categories_item_divider - Used to seperate multiple category items (Used inside the "categories" template)


tags - Used to render a set of tags for a blog post (Used inside the "post" template)

%ITEMS% - Where tags items should be rendered, as defined by the "tags_item" and "tags_item_divider" templates


tags_item - Used to render a single tags item (Used inside the "tags" template)

%URL% - The URL path to sort by the specified tag
%TITLE% - The title of the tag


tags_item_divider - Used to seperate multiple tags items (Used inside the "tags" template)


disqus_comment_count - Used to render the comment count link for blog posts

%URL% - The URL path to view the full blog post, with the Disqus anchor tag attached
%IDENTIFIER% - The Disqus post identifier, so that the comment count is reported properly


edit_post - Used to render the edit post link (Used inside the "post" template)

%URL% - The URL path for editing the current post


page_single_post_page_title - Used to update the page title when viewing a blog post (Used in the "page_single_post" template)

%POST_TITLE% - The title of the current blog post
%C5_PAGE_TITLE% - The original title of the page, specified by Concrete


page_single_post - Used to render a page that contains only one post (detail view)

%POST% - The post that will be displayed
%COMMENTS% - If enabled, where the comment area for the current post will be displayed
%NEXT_POST% - A link for viewing the next newest post as described by the "next_post" template
%PREVIOUS_POST% - A link for viewing the next oldest post as described by the "previous_post" template


next_post - Used to render "next post" links (Used in the "page_single_post" template)

%URL% - The link that will bring the user to the next newer page 


previous_post - Used to render "previous post" links (Used in the "page_single_post" template)

%URL% - The link that will bring the user to the next older page 


comments - Used to render a comment area (Used in the "page_single_post" template)

%DISQUS_COMMENTS% - Where Disqus comments should be rendered


page_multiple_posts - Used to render a page with multiple posts (listing view)

%SEARCH_TITLE% - If the user has entered search keywords, the title that describes the search results, as described by the search title templates
%POSTS% - The posts that will be displayed on the current page
%NEWER_POSTS% - Paging for viewing newer posts as described by the "newer_posts" template
%OLDER_POSTS% - Paging for viewing older posts as described by the "older_posts" template
%CUSTOM_PAGINATION% - Custom pagination as described by the "custom_pagination" template


search_title_results
- Used to render a search title when matching entries have been found (Used in the "page_multiple_posts" template)

%KEYWORDS% - The search keywords the user entered


search_title_no_results - Used to render a search title when no matching entries are found (Used in the "page_multiple_posts" template)

%KEYWORDS% - The search keywords the user entered


multiple_post_divider - Used to render a divider between multiple posts (Used indirectly by the "page_multiple_posts" template)


newer_posts - Used to render a paging link for viewing newer posts (Used in the "page_multiple_posts" template)

%URL% - The link that will bring the user to the newer page


older_posts - Used to render a paging link for viewing older posts (Used in the "page_multiple_posts" template)

%URL% - The link that will bring the user to the older page


custom_pagination - Used to render custom pagination links (Used in the "page_multiple_posts" template)

%CURRENT% - The current page number
%TOTAL% - The total number of pages
%FIRST% - Link for the first page as described by the "custom_pagination_first" template
%PREVIOUS% - Link for the previous page as described by the "custom_pagination_previous" template
%ITEM% - Numeric page links as described by the "custom_pagination_item" and "custom_pagination_item_current" templates
%NEXT% - Link for the next page as described by the "custom_pagination_next" template
%LAST% - Link for the last (oldest) page as described by the "custom_pagination_last" template


custom_pagination_first - Used to render the first page link (Used in the "custom_pagination" template)

%URL% - The link that will bring the user to the first (newest) page


custom_pagination_previous - Used to render the previous page link (Used in the "custom_pagination" template)

%URL% - The link that will bring the user to the previous page


custom_pagination_item - Used to render numeric page link items (Used in the "custom_pagination" template)

%URL% - The link that will bring the user to the numbered page
%NUMBER% - The number of the page


custom_pagination_item_current - Used to render the current page text (Used in the "custom_pagination" template)

%NUMBER% - The number of the current page


custom_pagination_next - Used to render the next page link (Used in the "custom_pagination" template)

%URL% - The link that will bring the user to the next page


custom_pagination_last - Used to render the last page link (Used in the "custom_pagination" template)

%URL% - The link that will bring the user to the last page

 

 

Tweak Your WordPress Install

 

The following are tips and tricks to help you get the most from your install. Here you can find add-ons and scripts I have personally used to send updates to Facebook, post notifications to Twitter, customize my blog excerpts, etc.

 

How-to: Send updates to Facebook when you post on your blog

If you would like to post a status to Facebook each time you write a new blog entry, search and install the "WordBooker" plugin. Once it is installed, it should prompt you to authorize with Facebook in order to link to your Facebook account. You may also want to go to Settings > WordBooker and enable "Default Publish Post to Facebook".

 

How-to: Send a tweet on Twitter when you post on your blog

If you would like to send a tweet each time you write a new blog entry, search and install the "Tweetly Updater" plugin. In the settings for the plugin, use the link to authorize your Twitter account, then enter your bit.ly login information for URL shortening. If you're creating a new bit.ly account, it's quick to do, but I found it to be slightly difficult to see where to find the API key. When you're logged into bit.ly, click on your username at the top, then select "Settings", then it will show you your API key.

 

How-to: Automatically redirect traffic from your WordPress URL to your Concrete blog URL

The easiest way to redirect traffic is to go to Appearance > Editor > Header from the WordPress Dashboard, then paste in this snippet at the very top, before anything else (replacing "/blog2" with the URL of your WordPress site, and "/blog" with the path of your blog in Concrete):

<?php

    if (empty ($_GET['json'])) {

        $path = str_replace ("/blog2", "/blog", $_SERVER['REQUEST_URI']);

        Header("HTTP/1.1 301 Moved Permanently"); 
        Header("Location: " . $path); 

    }

?>

 

How-to: Configure Windows Live Writer 2011 for remote publishing

Windows Live Writer can actually import styles from your Concrete page, and allow remote publishing for posts. It's an excellent way to blog without logging into WordPress. When it prompts you to select the type of your blog, choose "Other Services", then enter the URL for your blog (on Concrete5) and the user name and password for WordPress. When it says it cannot automatically detect the blog settings, choose "WordPress 2.2+" and replace <hostname> and <wp_path> with the URL for your WordPress install. This will configure it correctly to use your Concrete URL as the path to the site, but the WordPress URL as the path to use when publishing posts.

 

How-to: Add syntax highlighting for writing about programming languages

If you are like me, you might write about programming sometimes. If you're interested in doing this on your blog, here's a couple plugins to try: "WP-Syntax" and "WP-Syntax Editor Integration Plugin". I'm currently using it on my own blog and it works great.

If you are also like me, and write code that is too long to fit into the window, you may also want to add a little bit of CSS to your theme to enable word-wrapping for <PRE/> tags. If you use this style, you will need to make sure that you do not post code with line numbers enabled, as it will mess up the alignment, but here it is if you are interested:

pre { white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; }

 

How-to: Alter the length of WordPress excerpts

By default, WordPress will use an excerpt length of 55 words. Excerpts are displayed in RSS feeds, or when you use the "Excerpts Only" display mode in a WordPress Entries block. To change this length, go to Appearance -> Editor under WordPress, edit "Theme Functions (function.php)", then add this snippet of code:

function improved_excerpt_length ($length) {
    return 80;
}
add_filter('excerpt_length', 'improved_excerpt_length');

 

How-to: Change the [...] text for WordPress excerpts

WordPress will use the text " [...]" by default to show that an excerpt does not contain the full body of a blog entry. If you are interested in altering this text, or linking it to your post, go to Appearance -> Editor under WordPress, edit "Theme Functions (function.php)", then add this snippet of code:

function improved_excerpt_more($more) {
    global $post;
    return ' <a href="' . get_permalink($post->ID) . '">[...]</a>';
}
add_filter('excerpt_more', 'improved_excerpt_more');

 

How-to: Include paragraphs, breaks and other formatting in WordPress excerpts

If you are interested in preserving some of the formatting in your blog entries when WordPress generates an excerpt, you can use (or update) the following snippet based on what you would like to include. Go to Appearance -> Editor in WordPress, then edit "Theme Functions (function.php)" and add this in:

function improved_trim_excerpt($text) {
    $raw_excerpt = $text;
    if ( '' == $text ) {
       $text = get_the_content('');
       $text = strip_shortcodes( $text );
       $text = apply_filters('the_content', $text);
       $text = str_replace(']]>', ']]&gt;', $text);
       $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
       $text = strip_tags($text, '<p><a><ul><ol><li><blockquote><pre><br>');
       $text = force_balance_tags ($text);
       $excerpt_length = apply_filters('excerpt_length', 55);
       $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
       $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
       if ( count($words) > $excerpt_length ) {
           array_pop($words);
           $text = implode(' ', $words);
           $text = $text . $excerpt_more;
       } else {
           $text = implode(' ', $words);
       }
   }
   return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'improved_trim_excerpt');

 

 

p

If you are using an older version of Concrete, it is possible to support Just Another Wordpress %EDIT_POST% - If logged in as a user with editing rights, the edit post link as defined by the br /page_single_post/strong - Used to render the last page link (Used in the

If you are using an older version of Concrete, it is possible to support br /page_single_post/strong - Used to render the last page link (Used in the

Just Another Wordpress %EDIT_POST% - If logged in as a user with editing rights, the edit post link as defined by the br /page_single_post/strong - Used to render the last page link (Used in the

%EDIT_POST% - If logged in as a user with editing rights, the edit post link as defined by the - Used to render the last page link (Used in the

If you are using an older version of Concrete, it is possible to support Just Another Wordpress %EDIT_POST% - If logged in as a user with editing rights, the edit post link as defined by the br /page_single_post/strong - Used to render the last page link (Used in the

If you are using an older version of Concrete, it is possible to support Just Another Wordpress %EDIT_POST% - If logged in as a user with editing rights, the edit post link as defined by the br /page_single_post/strong - Used to render the last page link (Used in the

a href=concrete/libraries/view.phpstrong/strong

br /br / %URL% - The link that will bring the user to the newer pagebr //strong by default to show that an excerpt does not contain the full body of a blog entry. If you are interested in altering this text, or linking it to your post, go to Appearance -nbsp;