Jump to content

toolman

Members
  • Content Count

    210
  • Joined

  • Last visited

Community Reputation

0 Neutral

About toolman

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Hi there, Thank you for the reply. Thanks, that works great with the text if its already set. However, If I try to pull it through using the WordPress function I have, It outputs the whole text. This is what I tried: <?php $text = wpjm_the_job_description(); $words = array_slice(explode(' ', $text), 0, 15); echo join(' ', $words) . '…'; ?>
  2. Hi, Thanks for the replies. I'm happy with the one I have above, so if there is a way I can truncate that, that would be ideal. With regards to phpmillion, it is outputting everything, but what I meant was the code I have is not doing anything, so I guess I have something wrong with it. I am happy the character count, but ideally word count would be better.
  3. Hi there, I'm trying to truncate some text by 15 words which is then followed by a "..." This is the line that outputs all the text: wpjm_the_job_description(); I've tried this, but nothing is happening. <?php $desc=wpjm_the_job_description(); echo substr($desc, 0, 15); ?> Any ideas what I have wrong? Thanks
  4. Hi, I'm trying to escape the following: 'label' => __( 'Title <span class="tooltips" title="Give your title a catchy title, ideally starting with the word \"test"\> All it is displaying is a backslash. Any ideas why this is? Thanks
  5. Hi, I'm trying to create a simple bit of PHP that will display today's date +3 days. This is what I have: echo "Order today to receive by " . date("l j F Y")+3; I am new to PHP, but what I am trying to do is to add 3 days to a date is the day is a week day and add 5 days if the day is a weekend. How would I achieve this?
  6. Hi, By custom page I mean like a "thank you" page or "error" page. The footer-contact.php file is the file that contains the PHP code.
  7. Hi there, I have the following code which adds a reCAPTCHA to my form, however, I would like to send it to a custom page to display the error or success message. Also, I would like the form to be submitted to my email address with a subject and details of the form completed. How would I do this? This is the code: <form action="footer-contact.php" class="form-horizontal" method="POST"> <div class="form-group"> <label class="col-md-4 control-label">Name:</label> <div class="col-md-6"> <input type="text" class="form-control" name="name" placeholder="Enter Name" required="" /> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Email:</label> <div class="col-md-6"> <input type="text" class="form-control" name="email" placeholder="Enter Email" required="" /> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Message:</label> <div class="col-md-6"> <textarea type="text" class="form-control" name="message" placeholder="Enter Message" required=""></textarea> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Captcha:</label> <div class="col-md-6"> <div class="g-recaptcha" data-sitekey="mySiteKey"></div> </div> <div class="form-group"> <div class="col-md-6 col-md-offset-6" class="text-center"> <br/> <input class="btn btn-success" type="submit" name="submit" value="Submit"> </div> </div> </form> <?php if($_SERVER["REQUEST_METHOD"] === "POST") { $recaptcha_secret = "mySecretKey"; $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']); $response = json_decode($response, true); if($response["success"] === true){ echo "Form Submit Successfully."; }else{ echo "You are a robot"; } } ?> Any help would be great! Thanks.
  8. Hi there, I have the following select: <select name="place"> <option value="place1">Place 1</option> <option value="place2">Place 1</option> <option value="place3">Place 1</option> <option value="place4">Place 1</option> </select> What I would like to do is display another select dropdown if either option "place2", "place3" or "place4" is selected. How would I do this? Thanks!
  9. Hi, I don't have PHP, I only want to work with jQuery :/ I've managed to create this: var urls = window.location.href; $("a").each(function() { var $this = $(this); var _href = $this.attr("href"); $this.attr("href", _href + urls.substring(urls.lastIndexOf('/') + 1)); }); This sort of works on the following code: <a href="/sub/page.shtml" onClick="window.open('/sub/page.shtml', ''); return false; trackOutboundLink(this, 'Outbound Links', 'my link');" >Link</a> However, the window.open event causes the link to lose the appended URL. How can I apply the above to append the URL in the window.open? Thanks
  10. Hi there, I have the following URL: http://www.website.com/?code=code1&ref=myref&utm_source=email&utm_medium=direct&utm_campaign=test What I would like to do is add the ?code=code1&ref=myref&utm_source=email&utm_medium=direct&utm_campaign=test part of the URL to specific links on the page based on their ID's. The ?code= and ?ref= are dynamic, so I would need to get the URL as a dynamic URL. What would be the best way to do this? Thanks!
  11. The website has over 100,00 pages - not all have a global library with jQuery included, so I wanted to see if I could use native JavaScript. Initially I thought jQuery was included on all pages, but it's not. I have a JS include globally, but because the website is so old, I need to work with something without jQuery if possible.
  12. Thanks for the reply. After posting this, I realised, I may not have jQuery cookie plugin installed. Basically, a page loads with a URL for example of: http://www.website.com/cookie_name This then inserts a cookie called cookie_name with a value of cookie_value E.G: http:www.website.com?agent=john This then gives the cookie "cookie_name" a value of "john" What I would like to do is to use an if statement based on if the cookie has a value of "john" to do something; replace a one line of HTML. Not sure if that helps?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.