Modifying and Existing Drupal Theme - php

The theme I am using has a slider -- a panel of automatically changing images to display a topic that the user can choose -- but it only shows a few slides. I want to extend it to a dozen slides. I did simple text searches to determine which files in the theme are used code files to provide the functionality to the slider. That was the easy part. I was able to extend the code from the few slides to 12 slides.
Now comes the more difficult and hidden part. As I see it, each slide has two parts that are not hardcoded. First, each slide has a caption -- a text description. Secondly, each slide has a URL associated with it that is where the browser goes if the user clicks on the slide. These two things are not hardcoded in any of the PHP or other files, as far as I can tell. They can be edited by the admin in the Drupal backend admin settings.
So I assumed that these fields are somehow set and retained in the database. But I did a search on a downloaded copy of the database and I did not find this text.
Please advise. What additional work do I need to do to complete this task?
I suppose I could just forge ahead. Obviously, this data is being stored somewhere. Maybe they are stored in the database in an encrypted form for security reasons. I could do an FTP upload of the site theme files. But then what? Do I uninstall the theme and then reinstall it? Do I just deactivate it and then reactivate it? How do I make my code changes work?
The theme is called "impact_theme" and as far as I can tell all the code for it resides in
sites\all\themes\impact_theme
The README.txt file for the theme is:
About Impact Theme
====================
Impact Theme is a Drupal 7 theme. The theme is not dependent on any
core theme. Its very light weight for fast loading with modern look.
Simple and clean design
Drupal standards compliant
Implementation of a JS Slideshow
Multi-level drop-down menus
Footer with 4 regions
A total of 10 regions
Compatible and tested on IE7, IE8, IE9+, Opera, Firefox, Chrome browsers
Browser compatibility:
=====================
The theme has been tested on following browsers. IE7+, Firefox, Google Chrome, Opera.
Drupal compatibility:
=====================
This theme is compatible with Drupal 7.x.x
Developed by
============
www.devsaran.com
Slideshow photos by http://www.flickr.com/photos/68666702#N00/
Help and Support Us
=====================
Please consider a small donation
Paypal ID : donation#devsaran.com
============================================================================
I made a subtheme according to this page: https://www.drupal.org/docs/7/theming/creating-a-sub-theme.
I logged in to the Administrative Dashboard and I made the subtheme as the default theme.
And then the website immediately crashed and I am unable to see anything apart from "HTTP ERROR 500".
What do you think I should do now?
For completeness sake, I will list here the screenshots I made when I was comparing my modifications to the original theme.
I am thinking what I should do now is try to step back and see if I can narrow down the point where the website crashes. But in order to do that, I wonder if it will do any good to just modify the files. I mean, the subtheme is already set as the default theme. How can I undo that without being able to log into the Admin Dashboard?

First, slides are stored in theme settings, so you should go to Appearance -> Your Theme -> Settings to edit them. That's however not very good way to store the variables that shouldn't have definitive number of values. Also slides are more site content then theme settings.
I would define new content type called "Slide" or something, add all the values one slide needs (picture field, description, link...) and use the View to collect those values - loop over them. That way you can have any number of slides. You can also add some field for ordering slides etc.
Also, I wouldn't use picture field directly (to display image uploaded by admin), but I would add image style for slide, to scale that image to proper dimensions. That makes life much easier for admin - he doesn't have to use some image editing tool to scale each image manually.
That's my suggestion - what I would do.
Second, site is "made" of files and database, so any content it displays must be in one of those two parts.
And third, start from just inheriting the them and see will it work and then change it step by step, so you can notice easier what causes the problem. Also if base theme is not public one (it won't get updates and so) you can change it directly.
And about error 500 - error can be logged or displayed. Run phpinfo() to see where is php.ini file. Edit it and allow at least error login. Or for you development environment even better allow error displaying.

Related

Wordpress Preview shows wrong Template

Recently, when I view a page in Wordpress Preview mode, it always loads the default template (theme page.php file) whereas when I look at the published page, it's the right template. I have around 10 different templates for my pages. Just keep in mind that I'm not talking about the theme itself, but the Wordpress template structure. I included three pictures. The admin panel one, shows different templates for my page.As shown, I chose Fixed-Width Clean Page. The second picture shows the page in Preview mode.As you can see it includes a sidebar which is included in the default template but not the one that I chose. And the last picture is the Live view of the website which is correct. As you can see the sidebar doesn't exist. I searched all over the internet and did some suggestions, but none of them work (like saving the permalinks again, changing the theme and changing it back again, etc). The only change that I recently made was upgrading to Wordpress 4.7.4 and blocking access to admin panel by ip using .htaccess file (I removed the .htaccess file, but still no luck). Any suggestions would be appreciated.
OK, after some time I figured out what the problem was. The "WP Subtitle" plugin version 2.9, breaks the preview functionality if you have multiple templates. I report the issue to them as well, but posted the answer if somebody came across the same problem. In order to fix the issue temporarily, i commented out the below line (line 74) on the plugin's main file (wp-subtitle.php):
//add_filter( 'the_preview', array( 'WPSubtitle', 'the_preview' ), 10, 2 );

Eliminating WordPress Error "Hello world! Please change me in Site Preferences -> This Category/Section -> Lower Description Bar"

I inherited some unfinished website from another developer on WordPress 4.2.2 running the Wise Guys theme. On other pages, the Lower Description Bar shows great quotes from people, but on a specific page (the gallery page) it shows these words... Hello world! Please change me in Site Preferences -> This Category/Section -> Lower Description Bar. Obviously it looks ugly.
I am not a great WordPress user myself, I prefer Joomla, but my client is needing his site to work right in WordPress.
I've got a few questions in this regard:
1) How do I tell the Category/Section of the specific page so that I can follow that suggested path above? I don't seem to find a reasonable route; after all there's only one category that doesn't seems to feature anywhere on the pages.
2) When I login to the backend and follow that path (Site Preferences -> etc...) there's little to do or change. Where in the file system could I do a manual edit, if need be? I'd still want to keep the quotes showing on the other pages, even on this particular page if possible.
Check which plugins are activated. The quotes sounds like "Hello Dolly" is activated. You can deactivate it, since it is a default plugin included with the WordPress download.
As for manual edits, all of your changes should take place in your theme, keep in mind that any changes to a third party theme will be overwritten with any updates. So, you should rename the theme to a custom name. Themes are locate in the themes folder "/path/to/your/wordpress/wp-content/themes".

Widget or Plug-in? Building a theme and unsure how to approach optional content

I have a question regarding how best to build a widget/plug-in for WordPress.
I have tried to code this thing out but unfortunately to no avail but that's because I'm increasingly thinking I'm going about it the entirely wrong way.
This is what I'm trying to achieve:
I have built a theme from scratch. In this theme I have two content areas. The larger of the two contains the main content and the smaller of the two (proposed widget/plug-in) contains supplementary information (opening times, Facebook feed). I don't want this widget/plug-in to appear on every page and would like the ability to turn it on or off within the usual WordPress admin area.
The impression I am getting is that I can build the widget that contains the content I want (with necessary forms to change said content) but it is either on for ALL pages or off for ALL pages, no sort-of page specific functionality. That's where I'm thinking a plug-in would extend the functionality and allow me to be more page specific with it. That is my current set-up with a theme I'm running and plug-in I added (neither of which were coded by me) but I would like to repeat it as best as possible.
Would it be right to assume that widgets are not really designed to have page specific functionality and that function should be left down to a plug-in?
I appreciate this question asks nothing really in the way specific advice but I would just like an opinion or two on the best approach before I go away and create it - this is my main struggle at the moment.
Thanks for looking.
This can be done with the Jetpack plugin. Once activated you can choose what widgets display on what pages:
The Widget Visibility module enables you to configure widgets to appear only on certain pages (or be hidden on certain pages) by using the Visibility panel.
Visibility is controlled by five aspects: page type, category, tag, date, and author. For example, if you wanted the Archives widget to only appear on category archives and error pages, choose “Show” from the first dropdown and then add two rules: “Page is 404 Error Page” and “Category is All Category Pages.”
Originally posted here
It is also possible with the Display Widgets plugin.
This is a common problem. The usual remedy is to use an existing plugin that allows widgets to be tied to pages.
The 3 most popular plugins for this are:
JetPack
Per Page Widgets
Widget Logic

