Jump to content

Archived

This topic is now archived and is closed to further replies.

lazlo

Call To Action Boxes: advice needed on best way forward -

Recommended Posts

lazlo

Hi, I'm just switching from Pagelines to DMS2 and i'd like some advice on the best way to create a row of 3 call outs that will need to be updated by the client as they choose.

 

The structure needed is:

- image

- h2

- p

with an a tag linking to to a different web page

 

Here is my example - ('Projects', 'Services', 'Clients') made utilising responsive grid divs - I feel this way will break easy should divs get deleted or nested when the client edits the page.

 

I have tried iBoxes, using images instead of fontAwesome icons but could't get the images to display as rectangles instead of circular (I did trawl through DOCS.Pagelines and tried some of the Cool Image Classes with no success.

 

What would be the best way to accomplish the old style Pagelines Boxes, that will be easy for client to update and would ideally have resizing images to scale to fit the box column? have i overlooked a section, or create three sidebars, each populated with a text widget and add to page with columizer (again, not v easy for client to update), create a separate Posts Category and create three posts, with a gallery/image format?

 

many thanks in advance for an advice received,

 

 

Share this post


Link to post
Share on other sites
Danny

Hi,

 

For me personally, I would just use three Media Boxes, reduce their size to 4/12, then add two MediaBoxes and reduce there width to the same, this will give you three columns of MediaBoxes.

 

Then just use HTML to add both your image(s), Header(s) and text via a p tag. By using this method you can use all of the cool image classes and any of the other CSS utility classes.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
lazlo

many thanks Danny, will try that now..

Share this post


Link to post
Share on other sites
Danny

No problem, let us know if that resolves your problem.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
lazlo
Hi Danny, your advice was spot on - v easy to set up and is looking good - can as ask your advice again on which is the best route to wrap the media box image with an <a> tag - should I copy media box section into child theme folder (or cutomise plugin folder) and tweak from there and try and add extra functionality..or is there a swifter route that I've missed like I did with media box ;o) ?

Share this post


Link to post
Share on other sites
greenfly

You can just add the HTML image into the media box text area and wrap it in the link 

 

<a href="url"><img src="yourimage.jpg"></a>


The answer to many issues can be found by searching in the forum before posting as someone else  may very well have had the same problem before you have.  Also, reading the documentation can help you gain a good understanding of how everything works. 

 

Please do not send me private messages. Occam's razor - The principle states "Keep things simple!"

Share this post


Link to post
Share on other sites
lazlo

Hi Martin - I tried as you advised but isn't working for me -see screenshot - I have tried full path as well:

<a href="http://www.cleverthinkingwebsites.co.uk/?page_id=201"><img src="[pl_site_url]/wp-content/uploads/2014/04/ibox-clients1.jpg"></a>

<a href="http://www.cleverthinkingwebsites.co.uk/?page_id=201"><img src="http://www.cleverthinkingwebsites.co.uk/wp-content/uploads/2014/04/ibox-clients1.jpg"></a> 

Share this post


Link to post
Share on other sites
lazlo

Hi
 

trying to wrap an <a> tag around media box image, so I copied section to base theme folder and added an array (lines 44-48) for 'mediabox_link'

					array(
						'type' 			=> 'text',
						'key'			=> 'mediabox_link',
						'label' 		=> __( 'URL', 'pagelines' ),
					),

...then under "function section_template area I created a string called $mediabox_link:

	function section_template() {

		$image = $this->opt('mediabox_image');
		$media_html = $this->opt('mediabox_html');
		$mediabox_link = $this->opt('mediabox_link');
		$disable_center = $this->opt('disable_centering');

...how do i incorporate the new string into the following line to wrap the <h3>with an <a> tag referencing the URL to be entered in mediabox_link field? (i'm not understanding the format it should take)

		$title = ( $this->opt('mediabox_title') ) ? sprintf('<h3 data-sync="mediabox_title">%s</h3>', $this->opt('mediabox_title')) : '';

here is the full section.php with my added functionality so far:

<?php
/*
	Section: MediaBox
	Author: PageLines
	Author URI: http://www.pagelines.com
	Description: A simple box for text and HTML.
	Class Name: PageLinesMediaBox
	Filter: component
	Loading: active
*/

class PageLinesMediaBox extends PageLinesSection {

	function section_head(){
		
		// Upgrade title options from 1.1 > 1.2
		// $upgrade_options = array(
		// 		'mediabox_title'		=> 'pl_standard_title',
		// 	); 
		// 
		// 	$this->upgrade_section_options( $upgrade_options );
	
	}

	function section_opts(){
		$opts = array(
	
			array(
				'title'	=> __( 'MediaBox Media', 'pagelines' ), 
				'type'	=> 'multi',
			
				'opts'	=> array(
					array(
						'type' 			=> 'image_upload',
						'key'			=> 'mediabox_image',
						'label' 		=> __( 'MediaBox Image', 'pagelines' ),
						'has_alt'		=> true
					),
					array(
						'type' 			=> 'text',
						'key'			=> 'mediabox_title',
						'label' 		=> __( 'Title', 'pagelines' ),
					),
					array(
						'type' 			=> 'text',
						'key'			=> 'mediabox_link',
						'label' 		=> __( 'URL', 'pagelines' ),
					),
					array(
						'type' 			=> 'textarea',
						'key'			=> 'mediabox_html',
						'label' 		=> __( 'Text and Embed HTML', 'pagelines' ),
						'help'			=> __( 'Enter rich media "embed" HTML in this field to add videos, etc.. instead of an image.', 'pagelines' )
					),
					
				)
			),
			
			array(
				'title'	=> 'MediaBox Display', 
				'type'	=> 'multi',
				'col'	=> 2,
				'opts'	=> array(
					array(
						'type' 			=> 'select',
						'key'			=> 'mediabox_align',
						'label' 		=> __( 'Text/Media Alignment', 'pagelines' ),
						'opts'			=> array(
							'center'		=> array('name' => __( 'Align Center (Default)', 'pagelines' )),
							'left'			=> array('name' => __( 'Align Left', 'pagelines' )),
							'right'			=> array('name' => __( 'Align Right', 'pagelines' )),
							'none'			=> array('name' => __( 'None', 'pagelines' )),
						)
					),
					array(
						'type' 			=> 'text',
						'key'			=> 'mediabox_height',
						'default'		=> '300',
						'label' 		=> __( 'MediaBox Min Height (px)', 'pagelines' ),
						'help'			=> __( 'Required for "cover" mode. Otherwise the mediabox will be drawn at the height of the media.', 'pagelines' )
					),
					array(
						'type'			=> 'check',
						'key'			=> 'disable_centering', 
						'label'			=> __( 'Disable Media Vertical Centering?', 'pagelines' )
					),
					array(
						'type' 			=> 'select_animation',
						'key'			=> 'mediabox_animation',
						'label' 		=> __( 'Viewport Animation', 'pagelines' ),
						'help' 			=> __( 'Optionally animate the appearance of this section on view.', 'pagelines' ),
					)
				
				)
			),
			array(
				'title'	=> 'MediaBox Background (Optional)', 
				'type'	=> 'multi',
				'col'	=> 3,
				'opts'	=> array(
					array(
						'type' 			=> 'image_upload',
						'key'			=> 'mediabox_background',
						'label' 		=> __( 'MediaBox Background Image', 'pagelines' ),
					),
				)
			),
		

		);

		return $opts;

	}

	function section_template() {

		$image = $this->opt('mediabox_image');
		$media_html = $this->opt('mediabox_html');
		$mediabox_link = $this->opt('mediabox_link');
		$disable_center = $this->opt('disable_centering');

		$title = ( $this->opt('mediabox_title') ) ? sprintf('<h3 data-sync="mediabox_title">%s</h3>', $this->opt('mediabox_title')) : '';
			
		$set_height = ( $this->opt('mediabox_height') )  ? $this->opt('mediabox_height') : 30;
		$height = sprintf('min-height: %spx', $set_height);
		


		if( $image || $media_html )
			$img = ( $this->opt( 'mediabox_image' ) ) ? $this->image( 'mediabox_image', $this->base_url.'/default.png' ) : '';
		elseif( ! $this->opt('mediabox_background') )
			$img = sprintf('<img data-sync="mediabox_image" src="%s" />', $this->base_url.'/default.png'); // DEFAULT
		else 
			$img = '';
		
		$classes = array(); 
		$align_class = array(); 
		
		$align = $this->opt('mediabox_align');
		
		if($align == 'right')
			$align_class = 'textright alignright';
		elseif($align == 'left')
			$align_class = 'textleft alignleft';
		elseif($align == 'none')
			$align_class = '';
		else
			$align_class = 'center';
		
		
		$classes[] = ($disable_center) ? '' : 'pl-centerer';
		$classes[] = ($this->opt('mediabox_animation')) ? $this->opt('mediabox_animation') : 'pla-fade';
		
		
		$html = do_shortcode( wpautop( $media_html ) );
		
		$height_sync_data = (pl_draft_mode()) ? 'data-sync="mediabox_height" data-sync-mode="css" data-sync-target="min-height" data-sync-post="px"' : '';
		
		printf(
			'<div class="mediabox-wrap %s pl-animation fix" %s style="%s">
				<div class="the-media fitvids pl-centered %s hentry">
					%s %s
					<div class="the-media-html">%s</div>
				</div>
			</div>', 
			join(' ', $classes), 
			$height_sync_data,
			$height, 
			$align_class,
			$img, 
			$title,
			$html
		);
	
		
	}
}


Share this post


Link to post
Share on other sites
James B

Hi there, using Danny and Martins option you need to add the html code into the html/text box, not via the image/media field. Example - http://screencast.com/t/wJFITuNhS

 

You won't need to copy/edit the child section code.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites

  • Similar Content

    • Lisa Haran
      By Lisa Haran+
      Hi 
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • clj182
      By clj182+
      Hello,
      I've been having trouble unlocking the template section for past couple of weeks. When I try clicking nothing happens. 
      I've deleted my custom css and removed plugins. Im down to having only the following plugins:
      Akismet
      Contact Form 7
      DMS Professional Tools
      Pagelines Updater
      WooCommerce
      It was working fine before i have no idea what's going on with it.
    • flourishdesignstudio
      By flourishdesignstudio+
      My DMS 2 site http://www.heart-stone.com/ will not save any new custom css... I can still edit templates and publish those but any custom css that I enter never saves.
      All WP files, themes, and plugins are up to date. 
      Any thought about what might be causing this?
    • flourishdesignstudio
      By flourishdesignstudio+
      Is there a way to edit the custom CSS via FTP? I know I can edit the custom code in the Chrome editor but is there a file path I can use to find and edit the CSS directly from our FTP?
      Thanks in advance for the help!
    • nizami
      By nizami+
      Using navbar section with correctly configured WP menu to display main navigation at https://elenaangel.com. 
      All fine in desktop viewport. Menu displays twice in hamburger mode. How to fix this please? 

×