Jump to content

jimleeder123

Members
  • Posts

    84
  • Joined

  • Last visited

Everything posted by jimleeder123

  1. Ok you have permission to send an army after me, you were right. I swear it wasn't working yesterday. Very odd, but it works now!
  2. I'm editing the Woocommerce e-mail files, and have got a session working. When it's echoed on the e-mail it appears as expected - "1 Day Health & Safety Awareness Chelmsford". However the if statement is not working. This is shown below, can anyone tell me where I'm going wrong? if (strpos($_SESSION['ahsname'], 'safety awareness') !== false) { // This is what I want to happen, the session should (and does) contain the string shown above //include( get_template_directory() . '/instructions/chelmsford-hsa-ahs.html'); echo "YES"; }else{ // This should not happen but it does! echo "NO "; echo $_SESSION['ahsname']; // the session is echoed with the bit I'm checking for included as mentioned above }
  3. I decided to ditch this idea, and had success with another method instantly. Thanks for the help though, do appreciate it
  4. Sorry, I'm using WooCommerce, and my own custom theme. I'm trying to enter this into the admin order e-mail file, and will carry it into the customer one later when ready. I've googled a lot and tried a lot, but nothings working. What I need is the product name(s) in the order. Because of the nature of the business, it's likely only one product will be bought (or multiple of a single product).
  5. I'm editing the e-mail templates on WordPress. I want to be able to get the product info from the order that the e-mail is about, so I can do stuff with it. I need the product name/title, and can go on with it from there. Any help greatly appreciated.
  6. I've had a quick look. Can this be used with an existing word document in my web files?
  7. I've hit a real wall here. I've got your code working ok outside the required function. This means that it goes through all of the same elements. However the function uses the event ID of the required item. Therefore it's just one event, so there should be just one name to check. The name of the event I'm testing contains "SSSTS" in the title, so below is my code. (by the way this is a function in my functions.php in WordPress. function attach_doc_to_email ( $attachments , $event_id, $object ) { // This function attaches a word doc to the order confirm e-mail based on an if statement // get the tickets $main = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(); $tickets = $main->get_tickets( $event_id ); // Get ticket title - not yet complete foreach($tickets as $k=>$v){ $theresult[] = $v->name; } $ticket_title = $theresult[0]; if (strpos($ticket_title, 'sssts') !== false) { $your_doc_path = get_template_directory() . '/instructions/chelmsford-sssts.docx'; }else{ $your_doc_path = get_template_directory() . '/instructions/chelmsford-health-safety-awareness.docx'; } $attachments[] = $your_doc_path; return $attachments; } So the wrong result is always coming up. The way I can test this is by submitting an order each time and see if the correct attachment has been sent. The wrong attachment is always attached. However the code works outside the function like below... $main = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(); $tickets = $main->get_tickets( $event_id ); foreach($tickets as $k=>$v){ $whatYouWantIs[] = $v->name; } $name = $whatYouWantIs[0]; if (strpos($name, 'sssts') !== false) { echo "yes $name"; }else{ echo "no"; } Which is very odd. Of course I need it working inside the function. Any ideas? Much appreciated.
  8. It's an array because thats what the plugin makes it. Has been a nightmare trying to get people in a different timezone to help with it! Thanks for that, will try to work something out.
  9. I'm using WordPress and Tribe's Event Calendar and Event ticket plus plugins. Their website is http://theeventscalendar.co.uk. I've been using their forums but it's taking a while to sort this out, so though someone on here might be able to help. I've got an array that I need to echo out part of. Inside each key (0, 1, 2, 3 and so on) there are numerous parts like ["ID"], ["name"] and so on. I want to echo out the ["name"] part of the key. I have a var dump for 10 keys in the array, each of which have their own ["name"] set. In the situation I'm using it, it will always have just 1 in the array, so I can target the first key in the array. Any ideas please on how to echo the ["name"] part? I have left a var dump of the array below. array(10) { [0]=> object(Tribe__Tickets__Ticket_Object)#4474 (20) { ["ID"]=> int(405) ["name"]=> string(16) "2 day sssts kent" ["description"]=> string(0) "" ["price"]=> string(3) "295" ["regular_price"]=> string(3) "295" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(38) "http://ssstsuk.co.uk/2-day-sssts-kent/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(0) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-07-07 08:00:00" ["end_date"]=> string(19) "2016-07-30 17:00:00" ["purchase_limit"]=> string(1) "0" } [1]=> object(Tribe__Tickets__Ticket_Object)#4494 (20) { ["ID"]=> int(308) ["name"]=> string(22) "2 Day SSSTS Chelmsford" ["description"]=> string(0) "" ["price"]=> string(3) "265" ["regular_price"]=> string(3) "265" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(64) "http://ssstsuk.co.uk/1-day-health-safety-awareness-chelmsford-2/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(13) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-06-20 08:00:00" ["end_date"]=> string(19) "2016-07-20 17:00:00" ["purchase_limit"]=> string(1) "0" } [2]=> object(Tribe__Tickets__Ticket_Object)#4687 (20) { ["ID"]=> int(306) ["name"]=> string(46) "1 Day Health & Safety Awareness Chelmsford" ["description"]=> string(0) "" ["price"]=> string(2) "95" ["regular_price"]=> string(2) "95" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(62) "http://ssstsuk.co.uk/1-day-health-safety-awareness-chelmsford/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(0) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-06-20 08:00:00" ["end_date"]=> string(19) "2016-07-19 17:00:00" ["purchase_limit"]=> string(1) "0" } [3]=> object(Tribe__Tickets__Ticket_Object)#4662 (20) { ["ID"]=> int(304) ["name"]=> string(46) "1 Day Health & Safety Awareness Colchester" ["description"]=> string(0) "" ["price"]=> string(3) "150" ["regular_price"]=> string(3) "150" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(62) "http://ssstsuk.co.uk/1-day-health-safety-awareness-colchester/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(0) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-06-20 08:00:00" ["end_date"]=> string(19) "2016-07-12 17:00:00" ["purchase_limit"]=> string(1) "0" } [4]=> object(Tribe__Tickets__Ticket_Object)#4475 (20) { ["ID"]=> int(301) ["name"]=> string(43) "1 Day Health & Safety Awareness Romford" ["description"]=> string(0) "" ["price"]=> string(3) "150" ["regular_price"]=> string(3) "150" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(51) "http://ssstsuk.co.uk/1-day-health-safety-awareness/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(1) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-06-20 08:00:00" ["end_date"]=> string(19) "2016-07-12 17:00:00" ["purchase_limit"]=> string(1) "0" } [5]=> object(Tribe__Tickets__Ticket_Object)#4705 (20) { ["ID"]=> int(298) ["name"]=> string(19) "2 Day SSSTS Romford" ["description"]=> string(0) "" ["price"]=> string(3) "295" ["regular_price"]=> string(3) "295" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(33) "http://ssstsuk.co.uk/2-day-sssts/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(1) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-06-20 09:00:00" ["end_date"]=> string(19) "2016-07-10 17:00:00" ["purchase_limit"]=> string(1) "0" } [6]=> object(Tribe__Tickets__Ticket_Object)#4719 (20) { ["ID"]=> int(237) ["name"]=> string(10) "SSSTS Test" ["description"]=> string(0) "" ["price"]=> string(4) "9.99" ["regular_price"]=> string(4) "9.99" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(32) "http://ssstsuk.co.uk/sssts-test/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(6) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-06-08 08:00:00" ["end_date"]=> string(19) "2016-06-17 17:00:00" ["purchase_limit"]=> string(1) "0" } [7]=> object(Tribe__Tickets__Ticket_Object)#4803 (20) { ["ID"]=> int(110) ["name"]=> string(13) "IT Training 1" ["description"]=> string(34) "Admits one person to IT Training 1" ["price"]=> string(5) "10.99" ["regular_price"]=> string(5) "10.99" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(35) "http://ssstsuk.co.uk/it-training-1/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(2) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-05-17 09:00:00" ["end_date"]=> string(19) "2016-06-17 17:00:00" ["purchase_limit"]=> string(1) "0" } [8]=> object(Tribe__Tickets__Ticket_Object)#4894 (20) { ["ID"]=> int(108) ["name"]=> string(21) "Health & Safety 2" ["description"]=> string(40) "Admits one person to health and safety 2" ["price"]=> string(5) "11.99" ["regular_price"]=> string(5) "11.99" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(37) "http://ssstsuk.co.uk/health-safety-2/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(1) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-05-17 09:00:00" ["end_date"]=> string(19) "2016-07-22 17:00:00" ["purchase_limit"]=> string(1) "0" } [9]=> object(Tribe__Tickets__Ticket_Object)#4906 (20) { ["ID"]=> int(106) ["name"]=> string(28) "Health & Safety Course 1" ["description"]=> string(49) "Admits one person to Health & Safety Course 1" ["price"]=> string(5) "11.99" ["regular_price"]=> string(5) "11.99" ["on_sale"]=> bool(false) ["admin_link"]=> string(42) "http://ssstsuk.co.uk/wp-admin/&action=edit" ["frontend_link"]=> string(44) "http://ssstsuk.co.uk/health-safety-course-1/" ["provider_class"]=> string(48) "Tribe__Tickets_Plus__Commerce__WooCommerce__Main" ["provider":protected]=> NULL ["stock":protected]=> int(0) ["global_stock_mode":protected]=> string(3) "own" ["global_stock_cap":protected]=> int(0) ["qty_sold":protected]=> int(10) ["qty_pending":protected]=> int(0) ["qty_cancelled":protected]=> int(0) ["manage_stock":protected]=> bool(false) ["start_date"]=> string(19) "2016-05-17 08:00:00" ["end_date"]=> string(19) "2016-06-10 17:00:00" ["purchase_limit"]=> string(1) "0" } }
  10. Ok, was wondering if there is a CSS hack for it or anything?
  11. I've got an HTML 5 date input box working on my site. Anyone know how to make the whole thing selectable like a drop down (select) box? Currently you can only select it by clicking on the arrow at the far right of it. I don't mind about losing the cross or up and down arrows. I just want the field to be fully selectable like a drop down box. Any ideas please? Thanks.
  12. The data will be going through WooCommerce. Also the file type is .docx. So how would I go about using this PHPWord thing please?
  13. I've got a function in my WordPress functions file that sends a Word doc based on what venue the ordered product is from. However I also need to be able to paste variables such as the customer name and others onto the specified word document. It also needs to be in specific places. How can I go about doing this? Please let me know if you have any idea or don't understand me! Thanks!
  14. Is it possible to have a horizontal masonry effect? I know usually masonry is done in columns with posts shown in order vertically. However I want it to be done horizontally. I also want it to be CSS only - no JavaScript whatsoever. Is this possible? Have tried loads of things like displaying as flex, CSS columns, floating, inline-blocks and whatever.
  15. I'm looking for a div that has the class row0 if the clicked element is pagelink0, row1 if its pagelink1 etc. Please note that the row div is not a child element, pagelink is a child element of another element (div called paginationwrap). Requinix can you please tell me how to do search in jQuery? Haven't done it before.
  16. I've got a bit of jQuery that is getting the bit of data that I want to search the page for. This is posted below. $(".pagelink").click(function(){ var myClass = this.className; var number = myClass.substr(myClass.length - 1); }); This bit is working ok. It gets the last bit of the element's class name which is a number incremented by the PHP that echoes it out. Now I want to search the page for a div that has a class that contains that var number. There will be a div somewhere on the page with a class that contains that number. It will be called either row0, row1, row2, row3 etc etc. The div is not a descendant element of the pagelink class, it is somewhere else so I don't think the find() variable is suitable. Any help will be greatly appreciated, thanks!
  17. I want to have a list that has pictures on either side of each li. As the li gets bigger (more content), the images should stay in the middle of the li. I've tried numerous divs, before and after classes and gone a bit mad. Any ideas please?
  18. I can't see how any of that will be a help, I already know about the pointer-events property. I think jQuery might be the only way since adding classes to open the ul and close it using the same link element causes the styles to cancel the other out. However am open to any ideas for it to be done CSS only.
  19. Its a menu in Wordpress, when you click the link and the sub menu appears, it pushes everything else down so that hack doesn't work. How it works is you click the li element which makes the ul element inside it appear. The below code is 2 CSS styles I've got. /* this makes the sub menu appear */ .responsivewrap ul li:hover ul.sub-menu {display:block !important;} /* this is outdone by the above style. If set to important, sub menu won't appear (above style won't work) */ .responsivewrap ul li a:hover + ul[style*="display: block"] {display:none !important} The first one makes it appear and was there before I started this exercise. The second style is what I've added in. Since I have to use the same element to open AND close the ul element, the 2 styles override each other. The only thing I can think of to counter it is jQuery but we want to use CSS only.
  20. We've got a responsive menu that when you click on an li the ul inside it is then displayed as a block (displayed as none beforehand). However you cannot then close the ul without refreshing the page or closing the menu itself. What we want is for when you click the li again, the ul inside it then displays as none. Is this possible using only CSS? (No jQuery please!!!) Any help is greatly appreciated, thanks!
  21. I've got a few full height/width rows on a web page that contain an image on the left, then a paragraph and button on the right. What we want to do is as you scroll down, the current one shown stays at the top giving the illusion that it stays still and the next div scrolls over it. Like this - http://stackoverflow.com/questions/16688545/scroll-div-over-another-div - but the effect for the first div on them all. Is this possible? If this has made any sense then please help otherwise ask away.
  22. Have sorted that bit out, but have also discovered that if a a category has 2 pages of results (5 per page, so between 6 - 10 posts in category) then it doesn't go back to the 2nd page, when you click the link it stays on page 1. However with any higher number of pages it goes through them all ok.
  23. Got it working. Found a bit of code on the Wordpress forum that goes after the $wp_query bit but before the while loop. Only thing is when you click onto the last page of results, if it has less than 5 pages, they don't show. So if a category has 17 posts, the last 2 posts won't show on the final page. Instead it keeps you on the penultimate page of results. global $query_string; //this function solves the category error of showing all posts $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($query_string.'&paged='.$paged.'&posts_per_page=5');
  24. Below is my code. Showing posts from the category and the amount of posts specified but the pagination links are not working. It goes to /page2/ but it is a blank page when there should be some posts there. Its archive.php by the way. <?php /** * Template Name: Archive * */ get_header();?> <!--blogcontent--> <section class="strapline"> <div class="container12 heading"> <div class="column12 heads"> <h1>Category: <?php single_cat_title( '', true ); ?></h1> </div> </div> </section> <div class="container12"> <div class="column8 news"> <?php // The current selected category defined in $maincat $maincat = get_category(get_query_var('cat'))->name; $catid = get_cat_ID($maincat); //the selected category ID $countallposts = wp_count_posts(); //counts all published posts $totalposts = $countallposts->publish; //result of all published posts $i = query_posts('category_name="'.$maincat.'"'); $noofposts = count($i); $postcatcount = 0; //count the posts with the selected category $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=5' . '&paged='.$paged); $args = 'cat=' . $catid . '&posts_per_page=3'; //arguments - does the category and amount per page query_posts($args); //shows only posts in selected category while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <?php $cats = get_the_category(); $postcat = $cats[0]->name; // category name for individual post defined in $postcat ++$postcatcount; //plus one to the amount of posts in the selected category ?> <h2><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php echo "COUNT: "; echo $postcatcount; ?> <hr> <?php endwhile; ?> <?php if ($paged > 1) { ?> <nav id="nav-posts"> <div class="row"> <div class="column4 alpha prev"><?php // next_posts_link(); ?> <?php echo paginate_links( $args ); ?></div> <div class="column4 omega next"><?php // previous_posts_link(); ?></div> <?php echo "Yes theres more than 5 - Count total: "; echo $postcatcount; echo " Paged data = "; echo $paged; ?> </div> </nav> <?php }else{ ?> <nav id="nav-posts"> <div class="row"> <div class="prev"><?php // next_posts_link('« Previous Posts'); ?> <?php echo paginate_links( $args ); ?></div> <?php echo "No theres less than 5 - Count total: "; echo $postcatcount; echo " Paged data = "; echo $paged; ?> </div> </nav> <?php } ?> <?php wp_reset_postdata(); ?> </div> <div class="column4"><?php dynamic_sidebar('primary-sidebar'); ?></div> </div> <!--blogcontent end--> <?php get_footer(); ?>
  25. On our wordpress website we've got a template that didn't come with the category section fully working - when you click a category it shows all posts regardless of the category. I've had a crack at it and have got all posts appearing for the category but with no pagination, which is required. Basically I've got all posts going through an IF statement, and only being shown if they are in the selected category. Ones that are not in the category just don't echo anything out. I want to be able to show only 5 at a time as is the usual thing to do on our websites. I imagine it might be something to do with the wp_query bit. Below is what I've got for that: $wp_query = new WP_Query(); $wp_query->query('showposts='.$totalposts . '&paged='.$paged); $totalposts is the amount of published posts. The full list of variables I've got defined is below. Total amount of published posts Selected Category name Selected Category ID The post's associated category ID An incrementor counting the posts on the page as they are echoed out (counting only ones in the category Any help is greatly appreciated, thanks.
×
×
  • 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.