WordPress.org

Ready to get started?Download WordPress

Forums

Adding an option in a Options Panel (3 posts)

  1. staceyzav
    Member
    Posted 2 years ago #

    I have created an Options Panel in my theme that is working quite well. I'm trying to add a option where if the user checks it, the loop is no longer shown. It seems to be working fine on the options panel, however I'm having trouble retrieving the loop based on the user's selection.

    here is the code I'm using on the functions.php file:

    array( "name" => "Disable Home Text and Image",
    	"desc" => "check this box if you would like to DISABLE the home page text block and image",
    	"id" => $shortname."_home_disable",
    	"type" => "checkbox",
            "std" => "false"),

    again - that part is working fine and showing up on the options panel as expected.

    Here is the code I'm using to retrieve the results, but the loop doesn't show up whether the box is checked or not. If the box is checked I would like the loop not to show up. If it is not checked, I want it to show.

    <?php if (get_option('fs_home_disable == "false"') ) { ?>
    
    	 <div class="exerptpost">
    
    <?php echo the_post_thumbnail(array(230,230), array('class' => 'archimg')); ?><h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1><div class="entrydate"><?php the_time('l, F jS, Y') ?> </div>
         <p><?php echo excerpt(40); ?></p>  </div>
    
        <? } else { ?>      <? } ?>

    Thanks in advance for any help.

  2. vtxyzzy
    Member
    Posted 2 years ago #

    Looks like you may have misplaced quote marks in the if-test. Try this:

    <?php if (get_option('fs_home_disable') == false ) { ?>
  3. staceyzav
    Member
    Posted 2 years ago #

    That did it! THANK YOU SO MUCH.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.