• Resolved Pia1973

    (@pia1973)


    Please can somebody help me this is a exame project

    I have this index page (link) and this 18 boxs I have to make theme as categories but how??
    And the boxes is style with css
    My code look like this:

    <?php get_header();?>
        <div id="mainContent">
                    <a href="#"><div id="box1"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box2"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box3"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box4"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box5"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box6"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box7"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box8"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box9"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box10"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box11"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box12"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box13"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box14"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box15"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box16"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box17"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                    <a href="#"><div id="box18"><img src="<?php bloginfo('template_url');?>/css/icon/1.png" alt="Patientfolder" width="35" height="30"/></div></a>
                </div><!-- END #mainContent -->
    <?php get_footer();?>

Viewing 15 replies - 1 through 15 (of 21 total)
  • Thread Starter Pia1973

    (@pia1973)

    I have to make theme as categories

    what exactly are you trying to show per box?

    Thread Starter Pia1973

    (@pia1973)

    each box is a link to a category and there will be 18 categories

    will there be only exactly 18 categories in your site?
    do you need a specific order for the categories, like alphabetic?
    do you need a specific icon per category?
    do you want to link each box to the category archive page of the category?

    assuming you answer ‘yes’ to each of the questions, then an example code would be:

    <?php get_header();?>
    		<div id="mainContent">
    <?php $cats = get_categories( array( 'hide_empty' => 1, 'number' => 18 ) );
    $counter = 0;
    foreach( $cats as $cat ) {
    $counter++; ?>
                    <div id="box<?php echo $counter; ?>"><a href="<?php echo get_category_link( $cat->term_id ); ?>"><img src="<?php bloginfo('template_url');?>/css/icon/<?php echo $counter; ?>.png" alt="<?php echo esc_attr( $cat->name ); ?>" width="35" height="30"/></a></div>
    <?php } //end of the foreach// ?>
    
    		</div><!-- END #mainContent -->
    <?php get_footer();?>

    you will need icon images 1.png, 2.png, etc corresponding to the categories.

    http://codex.wordpress.org/Function_Reference/get_categories

    Thread Starter Pia1973

    (@pia1973)

    will there be only exactly 18 categories in your site?: YES
    do you need a specific order for the categories, like alphabetic?: YES
    do you need a specific icon per category?: YES
    do you want to link each box to the category archive page of the category?: YES

    I have icon for each category πŸ™‚

    Thread Starter Pia1973

    (@pia1973)

    Thanks πŸ™‚

    It should be such that when you click on categorien (box) that you enter the category page

    Thread Starter Pia1973

    (@pia1973)

    and on this site under categories I would like to have a search form πŸ™‚ please

    Thread Starter Pia1973

    (@pia1973)

    or a search form on the index page πŸ™‚

    Thread Starter Pia1973

    (@pia1973)

    I am a newbeen in this so I am not so good at it so cut you please help me

    when I clike on the box I like to get into the page for the categorie

    the search form I think I can fix it by my self

    when I clike on the box I like to get into the page for the categorie

    that should happen automatically (?)

    what file name are you using for the boxes?

    if you intend the boxes to be on the home page, possibly rename the file to front-page.php and create an index.php with the default loop.

    http://codex.wordpress.org/Template_Hierarchy
    http://codex.wordpress.org/The_Loop

    Thread Starter Pia1973

    (@pia1973)

    the site where the boxes is on is called index.php
    I’m not sure what you mean

    Thread Starter Pia1973

    (@pia1973)

    I canΒ΄t see what I am doing wrong
    please help me

    http://skrivers-shop.dk/wordpress/

    I’m not sure what you mean

    index.php is used when no other, more specific template exists in your theme;
    read http://codex.wordpress.org/Template_Hierarchy

    that means, that your category page is using index.php which is obviously in your case very specialized, and does not contain the general loop.

    Thread Starter Pia1973

    (@pia1973)

    yes but how am I getting it to work

    I have tried to make a frontpage with the boks code in and the loop on the index file but it donΒ΄t work

    you can write the code to be on the front page and the code to the index
    please please

Viewing 15 replies - 1 through 15 (of 21 total)

The topic ‘18 boxes in wordpress’ is closed to new replies.