-
AuthorPosts
-
legalgrind Friend
legalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 2, 2011 at 8:42 am #170298I want to pull some WordPress (installed separately on same host) excerpts for homepage. To do this I need to put some php code at the very top of the homepage. How do I do that?
This must go at the very top of the homepage.
Below (with correct path to the blog & # of entries) goes at the very top of the homepage.
<?php
// Include WordPress
define(‘WP_USE_THEMES’, false);
require(‘./blog/wp-load.php’);
query_posts(‘showposts=4’);
?>Below goes in the body of the page where the entries will be displayed – the current ‘blog’ modules will have to be changed. How do I get the right module for that? Below will display as many excerpts as I choose by above snippet.
<?php while (have_posts()): the_post(); ?>
<p class=”greenTitles14Lft”><?php the_title(); ?></p>
<?php the_excerpt(); ?>
<p><a href=”<?php the_permalink(); ?>”>Read more…</a></p><br />
<?php endwhile; ?>Thank you for your help!
Blaine FriendBlaine
- Join date:
- August 2007
- Posts:
- 1443
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 98
- Thanked:
- 177 times in 154 posts
November 10, 2011 at 2:47 am #423927Hi legalgrind!
it would be best to implement an extension to integrate any WordPress into Joomla.
If you just want to integrate PHP into Joomla, let me know the version of Joomla being used.legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 10, 2011 at 4:24 pm #424072I do no know php at all … but I have used the above code to do exactly what I want on normal static sites. We have Version 1.7.0
Thank you for your help!
Blaine FriendBlaine
- Join date:
- August 2007
- Posts:
- 1443
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 98
- Thanked:
- 177 times in 154 posts
November 11, 2011 at 5:00 am #424149<blockquote>I do no know php at all … but I have used the above code to do exactly what I want on normal static sites. We have Version 1.7.0</blockquote>
Hi legalgring!
First think i recommend is to update the Joomla site to 1.7.2, which can be found here. I am big on keeping sites updated with templates, Joomla version and all extensions. Not only will this help the site to run it’s best, it will also provide a more secure environment for the site.
Joomla works a bit differently.
Although built with PHP, Joomla has different ways to implement items and the way you wish to use the info might be helpful in deciding which direction to steer you in. That said, there are many extensions available on Joomla.org to help you to place the PHP code above where you wish in the site.
Joomla is based on module posionms. Do you have a module position available at the location you wish to place the code?
If you have an available module position in the location you desire, you can always add custom PHP using one of these great extensions offered at Joomla.org
Best of luck with your customization! Let me know if you need any more help.1 user says Thank You to Blaine for this useful post
legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 11, 2011 at 9:50 am #424208Thank you so much.
I will keep this thread open until I do above upgrade and explore the extensions.
I think I should also explore the Park Blog in the sample site included with ja_portfolio. Perhaps the blog will be ok and there might even be a module for ‘latest posts’ included. Having a new blog within the template is OK for us too.
Again, thank you!
tfosnom Friendtfosnom
- Join date:
- October 2010
- Posts:
- 742
- Downloads:
- 0
- Uploads:
- 31
- Thanks:
- 145
- Thanked:
- 200 times in 94 posts
Blaine FriendBlaine
- Join date:
- August 2007
- Posts:
- 1443
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 98
- Thanked:
- 177 times in 154 posts
November 11, 2011 at 5:49 pm #424262@ legalgrind~ See if this page helps you to find what you need.
@ tfosnom~ glad your with us for another year! 😀
@ALL~ There are several plugins available that try to provide blogging integration for Joomla. Here is one to consider if it will meet your needs.
Not sure what versions of Joomla it is ready for yet.legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 12, 2011 at 12:25 pm #424357If I do it this way (by using my own code), the following must go at the very top of the page – not in any module – it must be a the very top of the file, before ANYTHING else.
<blockquote><?php
// Include WordPress
define(‘WP_USE_THEMES’, false);
require(‘./blog/wp-load.php’);
query_posts(‘showposts=4’);
?></blockquote>The rest of it goes where I want it on the page = main_content module.
None of the extensions on page you recommend above (http://extensions.joomla.org/extensions/edition/custom-code-in-modules) show ability to get to the very top of the page. Plus I do not know how to reach the main_content module either. But I could probably use the article that is there right now.
So maybe this is just a bad idea and I should be looking for an alternative, as you recommend below. That’s OK but above way just seems so simple.
legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 12, 2011 at 12:35 pm #424360I like Easy Blog from the page you recommended
<blockquote>@ legalgrind~ See if this page helps you to find what you need.</blockquote>But I am not sure I can accomplish my goal, which is to pull excerpts from the latest 2 blog posts on the homepage in main_content module. See: http://legalgrind.powweb.com/joomla/
I would be very happy to purchase the subscription to Easy Blog if it would do that.
Can you tell if it does? Or should I leave a pre-sales question to support on their website?
Thank you!
Blaine FriendBlaine
- Join date:
- August 2007
- Posts:
- 1443
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 98
- Thanked:
- 177 times in 154 posts
November 13, 2011 at 5:57 am #424422Hi legalgrind!
I understand you want that at the top of the page but Joomla is based on positions and with out a position added to the top, a module position, it won’t matter where you include the code, it will have no where to show.
Please review this Joomla.org documentation on module positions and see if this clarifies anything for you
Thanks!1 user says Thank You to Blaine for this useful post
legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 13, 2011 at 10:31 am #424462I did read the documentation you reference above. It appears there is no way to add code before the body, or even head, tags.
My next step is to explore the Easy Blog plug-in you turned me on to, to see if it offers a way to pull excerpts from the latest blog posts, to display in the main-content module on our homepage. That is my goal.
I will keep this thread open until I solve my problem.
Thank you for your help.
Blaine FriendBlaine
- Join date:
- August 2007
- Posts:
- 1443
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 98
- Thanked:
- 177 times in 154 posts
November 14, 2011 at 4:58 am #424527Hi legalgrind!
I can instruct you on how to add the code to the page.
I think you are not understanding that with out a module position in the area you want, that the information you are trying to pull in will not be displayed on the site.
Am I misunderstanding what you wish to do?
The template works by adding Joomla code into module positions and the component section in your template.
Thanks and do let me know if you need further help in understanding this! I am always happy to help!legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 14, 2011 at 10:03 am #424566Yes, you are right in understanding what I want to do.
My first problem with this is to understand how I ‘get’ to the content-main module of the home page. That is where I want to display the excerpts from the latest posts. I do not find that module in the position pop-up from the module manager.
Next, I do not understand how I put php code at the very top of the page – not the body – before the head tags, merta tags and document declarations. It must be at the top of the file.
If I could understand those 2 things I think I could do it.
Thank you so very much; your help is appreciated.
By the way, I did get a response back from support at Easy Blog, and they tell me they could do it with a hack in their app. But I prefer to do it with my existing wordpress blog, as above, if you can teach me.
Again, thank you so very much!
Blaine FriendBlaine
- Join date:
- August 2007
- Posts:
- 1443
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 98
- Thanked:
- 177 times in 154 posts
November 15, 2011 at 4:21 am #424673Hi legalgrind!
I look back and I remember how difficult I first found Joomla! WOW, was I overwhelmed.
I think this link will be of benefit to you.
Please read it. Then get back to me.
Thanks!1 user says Thank You to Blaine for this useful post
legalgrind Friendlegalgrind
- Join date:
- July 2011
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 32
- Thanked:
- 2 times in 1 posts
November 15, 2011 at 11:14 am #424730Thank you for understanding how Joomla! can be a bit overwhelming to a beginner.
While I have not followed every link on your above referenced documentation, I did read most of the pages. The first thing I noticed was in this documentation there is a reference to a front page manager.
<blockquote>Select Content → Front Page Manager from the drop-down menu on the back-end of your Joomla! installation. Or click on the ‘Front Page Manager’ button in the Control Panel screen.
Front-page-manager-button.png</blockquote>
I do not have that option and that is what I am trying to access.
It also references ‘Sections’ and I do not have that option either, although I have organized our site with categories. I created a site with 100+ new articles and changed & added menus, contacts, and css rules. I have organized media, although I cannot figure out how to upload and link a zip file for downloads. (Should I just upload via ftp and link in html mode?)
By no means do I feel confident (obviously!) with Joomla! however. And it must be noted that I have had a lot of moderator help getting this far (for which I am very grateful – joomlart support is excellent!).
So I am still questioning how to get to the content-main module on the homepage and how I place php code before the declarations on the home page.
Can you be more specific regarding where I should look in the documentation, to solve this problem?
I really appreciate your help; thank you!
-
AuthorPosts
This topic contains 21 replies, has 3 voices, and was last updated by Blaine 13 years, 1 month ago.
We moved to new unified forum. Please post all new support queries in our New Forum