• Gå direkte til primær navigation
  • Skip til indhold
  • Gå direkte til primær sidebar

Vayu Robins

WordPress theme & plugin developer

  • Kompetencer/Services
  • Om/About
  • Kontakt/Contact

Moving from WordPress.com to own hosted wordpress site

2. september 2011 by Vayu Robins Skriv kommentar

I recently had to move a site from a WordPress.com site to an own hosted website.  I had some trouble and had to go through a lot of trial and error before I succeeded.  I search the web for answer during the process, but didn’t find much help.  I did, however, find some forum threads saying stuff about people having similar problems because of large file sizes.  Therefore, I will attempt to outline the steps I used when I finally succeeded.

The problems I ran into where the following:

  • The entire XML/WXR file would not load and I was getting and error.
  • Not all posts were loaded.  There were a total of 57 posts, but only 49-50 posts where loaded.
  • Image links and paths where still referencing the WordPress.com site.

The problem causing this was that there were too many posts or the file was to large.

During the trial and error process I used a great plugin to reset my WordPress install called WordPress Reset.

Solution

The solution to the problem was to export the posts in many smaller files.  It is possible to export posts in smaller portion in many ways.  By author, by date, by content type etc.

I then imported each file one by one until I had imported them all.  This worked perfectly although it took some time.

The only thing I noticed was that the Links/Blogroll was not not imported.  In order to do this, you have to chose to import from Blogroll instead of import from WordPress.  You then have to supply the importer a path to an OPML URL of your blog.

Eks: http://yourblog.com/wp-links-opml.php

 

Skrevet i: WordPress

Highlighting wp_nav_menu() ancestor with Children for custom post types

10. august 2011 by Vayu Robins 8 kommentarer

I was in need of a solution to highlight the top menu item for a custom post type when viewing a single subpage (cpt).  There is no built-in method in WordPress that adds a class to the top menu item of cpt, when viewing a child item.

I spent some time searching for this topic on the net and came across this post on WordPress Answers.  I specifically noticed somatics answer.

I had created a cpt called “trips”.  Because it was for a danish website I could not have a menu item named Trips.

I just didn’t like having to enter the slug into my Title Attribute, as trips makes no sense in danish and I didn’t want the browser tooltip to appear on the menu line on mouseover.  So I came up with idea of adding a class name of the cpt slug instead to the menu item either.

So I went into the Menus section and added this “trips-menu-item” to the css classes in the menu item.

The code below then finds the menu item with this class trips-menu-item and adds another “current_page_parent” class to it.  Furthermore, it removes the “current_page_parent” from the blog menu item, if this is present.

add_filter('nav_menu_css_class', 'current_type_nav_class', 10, 2);
function current_type_nav_class($classes, $item) {
    // Get post_type for this post
    $post_type = get_query_var('post_type');

    // Removes current_page_parent class from blog menu item
    if ( get_post_type() == $post_type )
        $classes = array_filter($classes, "get_current_value" );

    // Go to Menus and add a menu class named: {custom-post-type}-menu-item
    // This adds a current_page_parent class to the parent menu item
    if( in_array( $post_type.'-menu-item', $classes ) )
        array_push($classes, 'current_page_parent');

    return $classes;
}
function get_current_value( $element ) {
    return ( $element != "current_page_parent" );
}

 

Skrevet i: Kode, WordPress

WordPress coding standards

28. juli 2011 by Vayu Robins

Hvis du beslutter dig for at kode dit eget WordPress Theme, så husk endelig at gennemlæs denne side om coding standards inden du går i gang.  Jeg støder ofte på Themes hvor koden er noget rod og man skal bruge ekstra tid på at gennemskue hvad der egentlig sker i koden.  På siden står der kort og fint om de mest basale kode standarder og det tager ikke mere end et par minuter at gennemlæse det.

Skrevet i: Kode, WordPress

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2

Primær Sidebar

Vayu

Vayu

I am a webdeveloper from Denmark. I make my living by building WordPress websites, e-commece sites, custom themes, plugins and widgets.

Personal Links

  • Vayu Robins
  • vrweb
  • The Home of Vayu

Verified Services

View Full Profile →

Kategorier

  • Ikke kategoriseret
  • Kode
  • Plugin
  • WordPress

Følg mig på Twitter

My Tweets
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

  • vayu.dk
  • Frederikssundsvej 49
  • 2400 København NV
  • +45 61 77 00 33
  • info@vrweb.dk