[Resolved] Dashboard Meta Box

Home Forums Support Dashboard Meta Box

  • This topic has 4 replies, 2 voices, and was last updated 1 year ago by Tom.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #994569
    Ashley

    Hi Guys,

    I’m looking to create a simple text field on the WordPress dash that then populates an element.

    The scenario is basically a news bar which I’m using an element to place underneath the nav. I’d like the client to be able to simply populate this from the WordPress dashboard to stop them going into Elements.

    Can this be done?

    #995029
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What kind of Element?

    If it’s a Hook Element, you would need to use get_post_meta() to get your custom field.

    Actually creating a custom metabox is a bit advanced for this forum, but you can use the core Custom Fields metabox to add your meta data if you don’t need a fully custom metabox.

    Let me know 🙂

    #995196
    Ashley

    Ok – I think I’ve managed to do it just using a custom widget-area for now.

    This is how my GP Element looks at the moment:

    <div id="ticker-wrapper">
    	<div id="ticker-bar">
    		<?php if ( is_active_sidebar( 'nsb_ticker_bar' ) ) : ?>
    	<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
    		<?php dynamic_sidebar( 'nsb_ticker_bar' ); ?>
    	</div><!-- #primary-sidebar -->
    <?php endif; ?>
    	</div>
    </div>

    Is there a way to hide the #ticker-wrapper div when there’s no widget present in the sidebar? Could I do that with a bit of PHP?

    #995198
    Ashley

    Ignore me – I’ve managed that by moving it within the if statement.

    Finished code is as follows:

    <?php if ( is_active_sidebar( 'nsb_ticker_bar' ) ) : ?>
    	<div id="ticker-wrapper">
    			<div id="ticker-bar">
    				<?php dynamic_sidebar( 'nsb_ticker_bar' ); ?>
    			</div>
    	</div>
    <?php endif; ?>

    Thanks Tom 🙂

    #995646
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working. Thanks for sharing your code 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.