Exemple #1
0
 function edit_form_after_title($post)
 {
     if (is_array($this->post_types) && in_array($post->post_type, $this->post_types)) {
         $form = tr_form();
         $builder_active = $editor_active = '';
         $page_boxes = tr_posts_field("builder");
         $use_builder = tr_posts_field("use_builder");
         $is_not_set = !isset($use_builder) || $use_builder === "";
         $has_boxes = is_array($page_boxes);
         $hide_builder = $hide_editor = '';
         if ($use_builder == '1' || $has_boxes && $is_not_set) {
             $builder_active = 'builder-active button-primary ';
             $hide_editor = 'style="display: none;"';
         } else {
             $editor_active = 'builder-active button-primary ';
             $hide_builder = 'style="display: none;"';
         }
         echo '<div id="tr_page_type_toggle"><div><a id="tr_page_builder_control" href="#tr_page_builder" class="button ' . $builder_active . '">Builder</a><a href="#builderStandardEditor" class="button ' . $editor_active . '">Standard Editor</a></div></div>';
         echo '<div id="builderSelectRadio">';
         echo $form->checkbox('Use Builder');
         echo '</div>';
         echo '<div id="tr_page_builder" ' . $hide_builder . ' class="typerocket-container typerocket-dev">';
         do_action('tr_before_builder_field', $this, $form, $use_builder);
         echo $form->builder('Builder');
         do_action('tr_after_builder_field', $this, $form, $use_builder);
         echo '</div><div id="builderStandardEditor" ' . $hide_editor . '>';
     }
 }
Exemple #2
0
    public function general()
    {
        global $post;
        ?>
        <div id="tr-seo-preview" class="control-group">
            <h4>Example Preview</h4>

            <p>Google has <b>no definitive character limits</b> for page "Titles" and "Descriptions". Because of this
                there
                is no way to provide an accurate preview. But, your Google search result may look something like:</p>

            <div class="tr-seo-preview-google">
        <span id="tr-seo-preview-google-title-orig">
          <?php 
        echo mb_substr(strip_tags($post->post_title), 0, 59);
        ?>
        </span>
        <span id="tr-seo-preview-google-title">
          <?php 
        $title = tr_posts_field('seo.meta.title');
        if (!empty($title)) {
            $s = strip_tags($title);
            $tl = mb_strlen($s);
            echo mb_substr($s, 0, 59);
        } else {
            $s = strip_tags($post->post_title);
            $tl = mb_strlen($s);
            echo mb_substr($s, 0, 59);
        }
        if ($tl > 59) {
            echo '...';
        }
        ?>
        </span>

        <div id="tr-seo-preview-google-url">
            <?php 
        echo get_permalink($post->ID);
        ?>
        </div>
        <span id="tr-seo-preview-google-desc-orig">
          <?php 
        echo mb_substr(strip_tags($post->post_content), 0, 150);
        ?>
        </span>
        <span id="tr-seo-preview-google-desc">
          <?php 
        $desc = tr_posts_field('seo.meta.description');
        if (!empty($desc)) {
            $s = strip_tags($desc);
            $dl = mb_strlen($s);
            echo mb_substr($s, 0, 150);
        } else {
            $s = strip_tags($post->post_content);
            $dl = mb_strlen($s);
            echo mb_substr($s, 0, 150);
        }
        if ($dl > 150) {
            echo ' ...';
        }
        ?>
        </span>
            </div>
        </div>
    <?php 
    }