Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

Como ponerle una class al titulo de este archivo?

Estas en el tema de Como ponerle una class al titulo de este archivo? en el foro de WordPress en Foros del Web. Código PHP: <?php /*  * Plugin Name: Featured Posts Widget  * Plugin URI: http://rubiqube.com  * Description: A widget to display a featured posts carousel  * Version: 1.0  * Author: Adrian Diaconescu  * Author URI: http://rubiqube.com  */ /*  * tabd function to widgets_init that'll lotab our widget.  */ add_action (  'widgets_init' ,  'rbq_featured_widget'  ); /*  * Register widget.  */ function  rbq_featured_widget ...
  #1 (permalink)  
Antiguo 19/01/2012, 15:29
RGT
Usuario no validado
 
Fecha de Ingreso: noviembre-2008
Mensajes: 505
Antigüedad: 15 años, 4 meses
Puntos: 5
Pregunta Como ponerle una class al titulo de este archivo?

Código PHP:
<?php

/*

 * Plugin Name: Featured Posts Widget

 * Plugin URI: http://rubiqube.com

 * Description: A widget to display a featured posts carousel

 * Version: 1.0

 * Author: Adrian Diaconescu

 * Author URI: http://rubiqube.com

 */







/*

 * tabd function to widgets_init that'll lotab our widget.

 */

add_action'widgets_init''rbq_featured_widget' );



/*

 * Register widget.

 */

function rbq_featured_widget() {

    
register_widget('RBQ_Featured_Widget');

}



/*

 * Widget class.

 */

class rbq_featured_widget extends WP_Widget {



    
/* ---------------------------- */

    /* ------- Widget setup ------- */

    /* ---------------------------- */

    

    
function RBQ_Featured_Widget() {

    

        
/* Widget settings */

        
$widget_ops = array( 'classname' => 'rbq_featured_widget''description' => __('A widget to display a featured posts carousel.''rbq-domain') );



        
/* Widget control settings */

        
$control_ops = array( 'width' => 250'height' => 350'id_base' => 'rbq_featured_widget' );



        
/* Create the widget */

        
$this->WP_Widget'rbq_featured_widget'__('Featured Posts''rbq-domain'), $widget_ops$control_ops );

    }



    
/* ---------------------------- */

    /* ------- Display Widget -------- */

    /* ---------------------------- */

    

    
function widget$args$instance ) {

        global 
$wpdb;

        
extract$args );



        
/* Our variables from the widget settings. */

        
$title apply_filters('widget_title'$instance['title'] );        



        
/* Before widget (defined by themes). */

        
echo $before_widget;



        
/* Display the widget title if one was input (before and after defined by themes). */

        
if ( $title )

            echo 
$before_title $title '<span><a href="#" id="carousel-vert-prev">&laquo;</a><a href="#" id="carousel-vert-next">&raquo;</a></span>' $after_title;

        

        
?>

        

        <ul id="carousel-vert" class="jcarousel-skin">

                <?php
                    query_posts
(array('orderby' => 'rand''showposts' => 8));
                    if (
have_posts()) :
                    while (
have_posts()) : the_post();
                
?>  

            <li>

                <a class="pimage" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>

                <p class="pcat"><?php the_category(', '); ?></p>

                <p class="ptitle"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></p>

                <p class="meta"><?php the_time('j / F / Y'?> - <?php if(function_exists('the_views')) { the_views(); } ?></p>

            </li>

        <?php endwhile; endif; ?>

        <?php wp_reset_query(); ?>

        </ul>

        

        <?php



        
/* After widget (defined by themes). */

        
echo $after_widget;

    }



    
/* ---------------------------- */

    /* ------- Update Widget -------- */

    /* ---------------------------- */

    

    
function update$new_instance$old_instance ) {

        
$instance $old_instance;



        
/* Strip tags to remove HTML (important for text inputs). */

        
$instance['title'] = strip_tags$new_instance['title'] );

        

        return 
$instance;

    }

    

    
/* ---------------------------- */

    /* ------- Widget Settings ------- */

    /* ---------------------------- */

    

    /**

     * Displays the widget settings controls on the widget panel.

     * Make use of the get_field_id() and get_field_name() function

     * when creating your form elements. This handles the confusing stuff.

     */

    

    
function form$instance ) {

    

        
/* Set up some default widget settings. */

        
$defaults = array(

        
'title' => 'Featured Posts'

        
);

        
$instance wp_parse_args( (array) $instance$defaults ); ?>



        <!-- Widget Title: Text Input -->

        <p>

            <label for="<?php echo $this->get_field_id'title' ); ?>"><?php _e('Title:''rbq-domain'?></label>

            <input class="widefat" id="<?php echo $this->get_field_id'title' ); ?>" name="<?php echo $this->get_field_name'title' ); ?>" value="<?php echo $instance['title']; ?>" />

        </p>

        

        <p><?php _e('Make sure you fill out the featured post IDs under Appearance > Theme Options''rbq-domain'); ?></p>

    

    <?php

    
}

}

