WordPress.org

Ready to get started?Download WordPress

Forums

SCF Dummy Content
Plugin works only if WordPress language is english (1 post)

  1. Edoardo Tenani
    Member
    Posted 1 year ago #

    Hello, I'm having some problems in using this plugin.

    I installed it on my website ( which is a WordPress 3.4.1 with bbPress 2.1.2 with italian localization ), but when clicking to execute, only posts were created ( altought I had selected some custom post types ) with title '0 x' (where x is the incrementing number ) instead of the post type.

    Doing some research in the code to find out what was the problem, I had a look at the scfdc_render_form() and found the problem: the plugin is using the name attribute in the Labels array, which changes upon localizations ( in english is 'Post', while in italian is 'Articoli' ). This lead to broken post types and post names.

    Solving this problem is quite easy: use the slug of the post_type instead of the name.


    <?php

    $scf_post_types = $scfdc->scf_registered_post_types();
    foreach ($scf_post_types as $scf_post_type_slug => $scf_post_type ) {
    if ( $scf_post_type_slug == 'attachment' ||
    $scf_post_type_slug == 'revision' ||
    $scf_post_type_slug == 'nav_menu_item' )
    continue;

    echo '<label>
    <input name="scfdc_options[cpt]['.$scf_post_type_slug.']"
    type="checkbox"
    value="1" ';

    if(isset($options['cpt'][$scf_post_type_slug])){
    checked('1',$options['cpt'][$scf_post_type_slug]);
    }

    echo '/>
    '.$scf_post_type->labels->name.'
    </label>

    ';
    }

    If you're hosting your code somewhere I'd be glad to contribute to this plugin.

    Regards,
    Edoardo Tenani

    http://wordpress.org/extend/plugins/scf-dummy-content/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic