SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: WordPress Help

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WordPress Help

    Hi everyone,

    I am trying to change my static website in to Wordpress and just got myself into a right pickle and really need some help here,
    as i have just come across two problems with my site http://all-wired.co.uk/.

    1, I cant get my featured content to work properly on the home page.

    2, I cant get my contact forms to work on my home page and on my contact form page.

    And solving these problems would be a great help, as i would be able to overcome them for future projects.
    So if anyone knows the answer pls let me know.

    Thanks

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,165
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    Are you using any plugins for either item? If so, which ones?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, i am using a ws-slides slide show which i got of the internet. But it looks they have changed up the website since i was last on there.
    And I just created the contact forms myself.

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,165
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    Okay, I'm still investigating the ws-slides, but can you tell me more about your contact forms?

    I see it is posting the data back to index.php, can you post the code you added to index.php to process the contact form?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks, well this is the original code for the ws-slides

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">

    <title>Slides, A Slideshow Plugin for jQuery</title>

    <style type="text/css" media="screen">
    /*
    Load CSS before JavaScript
    */

    /*
    Slides container
    Important:
    Set the width of your slides container
    Set to display none, prevents content flash
    */
    .slides_container {
    width:470px;
    display:none;
    }

    /*
    Each slide
    Important:
    Set the width of your slides
    If height not specified height will be set by the slide content
    Set to display block
    */
    .slides_container div {
    width:470px;
    height:170px;
    display:block;
    }

    /*
    Optional:
    Reset list default style
    */
    .pagination {
    list-style:none;
    margin:0;
    padding:0;
    }

    /*
    Optional:
    Show the current slide in the pagination
    */
    .pagination .current a {
    color:red;
    }
    </style>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script src="js/slides.min.jquery.js"></script>

    <script>
    $(function(){
    $('#slides').slides({
    preload: true,
    generateNextPrev: true
    });
    });
    </script>
    </head>
    <body>
    <div id="slides">
    <div class="slides_container">
    <div>
    <h1>Slide 1</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div>
    <h1>Slide 2</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div>
    <h1>Slide 3</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div>
    <h1>Slide 4</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    </div>
    </div>
    </body>
    </html>

    This is for the contact form, I used <?php echo $_SERVER['PHP_SELF']; ?> originally but it didnt work so u tried indexed.php to see if it would work.

    <h1 class="contactpage_headings">Contact Form</h1>
    <form id="contactform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <ul>

    <li>
    <label for="name">Full Name/label>
    <input type="text" name="name" id="name" />
    </li>

    <li>
    <label for="contact">Company Name/label>
    <input type="text" name="cname" id="cname" />
    </li>

    <li>
    <label for="contact">Contact Number/label>
    <input type="text" name="number" id="number" />
    </li>

    <li>
    <label for="email">Email/label>
    <input type="text" name="mail" id="mail" />
    </li>

    <li>
    <label for="message">Enquiry/label>
    <textarea id="textarea" name="message"></textarea>
    </li>

    <li>
    <input type="submit" id="submit" value="Submit">
    </li>
    </ul>
    </form>
    <p id="contactfeedback"><?php echo $feedback; ?></p>

    This is the PHP

    <?php

    $to = '';
    $subject = 'Email From';

    $name = $_POST['name'];
    $cname = $_POST['cname'];
    $number = $_POST['number'];
    $mail = $_POST['mail'];
    $message = $_POST['message'];


    $body = <<<EMAIL

    $name

    $cname

    $number

    $mail

    $message

    EMAIL;

    $header = "From: $name";

    if($_POST){

    if($name == '' || $number == '' || $mail == '' || $message == ''){
    $feedback = 'fill out all the fields';
    }else{
    mail($to, $subject, $body, $header);
    $feedback = 'Message sent';
    }
    }

    ?>

  6. #6
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,165
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    From the contact form perspective, my suggestion would be to create a new PHP file to process the form.

    Example: contact.php
    PHP Code:
    <?php
    $to 
    '';
    $subject 'Email From';

    $name $_POST['name'];
    $cname $_POST['cname'];
    $number $_POST['number'];
    $mail $_POST['mail'];
    $message $_POST['message'];


    $body = <<<EMAIL

    $name

    $cname

    $number

    $mail

    $message

    EMAIL;

    $header "From: $name";

    if(
    $_POST){
      if(
    $name == '' || $number == '' || $mail == '' || $message == ''){
        
    $feedback 'fill out all the fields';
      }else{
        
    mail($to$subject$body$header);
        
    $feedback 'Message sent'
      }    

      
    $_SESSION['feedback'] = $feedback;
      
    header('Location: index.php');
    }
    ?>
    Then point your form action to contact.php
    In your template, change this
    PHP Code:
    <p id="contactfeedback"><?php echo $feedback?></p>
    To
    PHP Code:
    <p id="contactfeedback">
      <?php
        $feedback 
    '';
        if (isset(
    $_SESSION['feedback']))
        {
           
    $feedback $_SESSION['feedback'];
           unset(
    $_SESSION['feedback']);
        }
        echo 
    $feedback
      
    ?>
    </p>
    From what I can tell, Wordpress is hijacking your form submission, so it is interfering with your form. By moving it to a separate file, it should help ease that pain.

  7. #7
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Watching the code makes me headache, I used to use tags to feature content or put the content in a category called "Feature", or "headline".
    You can use plugn-in for contact forms.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •