Category: Wordpress

  • “Page not Found” in WordPress after Upgrade

    I got “Page Not Found” on any permalink clicked in my blog after doing:

    • an upgrade of the Synology’s WordPress package from 3.4 to 3.5.
    • and an upgrade all my Plugins.

    The problem was in the URL rewriting configured in the .htaccess.

    Click to Read More

    The easiest solution is to reset the “Default” common settings for the Permalink via the WordPress Dashboard. This will reset the .htaccess.

    1. Go into the DashBoard > Settings > Permalinks.
    2. Select “Default” in the “common settings”
    3. “Save Changes”

    Possibly set back next your favorite settings (such as “Post name” in my case).

    Voilà.

    Here is for information purpose the content of the .htaccess once fixed:

    [bash] # BEGIN WordPress

    RewriteEngine On
    RewriteBase /wordpress/
    RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]

    # END WordPress
    [/bash]

    Loading

  • A check box is not appearing on all “Spams” in WordPress Dashboard

    I did notice in WordPress that there is sometimes no check box displayed next to some comments of the “Spam” category. I am in such case unable to permanently delete them. It’s actually not a bug but the result of the fine grained security (i.e.: permissions).

    Click to Read More

    Actually, we see the check box used to handle a comment depending on our profile and the author of that comment…

    E.g.: I am using two distinct accounts in WordPress; one as “Administrator” to manage WordPress and one as “Author” to publish. But I did publish a few posts by accident with my “Administrator” account.

    When connected as an “Author”, I can see the comments of any type (including the spams) written on any post (including those published by other accounts). However, I can only handle the comments written in response to my own posts. For that reason, I don’t see a check box on comments written in response to posts of other accounts…

    It’s quite confusing because who did publish a post is not displayed in the screen displaying the comments 🙁

    Loading

  • From WordPress 3.3 to 3.4 on Synology: Almost YAUN !!

    No! I don’t mean “Yet Another Unix Nerd”!!!

    But upgrading WordPress from 3.3 to 3.4 on my DS209+ was almost “Yet Another Upgrade Nightmare” 🙂

    Click to Read More

    Upgrading a package for Synology is usually really a piece of cake. Unfortunately, the upgrade package for WordPress caused me difficulties.

    First issue: MySQL password

    The setup failed quite immediately after downloading, complaining that there was possibly an issue with the MySQL password. After some investigation, it appeared to me that :

    • the DSM Package Center is running as Synology’s “root” user and
    • the setup of WordPress was trying to access MySql with that account but without any password.
    I found on Synology’s Forum that “Current wordpress package requires an default mysql account root with empty password to create database successfully. If you have set mysql root password before, please install phpMyAdmin to reset the password first.

    And unfortunately (although quite normal), I did set a password for the MySql “root” user in the past… So, as suggested in the message above, I did reset MySql root password to blank.

    • Go to phpMyAdmin, opened the “Users” tab and clicked “Edit Privileges” for the user “root” with Host=localhost.
    • In the “Edit Privileges” dialog box, scroll down to the “Change Password” area and select “No Password” before clicking “Go”.
    • Finally, back to the “Users” page, click “Create PHP code” to apply the change. At that moment, phpMyAdmin could prompt you to re-enter your credentials (root with a blank password).

    I did next restart the update of the WordPress which finally completed fine. But…

    Next issue: Page Not Found

    My Blog was not reachable anymore after the upgrade ? Damned… WordPress was imply disabled… I had to click “Start” next to the WordPress Package in the DSM Package Center 😆

    And finally, my home page appeared… I went immediately to the administration dashboard where I discovered that the setup was actually not yet complete. In this dashboard, I found a message asking me to click a button to upgrade the database. Fortunately, nothing wrong occurred during this upgrade 🙂

    Last issue: This is somewhat embarrassing, isn’t it?

    Although the home page appeared correctly, I was not able to open anything else: no post, no “custom” pages, no categories, … For each of them, I got the WordPress’ “Page Not Found”… All the permalinks appeared somewhat “corrupted”… No idea why.

    Fortunately (bis ter et repetita), fixing this issue was not difficult. I simply had to re-enforce the right Permalinks structure.

    • Go back to the administration dashboard and select the menu “Permalinks” under “Settings”.
    • Check that “your” structure of Permalinks is still selected and did click “Save Changes” (Even if you didn’t change the structure).

    And miracle! Everything went back to normal. I didn’t lose any customization or plugins except my custom smilies from \web\wordpress\wp-includes\images\smilies (fortunately backuped),…

    YASU!!

    No! I Don’t mean “Yet Another System Utility”!!! But “Yet Another Successful Update” 😆

    Loading

    ,
  • Line Break versus Paragraph in WordPress

    For a WordPress beginner (at least for me, who used to write html in notepad++), when editing a post, it is irritating that the ‘Enter’ key is not simply adding a line break but starting automatically a new paragraph instead, especially when typing some pieces of code.

    Fortunately, there is a trick to add a line break without starting a new paragraph.

    Click to Read More

    A new paragraph is usually started after a “Hard break” also known as a “Carriage Return”, which is indeed the default when typing “Enter” in a Word Processor. At the opposite, a simple “Line break” also known as “Soft Break” does not start a new paragraph and result in a normal line-spacing.

    Ex.: The white-space between the previous text and this line is due to a “paragraph separator”. But here after, you will see two lines A. and B. separated by a simple line break.

    A. first line of text
    B. second line of text

    Instead of typing “Enter” at the end of the line A., press “Shift-Enter” instead. That wilt result in a “soft break” (line break) instead of a “hard break” (carriage return).

    Loading

    ,
  • Add categories as dropdown menu in WordPress Navigation Bar

    Edit the file header.php of your theme to add such a menu.

    Click to Read More

    On Synology, this file is accessible via the “web” shared folder (See here for details) at:

    \\<YourSynology>\web\wordpress\wp-content\themes\<YourTheme>\header.php

    Find the right location in the code generating the navigation bar and add something like this (using the adequate ‘class’ from you own theme. Here after, I am using TwentyEleven.)

    [html]

    <!– Add a drop dow menu with all the categories –>
    <div style="text-align:center;">
    <ul id="menu" style="padding:0; margin:0;">
    <li class="cat-item">
    <a href="#" title="Filter by categories.">Categories</a>
    <ul class="children">
    <?php wp_list_categories(‘sort_column=name&sort_order=asc&
    style=list&children=true&hierarchical=true&
    title_li=0&exclude=1’); ?>
    </ul>
    </li>
    </ul>
    </div>

    [/html]

    Instead of href=”#” (to stay on the current page when selecting the head of that menu), you could also use:

    [php]href="<?php echo esc_url( home_url( ‘/’ ) ); ?>"[/php]

    The parameter “exclude=1” is used to skip the category “Uncategorized”. You can add other category IDs to be skipped separated with a comma. To determine the ID of a category, go to “Administration Dashboard > Posts > Categories” and move the mouse over the “Edit” link for that category. Look at the URL displayed by the browser for that link; this one includes the category ID as a parameter: “&tag_ID=xxx”

    Loading

  • Expand/Collapse content in WordPress

    I am using the plugin “JQuery Collapse-O-Matic” to let the reader expand or collapse parts of my posts…

    The documentation is available on the author’s website. As you can see, there are a lot of options to manage groups, scrolling, colors, pictures, etc, etc, etc…

    Click to Read More

    I mainly use the basic options to display a title to show the content and one to hide it:

    [expand title="Click to Read More" swaptitle="Click to Close"]

    some content

    [/expand]

    I found, so far, once issue with the “WordPress 2012” theme I am using:

    • When there is no content anymore after the closing tag, there is no space left between the collapsed block and the bottom line of the post.
    • If there is one blank line after the closing tag, there is a huge space (several lines) displayed between the collapsed block and the bottom line of the post.
    However, if you apply the “Align Full” style on the opening tag (only), one blank line will be kept between collapsed block and the bottom line of the post, which makes it more readable. Otherwise, the “link” to expand the block is barely visible.
    This issue does also not occur
    • if the opening tag to expand/collapse the block is not at the beginning of the line, i.e.: if there are some text in front of it.
    • if the previous line is not the last one of a paragraph. I.e.: if it ends with a simple line break (Shift-Enter) instead of a end-of-paragraph (Enter).

    Copy the code here above and paste it into your post with Ctrl-Shift-V, to paste-in-plain-text (without formatting!)

    Loading

  • Syntax highlighting in WordPress

    I am using the plugin “Syntax Highlighter Evolved” to color the code samples embedded in my posts.

    This one is based, as many others, on the code syntax highlighter developed in java-script by Alex Gorbatchev.

    Click to Read More

    Here is the list of supported syntaxes [syntax name: tag]:

    ActionScript3: as3, actionscript3
    Bash/shell: bash, shell
    ColdFusion: cf, coldfusion
    C#: c-sharp, csharp
    C++: cpp, c
    CSS: css
    Delphi: delphi, pas, pascal
    Diff: diff, patch
    Erlang: erl, erlang
    Groovy: groovy
    JavaScript: js, jscript, javascript
    Java: java
    JavaFX: jfx, javafx
    Perl: perl, pl
    PHP: php
    Plain Text: plain, text
    PowerShell: ps, powershell
    Python: py, python
    Ruby: rails, ror, ruby
    Scala: scala
    SQL: sql
    Visual Basic: vb, vbnet
    XML: xml, xhtml, xslt, html, xhtml

    The easiest it to use the tags here above as shortcode around your “code”, like this: [tag]my code[/tag] where tag can be php, vb, shell, ….

    Here is a sample from Alex G.’s website using the tag “php” as a shortcode:

    [php]// SyntaxHighlighter makes your code snippets
    // beautiful without tiring your servers.
    // http://alexgorbatchev.com
    var setArray = function(elems) {
    this.length = 0;
    push.apply(this, elems);
    return this;
    }[/php]

    There are various options than can be set using parameters: [tag parameter=”value”]my code[/tag]. Those options are listed in the “settings” page of the plugin (See via the WordPress admin dashboard).

    The various issues I found are:

    1. Although using the parameter gutter=”true”, I cannot remove the line numbering but keep the toolbar.
    2. Copy/Paste code from an IDE does not provide a nice output:
      • The indentation is lost,
      • some lines of code become formatted as “paragraphs” and extra blank lines appears therefore
    There is however a trick to keep the original formatting of the code when copy/pasting this one.
    1. Copy first your code from the IDE
    2. Next, in your post, select the HTML view
    3. Then, in this view, add your tags [tag][/tag]
    4. Finally, paste your code between those tags and switch back to the Visual view

    If you prefer to convert your code into HTML+CSS, the best online tool I found is Pygments (Python Syntax Highlighter) which supports for free much more languages than most others, has a simple interface and display not  advertisement.

    Loading

    ,
  • Edit WordPress sources on Synology via the shared folder “web”

    Although all Plugins’ files can be edited directly within WordPress, you may sometimes prefer to open them with your favorite editor. Also, you could desire to edit some sources of WordPress…

    And if it is quite easy to find the files to be modified under the share folder “web” (\\<SynologyHostname>\web), you will quickly notice that you may not save any change…

    This is simply because the folder ‘wordpress’ and its content (on Synology) belong by default to the user “nobody”. Click to read the solution

    To save your changes, you will first have to change the owner:

    • Check that Telnet is enabled on your Synology (Start Menu/Control Panel => Terminal)
    • Start the command (in a MS-Dos prompt): Telnet <SynologyHostname>
    • Log in with the root account and its password (same password as the Synology “admin” account)
    • Go to the physical folder associated to the shared folder “web”: cd /volume1/web/
    • Take ownership of WordPress’s whole content: chown -R <YourAccount> wordpress

    For sure, <YourAccount> must exist on Synology, be the same as your windows account (I.e.: same name and same password) and have privileges on the folder “web”. Otherwise, create such an account (Synology’s Start Menu/Control Panel => User) and don’t forget to grant him Read/Write access on “web” (Via the Synology User’s tab “Privileges Setup”)

    Once your changes saved, never forget to give back the ownership to “nobody”(*) otherwise WordPress won’t be able to update its plugins, themes, etc… automatically anymore.

    (*) Indeed, by default and for security reasons, the httpd demon of apache runs with the account “nobody”. All folders/files created by httpd (a.o.: during the installation of WordPress) belong therefore to “nobody”. All changes executed by https (e.g.: files editing) are executed with the credentials of “nobody”…

    Loading

    ,
  • WordPress on Synology accessible with both a Netbios name and Domain name

    When I have decided to install the package WordPress on my Synology, it was intended to be used as a basic “Knowledge Management Software” as I explained here.

    One of my requirement was however not covered out of the box by this solution: WordPress on Synology might only be configured to be accessible with one domain name.

    Click to read why

    Concretely:

    • Either with the Netbios name of the NAS, accessible from the Intranet only(my home network).
    • Or with the DNS name associated with your public IP, accessible from the Internet only (*) in my case.

    (*) Indeed, my DNS name is associated with the IP of my VDSL modem (my “public” IP). And although all http requests are forwarded to my NAS when they come from Internet, they are not when they come from my Intranet (So far, I didn’t find how to enable the Port Forwarding for this traffic and don’t even know if it’s possible with my modem; a Sagem Fast 3464):  If I browse my DNS name from my Intranet, I get the administration page of the modem.

    [EDIT] Now, when I browse my DNS name, I don’t get the Administration page of my Modem anymore but a message “Your internet connection is up, please close your browser and restart it again”. This is something configured by my Internet Provider in their own DNS Servers.

    Fortunately, there is an easy solution:

    Click to read the solution

    ==> Install the WordPress’ plugin “MultiDomain” and configure it to support “several domains”: a first one being simply my Netbios name and another one being your DNS name.

    This configuration has to be done in the file “config.php”, either with the “WordPress Plugins Editor” or with your favorite editor; the file can be accessed via the system shared drive “web” of Synology: \\<SynologyHostname>\web\wordpress\wp-content\plugins\multidomain\config.php). If you do it with your own editor, read this post about file access rights.

    That solution is from far easier than any advanced manual .htaccess customization and more effective than any other multi-site/multi-domain plugin I found 😉

    [EDIT] I have finally decided to access my blog only with its fully qualified domain name and never with its Netbios name anymore, including from my Intranet. So, I had to solve the access issue when using a domain name within my Intranet. I use the DNS Server of my Synology for that purpose.

    Loading

    ,
  • WordPress on my Synology!

    This first post to proudly announce that I finally decided to install the WordPress Package on my Synology, a DS209+ with DSM 4.1, and start to blog.

    Nothing could have been easier than installing this package… Click to read more

    • Log on your Synology as an administrator
    • Open the “Package Center” via the “Start Menu”
    • Go to the “Available” tab
    • Click “Install” on the package “WordPress”.

    The setup wizard will prompt you to get the root’s password in order to create a mysql database. By default, the Synology has no password configured to access mysql with the ‘root’ account. So I decided to configure one, using “phpMyAdmin”:

    • Open “phpMyAdmin” via the “Start Menu”

    If “phpMyAdmin” is not available in this menu:

    • Go back to the “Package Center”
    • Go to the “Available” tab
    • Click Install on the package “phpMyAdmin”

    Once “phpMyAdmin” open:

    • select the tab “Users”
    • for each “root” entry (one per host), click on “Edit Privileges”
    • scroll down in the “Privileges” window and change the password

    Use the “root” account and its new password to complete the setup of WordPress. The only other information required to configure WordPress on your Synology is a title and a tagline for your blog 🙂

    You can now access your blog on http://YourSynology/wordpress.

    In a next post, I will explain how to easily access your blog from both intranet and internet, i.e.: using either your Synology netbios name  (hostname) or DNS name (domain name).

    Loading

    ,