mardi 23 décembre 2014

wordpress option title won't appear on site when checkbox ticked

I have an issue with displaying information if a checkbox is ticked. I believe the if statement is incorrect.


Below is the code from my options page:



<div class="admin-options">Title:<input type="checkbox" name="option_title" value="1" <?php checked( '1', get_option( 'option_title' ) ); ?> ></div>

register_setting( 'option_control', 'option_title' );


This is the code sent to display:



function display_option_title() {

if (get_option('option_title') == 1 || get_option('option_title') <> ''){
echo '
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<h2><?php the_title(); ?></h2></a>
';
}
}

add_action( 'print_option_title', 'display_option_title' );


Any help would be most helpful.





Aucun commentaire:

Enregistrer un commentaire