Forum

Please make sure that you have read the documentation and extensive resources provided on this site before posting your question!

Dynamic Content Gallery Resources

DCG Version 4.0 beta is now available for download and testing. This is a development version and not recommended for live sites. Read more here.

Note that the current stable release of the DCG is version 3.3.5.

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 3 characters - maximum search word length is 84 characters

Topic RSS
Placing the in the home.php
Status: closed
October 9, 2011
1:25 am
seth
Member
Forum Posts: 7
Member Since:
October 9, 2011
Offline

I'm tearing my hair out!
Unbelievably poor documentation. I'm trying to place this code:
?php dynamic_content_gallery();
in my home.php to start-up this plugins display on my home page. In the configuration documentation, it says:
"…the answer is simple – place the code in an appropriate place in home.php."

I'm using Genesis plus a child theme, which does have a home.php file. It's a short enough code, but the above line assumes that we non-coders know where "an appropriate place" in the code is. Since the documentation doesn't actually tell us what that appropriate place might look like, I have tried placing it in 6 or 7 different spots at random. None have worked to display it, and all break the code of my home page with a parsing error:

Parse error: syntax error, unexpected '<' in /home/stuart2/public_html/wp-content/themes/lifestyle/home.php

C'mon guys, lots of us aren't coders, you can't just sat "an appropriate place," that's lame. Tell me exactly where to put this please. Thank You

October 9, 2011
11:45 am
Ade
Admin
Forum Posts: 2493
Member Since:
August 25, 2008
Offline

Hmmm… I think you should be aiming your frustration at Genesis rather than me, frankly. I provide a huge amount of documentation, but it cannot and will not account for every possible theme out there and yes, I assume that users have basic coding knowledge.

I have tried placing it in 6 or 7 different spots at random

Of course it will break if you add code at random.

Are you using Lifestyle 1.0 or Lifestyle 2.0? Their home.php's are coded differently.

Dynamic Content Gallery: Have you read the Configuration Guide and FAQ?
October 10, 2011
6:15 pm
seth
Member
Forum Posts: 7
Member Since:
October 9, 2011
Offline

Thanks for responding Ade.

I am using Lifestyle 2.0

I got the DCG to display on my home page by placing it here:

http://screencast.com/t/1K2mHM1mMk

<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'lifestyle_home_loop_helper' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function lifestyle_home_loop_helper() {
dynamic_content_gallery();
if ( is_active_sidebar( 'home' ) || is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-right' ) ) {

if ( is_active_sidebar( 'home-left' ) ) {
echo '

';
dynamic_sidebar( 'home-left' );
echo '

';

It kept giving me syntax errors for the "<" symbols and the ?php, so as you will notice, I had to truncate those things off and just enter dynamic_content_gallery();, then it worked.

Even though the DCG is displaying properly, my lack of coding knowledge and the fact that I had to alter your original coded so much, makes me worried that the code in my home.php isn't "clean" and possibly bad for SEO.
So now that you know my these is Lifestyle 2.0, perhaps you can tell me if there's anywhere in the home.php which is more correct placement, and where I can enter your entire line of code, not a chopped-off version.

Thanks for your time.

October 10, 2011
11:17 pm
Ade
Admin
Forum Posts: 2493
Member Since:
August 25, 2008
Offline

It kept giving me syntax errors for the "<" symbols and the ?php, so as you will notice, I had to truncate those things off and just enter dynamic_content_gallery();, then it worked.

Yes, it would do so because the php opening tag is already present a little higher up the page. If you are already within PHP tags, you don't add the PHP tags again.

So now that you know my these is Lifestyle 2.0, perhaps you can tell me if there's anywhere in the home.php which is more correct placement, and where I can enter your entire line of code, not a chopped-off version.

Your code placement is absolutely fine. Perfect, in fact.

Thanks for your time.

You're welcome.

Dynamic Content Gallery: Have you read the Configuration Guide and FAQ?
October 10, 2011
11:38 pm
seth
Member
Forum Posts: 7
Member Since:
October 9, 2011
Offline

Thanks very much Ade

"It kept giving me syntax errors for the "<" symbols and the ?php…"

"Yes, it would do so because the php opening tag is already present a little higher up the page. If you are already within PHP tags, you don't add the PHP tags again."

See, now that's the kind of thing us non-coders simply wouldn't know. Personally, I think tons of Wordpress users don't know much CSS or .php code…that's one of the main reasons Wordpress and plugins were invented in the first place…so non-coders could quickly put up very professional looking blogs.

Knowing that, I would suggest that, in the place where you say "…the answer is simple – place the code in an appropriate place in home.php.", you add, "If you don't know about php tags or aren't sure where to put this line, here's some examples (show examples) or here's a link to a .php tutorial (show link) or ask me on the forum."

We're just Wordpress bloggers trying to fancy up our sites with a cool plugin. When you say "Just place this code in your home.php" without more guidance, I think you assume too much…just my two centsLaugh

But you do give tons of documentation and I appreciate your time responding to me about this. Thanks

October 11, 2011
1:04 pm
Ade
Admin
Forum Posts: 2493
Member Since:
August 25, 2008
Offline

Hi Seth,

I can't resist responding to some of your points… Smile

Frankly, I think the success of self-hosted WP obscures the fact that it is not a code-free web site creation environment – and I dount it ever will be. I also disagree that themes and plugins were invented for this purpose – they were invented, and continue to be written, to give functionality that wasn't available "out of the box" in core WP. Modern themes, including theme frameworks like Genesis, have helped to remove a lot of coding (especially if using a non-customised child theme), but any customisation – including incorporating a plugin's template tag – will mean having to deal with PHP.

Finally, a point that just occured to me, why didn't you just use the DCG Widget instead of using the template tag? You wouldn't have had to do any coding at all. Smile

Dynamic Content Gallery: Have you read the Configuration Guide and FAQ?
October 12, 2011
3:16 am
seth
Member
Forum Posts: 7
Member Since:
October 9, 2011
Offline

I actually did try to drag the DCG Widget into my widgets. Obviously, I didn't want to drag it into one of the sidebar widgets, and in many themes there are no widget dropdowns for the body content area, just sidebar widgets.

But in Genesis>Lifestyle, there are 3 widget areas that relate to the body area of the page – Home, Home Left and Home Right. I tried dropping the DCG widget in each one…and everytime, even though the DCG displayed properly under my header, it also wiped out all the content and post excerpts that had been on the home page, leaving just blank white-space there. Those things were displaying fine on the page prior to dragging the DCG widget into place, and as far as I know, I didn't do anything weird to my body content area code to cause any conflict.

So I had to try the .php code. I'm glad I "stumbled" into the perfect truncation of your code line and the perfect placement of it Laugh. But even though I agree with your assessment that erecting a Wordpress blog is not always code-less work, and therefore it's good for even code-o-phobes to learn some basic CSS and php, you still could put a little more guidance in your code-placement instructions than just "– place the code in an appropriate place in home.php." I think my suggestions above are simple to add to your documentation and will be helpful to a lot of people…don't you want to be more helpful and clear if you can be Wink?? OR do you just want to argue about how much code we should all know before we venture into basic blog creation and plug-in adds.

Keep in mind there are many, many themes these days, already complete with slider carousels and other design-enhancing plugins, that have so many option tabs right there in the wp-admin dashboard (even TwentyTen/Weaver has this,) you can build a very beautiful and flashy site without ever going into the CSS or php. More & more people are getting used to this type of theme & dashboard interface, so it's likely you will keep running into bloggers who just never learned much code and need more than "just drop this in an appropriate place in your code." Have a little compassion for us and make it clearer…or don't…it's your call.Laugh

Forum Timezone: UTC 1

Most Users Ever Online: 28

Currently Online: nloronacele
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

johnbroome: 13

speedyp: 12

sjpeaches: 12

CherylMcL: 10

gscorp: 8

lsnoei: 8

Member Stats:

Guest Posters: 770

Members: 1300

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 7

Topics: 980

Posts: 4299

Newest Members: jochris26, eva-aa, Tushar, chargers3, jwhetstone, robert

Moderators:

Administrators: Ade (2493)