Example #1
0
/**
 * Return a textarea or TinyMCE if enabled
 *
 * @since bbPress (r3586)
 *
 * @param array $args
 *
 * @uses apply_filter() To filter args and output
 * @uses wp_parse_pargs() To compare args
 * @uses bbp_use_wp_editor() To see if WP editor is in use
 * @uses bbp_is_edit() To see if we are editing something
 * @uses wp_editor() To output the WordPress editor
 *
 * @return string HTML from output buffer 
 */
function bbp_get_the_content($args = array())
{
    // Default arguments
    $defaults = array('context' => 'topic', 'before' => '<div class="bbp-the-content-wrapper">', 'after' => '</div>', 'wpautop' => true, 'media_buttons' => false, 'textarea_rows' => '6', 'tabindex' => bbp_get_tab_index(), 'editor_class' => 'bbp-the-content', 'tinymce' => true, 'quicktags' => true);
    $r = bbp_parse_args($args, $defaults, 'get_the_content');
    extract($r);
    // Assume we are not editing
    $post_content = '';
    // Start an output buffor
    ob_start();
    // Output something before the editor
    if (!empty($before)) {
        echo $before;
    }
    // Get sanitized content
    if (bbp_is_edit()) {
        $post_content = call_user_func('bbp_get_form_' . $context . '_content');
    }
    // Use TinyMCE if available
    if (bbp_use_wp_editor()) {
        $settings = array('wpautop' => $wpautop, 'media_buttons' => $media_buttons, 'textarea_rows' => $textarea_rows, 'tabindex' => $tabindex, 'editor_class' => $editor_class, 'tinymce' => $tinymce, 'quicktags' => $quicktags);
        wp_editor(htmlspecialchars_decode($post_content, ENT_QUOTES), 'bbp_' . $context . '_content', $settings);
        // Fallback to normal textarea
    } else {
        ?>

			<textarea id="bbp_<?php 
        echo $context;
        ?>
_content" class="<?php 
        echo $editor_class;
        ?>
" name="bbp_<?php 
        echo $context;
        ?>
_content" cols="60" rows="<?php 
        echo $textarea_rows;
        ?>
" tabindex="<?php 
        echo $tabindex;
        ?>
"><?php 
        echo $post_content;
        ?>
</textarea>

		<?php 
    }
    // Output something after the editor
    if (!empty($after)) {
        echo $after;
    }
    // Put the output into a usable variable
    $output = ob_get_contents();
    // Flush the output buffer
    ob_end_clean();
    return apply_filters('bbp_get_the_content', $output, $args, $post_content);
}
function wpua_do_after_avatar()
{
    ?>
  <?php 
    if (class_exists('bbPress') && bbp_is_edit()) {
        // Add to bbPress profile with same style
        ?>
    </fieldset>
  <?php 
    } elseif (class_exists('WPUF_Main') && is_page()) {
        // Add to WP User Frontend profile with same style
        ?>
          </td>
        </tr>
      </table>
    </fieldset>
  <?php 
    } else {
        // Add to profile with admin style
        ?>
        </td>
      </tr>
    </table>
  <?php 
    }
    ?>
  <?php 
}
/**
 * After avatar container
 * @since 1.6
 * @uses bbp_is_edit()
 * @uses wpuf_has_shortcode()
 */
