Juliana
Respostas criadas no fórum
-
Fórum: Temas e templates
Em resposta a: ajuda com query_postsoi boa noite, esse código aqui é o original q que uns > sem fechar pelo menos eu acho rsrs, da uma olhada e me diz o que acha!
<?php
/**
* Able functions and definitions
*
* @package Able
* @since Able 1.0
*//**
* Set up the content width value based on the theme’s design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 1176; /* Default content width, no widgets active *//**
* Adjust the content width based on the presence of active widgets.
*
* @since Able 1.0
*/
function able_set_content_width() {
global $content_width;if ( is_active_sidebar( ‘sidebar-1’ ) /* Left Sidebar */
|| is_active_sidebar( ‘sidebar-2’ ) /* Right Sidebar */
)
$content_width = 869;if ( is_active_sidebar( ‘sidebar-1’ )
&& is_active_sidebar( ‘sidebar-2’ )
)
$content_width = 562;
}
add_action( ‘template_redirect’, ‘able_set_content_width’ );if ( ! function_exists( ‘able_setup’ ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since Able 1.0
*/
function able_setup() {/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you’re building a theme based on Able, use a find and replace
* to change ‘able’ to the name of your theme in all the template files
*/
load_theme_textdomain( ‘able’, get_template_directory() . ‘/languages’ );/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( ‘automatic-feed-links’ );/**
* Enable support for Post Thumbnails
*/
add_theme_support( ‘post-thumbnails’ );/**
* Editor Style
*/
add_editor_style();/**
* Enable support for Post Formats
*/
add_theme_support( ‘post-formats’, array( ‘aside’, ‘image’, ‘video’, ‘quote’, ‘link’ ) );/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
‘primary’ => __( ‘Primary Menu’, ‘able’ ),
‘footer’ => __( ‘Footer Menu’, ‘able’ ),
) );}
endif; // able_setup
add_action( ‘after_setup_theme’, ‘able_setup’ );/**
* Setup the WordPress core custom background feature.
*
* Use add_theme_support to register support for WordPress 3.4+
* as well as provide backward compatibility for previous versions.
* Use feature detection of wp_get_theme() which was introduced
* in WordPress 3.4.
*
* Hooks into the after_setup_theme action.
*
* @since Able 1.0.0
*/
function able_register_custom_background() {
$args = array(
‘default-color’ => ‘fafafa’,
);$args = apply_filters( ‘able_custom_background_args’, $args );
if ( function_exists( ‘wp_get_theme’ ) ) {
add_theme_support( ‘custom-background’, $args );
} else {
define( ‘BACKGROUND_COLOR’, $args[‘default-color’] );
define( ‘BACKGROUND_IMAGE’, $args[‘default-image’] );
add_custom_background();
}
}
add_action( ‘after_setup_theme’, ‘able_register_custom_background’ );/**
* Register widgetized area and update sidebar with default widgets
*
* @since Able 1.0
*/
function able_widgets_init() {
register_sidebar( array(
‘name’ => __( ‘Left Sidebar’, ‘able’ ),
‘id’ => ‘sidebar-1’,
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h1 class=”widget-title”>’,
‘after_title’ => ‘</h1>’,
) );
register_sidebar( array(
‘name’ => __( ‘Right Sidebar’, ‘able’ ),
‘id’ => ‘sidebar-2’,
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h1 class=”widget-title”>’,
‘after_title’ => ‘</h1>’,
) );
}
add_action( ‘widgets_init’, ‘able_widgets_init’ );/**
* Enqueue scripts and styles
*
* @since Able 1.0
*/
function able_scripts() {wp_enqueue_style( ‘able-style’, get_stylesheet_uri() );
wp_enqueue_script( ‘able-small-menu’, get_template_directory_uri() . ‘/js/small-menu.js’, array( ‘jquery’ ), ‘20120206’, true );
if ( is_singular() && comments_open() && get_option( ‘thread_comments’ ) ) {
wp_enqueue_script( ‘comment-reply’ );
}if ( is_singular() && wp_attachment_is_image( get_the_ID() ) ) {
wp_enqueue_script( ‘able-keyboard-image-navigation’, get_template_directory_uri() . ‘/js/keyboard-image-navigation.js’, array( ‘jquery’ ), ‘20120202’ );
}
}
add_action( ‘wp_enqueue_scripts’, ‘able_scripts’ );/*
* Hide the theme-provided background images if the user manually sets a custom background color
*
* @since Able 1.0
*/
function able_custom_background_check() {if ( ” != get_background_color() ) : ?>
<style type=”text/css”>
body {
background-image: none;
}
</style>
<?php endif;
}add_action( ‘wp_head’, ‘able_custom_background_check’ );
/**
* Implement the Custom Header feature.
*/
require( get_template_directory() . ‘/inc/custom-header.php’ );/**
* Implement Custom Google Fonts.
*/
require( get_template_directory() . ‘/inc/fonts.php’ );/**
* Custom template tags for this theme.
*/
require( get_template_directory() . ‘/inc/template-tags.php’ );/**
* Custom functions that act independently of the theme templates.
*/
require( get_template_directory() . ‘/inc/tweaks.php’ );/*
* Load Jetpack compatibility file.
*/
require( get_template_directory() . ‘/inc/jetpack.php’ );Fórum: Plugins e hacks
Em resposta a: Pluguin para formularioOi , obrigado por responder, esse contact form7 eu posso usar para fazer mais de um formulário?
Fórum: Temas e templates
Em resposta a: ajuda com query_posts<?php /** * Able functions and definitions * * @package Able * @since Able 1.0 */ /** * Set up the content width value based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 1176; /* Default content width, no widgets active */ /** * Adjust the content width based on the presence of active widgets. * * @since Able 1.0 */ function able_set_content_width() { global $content_width; if ( is_active_sidebar( 'sidebar-1' ) /* Left Sidebar */ || is_active_sidebar( 'sidebar-2' ) /* Right Sidebar */ ) $content_width = 869; if ( is_active_sidebar( 'sidebar-1' ) && is_active_sidebar( 'sidebar-2' ) ) $content_width = 562; } add_action( 'template_redirect', 'able_set_content_width' ); if ( ! function_exists( 'able_setup' ) ): /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * @since Able 1.0 */ function able_setup() { /** * Make theme available for translation * Translations can be filed in the /languages/ directory * If you're building a theme based on Able, use a find and replace * to change 'able' to the name of your theme in all the template files */ load_theme_textdomain( 'able', get_template_directory() . '/languages' ); /** * Add default posts and comments RSS feed links to head */ add_theme_support( 'automatic-feed-links' ); /** * Enable support for Post Thumbnails */ add_theme_support( 'post-thumbnails' ); /** * Editor Style */ add_editor_style(); /** * Enable support for Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); /** * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __( 'Primary Menu', 'able' ), 'footer' => __( 'Footer Menu', 'able' ), ) ); } endif; // able_setup add_action( 'after_setup_theme', 'able_setup' ); /** * Setup the WordPress core custom background feature. * * Use add_theme_support to register support for WordPress 3.4+ * as well as provide backward compatibility for previous versions. * Use feature detection of wp_get_theme() which was introduced * in WordPress 3.4. * * Hooks into the after_setup_theme action. * * @since Able 1.0.0 */ function able_register_custom_background() { $args = array( 'default-color' => 'fafafa', ); $args = apply_filters( 'able_custom_background_args', $args ); if ( function_exists( 'wp_get_theme' ) ) { add_theme_support( 'custom-background', $args ); } else { define( 'BACKGROUND_COLOR', $args['default-color'] ); define( 'BACKGROUND_IMAGE', $args['default-image'] ); add_custom_background(); } } add_action( 'after_setup_theme', 'able_register_custom_background' ); /** * Register widgetized area and update sidebar with default widgets * * @since Able 1.0 */ function able_widgets_init() { register_sidebar( array( 'name' => __( 'Left Sidebar', 'able' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) ); register_sidebar( array( 'name' => __( 'Right Sidebar', 'able' ), 'id' => 'sidebar-2', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) ); } add_action( 'widgets_init', 'able_widgets_init' ); /** * Enqueue scripts and styles * * @since Able 1.0 */ function able_scripts() { wp_enqueue_style( 'able-style', get_stylesheet_uri() ); wp_enqueue_script( 'able-small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image( get_the_ID() ) ) { wp_enqueue_script( 'able-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', 'able_scripts' ); /* * Hide the theme-provided background images if the user manually sets a custom background color * * @since Able 1.0 */ function able_custom_background_check() { if (get_background_color()!=' '): echo '<style type="text/css"> body {background-image: none;} </style>'; endif; } add_action( 'wp_head', 'able_custom_background_check' ); /** * Implement the Custom Header feature. */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Implement Custom Google Fonts. */ require( get_template_directory() . '/inc/fonts.php' ); /** * Custom template tags for this theme. */ require( get_template_directory() . '/inc/template-tags.php' ); /** * Custom functions that act independently of the theme templates. */ require( get_template_directory() . '/inc/tweaks.php' ); /* * Load Jetpack compatibility file. */ require( get_template_directory() . '/inc/jetpack.php' );Fórum: Temas e templates
Em resposta a: ajuda com query_postsOLa bom dia Carlor, eu coloquei o código da seguinte forma:
echo'<div id="primary" class="site-content">'; <?php query_posts('cat=2&showposts=4&posts_per_page=9'); ?> <?php while(have_posts()) : the_post(); ?> echo'<h1>'; <?php the_title(); ?> echo'</h1>'; <?php the_excerpt(); ?> <?php endwhile; else: ?> echo'<p>'; <?php the_content( 'Sem Posts para essa categoria', 'ABLE');?> echo'</p>'; <?php endif; ?> echo'</div>';so que continua da o mesmo erro Parse error: syntax error, unexpected ‘<‘ in /home/u245150648/public_html/wp-content/themes/able/functions.php on line 202, so mudando a linha. Obrigado.
Fórum: Temas e templates
Em resposta a: ajuda com query_postsObrigado Carlos vou tentar 🙂
Fórum: Problemas no funcionamento
Em resposta a: Problemas com o functions.phpacabou
Fórum: Problemas no funcionamento
Em resposta a: Problemas com o functions.phpOla, eu reinstalei o WordPress e fiz o upload do tema e enviei ftp e resolveu. Mas obrigado vlw! 🙂
Fórum: Problemas no funcionamento
Em resposta a: Problemas com o functions.php<?php /** * Register our sidebars and widgetized areas. * */ function simplue_widgets_init() { register_sidebar( array( 'name' => 'Home right sidebar', 'id' => 'home_right_1', 'before_widget' => '<div class="boxSide">', 'after_widget' => '</div>', 'before_title' => '<h1>', 'after_title' => '</h1>', ) ); } add_action( 'widgets_init', 'simplue_widgets_init' ); add_action( 'after_setup_theme', 'simplue_setup' ); function simplue_setup(){ if ( ! isset( $content_width ) ) $content_width = 700; // pixels $defaults = array( 'default-color' => '', 'default-image' => get_template_directory_uri() . '/images/bg.jpg', ); add_theme_support( 'custom-background', $defaults ); $args = array( 'flex-width' => false, 'width' => 998, 'flex-height' => false, 'height' => 180, 'default-image' => get_template_directory_uri() . '/images/bg-header.png', ); add_theme_support( 'custom-header', $args ); add_theme_support( 'automatic-feed-links' ); register_nav_menu( 'main-menu', 'main-menu' ); add_editor_style( 'custom-editor-style.css' ); } // WP TITLE function simplue_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( 'Page %s', '', max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'simplue_wp_title', 10, 2 ); // Script style function simplue_scripts_styles() { /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); // Loads our main stylesheet. wp_enqueue_style( 'simplue-style', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scripts', 'simplue_scripts_styles' ); class simplue_CSS_Menu_Maker_Walker extends Walker { var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent <ul>\n"; } function end_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent</ul> \n"; } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; /* Add active class */ if(in_array('current-menu-item', $classes)) { $classes[] = 'active'; unset($classes['current-menu-item']); } /* Check for children */ $children = get_posts(array('post_type' => 'nav_menu_item', 'nopaging' => true, 'numberposts' => 1, 'meta_key' => '_menu_item_menu_item_parent', 'meta_value' => $item->ID)); if (!empty($children)) { $classes[] = 'has-sub'; } $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . '<li' . $id . $value . $class_names .'>'; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= '<a'. $attributes .'>'; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } function end_el( &$output, $item, $depth = 0, $args = array() ) { $output .= "\n"; } } // Single navigation function simplue_post_nav() { global $post; // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; } <div id="navSingle"> <div class="aPrev"><?php previous_post_link( '%link', '<span class="meta-nav">←</span> %title', 'Previous post link', 'simplue' ); ?></div> <div class="aNext"><?php next_post_link( '%link', '%title <span class="meta-nav">→</span>', 'Next post link', 'simplue' ); ?></div> </div><!-- navSingle --> ?>