<!--Automatic Greybox-->
<?php
//Die zum Post gehoerenden Bilder ins Array $images schreiben
//Put images from post in to array $images. Order by menu order defined in post gallery
$images = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
//Pruefen, ob dem Beitrag Bilder angehaengt wurden.
//check if there are any images attached to the post
if (isset($images))
{
//Den Zaehler auf 0 setzen
//set counter to 0
$count=0;
//Alle Bilder im Array $images nacheinander durchlaufen
//go through all images in array $images
foreach( $images as $image )
{
$imageID = $image->ID;
//fuer jedes Bild im Array die URL von sowohl der Mittleren, als auch der grossen Groesse ermitteln.
//get medium and large image url for image
$medImageSrc = wp_get_attachment_image_src($imageID, $size='medium', $icon = false);
$largeImageSrc = wp_get_attachment_image_src($imageID, $size='large', $icon = false);
//Wenn es sich um das erste Bild im Array handelt...
//If it's the first image in the array
if ($count==0)
{
//Den Greybox-Code mit einem Vorschaubild ausgeben
//output Greybox Code with medium size preview
echo"<a href='$largeImageSrc[0]' rel='shadowbox[Bilder]'><img src='$medImageSrc[0]' border='0'></a>";
}
//alle Bilder ,die nach dem erstern Bild kommen
//this is for all the images that come after the first one
else
{
//unsichtbare Greybox-Verknuepfung darstellen.
//create invisible Greybox-Links without preview image
echo"<a href='$largeImageSrc[0]' rel='shadowbox[Bilder]'></a>";
}
//Zaehler erhoehen.
//increase counter
$count++;
} //foreach
}
?>
<!--ENDE Automatic Greybox -->
Tag Archive for theme
WordPress – Get current category name and / or ID
<?php
//AKTUELLE Post-KATEGORIE-ID ermitteln
foreach((get_the_category()) as $category)
{
$postcat= $category->cat_ID;
$catname =$category->cat_name;
//echo $postcat;
}
?>
WordPress display content of a category on a page
<?php if (is_page('pagename')) { query_posts('cat=yx') } ?>
<!--or use query_posts like this:(full loop)-->
<?php
$displayposts = new WP_Query();
$displayposts->query('cat=5');
while ($displayposts->have_posts()) : $displayposts->the_post();
?>
<?php the_content('read more...'); ?>
<?php edit_post_link('edit', '', ''); ?>
<?php endwhile; ?>
WordPress theme directory
<?php bloginfo('template_directory'); ?>/
Developer only stylesheet
<?php if ($GLOBALS['user']->uid == 1): ?> <style type="text/css" media="screen"> @import url(/<?php print $directory ?>/style-dev.css); </style> <?php endif ?>
Drupal breadcrumb override
/**
* Make breadcrumbs include the current page as an inactive crumb
* Also, remove the top level for image_galleries.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
$breadcrumb_new = array();
// Create new breadcrumb array without the top level image gallery link
foreach ($breadcrumb as $crumb) {
if (strstr($crumb, '<a href="/image">') != TRUE) {
$breadcrumb_new[] = $crumb;
}
}
$breadcrumb_new[] = '<span class="active">'. drupal_get_title() .'</span>';
return '<div class="breadcrumb">'. implode(' » ', $breadcrumb_new) .'</div>';
}
}
Drupal primary links
<?php
/**
* Option 1
*******************************************************/ ?>
<?php if (isset($primary_links)) : ?>
<?php print theme('links', $primary_links, array('class' => 'links primary-links clear-block')) ?>
<?php endif; ?>
<?php if (isset($secondary_links)) : ?>
<?php print theme('links', $secondary_links, array('class' => 'links secondary-links clear-block')) ?>
<?php endif; ?>
<?php
/**
* Option 2
*******************************************************/ ?>
<?php if (isset($primary_links)) { ?>
<div id="primary-links">
<?php print theme('menu_tree',variable_get('menu_primary_menu',0)); ?>
</div>
<?php } ?>
<?php
/**
* Option 3
*******************************************************/ ?>
<?php if (isset($primary_links)) {
print theme('links', $primary_links, array('class' => 'links primary-links clear-block'));
} ?>
Angel LMS Course Title Image Replacement
#bannerSection h1 {
background: black url( your-image-url ) no-repeat;
height:100px; /* height of your image */
margin:0.5em auto 0 0.8em;
padding:0.4em 0 0.4em 25px;
text-indent:-9999px;
width:auto;
}