• Resolved cyrjm

    (@cyrjm)


    I generally work with premium themes and get good, solid support from the developers (in this case, Elegant Themes). I’m making an attempt at “hacking” together some php to create a specific page and am almost there. I don’t have the know how nor do I expect the developers to support questions I have about doing this kind of stuff. I’ve learned a lot just poking around with it today.

    Is there a good resource on the web where I can post questions about php specifically geared towards php that’s beginner friendly? I would post here but didn’t really see a forum that would fit my question.

    Thanks!
    JC

Viewing 11 replies - 1 through 11 (of 11 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Don’t try PHPFreaks unless you’re desperate. Their forum volunteers are not nice.

    JC,

    First, kudos to you for getting started with PHP and learning on your own. That is never easy.

    A good WordPress related forum for help with PHP code would be WordPress Answers.

    Thread Starter cyrjm

    (@cyrjm)

    Yeah, thanks! I find myself hancuffed when I’m doing work for clients…I have the vision but not always the means to pull the design off. I will check that site out Rachel.

    Cheers!

    JC

    Totally post here too if you want, I would love to answer some actual php questions.

    No problem. Also, I agree with Andrew. You are welcome to post here as well, I love helping with PHP/code related questions.

    Thread Starter cyrjm

    (@cyrjm)

    In case anyone may be interested, here’s my question:

    Thread Starter cyrjm

    (@cyrjm)

    Oh man, that would be awesome. I’m sure it’s super simple and I’ll echo what I just posted at WordPress Answers.

    So, I’m customizing an Elegant Themes theme to make it into a one page/landing page for my client. I’ve basically taken a piece from a different php file and have added it to their home.php file and for the most part it looks good (well, it’s a work in progress so…). I’ve been able to pull in elements from other pages and insert them in specific locations on home.php with success today (I’m kind of stoked about!). However, this one thing is driving me crazy.

    Check out this page and see how it’s repeating at the bottom, just before the footer…I’ve tried to pull lines of code through trial and error and I can’t get it (the repeating elements) to dissapear. When I inspect the elements in Firefox I can see the div repeating itself.

    So, here’s the php code (again, it may make your eyes bleed so be gentle, first time doing this):

    <?php get_header(); ?>
    
    <?php if ( get_option('mycuisine_blog_style') == 'false' ) { ?>
    	<?php if ( get_option('mycuisine_quote') == 'on' ) { ?>
    		<div id="quote">
    			<div class="container">
    				<div id="quote-shadow"></div>
    				<p id="quote-line-1"><?php echo get_option('mycuisine_quote_line1'); ?></p>
    				<p id="quote-line-2"><?php echo esc_html(get_option('mycuisine_address')); ?></p>
    			</div> 	<!-- end .container -->
    		</div> <!-- end #quote -->
    	<?php } ?>
    
    	<div class="container fullwidth">
    
    	<div id="content" class="clearfix">	
    
    		<div id="left-area">
    
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    			<div id="location-left-area">
    
    				<div class="info-block">
    
    					<h2 class="category_name"><?php esc_html_e('Address','MyCuisine'); ?></h2>
    
    					<?php echo esc_html(get_option('mycuisine_address')); ?>
    
    				</div> <!-- end .info-block -->
    
    				<div class="info-block">
    
    					<h2 class="category_name"><?php esc_html_e('Hours Of Operation','MyCuisine'); ?></h2>
    
    					<p><?php esc_html_e('Monday-Saturday:','MyCuisine'); ?> <span><?php echo esc_html(get_option('mycuisine_mon_fri')); ?></span></p>
    
    					<p><?php esc_html_e('Sunday:','MyCuisine'); ?> <span><?php echo esc_html(get_option('mycuisine_sat_sun')); ?></span></p>
    
    				</div> <!-- end .info-block -->
    
    				<div class="info-block">
    
    					<h2 class="category_name"><?php esc_html_e('Contact Info','MyCuisine'); ?></h2>
    					<p><?php esc_html_e('Telephone:','MyCuisine'); ?> <span><?php echo esc_html(get_option('mycuisine_telephone')); ?></span></p>
    
    				</div> <!-- end .info-block -->
    
    				<?php do_action('et_location_additional_info'); ?>
    
    			</div> <!-- end #location-left-area -->
    
    			<div id="gmaps-border" class="location-page">
    
    				<div id="gmaps-container"></div>
    
    			</div> <!-- end #gmaps-border -->
    
    			<script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3.1&sensor=false"></script>
    
    			<script type="text/javascript">
    
    			  //<![CDATA[
    
    			  var map;
    
    			  var geocoder;
    
    			  initialize();
    
    			  function initialize() {
    
    				 geocoder = new google.maps.Geocoder();
    
    				 geocoder.geocode({
    
    					'address': '<?php echo esc_js(get_option('mycuisine_address')); ?>',
    
    					'partialmatch': true}, geocodeResult);   
    
    			  }
    
    			  function geocodeResult(results, status) {
    
    				 if (status == 'OK' && results.length > 0) {         
    
    					var latlng = new google.maps.LatLng(results[0].geometry.location.b,results[0].geometry.location.c);
    
    					var myOptions = {
    
    					   zoom: 15,
    
    					   center: results[0].geometry.location,
    
    					   mapTypeId: google.maps.MapTypeId.ROADMAP
    
    					};
    
    					map = new google.maps.Map(document.getElementById("gmaps-container"), myOptions);
    
    					   var marker = new google.maps.Marker({
    
    					   position: results[0].geometry.location,
    
    					   map: map
    
    					});
    
    					var contentString = '<div id="et-gmaps-content">'+
    
    					'<div id="bodyContent">'+
    
    					'<p><a target="_blank" href="https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q='+escape(results[0].formatted_address)+'&ie=UTF8&view=map">'+results[0].formatted_address+'</a>'+
    
    					'</p>'+
    
    					'</div>'+
    
    					'</div>';
    
    					var infowindow = new google.maps.InfoWindow({
    
    					   content: contentString,
    
    					   maxWidth: 100,
    
    					   maxHeight: 200
    
    					});
    
    					google.maps.event.addListener(marker, 'click', function() {
    
    					   infowindow.open(map,marker);
    
    					});
    
    					google.maps.event.trigger(marker, "click");
    
    				 } else {
    
    					//alert("Geocode was not successful for the following reason: " + status);
    
    				 }
    
    			  }
    
    			  //]]>
    
    			</script>
    
    			<?php do_action('et_location_content'); ?>
    
    		<?php endwhile; endif; ?>
    
    		</div> 	<!-- end #left-area -->
    
    	</div> <!-- end #content -->
    
    	<div id="bottom-shadow"></div>
    
    </div> <!-- end .container -->
    <?php } else { ?>
    	<div class="container">
    		<div id="content" class="clearfix">
    			<div id="left-area">
    				<?php get_template_part('includes/entry','home'); ?>
    			</div> 	<!-- end #left-area -->
    
    			<?php get_sidebar(); ?>
    		</div> <!-- end #content -->
    		<div id="bottom-shadow"></div>
    	</div> <!-- end .container -->
    <?php } ?>
    
    <?php get_footer(); ?>

    Let me know what you think. Again, not familiar with php but I’m guessing that extra spaces or characters can make things go wacky? Here’s a link to Pastebin too.

    Thanks for the help!

    Jay C.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    So, I’m customizing an Elegant Themes theme to make it into a one page/landing page for my client.

    Not really the right place for this question: we don’t support Elegant Themes here. We don’t have access to the theme files (don’t want access either).

    Try asking at the Elegant Theme’s support location.

    https://www.elegantthemes.com/members-area/

    Or if you are using a plugin for that functionality which one?

    Thread Starter cyrjm

    (@cyrjm)

    Thanks Jan, I don’t expect this kind of support from Elegant Themes and their support otherwise is awesome. If you read the previous responses here, they seem more than willing to help since this is more about me trying to learn why my modifications are not working and me getting elbow deep into php. I am a paid member at Elegant (developer’s license) and am not here to mooch off people more knowledgeable than me. I just want to learn and that’s why I asked the original question. Seems like Rachel is helping me out at WordPress Answers too…

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    My input was more of a “Not much we can/may do here for reasons of not having access to the theme” reply then anything else.

    If someone (Rachel’s really good) helps you here that’s fine and will not be discouraged. But there are limits to what can realistically offered here and I do hope you are also pinging the Elegant Themes forum in parallel.

    Thread Starter cyrjm

    (@cyrjm)

    Yeah, no worries Jan. I guess my thing is that I was trying to learn the inner workings of php that I thought weren’t really pertinent to the fact I’m working with code from Elegant Themes. I just thought this was a “general” php question.

    I realize that theme developers only offer a certain level of support, and I get that. I didn’t even want to post this over there because I am essentially taking 2 elements of this theme and trying to make them into what I want them to be, something most theme devs do not officially support. This is my first time diving into php and surprised I made it this far!

    Anyways, Rachel helped me get it sorted and it turns out it was something super basic. That’s how I learn…spend hours banging my head against my desk and then when I find out how’s it done, I’ll remember it forever. I hope. Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Good PHP Forums?’ is closed to new replies.