Magento and Wordpress Joint. How do i edit a page manually or the CSS?

I am having problems trying to figure out how exactly i can edit a simple page of the website. I didn't initially create it so i am given the task of trying to understand someones code. So the problem is... i am trying to change the simple font colour on the front home page, but i cannot even find the CSS file on magento or Wordpress so i'm kind of confused. I want to change the white font colour to black.
Do i just log in with FTP and edit the pages manually on there? Please give me some information on how i can go about editing any pages at all.
Wordpress
Wordpress have /wp-content/themes/ for a directory which stores all instaled themes (downloaded or created by you). You can edit everything of a theme there. The default stylesheet file in wp's /wp-content/themes/[yourtheme]/style.css. Attention: this CSS file can import another from somewhere else.
Finding the style
You can find the ids and classes statements just positioning the mouse over the element that you want to discover what is influencing it, right button click and select Inspect Element if in Chrome or Mozilla. An add-on to help is Web Developer.
Possibly useful links: http://ithemes.com/tutorials/ ; http://mcbuzz.wordpress.com/wordpress-tutorials-complete-list/ ; http://themeshaper.com/2009/06/22/wordpress-themes-templates-tutorial/ ; http://line25.com/articles/15-tutorials-to-help-you-build-wordpress-themes
Web developer
Mozilla | Chrome
#edit Yes, you can edit via FPT or SSH connection ;P
In wordpress you should check in settings->reading what the front page is set to and css changes can be done in the theme folder wp-content/themes/theme_name/ and for magento the css is usually in /skin/frontend/package/theme/css. or somewhere close depending on the template.

Identifying which files to edit when using php based CMS

I'm trying to make some edits to a website. The website is based on a CMS and runs on PHP.
I have some html/css experience and have a thick guide to PHP into book to help me.
Among the many edits I'd like to make to the site which are out of the control from the CMS admin area, I'd like to add a Facebook link in the main nav.
Now, I would normally, if inheriting someone else's simpe HTMl/CSS site just use the inspect element feature in Chrome of FF and then see whereabout to edit the code.
Probably a classic rookie question but how does one do that with PHP? If I right click the nav on my site, how do I know which PHP file to edit? Is there a "best way" here?
Here's the site incidentally if it helps at all. I'd like to add (among many other things) a Facebook icon next to the RSS icon in the main nav. I just don't know which file to edit.
http://tinyurl.com/byal33m
This all depends on which CMS you are using. It's like asking - I have a 'word processor', how do I add an image...
You should read the documentation that comes with the CMS that you are using. It will likely explain where the files are.
Typically, CMSs usually have a core directory with contain the files that make the CMS work itself, which you wont need to edit.
Then there is a themes directory which contains the files that make up the HTML that is actually rendered and supplemented with data from the CMS. In the admin area, it usually tells you which theme you are using and where it is located.
Wordpress is a popular CMS, and their documentation explains the basics: http://codex.wordpress.org/Using_Themes
-- Updated
Question relates to Ushahidi CMS which has documentation indicating theme HTML located in the 'themes' subdirectory.
https://wiki.ushahidi.com/display/WIKI/Themes+-+Developers+Guide#Themes-DevelopersGuide-HowdoIinstallatheme%3F

Categories