Vaya por delante que yo de programar cero, lo poco que pretendo conocer es lo poco que he necesitado usar en mi blog y lo que te comento espero que no te líe más; la cuestión es que a mi me pasaba algo parecido.
En Wordpress hay un archivo de funciones (functions.php) donde se almacenan diferentes scripts php para ser ejecutados, la cuestión es que alguna vez cuando he ido a un sitio a copiar un código para introducir en ese archivo me lo he encontrado completo, con las etiquetas de apertura y cierre de lenguaje.
<?php
function related_posts_shortcode( $atts ) {
extract(shortcode_atts(array(
'limit' => '5',
), $atts));
global $wpdb, $post, $table_prefix;
if ($post->ID) {
$retval = '
<ul>';
// Get tags
$tags = wp_get_post_tags($post->ID);
$tagsarray = array();
foreach ($tags as $tag) {
$tagsarray[] = $tag->term_id;
}
$tagslist = implode(',', $tagsarray);
// Do the query
$q = "
SELECT p.*, count(tr.object_id) as count
FROM $wpdb->term_taxonomy AS tt, $wpdb->term_relationships AS tr, $wpdb->posts AS p
WHERE tt.taxonomy ='post_tag'
AND tt.term_taxonomy_id = tr.term_taxonomy_id
AND tr.object_id = p.ID
AND tt.term_id IN ($tagslist)
AND p.ID != $post->ID
AND p.post_status = 'publish'
AND p.post_date_gmt < NOW()
GROUP BY tr.object_id
ORDER BY count DESC, p.post_date_gmt DESC
LIMIT $limit;";
$related = $wpdb->get_results($q);
if ( $related ) {
foreach($related as $r) {
$retval .= '
<li><a title="'.wptexturize($r->post_title).'" href="'.get_permalink($r->ID).'">'.wptexturize($r->post_title).'</a></li>
';
}
} else {
$retval .= '
<li>No related posts found</li>
';
}
$retval .= '</ul>
';
return $retval;
}
return;
}
add_shortcode('related_posts', 'related_posts_shortcode');
?>
Este por ejemplo, así que cuando localizo una nueva función que quiero añadir simplemente elimino las etiquetas de lenguaje y la añado a partir del final de la función anterior en una nueva línea:
<?php
function related_posts_shortcode( $atts ) {
extract(shortcode_atts(array(
'limit' => '5',
), $atts));
global $wpdb, $post, $table_prefix;
if ($post->ID) {
$retval = '
<ul>';
// Get tags
$tags = wp_get_post_tags($post->ID);
$tagsarray = array();
foreach ($tags as $tag) {
$tagsarray[] = $tag->term_id;
}
$tagslist = implode(',', $tagsarray);
// Do the query
$q = "
SELECT p.*, count(tr.object_id) as count
FROM $wpdb->term_taxonomy AS tt, $wpdb->term_relationships AS tr, $wpdb->posts AS p
WHERE tt.taxonomy ='post_tag'
AND tt.term_taxonomy_id = tr.term_taxonomy_id
AND tr.object_id = p.ID
AND tt.term_id IN ($tagslist)
AND p.ID != $post->ID
AND p.post_status = 'publish'
AND p.post_date_gmt < NOW()
GROUP BY tr.object_id
ORDER BY count DESC, p.post_date_gmt DESC
LIMIT $limit;";
$related = $wpdb->get_results($q);
if ( $related ) {
foreach($related as $r) {
$retval .= '
<li><a title="'.wptexturize($r->post_title).'" href="'.get_permalink($r->ID).'">'.wptexturize($r->post_title).'</a></li>
';
}
} else {
$retval .= '
<li>No related posts found</li>
';
}
$retval .= '</ul>
';
return $retval;
}
return;
}
add_shortcode('related_posts', 'related_posts_shortcode');
function chart_shortcode( $atts ) {
extract(shortcode_atts(array(
'data' => '',
'colors' => '',
'size' => '400x200',
'bg' => 'ffffff',
'title' => '',
'labels' => '',
'advanced' => '',
'type' => 'pie'
), $atts));
switch ($type) {
case 'line' :
$charttype = 'lc'; break;
case 'xyline' :
$charttype = 'lxy'; break;
case 'sparkline' :
$charttype = 'ls'; break;
case 'meter' :
$charttype = 'gom'; break;
case 'scatter' :
$charttype = 's'; break;
case 'venn' :
$charttype = 'v'; break;
case 'pie' :
$charttype = 'p3'; break;
case 'pie2d' :
$charttype = 'p'; break;
default :
$charttype = $type;
break;
}
if ($title) $string .= '&chtt='.$title.'';
if ($labels) $string .= '&chl='.$labels.'';
if ($colors) $string .= '&chco='.$colors.'';
$string .= '&chs='.$size.'';
$string .= '&chd=t:'.$data.'';
$string .= '&chf='.$bg.'';
return '<img title="'.$title.'" src="http://chart.apis.google.com/chart?cht='.$charttype.''.$string.$advanced.'" alt="'.$title.'" />';
}
add_shortcode('chart', 'chart_shortcode');
?>
No sé si esto te servirá, si podrás hacerlo del mismo modo pero tiene que haber algún modo (así de sencillo o más complicado) de incorporar más código php dentro de la página.
Otra solución que se me ocurre que te pudiese servir es que en caso de autentificación redirecciones la página a una nueva, por ejemplo index2.php o el nombre que sea donde si puedas meter el calendario sin problemas.