The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> single.php not loading sidebar
JCKnoell
post Mar 3 2014, 02:52 PM
Post #1


Member
***

Group: Members
Posts: 52
Joined: 26-June 13
Member No.: 19,351



For my WordPress site, beta.cleantelligent.com , I have a blog which has a custom sidebar. (sidebar-blog.php)

When you click on a single post (single.php), the sidebar goes away, even though it is correctly coded into the php.

http://pastebin.com/sRE1GV1W - Single.php
http://pastebin.com/Q6ej6qM5 - sidebar-blog.php

Is there any idea why this isn't showing up? I'm not super proficient when it comes to editing functions.php, so if it involves that, please explain it in simple terms and specifically.

Thank you!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 3 2014, 03:59 PM
Post #2


.
********

Group: WDG Moderators
Posts: 8,277
Joined: 10-August 06
Member No.: 7



QUOTE(JCKnoell @ Mar 3 2014, 08:52 PM) *

I don't see any sidebar-blog.php being mentioned in the code example above.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Mar 4 2014, 12:00 PM
Post #3


This is My Life
*******

Group: Members
Posts: 1,125
Joined: 24-August 06
From: t-dot
Member No.: 16



It looks right.

get_sidebar('blog') function should retrieve sidebar-blog.php http://codex.wordpress.org/Function_Reference/get_sidebar

Maybe something in the sidebar code itself . . . the jQuery hide function?
Or put the sidebar just before the footer . . . usually you see the following in single.php
get_sidebar();
get_footer();

You said it goes away on single.php, do you mean it displays properly on for instance page.php?

Can't comment on function.php without seeing it.

This post has been edited by jimlongo: Mar 4 2014, 12:13 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 4 2014, 02:37 PM
Post #4


.
********

Group: WDG Moderators
Posts: 8,277
Joined: 10-August 06
Member No.: 7



QUOTE(jimlongo @ Mar 4 2014, 06:00 PM) *

It looks right.

get_sidebar('blog') function should retrieve sidebar-blog.php http://codex.wordpress.org/Function_Reference/get_sidebar

How is that done? It looks like an ordinary PHP function call, but to a function that doesn't exist in Single.php. Could the function be part of some PHP code included by get_header()?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Mar 4 2014, 02:39 PM
Post #5


This is My Life
*******

Group: Members
Posts: 1,125
Joined: 24-August 06
From: t-dot
Member No.: 16



Wordpress has hundreds or more functions of its own.

https://codex.wordpress.org/Function_Reference
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 4 2014, 07:29 PM
Post #6


.
********

Group: WDG Moderators
Posts: 8,277
Joined: 10-August 06
Member No.: 7



But Wordpress isn't the PHP module (which contains all the predefined PHP functions), it's just written in PHP, right? So all those Wordpress functions must be included in the PHP code somehow. unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Mar 4 2014, 07:38 PM
Post #7


This is My Life
*******

Group: Members
Posts: 1,125
Joined: 24-August 06
From: t-dot
Member No.: 16



No, those are all custom functions that exist in the wordpress core. They are written in PHP, but they only exist in Wordpress.

Wordpress is fairly simple in structure. There are a dozen files in the root directory. There is wp-content, wp-admin and wp-includes directories. Only the files in the wp-content should ever be edited by users - this is where themes, plugins, javascript and customizations occur.

If you read the documentation on any of those functions in the wordpress codex I linked to earlier, it will tell you what file they originate in, and you can see what how the function and any classes it uses are composed.

Drupal has much the same construct, custom functions written in PHP that can only be accessed in a Drupal installation.

It is quite a powerful and very deep framework.

This post has been edited by jimlongo: Mar 4 2014, 07:39 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 4 2014, 10:37 PM
Post #8


.
********

Group: WDG Moderators
Posts: 8,277
Joined: 10-August 06
Member No.: 7



QUOTE(jimlongo @ Mar 5 2014, 01:38 AM) *

No, those are all custom functions that exist in the wordpress core.

That's what I meant (I think): isn't this "Wordpress core" just a PHP script library (analogous to e.g. jQuery)? In that case WP's readymade functions must be included in the PHP document with e.g. get_header() before the PHP module can parse the code.

(Compare this with the PHP module: it too contains predefined functions like htmlspecialchars(), but they are part of the PHP module itself, not part of any included script library, so they're not included in the actual PHP code.)

QUOTE
It is quite a powerful and very deep framework.

I've only seen the HTML it outputs. mellow.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Mar 5 2014, 01:31 AM
Post #9


This is My Life
*******

Group: Members
Posts: 1,125
Joined: 24-August 06
From: t-dot
Member No.: 16



QUOTE(Christian J @ Mar 4 2014, 10:37 PM) *

QUOTE(jimlongo @ Mar 5 2014, 01:38 AM) *

No, those are all custom functions that exist in the wordpress core.

That's what I meant (I think): isn't this "Wordpress core" just a PHP script library (analogous to e.g. jQuery)? In that case WP's readymade functions must be included in the PHP document with e.g. get_header() before the PHP module can parse the code.

(Compare this with the PHP module: it too contains predefined functions like htmlspecialchars(), but they are part of the PHP module itself, not part of any included script library, so they're not included in the actual PHP code.)


The inclusion of all the necessary files happens in the core files that the user is not supposed to be concerned with. So the fact you didn't see any includes in the templates may be misleading you. If you download the files you could see the core structure and probably satisfy your question, i can't find a good explanation of it anywhere, most searches for wordpress anatomy are explaining theme anatomy, not core.

QUOTE

QUOTE
It is quite a powerful and very deep framework.

I've only seen the HTML it outputs. mellow.gif

You might like it. The base HTML should validate.
It's generally bad plugins that will lead one from the true path.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
JCKnoell
post Mar 7 2014, 01:48 PM
Post #10


Member
***

Group: Members
Posts: 52
Joined: 26-June 13
Member No.: 19,351



Okay, some of these comments were a little over my head... if you need it, here's my functions.php:
http://pastebin.com/pPRzhDhj

I don't know what's causing it. Yes, the single.php DOES call the sidebar-blog... but it's not there when you click on a single post.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 7 2014, 03:40 PM
Post #11


.
********

Group: WDG Moderators
Posts: 8,277
Joined: 10-August 06
Member No.: 7



Maybe it's just hidden with CSS or javascript? Look in the source of the live page and see if it's included.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Mar 7 2014, 04:01 PM
Post #12


This is My Life
*******

Group: Members
Posts: 1,125
Joined: 24-August 06
From: t-dot
Member No.: 16



It looks like it might be a widget. "secondary blog"
Can you look in the Appearance>Widgets and see if there's anything.

Also to troubleshoot this can you temporarily put this in your themes header.php at the top of the body to confirm which templates are used at each point.

CODE
<?php  var_dump(get_page_template()); ?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th January 2020 - 05:05 PM