-
AuthorPosts
-
June 6, 2014 at 9:03 pm #275816
Hello, I would like to copy in the homepage some functions I’ve coded, I’ve been looking for the correct file and it’s been impossible, could you please help me find which page I need to modify in order to have something like our http://www.drlawyer.com page, I need to have the information News and Publications area under the Firm Profile.
The original page is at: http://www.drlawyer.com and the one I am working right now is at http://www.drlawyer.com/prueba
The only thing missing is the News and Publications area under the Firm Profile.
June 6, 2014 at 9:34 pm #275832Hey!
You could try creating a custom shortcode for that content:
http://codex.wordpress.org/Shortcode_APIBest regards,
JosueJune 10, 2014 at 10:20 pm #277223Hello, I’ve created a shortcode, it worked perfectly, but because I am mixing css, html and php in the same function I got a big error, then I move the code to a html file and included directly into the shortcode without success, could you please help me find the better way to run this chunk of code into the homepage without sacrifying some sleep?
code:
<!– MOBILE NEWS –>
<div id=”home-news-mobile” class=”row” style=”background:#c0c0c0;margin-top: 0px;margin-bottom: 20px;width: 100%;padding:0px 0px 10px 0px;font-weight:bold;”><div style=”width:100%;height:57px;background:url(<?php echo home_url( ‘/’ ); ?>wp-content/themes/enfold/images/ga-home-newstop.png) no-repeat top right;”></div>
<ul class=”homenews scroll-pane” style=”width:90%;margin-right:20px;padding:10px;float:right;font-weight:bold”>
<?php $posts = get_posts(‘category=2&orderby=date&numberposts=20’); foreach($posts as $post) { ?>
<li style=”list-style:none;text-align:right;line-height:24px;font-weight:bold”>” target=”_parent” style=”font-weight:bold;border:thin;”><?php the_title(); ?>
<?php } ?></div>
<!– MOBILE PUB –>
<div id=”home-pub-mobile” class=”row” style=”background:#c0c0c0;margin-top: 10px;margin-bottom: 20px;width: 100%;padding:0px;font-weight:bold”><div style=”width:100%;height:51px;background:url(<?php echo home_url( ‘/’ ); ?>wp-content/themes/enfold/images/ga-home-pubtop.png) no-repeat top right;”></div>
<ul class=”homenews scroll-pane” style=”width:90%;margin:20px;padding:10px;max-height:160px;float:right;text-align:right;font-weight:bold”>
<?php wp_list_pages(‘depth=4&child_of=111&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=109&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=194&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=196&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=198&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=200&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=202&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=204&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=206&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=208&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=211&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=215&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=213&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=217&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=219&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=221&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=223&title_li=’); ?>
<?php wp_list_pages(‘depth=4&child_of=225&title_li=’); ?><?php
/*
$pages = get_pages(array(‘child_of’ => ’17’, ‘exclude’ => ‘111’, ‘parent’ => 17, ‘sort_column’ => ‘menu_order’, ‘sort_order’ => ‘ASC’));
foreach($pages as $page){
print ‘<li style=”text-align:right;line-height:24px;font-weight:bold”>ID).'”>’.$page->post_title.’‘;
}
*/
?></div>
<!– MOBILE COMMUNITY –>
<div id=”home-community-mobile” class=”row” style=”margin:20px auto;width: 100%;text-align:center;”>
<?php echo qtrans_getLanguage();?>/news/guzman-ariza-and-the-community/”>wp-content/uploads/2013/12/ga_home_community_<?php echo qtrans_getLanguage();?>.png” style=”width:260px” border=”0″ />
</div><div id=”home-news-desktop” class=”row” style=”margin-top: 10px;margin-bottom: 20px;width:100%;max-width:959px;height:292px;float: left;”>
<div class=”col-box span-7″ style=”width: 682px;height:290px;float:left;margin: 3px 15px 3px 0px;text-align:center;background:url(<?php echo home_url( ‘/’ ); ?>wp-content/uploads/2013/12/ga_home_newsh_<?php echo qtrans_getLanguage();?>.jpg);”>
<div class”holder” style=”position:absolute;top:6px;left:4px;width:460px;height:200px;border:0px solid red”>
<div id=”homepane2″ class=”scroll-pane” style=”height:275px;”>
<ul class=”homenews” style=”margin-right:20px;text-align:right;font-weight:bold”>
<?php
$pages = get_pages(array(‘child_of’ => ’17’, ‘exclude’ => ‘111’, ‘parent’ => 17, ‘sort_column’ => ‘menu_order’, ‘sort_order’ => ‘ASC’));
foreach($pages as $page) {
print ‘<li style=”text-align:right;line-height:24px;font-weight:bold”>ID).'”>’.$page->post_title.’‘;
}
?></div>
</div>
</div>
<div class=”col-box span-3″ style=”float:left;margin: 3px 0px;text-align:center;”>
</div>
Thank you for your time and patience.
June 10, 2014 at 10:35 pm #277232Hello!
You can’t do that because PHP code won’t work in a HTML file. My recommendation is to keep using the shortcode method but to clean the code (separate CSS from HTML).
If you need further help you’d need to contact a developer, please understand that this kind of requests exceed the support scope we can offer.
Cheers!
JosueJune 10, 2014 at 10:53 pm #277243Thanx,
But, Can’t I paste it directly into a Text box and place it at the frontage? or go to the home.php or index.php and drop the code?
June 10, 2014 at 10:56 pm #277246No, WordPress does not allow you to run PHP code from the post content by default, there are some plugins that may allow you to do that.
http://wordpress.org/plugins/exec-php/Cheers!
Josue -
AuthorPosts
- You must be logged in to reply to this topic.