Archive
wordpress

Reusable Custom Meta Boxes Part 1: Intro and Basic Fields | Wptuts+.

Read More
If you have a form text field with default value / text like “Enter your Name: ”. As soon a visitor clicks on it to enter his Name the text should disappear. Is there a way to create this in wordpress if we use contactform7 plugin? Fortunately there is a way. Here is the steps:

1. add the below javascript to header.php

<script type=”text/javascript”>

function clearText(field)

{

if (field.defaultValue == field.value) field.value = ”;

}

function restoreText(field) {

if (field.value == ”) field.value = field.defaultValue;

}

</script>

2. In the contact form 7 plugin folder, edit file /modules/text.php.

Find line 76

$html = ‘<input type=”text” name=”‘ . $name . ‘” value=”‘ . esc_attr( $value ) . ‘”‘ . $atts . ‘ />’;

3. between ‘input’ and ‘type’, add:

onFocus=”clearText(this)” onBlur=”restoreText(this)”

4. You can add like the following to delete values automatically form textarea

Read More

A Simple but useful jquery function to swich between two different forms (contact form 7)

Written by Alessandro cristi for contact section of www.bayloncafe.com

 

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js”></script>

<script>

$(“#info_btn”).click(function() {
switchForm(“info”);
});
$(“#arts_btn”).click(function() {
switchForm(“arts”);
});

function switchForm(form){

if (form == “info”) {
$(“#info_btn”).addClass(“active”)
$(“#arts_btn”).removeClass(“active”)
$(“#form_info”).css(“display” , “block”)
$(“#form_arts”).css(“display” , “none”)
}
else {
$(“#arts_btn”).addClass(“active”)
$(“#info_btn”).removeClass(“active”)
$(“#form_info”).css(“display” , “none”)
$(“#form_arts”).css(“display” , “block”)
}
}

</script>

Read More

i use this to in my “taxonomy-taxonomyname.php” to output 4 posts followed by a wp_pagenavi.php

<?php
global $paged;
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’): 1;
$posts = query_posts(array (
‘post_type’ => ‘tf_events’,
‘posts_per_page’ => 4,
‘post_status’ => ‘publish’,
‘meta_key’ => ‘tf_events_startdate’,
‘meta_value’ => $today6am,
‘orderby’ => ‘meta_value’,
‘paged’=> $paged,
‘meta_compare’ => ‘<=’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘tf_eventcategory’,
‘field’ => ‘slug’,
‘terms’ => $slug
)
)
));
//’post_type=tf_events&posts_per_page=4&paged=’.$paged

?>

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>

<!– LOOP –>

<?php endwhile; ?>

<?php else: //If no posts are present ?>

<p><?php _e(‘No posts were found.’, ‘super core’); ?></p>

<?php endif; ?>

<?php
include(TEMPLATEPATH . ‘/php/wp-pagenavi.php’);
if(function_exists(‘wp_pagenavi’)) {
echo ‘paginazione’;
wp_pagenavi();
}
?>

 

 

…but when i click to open the second page it give me a 404 page error.

The soloution is about the settings->reading page in wordpress dashboard.

I have 4 posts per page. The “blog pages show at most” filed was set to “30″. I’ve changed it to 4 and it works. i don’t know why … maybe was sufficient to update this value.

 

 

Read More

<?php
/**
* Create a list of links of a certain taxonomy
*/

$liks_of_taxonomies = wp_list_categories( array(
‘taxonomy’ => ‘tf_eventcategory’
) );

// Make sure there are terms with articles
if ( $liks_of_taxonomies )
echo $liks_of_taxonomies;
?>

Read More

Introducing WordPress 3 Custom Taxonomies | Nettuts+.

Read More

<?php

//mostro il titolo solo se cen’è più di 0

$mypostcount = count($custom_posts);

if ($mypostcount > 0) {

echo NEXT_EVENT;

} ?>

Read More
	<?php if(is_tax('tf_eventcategory','expositions')) { ?>
		<img src="<?php bloginfo('template_directory'); ?>/img/titoli/next_events.png" />
	<?php } elseif(is_tax('tf_eventcategory','events')) {  ?>
		<img src="<?php bloginfo('template_directory'); ?>/img/titoli/next_expo.png" />
	<?php } else {
	}?>
Read More
<?php
   global $wp_query;
   $term = $wp_query->get_queried_object();
   $title = $term->name;
   $slug = $term->slug;
   $description = $term->description;
?>

<?php echo $slug ?>
Read More

<?php query_posts’cat= IDcat1, IDcat2′; ?>

<?php if have_posts : ?><?php while have_posts : the_post; ?>

Read More