?>
Hola, ese archivo muestra el Widget del lado derecho en mi web llamado 'Articulos Destacados'

Qué pasa?, yo quiero agregarle al lado del titulo esto:
<span class="TeGusto"></span>

Pero no sé donde, trato de agregarlo pero la linea me sale en rojo.

Ese span muestra una pequeña foto 24x24, un ejemplo de lo que quiero hacer aqui:
http://www.oyeeso.com/?s=mmg
Sale la imagen de una estrella al lado del titulo.

Podrian ayudarme a agregarlo en ese archivo, no logro lograrlo!
  #2 (permalink)  
Antiguo 19/01/2012, 15:45
Avatar de Nekko
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Buenos Aires
Mensajes: 3.141
Antigüedad: 16 años
Puntos: 656
Respuesta: Como ponerle una class al titulo de este archivo?

Lee los comentarios que tiene el plugin, quizás por ahí venga la mano. Mirá esta parte del código:
Código PHP:
Ver original
  1. /* Display the widget title if one was input (before and after defined by themes). */
  2. if ( $title )
  3.  
  4. echo $before_title . $title . '<span><a href="#" id="carousel-vert-prev">&laquo;</a><a href="#" id="carousel-vert-next">&raquo;</a></span>' . $after_title;

Intuyo, sin testearlo, que está hablando de las etiquetas del título del widget que se definen desde el theme (en el functions.php). Todo eso figura en el codex de WordPress, sólo es cuestión de tomarte tu tiempo en leer cada sección como funciona.

Código PHP:
Ver original
  1. /* Display the widget title if one was input (before and after defined by themes). */
  2. if ( $title )
  3.  
  4. echo $before_title . '<span class="TeGusto">'. $title . '</span><span><a href="#" id="carousel-vert-prev">&laquo;</a><a href="#" id="carousel-vert-next">&raquo;</a></span>' . $after_title;

Fijate que la sintaxis funcione, no creo que sea correcto poner un span dentro de un heading.
__________________
Taller para crear themes wordpress desde cero | Presupuestos para trabajos particulares vía MP
  #3 (permalink)  
Antiguo 19/01/2012, 20:20
RGT
Usuario no validado
 
Fecha de Ingreso: noviembre-2008
Mensajes: 505
Antigüedad: 15 años, 4 meses
Puntos: 5
Respuesta: Como ponerle una class al titulo de este archivo?

Hola,
Lo puse como dijiste y este es el resultado:



La estrella junto con el titulo se movieron a la derecha.

No tengo idea de que hacer.
  #4 (permalink)  
Antiguo 20/01/2012, 07:03
Avatar de Nekko
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Buenos Aires
Mensajes: 3.141
Antigüedad: 16 años
Puntos: 656
Respuesta: Como ponerle una class al titulo de este archivo?

Vas a tener que aprender CSS.
__________________
Taller para crear themes wordpress desde cero | Presupuestos para trabajos particulares vía MP
  #5 (permalink)  
Antiguo 20/01/2012, 08:50
RGT
Usuario no validado
 
Fecha de Ingreso: noviembre-2008
Mensajes: 505
Antigüedad: 15 años, 4 meses
Puntos: 5
Respuesta: Como ponerle una class al titulo de este archivo?

Yo sé mas o menos, y no logro dar con que falta poner o cual es el problema.

Este es mi css:

Código:
.jcarousel-skin .jcarousel-container-vertical {
    width: 336px;
}

.jcarousel-skin .jcarousel-clip-vertical {
    width: 336px;
    height: 394px;
}

.jcarousel-skin .jcarousel-item-vertical {
    width: 336px;
    height: 80px;   
}

#carousel-vert-next {
    display: block;
	float: right;
	width: 16px;
	height: 12px;
	background: url("../images/arrow_down.png") no-repeat top left;
	text-indent: -1000px;
}

#carousel-vert-next:hover {
    background-position: -16px 0;
}

#carousel-vert-prev {
    display: block;
	float: left;
	width: 16px;
	height: 12px;
	background: url("../images/arrow_up.png") no-repeat top left;
	text-indent: -1000px;
}

#carousel-vert-prev:hover {
    background-position: -16px 0;
}

Última edición por RGT; 20/01/2012 a las 08:58
  #6 (permalink)  
Antiguo 20/01/2012, 11:23
Avatar de Nekko
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Buenos Aires
Mensajes: 3.141
Antigüedad: 16 años
Puntos: 656
Respuesta: Como ponerle una class al titulo de este archivo?

Te dije que no creo que un span dentro de un h3 sea correcto. Consultá en el subforo de CSS para aprender mas sobre el tema. Nosotros te asesoramos hasta donde está relacionado con WordPress.
__________________
Taller para crear themes wordpress desde cero | Presupuestos para trabajos particulares vía MP

Etiquetas: php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:57.