• Resolved rebelsaga

    (@rebelsaga)


    Trying to display Contact Widgets outside of the Sidebar using class (‘ Contact_Widgets ‘) and it’s not working. I’ve also tried (‘ wpcw-widget-social ‘) and (‘ Widget_Social ‘). I’m utilizing the below code, which works with standardized WP Widgets:

    <?php the_widget( ' Contact_Widgets ' ); ?>

    Is this the wrong class? Do I need to add a function of some kind or is this the wrong code entirely?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jonathan Bardo

    (@jonathanbardo)

    Hey Rebelsaga,

    The class name would be:
    <?php the_widget( 'WPCW\Contact' ); ?>

    You actually have to specify a couple of options in order for it to show up. Here is the code if you want to look for yourself (https://github.com/godaddy/wp-contact-widgets/blob/develop/includes/class-contact.php).

    Cheers!

    Thread Starter rebelsaga

    (@rebelsaga)

    I don’t know what options I have to specify. Simply putting the below code doesn’t cause it to show up.

    <?php the_widget( 'WPCW\Contact' ); ?>

    Plugin Author Jonathan Bardo

    (@jonathanbardo)

    Hey Rebelsa,

    I don’t have a straight answer to give you right now unfortunately. I will have to dig into it to see what’s missing exactly. I’ll try to do some testing over the week-end to see if I can make it work.

    Plugin Author Jonathan Bardo

    (@jonathanbardo)

    Hey Rebelsa,

    Since this is a multi widget instance we need to specify the instance fields when we use the_widget.

    Here is a working example:

    
    the_widget(
    	'WPCW\Contact',
    	array(
    		'title' => 'TITLE',
    		'phone' => array( 'value' => '515-555-5555' ),
    		'fax' => array( 'value' => '515-555-5555' ),
    		'address' => array( 'value' => '123 Santa Monica Blvd' ),
    		'labels' => array( 'value' => 'yes' ) ,
    		'map' => array( 'value' => 'yes' ) )
    );
    

    Let me know if that works for you.

    Thread Starter rebelsaga

    (@rebelsaga)

    Thank you. I like your honesty.

    I’ve tried every variation of ‘WPCW\Contact’, ‘WPCW\Social’, and ‘wpcw-widgets wpcw-widget-social’ that popped into my head.

    Maybe, there’s a way to call the class??

    Plugin Author Jonathan Bardo

    (@jonathanbardo)

    Hey Rebelsa,

    Have you tried the code from my last comment? It worked for me when I tried in on one of my themes.

    Thread Starter rebelsaga

    (@rebelsaga)

    I didn’t realize that this was a multi-widget and was looking to use the social icons, i.e. facebook, etc. Would I just substitute the array parameters like:

    the_widget(
        'WPCW\Contact',
    	array(
    	    'facebook'    => [
    		'icon'    => 'facebook-official',
    		'label'   => __( 'Facebook', 'contact-widgets' ),
    		'default' => "https://www.facebook.com/{$username}",
    		'select'  => $username,
    	    ],
    	    'twitter'     => [
    		'label'   => __( 'Twitter', 'contact-widgets' ),
    		'default' => "https://twitter.com/{$username}",
    		'select'  => $username,
    	],
    );
    Plugin Author Jonathan Bardo

    (@jonathanbardo)

    Hey Rebelsa,

    If you want to use the Social Widget then yes the arguments are different and the class name is different as well.

    Here is what you need for the social widgets:

    the_widget(
    	'WPCW\Social',
    	array(
    		'title' => 'Social',
    		'facebook' => array(
    			'value'    => 'https://www.facebook.com/username',
    		),
    		'labels' => array(
    			'value' => 'no',
    		)
    	)
    );
    Thread Starter rebelsaga

    (@rebelsaga)

    Brilliant! Have a Cookie Monster… or two ??

    Have a Cookie Monster... or two :)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Display Widget outside Sidebar’ is closed to new replies.