function wpua_do_after_avatar()
{
    ?>
  <?php 
    if (class_exists('bbPress') && bbp_is_edit()) {
        // Add to bbPress profile with same style
        ?>
    </fieldset>
  <?php 
    } elseif (class_exists('WPUF_Main') && wpuf_has_shortcode('wpuf_editprofile')) {
        // Add to WP User Frontend profile with same style
        ?>
          </td>
        </tr>
      </table>
    </fieldset>
  <?php 
    } else {
        // Add to profile without table
        ?>
    </div>
  <?php 
    }
    ?>
  <?php 
}
Example #4
0
function porto_breadcrumbs()
{
    // use yoast breadcrumbs if enabled
    if (function_exists('yoast_breadcrumb')) {
        $yoast_breadcrumbs = yoast_breadcrumb('', '', false);
        if ($yoast_breadcrumbs) {
            return $yoast_breadcrumbs;
        }
    }
    global $porto_settings;
    $post = isset($GLOBALS['post']) ? $GLOBALS['post'] : null;
    $output = '';
    // add breadcrumbs prefix
    if (!is_front_page()) {
        if (isset($porto_settings['breadcrumbs-prefix']) && $porto_settings['breadcrumbs-prefix']) {
            $output .= '<span class="breadcrumbs-prefix">' . $porto_settings['breadcrumbs-prefix'] . '</span>';
        }
    }
    // breadcrumbs start wrap
    $output .= '<ul class="breadcrumb">';
    // add home link
    if (!is_front_page()) {
        $output .= porto_breadcrumbs_link(__('Home', 'porto'), apply_filters('woocommerce_breadcrumb_home_url', home_url()));
    } elseif (is_home()) {
        $output .= porto_breadcrumbs_link($porto_settings['blog-title']);
    }
    // add woocommerce shop page link
    if (class_exists('WooCommerce') && (is_woocommerce() && is_archive() && !is_shop() || is_cart() || is_checkout() || is_account_page())) {
        $output .= porto_breadcrumbs_shop_link();
    }
    // add bbpress forums link
    if (class_exists('bbPress') && is_bbpress() && (bbp_is_topic_archive() || bbp_is_single_user() || bbp_is_search() || bbp_is_topic_tag() || bbp_is_edit())) {
        $output .= porto_breadcrumbs_link(bbp_get_forum_archive_title(), get_post_type_archive_link('forum'));
    }
    if (is_singular()) {
        if (isset($post->post_type) && get_post_type_archive_link($post->post_type) && (isset($porto_settings['breadcrumbs-archives-link']) && $porto_settings['breadcrumbs-archives-link'])) {
            $output .= porto_breadcrumbs_archive_link();
        } elseif (isset($post->post_type) && $post->post_type == 'post' && get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
            $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
        }
        if (isset($post->post_parent) && $post->post_parent == 0) {
            $output .= porto_breadcrumbs_terms_link();
        } else {
            $output .= porto_breadcrumbs_ancestors_link();
        }
        $output .= porto_breadcrumb_leaf();
    } else {
        if (is_post_type_archive()) {
            if (is_search()) {
                $output .= porto_breadcrumbs_archive_link();
                $output .= porto_breadcrumb_leaf('search');
            } else {
                $output .= porto_breadcrumbs_archive_link(false);
            }
        } elseif (is_tax() || is_tag() || is_category()) {
            $html = porto_breadcrumbs_taxonomies_link();
            $html .= porto_breadcrumb_leaf('term');
            if (is_tag()) {
                if (get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
                    $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
                }
                $output .= sprintf(__('Tag - %s', 'porto'), $html);
            } elseif (is_tax('product_tag')) {
                $output .= sprintf(__('Product Tag - %s', 'porto'), $html);
            } else {
                if (is_category() && get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
                    $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
                }
                if (is_tax('portfolio_cat') || is_tax('portfolio_skills')) {
                    $output .= porto_breadcrumbs_link(porto_breadcrumbs_archive_name('portfolio'), get_post_type_archive_link('portfolio'));
                }
                if (is_tax('member_cat')) {
                    $output .= porto_breadcrumbs_link(porto_breadcrumbs_archive_name('member'), get_post_type_archive_link('member'));
                }
                if (is_tax('faq_cat')) {
                    $output .= porto_breadcrumbs_link(porto_breadcrumbs_archive_name('faq'), get_post_type_archive_link('faq'));
                }
                $output .= $html;
            }
        } elseif (is_date()) {
            global $wp_locale;
            if (get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
                $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
            }
            $year = esc_html(get_query_var('year'));
            if (is_month() || is_day()) {
                $month = get_query_var('monthnum');
                $month_name = $wp_locale->get_month($month);
            }
            if (is_year()) {
                $output .= porto_breadcrumb_leaf('year');
            } elseif (is_month()) {
                $output .= porto_breadcrumbs_link($year, get_year_link($year));
                $output .= porto_breadcrumb_leaf('month');
            } elseif (is_day()) {
                $output .= porto_breadcrumbs_link($year, get_year_link($year));
                $output .= porto_breadcrumbs_link($month_name, get_month_link($year, $month));
                $output .= porto_breadcrumb_leaf('day');
            }
        } elseif (is_author()) {
            $output .= porto_breadcrumb_leaf('author');
        } elseif (is_search()) {
            $output .= porto_breadcrumb_leaf('search');
        } elseif (is_404()) {
            $output .= porto_breadcrumb_leaf('404');
        } elseif (class_exists('bbPress') && is_bbpress()) {
            if (bbp_is_search()) {
                $output .= porto_breadcrumb_leaf('bbpress_search');
            } elseif (bbp_is_single_user()) {
                $output .= porto_breadcrumb_leaf('bbpress_user');
            } else {
                $output .= porto_breadcrumb_leaf();
            }
        } else {
            if (is_home() && !is_front_page()) {
                if (get_option('show_on_front') == 'page') {
                    $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)));
                } else {
                    $output .= porto_breadcrumbs_link($porto_settings['blog-title']);
                }
            }
        }
    }
    // breadcrumbs end wrap
    $output .= '</ul>';
    return apply_filters('porto_breadcrumbs', $output);
}