Tagged: ,

Viewing 30 posts - 1 through 30 (of 31 total)
  • Author
  • #21570


    I just installed the WPML plugin, and I got an issue with the theme-powered portfolio pages.

    I didn’t modify any setting under Flagship > Theme Options > Portfolio, but now the pages that should display portfolio items based on their categories do not display anything.

    I noticed something that could be an hint. In the settings, next to the input box where I have to place the “page slug that should be used for your portfolio single items”, I see this:

    For example if you enter ‘portfolio-item’ the link to the item will be http://www.[domain-name]//portfolio-item/post-name

    Could the double slash displayed after the domain name be a problem?


    Please try to flush the permalink rules. Go to Settings > Permalinks and hit the “save” button on the option page. Then reload the permalinks settings page. This will force WP to rewrite the htacess file and to rewrite the rules in the database.


    Thanks. I just did so, but unfortunately the problem is not solved.

    Nothing changed: portfolio pages still do not display portfolio items, and theme options still show the double slash.


    It must be a problem of theme-plugin compatibility (with WPML), as simply disabling the “WPML Multilingual CMS” plugin solves the visualization problem.. (and also fixes the double slash)


    Hey Berza,

    If you change your permalink settings to Default and save, does the portfolio work then?




    No, it doesn’t :(

    Still, setting Default permalinks AND disabling WPML solves the problem.

    EDIT: also, if this is somehow useful, the qTranslate to WPML Import plugin ( http://wpml.org/documentation/related-projects/qtranslate-importer/ ) wanted me to add some URL redirects to the .htaccess file in the root folder of my website. I tried commenting and also removing these RewriteRule instructions, but nothing changes with respect to this issue.


    I asked for help with this issue also to the WPML support staff, and they are giving some hints that maybe could be useful also for your analysis of the issue.

    This is the topic: (Purchase code hidden if logged out) /#post-115585?affiliate_key=K9b6X1wRp9SS”>http://wpml.org/forums/topic/ (Purchase code hidden if logged out) /#post-115585

    Dear Michele,

    The strings that are part of the options that the plugins or themes save in the wp_options table.

    When themes and plugins use get_option, they read values from the wp_options table. WPML can filter these calls and provide translation to the values of these options.

    For this you can create a language configuration file, which tells WPML which Admin texts you want to translate.


    Could this be a useful hint?

    Would you be able to translate this into something to do practically? I’m a little into the technical details, but not enough for this (and I wouldn’t be asking for help otherwise) :)



    Please install this plugin http://wordpress.org/extend/plugins/rewrite-rules-inspector/ .. It will create a link in the Tools menu > Rewrite Rules. Now the first time you enter that page (rewrite rule plugin), keep your eye on the total number , if any are red, location : other. Now copy the url to a page on the site that is not loading (showing 404) and paste the url of that page into the text box on top of the rewrite rule page and see if there is a rule that matches. Flush the rules and compare how the new regeneration list looks with the original one the first time it loaded .. same number of rules, etc…

    I am working on that xml file for you




    Hi Nick,

    I did what you suggested.

    The first time I entered the plugin page, it showed 105 rewrite rules, none was red.

    I checked with a simple invalid URL (like http://domain.name/bababa ), and there are 2 rules that match:

    (.?.+?)(/[0-9]+)?/?$ index.php?pagename=$matches[1]&page=$matches[2] page

    ([^/]+)(/[0-9]+)?/?$ index.php?name=$matches[1]&page=$matches[2] post

    Then I flushed the rules, but nothing changed: the new list is still made of 105 rules, that look the same as before, and filtering by an invalid URL still gives the same result.

    Thanks for your work,




    Excellent. The url you used could be valid. Your site doesnt have a single page/post/category that follows the pattern your-domain.com/some-page ? The rules are based on patterns not real pages that exist anywhere. If you flushed and have nothing in red, that means that the rewrite rules are working correctly. And they are. Because I now setup a Flagship and portfolio works, portfolio item, portfolio categories, and posts. (main portfolio is a page). This is how I did it:

    When WPML installs, dont touch any settings and go to page. fill out all the fields and upload the image/slideshow, then click the two check boxes for duplicate, then save the page. at this point you should get right above save button another checkbox which asks if you want to duplicate (this time its alone) and when you check it a button appears bellow it.

    When you click it nothing seems to happen. Click Update button and then switch to the ‘second language” (don’t click the checkboxes on bottom that ask if you wish to copy, ignore, or translate) Now on translate page, you should have a complete duplicate of the original page including all the images etc and settings. On the translation page just click update when you enter it. On the very top right corner of translation page you will see WPML asking if you want to stop synchronizing the translation to the original and you click that button. Now go and test if pages are found.

    I am recording a screen cast so there is no doubt. Will post shortly.




    Thanks a lot for your effort.

    First of all, I tried again to filter rewrite rules with a more complex invalid URL, and now only the following rule shows

    (.?.+?)(/[0-9]+)?/?$ index.php?pagename=$matches[1]&page=$matches[2] page

    Second, I carefully followed your instructions trying to setup a page and portfolio items in different languages, and the language switch has no problem at all.

    So, I set up:

    • A new page, original in Italian and translated in English
    • A new portfolio item, same languages
    • A new portfolio category, same languages. Assigned to the portfolio item
    • A new portfolio “rule” in Flagship > Theme Options > Portfolio using the new category as a filter and the new page as the “display page”

    It still doesn’t work, as the only issue is still the one with – I guess – the page slug used for portfolio items, that has some problems: http://d.pr/i/xT6o (screenshot)

    I’ll try to remove WPML and make a fresh install of the plugin, as maybe the “qTranslate to WPML import” plugin I used could have damaged something.

    I’ll report soon.



    While we investigating this, lets do this, please open up /includes/admin/register-admin-options.php and find line 1234 which looks like

    "std" 	=> "portfolio-item",

    and change the portfolio-item to whatever you wanted the slug to be that should match what you currently have in Theme Options > Portfolio.




    I changed that line to

    "std" => "product",

    but I still can’t see anything happening in the pages (supposed to be) displaying portfolio items or in the theme options.

    I’d like to point you out again to the other forum’s suggestions: (Purchase code hidden if logged out) /#post-115652?affiliate_key=K9b6X1wRp9SS”>http://wpml.org/forums/topic/ (Purchase code hidden if logged out) /#post-115652

    The file Harshad is referring to is this one: http://d.pr/f/nGi (a php file that generates an xml)

    Dear Michele,

    I have sent you email with a file attached, please follow the steps below:

    1) Upload the attached file to wordpress root folder

    2) This file will create a code for wpml-config.xml file.

    3) Then execute the file using http://yourdomainname.com/create_wpml_config.php?option_name=<option_name&gt;

    4) Copy the code to your wpml-config.xml file

    5) Upload the wpml-config.xml file to your themes root folder.

    Note :: Replace <option_name> with actual option_name used by your theme.

    He asks me to replace <option_name> with actual option_name used by your theme.

    Do you have any idea what option the theme uses for this functionality?

    I also noticed the theme already includes a wpml-config.xml file, but from what I can understand it looks like that file just tells WPML which elements have to be translated, and something about the styling of the language switcher…



    That xml file contains the post types , taxonomies , and fields (and yep, a language switcher). The thing though is that the plugin gets all that information anyways during the scanning or as you normally add things to the site . Perhaps something changed in the new version of WPML. because that was the whole purpose of those radio buttons in WPML – to chose ignore, copy or translate for the options.

    Alright lets try it out. This aught to be fun. Need to do a database dump. If you click on WPML > Support in the admin area of wordpress, and then on bottom part of that page there is a text link for ‘ troubleshooting’, click it and one of the near to last buttons/links on that page is ”Database Dump”. Download it, it is compressed in .GZ format. inside is a file with extension .sql that you can open in notepad++ or notepad2. , and find/look for – wp_options – using the ctrl-f find command , and depending on database size, either on line 4 million or 4 thousands you will find it.

    In the wp_options part of the sql file, there are over 150 lines like this below (some 50 pages long) and the option name (what he says needs to be added to the query string of the file he gave woould be the ‘current_theme’. However I think this will be looking for serialized data.

    INSERT INTO 'wp_options' VALUES (145, 'current_theme', 'Theme Name', 'yes');


    Ask Harshad if the php file he sent you accepts: (a) transient option fields and whether they should be added


    In the mean time I will fire up this thingy and check it out, since this is something new that I want to play with , lol.





    Alright. You can use this to replace the wpml-config.xml file in Flagship I followed the instructions. I think the php file may not be working correctly as it goes 3 layers deep which i dont think is deep enough (which i will modify) But try it out. http://pastebin.com/1jRS8XWh




    Hi Nick,

    I followed your instructions and found the line you were asking for

    INSERT INTO 'wp_options' VALUES (196, 'current_theme', 'Flagship', 'yes');

    I tried generating the xml with the php file provided by Harshard, but it reported an error:

    <key name="current_theme">
    Warning: Invalid argument supplied for foreach() in /htdocs/public/www/create_wpml_config.php on line 23 </key>

    Then I tried the xml file you provided via pastebin, but it again doesn’t solve my problem. I don’t know where to look to understand whether it changes something else, but certainly the main issue is not resolved.

    Also, I asked Harshard what you wanted to know, and I’m currently waiting for an answer ((Purchase code hidden if logged out) /#post-116661?affiliate_key=K9b6X1wRp9SS”>http://wpml.org/forums/topic/ (Purchase code hidden if logged out) /#post-116661 )



    I had to modify the file to get it to work. Use this https://gist.github.com/meishern/fabd02a1491fad761fff and follow my instructions.

    a) call it whatever you want, i called mine a.php since its easy.

    b) you have to run the file twice.

    c) The first time you run it will be using this url (change to your own but leave the query string as is)


    and then you copy all that prints out on the screen (a lot) ****Delete first line that looks like <admin-texts> **** and paste it in the wpml-config.xml file right after line 1

    the second time you run the code , use this query string … http://your-domain.com/a.php?option_name=avia_options_flagship

    then you need to copy what prints out on your screen (except the very last line that looks like </admin-texts>) and paste it on line 2 of wpml-config.xml **before the block you pasted earlier.*** So that line 2 of wpml-config.xml file will look like <admin-texts> , and the very last line you pasted from the first block looks like </admin-texts>

    It sounds harder than it is.




    I did as you suggested.

    So, the final wpml-config.xml file I created and uploaded into /wp-content/themes/flagship is something like this (full file here: http://pastebin.com/Q4ikdTzP ):

    <key name="avia_options_flagship">
    [lines 4 to 529]
    <key name="avia_options_flagship_dynamic_elements">
    [lines 532 to 3985]
    <custom-type translate="0">avia_framework_post</custom-type>
    <custom-type translate="1">portfolio</custom-type>
    <taxonomy translate="1">portfolio_entries</taxonomy>
    [lines 3996 to 4030]

    where all the code after </admin-texts> was in the original .xml file.

    Is it correct?

    Well, the problem is not solved :(



    It is correct and so now go to WPML > String Translation and you should see a whole lot of new strings to translate. One of those new strings should be the portfolio slug. I guess try translating this. Please ask the WPML gentleman who provided this file regarding his expectations, since I am curious myself which way he is going. I am following that thread as well since creating this 4000 line file is a new recommendation from them. I am also testing as well, but please do follow up on your post on WPML.




    Hi Nick,

    This xml did activate a lot of new strings (http://d.pr/i/q5rH ), and I tried translating the portfolio slug (http://d.pr/i/YCVh ), but still.. I can’t see how this could solve the problem. And it didn’t for the moment..

    Anyway I am now asking WPML how to proceed.



    I read the instructions on WPML forum and now see where he is going with this. A clever approach. Though i am not certain how the url is going to look but this approach should connect the native language and the translated language portfolio items.

    What you need to do is open up a text file, and write down all the ID numbers of your portfolio items/categories in language:Native and then write down the ID numbers of portfolio items/categories in the translation language so they are matched up. Portfolio Item X Italian (id 24) — Portfolio Item X Japanese (id 67)..

    Then you go to WPML String Translate and you look for where the portfolio IDs are listed so when you find ID 24 (it will just be 24) you would translate it to 67..

    I once more setup a new Flagship just to see what the problem is and created a portfolio (base Spanish, translation language English) and I added a portfolio. , categories, portfolio items. and everything works. I didn’t use any extra fields in the XML file, Didn’t even touch one WPML setting, Just turned the plugins on, went through choosing the languages, and immediately started adding things. I tried it so far with permalinks /%postname%/ , and with language selection as a query string. I made a video. After the video I changed the portfolio to sub-directory and everything continues working. So the problem here isn’t Flagship or WPML. If I am able to consistently create working portfolio translations.



    Oh yeh the slug for my Spanish portfolio items is: portfolio-items-spanish and portfolio-items-english , is the English slug.

    Email me your credentials please as well as FTP login info. *usjahm (at) gmail (dot) com


    It’s really awesome to see that your fresh build is working fine, it makes me hope we’ll reach a solution in the end.

    I tried again to exclude any possible issues:

    • I tried going back to default permalink structure (with the appended query string), both in the WordPress settings and in the WPML settings
    • I tried disabling all plugins but WPML
    • I tried comparing the original theme folder downloaded from themeforest with the live one using Kaleidoscope trial (kaleidoscopeapp.com), and I found only some minor tweaks I did that do not have anything to do with this issue (changed an image, added some header code / footer signature, and added a few functions needed for a fast custom addition to the site)

    The thing about Multilingual Content Setup you show on 4:23 in your screencast. I don’t have that.

    I mean, I have the same custom field called “_avia_elements_avia_options_flagship” for both the English and the Italian version of my pages.

    Is this an hint of something else we need to check?

    Anyway, I’m now sending you the credentials, thanks a lot for your support.



    The trick is to have _avia_elements_avia_options_flagship_en (in your case) on every single post/page/portfolio item . it only appears when you save the translation. the problem is that this field is not native to the theme’s framework (the _avia_elements_avia_options_flagship is native). WPML creates and uses that field in the post_meta table to hold the translated information for all the extra fields on the add post, add page, add portfolio item pages (extra images in slideshow, background image, color of background, buttons, captions,etc).

    The problem I am having is that this _avia_elements_avia_options_flagship_en (in your case, but if you were to translate into french it would be _fr), field doesn’t always get created by WPML. and when it doesn’t get created (its per post/page/portfolio item etc.. basis, not 1 field per website), there are always problems since when language is changed by website visitor , WPML looks for this field (my hypothesis) , but since it never created it , it finds nothing and displays 404 error, or a partially translated/duplicated page, or an invalid permalink. This is how I understand the problem. So the trick is to find how this field is created and why only sometimes and to force it to be created every time. (if that makes sense , lol)

    But as I wrote to you I would like to use my fresh install that was working, on my video to test your site quickly, so exported it as a proper sql insert script. If your server wont allow me to create a new database, I would like to rename every table in your database with a _old extension (so its not lost) and insert my demo tables (from the screencast demo that were working) to see if they will continue to work on your server (changing the name of domain to yours before inserting).

    Its a very good test to determine very quickly if the structure that works 100% in the demo will continue to work just as well on your live site. If it doesn’t then the problem is not the theme or WPML. Before investing any more time I just would like to be assured that any addition time is used productively towards a reachable goal or if instead the server//php//mysql settings need to be examined.




    Given the dynamics you’re talking about I’m more and more suspicious around the qTranslate Importer plugin (http://wpml.org/documentation/related-projects/qtranslate-importer/ ) I used to generate the translated posts. It might be that it has some issues creating that _avia_elements_avia_options_flagship_en on posts.

    However, when I tested with new page, portfolio item, portfolio category and theme settings created manually, they didn’t work, so that’s odd.

    You won’t be able to create a new database, but you can proceed renaming and inserting the new tables if you can do that with a WordPress plugin. Otherwise just send me the script and I’ll do it manually via phpMyAdmin (perhaps I should send you the credentials for that, too)





    Well as I wrote you in the email, I got it working on your site. I even imported my database which had Spanish as the main language and English as the second languge,, while you have Italian. So I added Italian, then made it the primary language via WPML and then deleted Spanish. Everything continued working after I created all 3 new pages for Italian and kept my old English pages.

    http://www.berza.it/en/port-en/ <–portfolio

    http://www.berza.it/en/portfolio_entries/cat-english-1/ <–category

    http://www.berza.it/en/portfolio-item-english/port-item-1-english/ <—portfolio item

    You can switch between languages. I mailed you what the password is and I also mailed you how you can switch back to your old website by just changing the wp_config.php file with nothing else needed.





    As I wrote you, I tested the site and switched back to my old one to get back on the issue.

    This time, I decided to take a step back and try to understand when things break in the first place.

    So I reverted to the original DB backup that I made before even starting the migration from qTranslate to WPML, when everything was working fine.

    I used a plugin to clean wp_posts content from qTranslate junk.

    FYI, qTranslate simply translates content using this structure:

    <!--:it-->Some text in Italian<!--:--><!--:en-->Some text in English<!--:-->

    and selectively displays the right content based on the language you choose. I discovered later that this approach is too basic and does not allow for a complete translation of a website based on the Flagship theme.

    The cleaning was simple. After that I checked all around the wp-admin for stuff that still had the qTranslate syntax, and in the end I directly searched the database to find any occurrence of the :it/:en structure and fixed them manually. Also, I deleted the freshly created entries in the wp_postmeta table that assigned a _qt_cleaned meta information to all the posts that were cleaned.

    At this point, my DB looks fine, or at least there is a perfectly reasonable number of records and the ones I can understand make sense.

    Here, I activate WPML. Just activate it. It means it just creates a bunch of db tables but doesn’t actually do anything to the functionality of the site (i.e. the portfolio display works).

    • –> I made a DB backup here

    Now, I start the setup. Which means I open WPML settings in the admin area and it asks me which is the main language. Italian is already selected, and I click “Next”.

    BAM! Now, and from now on, the portfolio display is broken.

    • –> Second DB backup here

    I ran a diff software to see what changes. At this point, my knowledge is no longer enough to understand what is getting broken, but I hope someone else’s could be.

    You can download the diff “report” along with the two DB exports (just before and just after the key moment) here: http://d.pr/f/y6Z1

    Please, I’d like to have your opinion on this. I think this is as deep as I can get trying diagnosing the problem.

    If this leads to nothing, I’ll probably leave WPML for a while, and perhaps do this with a double-installation setup.

    Unless you can suggest me a way to wipe everything to make a true clean install but still be able to re-import most information after this (I mean pages, portfolio items, and all the linked media files). Something that should work like the “demo data import” function.

    I’m now going to post a similar explanation on the WPML forum to see if they could say something, too.





    I can tell you what happened but its not going to help you much in figuring out how to prevent it from happening again. I think the whole problem is that you don’t want to start from 0 and re-import everything by hand. I don’t blame you. However in the amount of time you spend on this already you could have recreated your site more than once. I would setup a fresh install, made sure it works properly and using a lot of macros in 2 days have a working site I can launch and forget about. Hire someone to do it for , probably would cost you 50$. Look at the big picture and see how much you could be making each day in profit were you to be online and make a business decision.




    Ok then, what are you suggesting by “using a lot of macros”?

    How would you proceed to do it fast and without too much pain for myself? :)


    http://en.wikipedia.org/wiki/Comparison_of_macro_recorder_software and http://superuser.com/questions/107113/ (Purchase code hidden if logged out) -for-windows …. I would go with http://www.jitbit.com/macro-recorder/ though I would first plan this out really carefully what I would do first is get it to create every single category and translate it. you have to copy and paste them into like an excell spread sheet so that the recording ends with you hitting the enter key or mouse down key and thus setting up the next name in line so the recording always picks up a new name when it restarts. You can do a CSV (comma separated values) export and then open it up in Excell. Some things u will have to manually, like assign categories and images. I would first add 1 image to each product so this way u can get the site up, and then slowly add the remaining.

    You can also put an add in the paper that Microsoft is hiring for 200E/hour but need to test skill at how fast can copy data from one wordpress install to another in 30 minutes. lol :)




    Aww, this kind of software looks awesome. I downloaded jitbit’s one for Mac, I hope it’s powerful enough :)

    I would Google that, but this is the kind of question you don’t easily find a certain answer to: besides a backup of what is working now, I’d like to have also a live version of it somewhere when I erase everything. This is mainly so that I can copy things from the old version to the new one without having to write all down in the beginning (and being sure to forget something).

    I mean, could I simply move everything to a sub-folder? Or, since I have only 1 db with this hosting plan I could even move to another spare domain I have on my own. If I do so, what references should I change and when? I know WordPress is a little delicate when moved all around, as I already had some problems when having to deal with this

    Thanks :)


Viewing 30 posts - 1 through 30 (of 31 total)

The topic ‘Issue in retrieving portfolio items’ is closed to new replies.