• 0
Sign in to follow this  
Followers 0

Put code in a custom section

Question

Posted · Report post

Hej, I tried to put some code into a Custom Section. Using the code outside of the section works well - inside the section some parts (links + thumbnails) seem to be broken I set up a small test-page to show you the difference: The Custom section is located in the Content-Area. Underneath the whole page I inserted the code again, so you can see, what it's supposed to look like: http://archiv.schuldorf.org/testseite/ And here the Code of the Section:

<?php
	/*
		Section: Highlights Archiv
		Author: krafit
		Author URI: http://krafit.de
		Description: Auflistung einer, aus Custom-Fields und Post-Image zusamengesetzen Highlightsübersicht.
		Class Name: PageLinesCatArchiv
		Workswith: main, header, morefoot,
		Cloning: true
	*/
	
	class PageLinesCatArchiv extends PageLinesSection {
	
	 	function section_template(){ ?>
	
				
<?php $numberposts=1000; $categoryID=6; $count=20; // ab hier nicht mehr editieren $args = array( 'numberposts' => $numberposts,'category' => $categoryID,'orderby' => 'date' ); $all_posts = get_posts( $args ); foreach( $all_posts as $post ) : $count++; setup_postdata($post); ?> <?php endforeach; ?>
<?php } }[/code]

Share this post


Link to post
Share on other sites

5 answers to this question

  • 0

Posted · Report post

Are you trying to put this section into the main content area?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

yes I do

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

You can try using this CSS hack (to Custom Code > Custom CSS) to move the content up from below the page so that it doesn't lose its formatting: [code]div.vorschaucontent {margin-top: -550px; z-index: 1; margin-left: 160px; position: absolute;}[/code]

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

@catrina - I thought of something like too. But since its some kind of quick and dirty solution I would prefer getting the section working. Could it be possible that the Loop of the page somehow collides with my code? If I'm right with this there might be a fix for that...(?)

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Maybe, but I'm not certain. I'm not a php expert but I'll try to take a closer look at it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0