Closed

Fix and Refactor page-options.php template

This project received 14 bids from talented freelancers with an average bid price of $120 USD.

Get free quotes for a project like this
Employer working
Project Budget
$10 - $30 USD
Total Bids
14
Project Description

This is the Wordpress starter theme that I have built: [url removed, login to view]

I have written functions that input content into my Wordpress pages. The only way that this content is shown is if the page has a checkmark telling the function to show or not.

View the [url removed, login to view] image attached to view a screenshot of these checkmark options.

The options can be seen in the upper right hand corner of the screenshot and are available on each Wordpress page and post across this entire theme - giving every page and every post the ability to hide or show certain content.

We will now take a look at just one of these functions (the google map function) to explain the logic being performed when a user decides to use the checkbox to hide or show the map.

View the [url removed, login to view] image attached to view a screenshot of the map section function code.

This function will input a map into a page depending on if the page has the map option checked or not. The checks I am processing to accomplish this are simple. I'll explain using two examples:

1st Check Example

// The below code will input a map always if the page is a 404 or search page. In other words - it doesn't check any page options - it simply executes if the one page statement renders true.

<?php if (is_search() OR is_404()) { css_inner_map_section(); } ?>

2nd Check Example

// The below code will input a map ONLY if the page is an archive or index page AND the page option is ALSO set to show. In other words - it checks what kind of template is being used AND THEN checks the page options and ONLY executes if BOTH statement are true.

<?php elseif (is_archive() OR is_home()) { if ($map_check_global == 'no') { css_inner_map_section(); } else {} } ?>

These are the types of checks that all my functions are processing. By leaving the last "else" empty I ensure that all content that is supposed to be "hidden" never even loads onto the page. This is my way of limiting HTTP requests on pages while effectively hiding/showing sections of code without using CSS or jQuery. :)

Ok... Now look at this page: [url removed, login to view]

Now view the [url removed, login to view] image attached to view a screenshot of the blog page options.

All checkboxes are left empty so all possible content is being shown (you check each section to hide it). And if you look at the live blog page again you should see the title, description, author, timestamp, total comment count, testimonial section, contact section, map section and footer section. So you can see how this is helpful for quick customization.

So what is the problem?

The problem is that sometimes I am getting the wrong info on certain pages OR the info I have selected to hide is actually showing up (this happens only on a few odd pages like a taxonomy page, or the home page). I believe all this is happening as a result of the "checks" that I am performing. I am unfamiliar with the Wordpress page hierarchy and with IF statements and am certain the issue is being caused because:

1) I am not performing my PHP IF statements in the correct order

2) I am possibly passing in the wrong ID

Also, my code is quite redundant, but I don't understand PHP or IF statements well enough to make it not as repetitive.

The end goal is to have this function reduced in size (cleaned up - with not as many if statements and not as many attempts to get the ID) and for it to accurately check and input the content I am asking it to input on all Wordpress pages (home page, archive pages, category pages, taxonomy pages, single pages, regular pages, search page, 404 page etc... you get the idea).

Any Questions? Again - most all of this is already working and working quite well - so it's not as big of a job as it would seem. It shouldn't take long for a seasoned Wordpress developer to run through it and correct it.

I would like to do this project at a fixed rate.

Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online