Posts Tagged ‘WordPress’

Headline of parent and navigation list of children

onsdag, december 21st, 2011

Display parent headline and a list of children links in a submenu.

In this illustrative example:

  • Services is the parent
  • Service 1, Service 2, and Service 3 is children

The headline in the left column is Services both on parent as well as children page.

And this is the code:

<h2><?php

$parent_title = get_the_title($post->post_parent);

echo $parent_title;

?></h2>

<?php

if($post->post_parent)

$children = wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&echo=0″);

else

$children = wp_list_pages(“title_li=&child_of=”.$post->ID.”&echo=0″);

if ($children) { ?>

<ul>

<?php echo $children; ?>

</ul>

<?php } ?>

Set default url

mandag, september 5th, 2011

I stedet for at lave en absolut url (http://www.domain.com/), som tilføjer endnu en request til din server, kan du med fordel benytte dig af funktionen bloginfo:

<?php bloginfo(‘url’); ?>

Husk:

  • tilføj en “trailing slash” (/)
  • rette aprostrof hvis du copy’n'paster herfra

Url’en er den samme som du har under Indstillinger -> Generelt.

Del post via RSS på Twitter og Facebook

tirsdag, januar 4th, 2011

http://twitterfeed.com/

Horisontal og vertikal centrering

søndag, december 26th, 2010

WordPress plugin: NextGen gallery style (css) fra linje 116

.ngg-galleryoverview { overflow: hidden; padding: 4px; width: 100%; border-top: 2px solid #bfdbe2; clear: both; display: block !important;}

.ngg-gallery-thumbnail-box { float: left; width: 124px; height: 124px; margin: 5px;}

.ngg-gallery-thumbnail { width: 124px; height: 124px; display: table-cell; vertical-align: middle; border: 2px solid #cdcdcd; background-color: #efefef;}

a:hover .ngg-gallery-thumbnail { border: 2px solid #dedede; background-color: #ababab;}

.ngg-gallery-thumbnail img { display: block; margin-left: auto; margin-right: auto; padding: 2px; position: relative;}

.ngg-clear { clear: both;}

gallery.php

<!-- Thumbnails --> <?php foreach ( $images as $image ) : ?>
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> > <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> > <div class="ngg-gallery-thumbnail" > <?php if ( !$image->hidden ) { ?> <img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> /> <?php } ?> </div> </a> </div>

Vis filnavn i NextGen billede galleri

fredag, december 10th, 2010
<? echo $image->filename ?>

Vis undermenu i sidebar

mandag, december 6th, 2010

<?php wp_list_pages(‘child_of=8′); ?>

8 referer til sidens id nr.

Husk at give siderne numre (Rækkefølge i højre side), hvis du ikke vil vise undermenuen alfabetisk.

Redirect med .htaccess

tirsdag, september 7th, 2010

http://www.webweaver.nu/html-tips/web-redirection.shtml

CSS: Placering i lag

tirsdag, august 31st, 2010

Når du bruger z-index, forudsætter det at du benytter position.

Inkludere side i side i WordPress

fredag, juli 16th, 2010

<?php include('side.php'); ?>

Cache til WordPress

torsdag, juli 15th, 2010

http://www.tutorial9.net/web-tutorials/wordpress-caching-whats-the-best-caching-plugin/

Jeg bruger selv Hyper Cache, som kan sættes op på et PHP Safe Mode ON webhotel (Surftown, One.com etc.).

WP Super Cache har fået gode anmeldelser, men brugen forudsætter at du har webhotel med PHP Safe Mode OFF.