Forum Replies Created

Viewing 15 replies - 106 through 120 (of 154 total)
  • Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Took some searching.

    add_filter( ‘wpseo_opengraph_image_size’, function() { return ‘large’; } );
    add_filter( ‘wpseo_twitter_image_size’, function() { return ‘large’; } );

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    My second question was “how do I override the built-in templates?”.

    As I said, I found the answer to that: “adding a /amp/ to my themes folder provides for a location to put template overrides”.

    Thanks for the help.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thanks. That workaround works.

    As for my second question, I found that adding a /amp/ to my themes folder provides for a location to put template overrides.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    The string is available for editing, and the placeholder text is showing in Portuguese. So, the text has been translated. It’s just not picked up when the field is empty.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    I have two forms, one is single opt-in, the other is double opt-in.

    For the form with the single opt-in, the ‘thank you’ message is showing in Portuguese.

    For the form with the double opt-in, the ‘thank you’ message is showing in English in the frontend. For this form, I do have a ‘double opt-in’ field. It’s empty, and shows a placeholder in Portuguese.

    But, I found that if I enter text in the ‘double top-in’ field, this text is shown, in stead of the English text.

    So, this is now essentially resolved, though it does appear you have a bug, here. (That is, the default English message is shown when no text is entered in the ‘double opt-in’ field.)

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Could this not simply be because the translation file is missing?

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    I’m on 6.5.2. But, it’s in a multisite setup, if that makes a difference.

    However, quite baffling, this particular problem no longer exists: I just again went in and checked the form in question, and its opt in setting is now set to “single”, even though I didn’t touch it since writing this support request.

    The other issue (with the thank you message showing in English on a Portuguese site) still exists, though. Could that not simply be because the translation file is missing?

    Had the same problem, @angelxube’s suggestion worked for me.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thanks, using wp-safe-mode allowed me to debug the problem.

    The root cause was related to a custom-written extension to how search works. I’ve made some changes to that and now the events listing works properly.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Excellent!

    That requires a parameter, no? So, [namedirectory_single id=1]?

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Great!

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Here’s the code for the table listing the names in a directory:

        <table class="wp-list-table widefat name_directory_names fixed" cellpadding="0">
            <thead>
            <tr>
    	        <th width="5%"><?php echo __('ID', 'name-directory'); ?></th>
                <th width="5%"><?php echo __('Name', 'name-directory'); ?></th>
                <th width=""><?php echo __('Description', 'name-directory'); ?></th>
                <th width="5%"><?php echo __('Submitter', 'name-directory'); ?></th>
                <th width="10%"><?php echo __('Published', 'name-directory'); ?></th>
                <th width="10%"><?php echo __('Manage', 'name-directory'); ?></th>
            </tr>
            </thead>
            <tbody>
            <?php
            if(empty($name))
            {
                echo sprintf("<tr class='empty-directory'><td colspan='5'>%s</td></tr>",
                    __('Currently, there are no names in this directory..', 'name-directory'));
            }
    
            foreach($names as $name)
            {
                if(is_array($name))
                {
                    $name = (object)$name;
                }
    
                echo sprintf("
                <tr>
                    <td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><span title='%s' class='toggle_published' id='nid_%d' data-nameid='%d'>%s</span></td>
                    <td><a class='button button-primary button-small' href='" . $wp_url_path . "&edit_name=%d#anchor_add_form'>%s</a>
                        <a class='button button-small' href='" . $wp_url_path . "&delete_name=%d'>%s</a>
                    </td>
                </tr>",
                	$name->id,
                    $name->name, html_entity_decode(stripslashes($name->description)), $name->submitted_by,
                    __('Toggle published status', 'name-directory'), $name->id,
                    $name->id, name_directory_yesno($name->published),
                    $name->id, __('Edit', 'name-directory'),
                    $name->id, __('Delete', 'name-directory'));
            }
            ?>
            </tbody>
        </table>

    Here’s the function picking up one name by id:

    function name_directory_get_name($id)
    {
        global $wpdb;
        global $name_directory_table_directory_name;
    
    	$id = (int)$id;
    
        $names = $wpdb->get_results(sprintf("
    		SELECT *
    		FROM %s
    		WHERE <code>id</code> = $id",
            ARRAY_A
        );
    
        return $names;
    }

    And here’s the shortcode:

    function name_directory_show_name($attributes) {
    
        $dir = null;
        extract(shortcode_atts(
            array('id' => '0'),
            $attributes
        ));
    
        $names = name_directory_get_name($attributes["id"]);
    
        if (count($names) > 0) {
    	    $entry = (array)$names[0];
    	    $directory = name_directory_get_directory_properties($entry["directory"]);
    
            ob_start();
    
            echo '<div class="name_directory_name">';
            echo '<div class="name_directory_name_box">';
            echo '<a name="namedirectory_' . sanitize_html_class($entry['name']) . '"></a>';
            echo '<strong>' . htmlspecialchars($entry['name']) . '</strong>';
            if(! empty($directory['show_description']) && ! empty($entry['description']))
            {
                $print_description = html_entity_decode(stripslashes($entry['description']));
    
                /* This toggles the read more/less indicators, these need extra html */
                if(! empty($directory['nr_words_description']))
                {
                    $num_words = intval($directory['nr_words_description']);
                    $short_desc = name_directory_get_words($print_description, $num_words);
                    $print_description = str_replace($short_desc, "", $print_description);
                    if(! empty($print_description))
                    {
                        echo '<br /><div>
                          <input type="checkbox" class="name-directory-readmore-state" id="name-' . htmlspecialchars($entry['id']) . '" />
                          <span class="name-directory-readmore-wrap">' . $short_desc . ' <span class="name-directory-readmore-target">' . $print_description .'</span></span>
                          <label for="name-' . htmlspecialchars($entry['id']) . '" class="name-directory-readmore-trigger"></label>
                        </div>';
                    }
                    else
                    {
                        echo '<br /><div>' . $short_desc . '</div>';
                    }
    
                }
                else {
                    echo '<br /><div>' . $print_description . '</div>';
                }
            }
            if(! empty($directory['show_submitter_name']) && ! empty($entry['submitted_by']))
            {
                echo "<small>" . __('Submitted by:', 'name-directory') . " " . $entry['submitted_by'] . "</small>";
            }
            echo '</div>';
            echo '</div>';
    
            return ob_get_clean();
        }
    
    }
    add_shortcode('namedirectory_name', 'name_directory_show_name');
    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Oh, that’s nice. I’m actually marked as ‘Plugin contributor’. 🙂

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    How about that! This suddenly resolved itself, after, what, years!

Viewing 15 replies - 106 through 120 (of 154 total)