Jump to content

Search the Community

Showing results for tags 'wordpress'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. Hi all, PHP newbie here. I've been trying to integrate Gravity Forms with Gravity View's Import Entries from CSV plugin. Unfortunately, it needs a bit of tweaking to get everything connected properly. I used a code snippet from David at Gravity Whiz, (HERE) that gets integrated into my Wordpress site's functions.php file, and have been trying to customize to to suit my needs. From what I understand in looking at the code, the only bit I need to tweak (I think) is the bottom portion: # Configuration new GW_Value_Exists_Validation( array( 'target_form_id' => 1, 'target_field_id' => 3, 'source_form_id' => '/RSVPcodes.csv', 'source_field_id' => 'rsvp', 'validation_message' => 'Hey! Don\'t be a villain! Provide a legit RSVP code to reserve your spot at the Smackdown.' ) ); My main question here: how to get the validation code to see the database that I've uploaded via the Import Entries plugin? I know ignorance is making me miss something that should be pretty simple. Right now, I've got it to validate a test word that I know is not in my database, and also a code that I know is in the database. It's coming back with both items as not valid. The end result will be a RSVP form that will be used to accept RSVPs only from people who have an RSVP code from their invitation, a lot like a license key validation system. The live site (and form I'm trying to tweak) is HERE. Thanks in advance for any help.
  2. Hi dear php coders! ]'m almost new in php and now i'm dealing with wordpress . ] want to get a long string from database with get_post_meta function. (and aftar that i wanna Parse this string and Play with that ...! ) how can i do that ?? i don't know what arguments i must pass to the function ... any help would be appreciated. thanks in advance.
  3. This is working code that gets the data from a field that registered users have to fill out in their profiles in wordpress: <?php $field = xprofile_get_field_data(2, $user_id); echo '<span class="wisfb_carNumber">' . $field . '<span>'; ?> This is the code that generates data from a Excel-file: <?php $data = wp_excel_cms_get("EXCEL-DOCUMENT"); ?> <?php foreach($data as $entry): ?> <?php echo $entry[1]; ?> <?php endforeach; ?> Now I want to do this: If the number witch is generated in: <?php echo $entry[1]; ?> is the same number as in the users: $field = xprofile_get_field_data(2, $user_id); get this users avatar: echo get_avatar(); Does anyone have an idea on how to do this?
  4. Hi All, I'm currently trying to find a solution to a problem within a wordpress template I am using. On the homepage, Im using a widget to display recent posts. However, the widget displays all posts, whereas I want it to only display posts from a particular category. What do I need to edit within the php to make this happen? Heres the widget php: <?php /** * List Blog Posts * * @since Jobify 1.0 */ class Jobify_Widget_Blog_Posts extends Jobify_Widget { /** * Constructor */ public function __construct() { $this->widget_cssclass = 'jobify_widget_blog_posts'; $this->widget_description = __( 'Jobify - Display recent blog posts.', 'jobify' ); $this->widget_id = 'jobify_widget_blog_posts'; $this->widget_name = __( 'Jobify - Home: Blog Posts', 'jobify' ); $this->settings = array( 'title' => array( 'type' => 'text', 'std' => __( 'Recent News Article', 'jobify' ), 'label' => __( 'Title:', 'jobify' ) ), 'description' => array( 'type' => 'textarea', 'rows' => 4, 'std' => '', 'label' => __( 'Description:', 'jobify' ), ) ); parent::__construct(); } /** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget( $args, $instance ) { if ( $this->get_cached_widget( $args ) ) return; ob_start(); extract( $args ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $description = $instance[ 'description' ]; $posts = new WP_Query( apply_filters( 'widget_jobify_blog_posts', array( 'posts_per_page' => 3, 'ignore_sticky_posts' => true ) ) ); echo $before_widget; ?> <div class="container"> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <?php if ( $description ) : ?> <p class="homepage-widget-description"><?php echo $description; ?></p> <?php endif; ?> <div class="content-grid row"> <?php if ( $posts->have_posts() ) : ?> <?php while ( $posts->have_posts() ) : $posts->the_post(); ?> <?php get_template_part( 'content', 'grid' ); ?> <?php endwhile; ?> <?php endif; ?> </div> </div> <?php echo $after_widget; $content = apply_filters( 'jobify_widget_blog_posts', ob_get_clean(), $instance, $args ); echo $content; $this->cache_widget( $args, $content ); } }
  5. hello dear php-experts, i want to run and show facebook-actiity feeds (in other words "streams of two different facebook sites) that said i cannot do this with one plugin - can i? well some guys taled bout a solution of copying and cloing a wordpress plugin I want to have multiple instances of the plugin running so i can have different related content on a single page. that said i heard that some guys just do one thing; they coly the copy the plugin. https://wordpress.org/support/topic/installing-2-copies-of-the-same-plugin?replies=8 but thie does not work - so i have to do one facebook-feed with a version like so question - how to include the code: https://developers.facebook.com/docs/plugins/activity Initialize the JavaScript SDK using this app: booksocial123 Include the JavaScript SDK on your page once, ideally right after the opening <body> tag. <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=473241986032774&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Place the code for your plugin wherever you want the plugin to appear on your page. <div class="fb-activity" data-site="facebook.com/literaturen" data-action="likes, recommends" data-width="350px" data-height="350px" data-colorscheme="light" data-header="true"></div> how to include that into a wordpress
  6. I am new in php programming and I have develop php script using TCPDF libary that takes data from pdf form fields and create flatten copy of that PDF using TCPDF , after that I use "AttachMailer.php" to send copies of PDF to client and customer, when user fill pdf form and click submit button flatten copy of that pdf is created in wp-content/uploads/pdf folder , and email code gets same copy fro wp-content/uploads/pdf folder and copy is forwarded to client and customer once copies are forwarded, it should show message "email has been sent.....email-address". // =============Email Form=============================== require_once(dirname(__FILE__)."/AttachMailer.php"); $mailer = new AttachMailer($Email, $Email, "Submitted Form Copy", "hello <b>Please Find the Attached Copy of form sumitted</b>"); $mailer->attachFile($fpath.$Contact_Name.'_'.$Email.$fID); $mailer1 = new AttachMailer($Email,$CEmail, "CC for client Submitted Form ", "hello <b>Please Find the Attached Copy of form sumitted by </b>".$Contact_Name); $mailer1->attachFile($fpath.$Contact_Name.'_'.$Email.$fID); if($mailer->send()) { echo "Email has been sent to ".$Email."\n and" ; } else{ echo "error in email\n"; exit(); } if($mailer1->send()){ echo "\nCC has been sent to ".$CEmail ; } else{echo "\nerror in email CC was not sent to ".$CEmail;}! the problem is that when user click submit button he/or she is redirected to home page (which i dont want)with executing if and else statements in email code shown above please help me how can I stop redirecting to home page. you can see screenshot of redirected page from my dropbox https://www.dropbox.com/s/t48rqemujn21q42/redirectpagescreenshot.png?dl=0
  7. I am using the Starkers Wordpress theme as a foundation for my website and I am having difficulty getting my category.php to paginate posts properly. I am trying to display 10 posts per each page. When I click the 2,3,4,... post pagination button, it open the page but does not actually load new posts. Here is the code I have in my category.php file. Please could you help me to fix this issue? Please let me know if you need me to clarify anything further. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $cat = get_query_var('cat'); $catinfo = get_the_category($cat); ?> <div class="row"> <div class="large-8 small-12 columns"> <h2 class="category-header"><?php echo single_cat_title( '', false );?></h2> <?php if(1 == $paged) { //check if is page one and display main headlines and subcategories?> <?php //get category headline $cat = get_query_var('cat'); $category_headline = ae_get_category_headline($cat); if ($category_headline) { ?> <div class="category-headline"> <?php foreach($category_headline as $post) : setup_postdata($post); ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <h3><?php the_title(); ?></h3></a> <?php the_content('Read more...'); ?> <ul class="inline-list main-headline-social"> <li><?php comments_popup_link('Leave a Comment', 'View Comments (1)', 'View Comments (%)'); ?></li> <li class="addthis_toolbox addthis_pill_combo_style"><a addthis:url="<?php the_permalink(); ?>" class="addthis_button_facebook_like"></a><a addthis:url="<?php the_permalink(); ?>" class="addthis_button_tweet"></a><a addthis:url="<?php the_permalink(); ?>" class="addthis_button_compact"></a></li> </ul> <?php endforeach; ?> <?php wp_reset_postdata(); ?> </div> <?php } ?> <div class="all-category-posts"> <h4 class="title">All news in <?php echo single_cat_title( '', false );?></h4> <?php global $post; $args = array( 'posts_per_page' => 10, 'post_type' => 'post', 'cat' => $cat, 'offset' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'post_status' => 'publish', 'suppress_filters' => true, 'paged' => $paged, ); $allposts = get_posts($args); foreach ($allposts as $post) : setup_postdata($post); ?> <article> <header> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(array(80,80), array('class' => 'alignleft')); ?></a> <p class="date"><?php the_time(get_option('date_format')); ?></p> <hr class="rule" /> <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a> </header> <?php the_excerpt(); ?> </article> <?php endforeach; ?> </div> <?php if ($cat == 9) { ?> <div class="whats-hot-videos"> <a href="<?php home_url(); ?>/videos/" title="Hot Videos"><h4 class="title">Hot Videos!</h4></a> <?php global $post; $args = array( 'ae-video-categories' => 'hot-videos', 'number_of_posts' => 4, 'post_type' => 'ae-videos', 'orderby' => 'post_date', 'order' => 'desc', 'post_status' => 'publish', 'suppress_filters' => true, ); $videos = get_posts($args); ?> <ul class="large-block-grid-4 small-block-grid-2"> <?php foreach ($videos as $post) : setup_postdata($post); ?> <?php $videoid = get_post_meta($post->ID, 'videoid', true); ?> <li> <a href="http://www.youtube.com/watch?v=<?php echo $videoid; ?>" rel="wp-video-lightbox" title="<?php the_title();?>"> <?php the_post_thumbnail(); ?> <h6><?php the_title(); ?></h6> </a> </li> <?php endforeach; ?> </ul> <div class="all-videos-link"><a href="<?php home_url(); ?>/videos/" title="All Videos">...More videos</a></div> </div> <?php } ?> <ul class="large-block-grid-2 small-block-grid-2 sub-categories"> <?php $args = array ( 'parent' => $cat, 'type' => 'post', 'hide_empty' => 1, ); $subcategories = get_categories($args); foreach ($subcategories as $category) { ?> <li> <div class="sub-category-headlines <?php echo $category->slug; ?>-subcategory"> <a href="<?php home_url(); ?>/category/<?php echo $category->slug; ?><?php echo "/"; ?>" title="<?php echo $category->name; ?>"><h4 class="title"><?php echo $category->name; ?></h3> <?php $subcategory_posts = ae_get_categoryposts($category->slug, 2); ?> <ul> <?php foreach ($subcategory_posts as $post) : setup_postdata($post); ?> <li class="subcategory-headline"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_post_thumbnail(array(150,100), array('class' => 'alignleft')); ?> <h3><small><?php the_title(); ?></small></h3> </a> </li> <?php endforeach; ?> </ul> </div> </li> <?php } ?> <?php } //end check if is page one?> </ul> <?php if(function_exists('wp_paginate')) { wp_paginate(); } ?> </div>
  8. Hi experts! I am not a programmer, just a designer and I have problems with php codes, I would like to display a bundle of Wordpress shortcode below on my website but I unable to make it correct, please help me. <?php if ( is_single() ) { echo "<div class="pagelink"><?php wp_link_pages('pagelink=trang %'); ?></div><p>" echo "<div class="fb-like" data-href="https://www.facebook.com/tvvn.net" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div><p>" <?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif; ?><p> <?php echo do_shortcode("[kpvc_single]"); ?><p> <?php echo do_shortcode("[fbcomments]"); ?><p> <?php zemanta_related_posts()?> } else {} ?> Each part of the code is correct because it came from the plugin, but I don't known how to make it display at the same place. Could you please help complete Echo etc... the code above. Thanks very much! TOM
  9. een experiencing internal error message on my website for some time now. After being sent the error log, i got this; 20150210T084758: www.traditnow.com/index.php PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /hermes/bosoraweb136/b1865/ipg.traditnowcom/wp-content/themes/classipress/includes/functions.php on line 1079 I eventually found the line of code but could not figure out where the error is. echo $currentBefore . __( 'Ads tagged with', APP_TD ) . ' '' . single_tag_title('', false) . ''' . $currentAfter; please help me anybody. i wouldn't mind if someone will help rewrite it. Any one please... echo $currentBefore . __( 'Ads tagged with', APP_TD ) . ' '' . single_tag_title('', false) . ''' . $currentAfter; Thank you
  10. Hi, I'm new to this forum and I'm Italian, so I'm so sorry for my bad English. Anyway, I need some help with header of my blog, I hope someone can help me! I'm not an expert of php I bought a new theme for my blog (the developer doesn't help with code), and I found this problem: logo has a fixed width, I have to change it to have a bigger logo, and to put an ads on the right. The code is below, the theme can be viewed at this url http://www.industrialthemes.com/engine/ Any help or suggestions are accepted. Thanks in advance! <?php $postid = isset($post) ? $post->ID : ''; #theme options $logo_url=it_get_setting('logo_url'); $logo_url_hd=it_get_setting('logo_url_hd'); $logo_width=it_get_setting('logo_width'); $logo_height=it_get_setting('logo_height'); $logo_color_disable=it_get_setting('logo_color_disable'); $link_url=home_url(); $dimensions = ''; $tagline_disable = true; if(!it_get_setting('description_disable') && get_bloginfo('description')!=='') $tagline_disable = false; #category specific logo $category_id = it_page_in_category($postid); if($category_id) { $categories = it_get_setting('categories'); foreach($categories as $category) { if(is_array($category)) { if(array_key_exists('id',$category)) { if($category['id'] == $category_id) { if(!empty($category['logo'])) $logo_url=$category['logo']; if(!empty($category['logohd'])) $logo_url_hd=$category['logohd']; if(!empty($category['logowidth'])) $logo_width=$category['logowidth']; if(!empty($category['logoheight'])) $logo_height=$category['logoheight']; if(array_key_exists('tagline_disable',$category)) { if($category['tagline_disable']) $tagline_disable = true; } break; } } } } } if(!empty($logo_width)) $dimensions .= ' width="'.$logo_width.'"'; if(!empty($logo_height)) $dimensions .= ' height="'.$logo_height.'"'; $termargs = array('num' => 7, 'tax' => array('post_tag','category')); ?> <?php if (!it_component_disabled('header', $postid)) { ?> <div class="container-fluid no-padding"> <div id="header-bar"> <div class="row"> <div class="col-md-12"> <div id="header-inner" class="container-inner"> <?php echo it_background_ad(); #full screen background ad ?> <?php if(!it_component_disabled('logo', $postid)) { ?> <div id="logo"<?php if($logo_color_disable) { ?> class="no-color"<?php } ?>> <?php if(it_get_setting('display_logo') && $logo_url!='') { ?> <a href="<?php echo $link_url; ?>/"> <img id="site-logo" alt="<?php bloginfo('name'); ?>" src="<?php echo $logo_url; ?>"<?php echo $dimensions; ?> /> <img id="site-logo-hd" alt="<?php bloginfo('name'); ?>" src="<?php echo $logo_url_hd; ?>"<?php echo $dimensions; ?> /> </a> <?php } else { ?> <h1><a class="textfill" href="<?php echo $link_url; ?>/"><?php bloginfo('name'); ?></a></h1> <?php } ?> <?php if(!$tagline_disable) { ?> <div class="subtitle"><?php bloginfo('description'); ?></div> <?php } ?> </div> <?php } ?> <?php if(!it_component_disabled('header_posts', $postid)) { ?> <div id="header-posts"> <div align="center"> SOMETHING IS CHANGING!!! <br /> TESTING <br /></div> </div> <?php } ?> <?php if(!it_component_disabled('header_terms', $postid)) { ?> <?php $terms = it_get_trending_terms($termargs); ?> <div id="header-terms"> <div class="shadowed"> <div class="term-panel first"><span class="theme-icon-flame"></span><span class="trending-label"><?php _e('TRENDING',IT_TEXTDOMAIN); ?></span></div> <?php $i = 0; foreach($terms as $term) { $i++; $cssalt = ($i % 2 == 0) ? '' : ' alt'; ?> <div class="term-panel<?php echo $cssalt; ?>"> <a href="<?php echo get_term_link($term); ?>"><?php echo $term->name; ?></a> </div> <?php } ?> </div> </div> <?php } ?> </div> </div> </div> </div> </div> <?php } ?>
  11. We have a wordpress install with the plugin wp-job manager installed. https://wpjobmanager.com We add and manage jobs via YouRecruit but we want to update them to our wordpress database (wp-job manager) every time they're added, updated or we deleted. We also have a plugin/api module from YouRecruit which extends the wp job manager plugin and enables us to post and delete jobs to wp-job manager using xml. This is all the documentation I have on the API module from YouRecruit below and there are no settings in the back end of wordpress for you to fill in. Based on what I have read below I am assuming the plugin handles most of the processing but you still have to write your own PHP script and host it at 'http://www.yoursite.com/jobload/get_job.php' for example. At least this is what it says. I'm thinking were going to have to fetch the xml with simple_xml there is a brief code snipped in the documentation on doing this. I then don't know where to go from there or if this is the correct way to go about dealing with this issue. http://yourecruit.com/resources_public/wordpress_job_manager_api.php http://yourecruit.com/resources_public/own_site_posting.php Could anyone confirm if I am thinking along the right lines here. Thanks your advice is very much appreciated.
  12. What I remember from my college days is that isset check whether the variable has a value set or not and return true or false value. However I encountered a code in wordpress - // Set up the content width value based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) $content_width = 625; Here why is this sign used ! This sign is actually not equal to, Right?
  13. I am new here I dont know if I am breaching any policy by posting questions. Are there any Tutorials that can give me input for wordpress basics such as listed here - http://codex.wordpress.org/Plugin_API http://codex.wordpress.org/Class_Reference I would be indebted if you can help me with that. Looking Forward. Cheers!
  14. I have some files saved outside the webroot and need to allow posts in WordPress to be able to access the files. Following is the location of one of the files: /home1/Mathone/TESTS/Test1/index1.html I created a Download.php file with the following code and saved it to public_html of my site: <?php $path = '/home1/Mathone/TESTS/'. $_GET['filename']; $mm_type="application/octet-stream"; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); ?> Next, I created a post in wordpress with the following link: <a href="www.mysite.com/download.php?filename=Test1/index1.html">download</a> I am getting an error This is somewhat embarrassing, isn’t it? It seems we can’t find what you’re looking for. Perhaps searching can help. Can anyone tell me what I am doing wrong? Thank you
  15. Hi, I'm using TCPDF to create a PDF from a webpage. This works great but I have the following problem: I'm building in WordPress and as you may know WP saves images on different sizes. (e.g. 150x150, 300x300 and 1024x1024) The thing I'm trying to create is that users can download a PDF ready for printing. So High Resolution images. I use a preg_match_all function to match the image source and remove the additional image size from the filename so the original high resolution image is loaded. e.g. image-150x150.jpg will be replaced by image.jpg. So now the original image that has a image size of 6024x6024px and 300 DPI is loaded. Then TCPDF uses a resize function that resizes the image back to 150x150 px but sets the DPI to 300 so it can be printed on a good quality. This all works but now the problem comes: If I do the preg_match_all function the image gets "pulled" from the rest of the content and looses it's position. So my thought to fix this was. Get a preg_replace function and replace the image tag with a function that executes the whole image change like described above. This doesn't work...... So i'm stuck here. Hope anyone can assist me with this. Here is what I have done so far. function execute(){ preg_match_all("/<img[^>]+src=(?:\"|\')\K(.[^\">]+?)(?=\"|\')/",$content,$matches,PREG_PATTERN_ORDER); for( $i=0; isset($matches[1]) && $i < count($matches[1]); $i++ ) { $search = array('-'.$s1.'x'.$s2.'', '-'.$s3.'x'.$s4.'', '-'.$s5.'x'.$s6.''); $replace = array('', '', ''); $a = $matches[1][$i]; if (strpos($a,'-'.$s1.'x'.$s2.'') !== false) { $w = $s1; $w = $pdf->pixelsToUnits($w); $h = $s2; $h = $pdf->pixelsToUnits($h); $l = '57'; $l = $pdf->pixelsToUnits($l); $t = '170'; $t = $pdf->pixelsToUnits($t); }elseif (strpos($a,'-'.$s3.'x'.$s4.'') !== false) { $w = $s3; $w = $pdf->pixelsToUnits($w); $h = $s4; $h = $pdf->pixelsToUnits($h); $l = '217'; $l = $pdf->pixelsToUnits($l); $t = '20'; $t = $pdf->pixelsToUnits($t); }elseif (strpos($a,'-'.$s5.'x'.$s6.'') !== false) { $w = $s5; $w = $pdf->pixelsToUnits($w); $h = $s6; $h = $pdf->pixelsToUnits($h); $l = '57'; $l = $pdf->pixelsToUnits($l); $t = '310'; $t = $pdf->pixelsToUnits($t); } $content .= $pdf->Image(str_replace($search,$replace,$matches[1][$i]), $l, $t, $w, $h, 'JPG', '', '', true, 300, '', false, false, 0, false, false, false); } }; global $post; $id = $_GET['id']; $content_post = get_post($id);// get the content $content = $content_post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $content = preg_replace('/<img[^>]+./e',execute(), $content); // replace the image tag with the new image // EXPORT IT ALL $pdf->writeHTML($content, true, false, true, false, '');
  16. Hi, I have the below code and jquery in wordpress. I would like the form to auto submit, but at the moment I just get a 0 in the place of the heart icon. it seems to refresh but the form is not submitting the query. Thank you in advance <form id="lastviewer" class="ajax-form" action="<?php echo AJAX_URL; ?>" method="POST"> <?php if(ThemexUser::islastviewed(ThemexUser::$data['active_user']['ID'])) { ?> <a href="#" title="<?php _e('Remove from lastviewed', 'lovestory'); ?>" data-title="<?php _e('Add to Last Viewed', 'lovestory'); ?>" class="icon-heart submit-button current"></a> <input type="hidden" class="toggle" name="user_action" value="remove_lastviewed" data-value="add_lastviewed" /> <?php } else { ?> <a href="#" title="<?php _e('Add to Last Viewed', 'lovestory'); ?>" data-title="<?php _e('Remove from Last Viewed', 'lovestory'); ?>" class="icon-heart submit-button"></a> <input type="hidden" class="toggle" name="user_action" value="add_lastviewed" data-value="remove_lastviewed" /> <?php } ?> <input type="hidden" name="user_lastviewed" value="<?php echo ThemexUser::$data['active_user']['ID']; ?>" /> <input type="hidden" class="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" /> <input type="hidden" class="action" value="<?php echo THEMEX_PREFIX; ?>update_user" /> </form> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { window.setInterval(function() { AutoPost(); }, 3000); }); function AutoPost() { $.ajax({ type: "POST", url: "<?php echo AJAX_URL; ?>", success: function(data) { $("#lastviewer").html(data) ; } }); } </script>
  17. Hi, I'm a novice and have the below code in a Wordpress theme. I'm trying to get the form to submit automatically so it logs an entry into the MySql db as though the person clicked the heart icon (submit). Ideally I subsequently want to hide the heart icon so on load maybe after 3 seconds the entry is auto fired to the MySql DB. I have got as far as the manual click adding the entry, however can't get to to auto submit, any gel would be appreciated. Thank you in advance. ////PHP Form///// <form class="ajax-form" action="<?php echo AJAX_URL; ?>" method="POST"> <?php if(ThemexUser::islastviewed(ThemexUser::$data['active_user']['ID'])) { ?> <a href="#" title="<?php _e('Remove from lastviewed', 'lovestory'); ?>" data-title="<?php _e('Add to Last Viewed', 'lovestory'); ?>" class="icon-heart submit-button current"></a> <input type="hidden" class="toggle" name="user_action" value="remove_lastviewed" data-value="add_lastviewed" /> <?php } else { ?> <a href="#" title="<?php _e('Add to Last Viewed', 'lovestory'); ?>" data-title="<?php _e('Remove from Last Viewed', 'lovestory'); ?>" class="icon-heart submit-button"></a> <input type="hidden" class="toggle" name="user_action" value="add_lastviewed" data-value="remove_lastviewed" /> <?php } ?> <input type="hidden" name="user_lastviewed" value="<?php echo ThemexUser::$data['active_user']['ID']; ?>" /> <input type="hidden" class="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" /> <input type="hidden" class="action" value="<?php echo THEMEX_PREFIX; ?>update_user" /> </form> ////Ajax///// //Elements var themeElements = { ajaxForm: '.ajax-form', } //AJAX Form $(themeElements.ajaxForm).each(function() { var form=$(this); form.submit(function() { var message=form.find('.message'), loader=form.find('.loader'), toggle=form.find('.toggle'), button=form.find(themeElements.submitButton), title=form.find(themeElements.submitButton).data('title'); var data={ action: form.find('.action').val(), nonce: form.find('.nonce').val(), data: form.serialize() } loader.show(); button.addClass('disabled').toggleClass('current'); if(!message.hasClass('static')) { message.slideUp(300, function() { $(themeElements.colorboxLink).colorbox.resize(); }); } jQuery.post(form.attr('action'), data, function(response) { if(jQuery('.redirect', response).length) { if(jQuery('.redirect', response).attr('href')) { window.location.href=jQuery('.redirect',response).attr('href'); } else { window.location.reload(); } message.remove(); } if(title) { button.data('title', button.attr('title')); button.attr('title', title); } toggle.each(function() { var value=toggle.val(); toggle.val(toggle.data('value')); toggle.data('value', value); }); loader.hide(); button.removeClass('disabled'); if(response!='' && response!='0' && response!='-1') { if(message.hasClass('popup')) { $.colorbox({html:'<div class="popup">'+response+'</div>'}); } else if(message.hasClass('static')) { message.append(response); } else { message.html(response).slideDown(300, function() { $(themeElements.colorboxLink).colorbox.resize(); }); } } form.find('.temporary').val(''); form.find('.scroll').each(function() { $(this).scrollTop($(this)[0].scrollHeight); }); }); return false; }); }); Thank you
  18. I have made a custom post type for products, and am using a custom taxonomy for the product categories. The thing that I am wondering about is that sometimes a product category is a parent, and sometimes a child, but sometimes both. For instance, if you have a top level category named shoes, then you might have a sub category named Nike. However, Nike also has shirts, so you could say that shoes and shirts were both subcategories of Nike. Do you know what I'm saying? It's like there is no real parent to child relationship, but they are both parents and both children of each other. How do you handle this type of situation?
  19. Hi Everyone I'm working with the woo commerece plugin and i'd like to have a sub heading under the title of each product. Style and format is sorted however i want a particular Category to show in the sub heading section. I've managed to get as far as showing all categories but i want to narrow this down to just one category that is under a parent category. Below is the code i am using, could anyone suggest how i could achieve showing any child category selected under a parent category. Thanks <?php /** * Single Product title * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $post, $product; $cat_count = sizeof( get_the_terms( $post->ID, 'product_cat' ) ); ?> <h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h1> <?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Artist:', 'Artist:', $cat_count, 'woocommerce' ) . ' ', '.</span>' ); ?>
  20. Working on a website directory that includes ratings for listed companies. Trying to obtain information from database that would put some companies in a higher category than others. Or at least, I believe that is the approach I should be taking. There are a few tricky issues. 1. Ratings are their own custom posts but are attached to company pages (parents) 2. Rating values I need to obtain are meta keys (1. total number of ratings & 2. rating average of EACH) 3. Ratings are based on four criteria which are summed and averaged for each rating submitted. As a result, values are rarely single digits such as 4 or 5 but include decimals rounded to 1 place (e.g. 4.8 or 3.5) Additional info: Ratings are based on 5-star system (out of 5) Higher category would be business that achieved at least 10 ratings of 4 or more Any help appreciated.
  21. I am taking a form that has been created and now trying to incorporate it into WP. The form is filled out multiple times per session. The form when filled out will generate an ID that is used to track the form submissions until completed. The problem that I'm running into is that the code is using a URL structure that breaks on the install. I'm not sure what to tell the code to look for as the URL. I hope I'm making sense. This is my first dive into WP dev. Thanks for the help. <?php /* Template Name: Form */ ?> <?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other 'pages' on your WordPress site will use a different template. * * @package WordPress * @subpackage Twenty_Thirteen * @since Twenty Thirteen 1.0 */ get_header(); ?> <div id="main-content" class="main-content"> <div id="headertitle"> <h1>Steam Trap Form Input</h1> </div> <div id="formtable"> <form class="form-horizontal" role="form" action="/test/FormHandler.php" method="post"> <fieldset> <div class="form-group"> <label for="dateSurvey" class="col-sm-2 control-label">Survey Date</label> <div class="col-sm-6"> <input type="text"<? echo (isset($sd['date']) ? ' value="'.format_date($sd['date']).'"' : '') ?> class="form-control col-sm-6 input-append date" id="dp1" name="dateSurvey" data-date="02-12-2014" data-date-format="mm-dd-yyyy"> </div> </div> <div class="form-group"> <label for="plantName" class="col-sm-2 control-label">Plant Name</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantName"<? echo (isset($sd['plant_name']) ? ' value="'.$sd['plant_name'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="plantLoc" class="col-sm-2 control-label">Plant Location</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantLoc"<? echo (isset($sd['plant_location']) ? ' value="'.$sd['plant_location'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="plantContact" class="col-sm-2 control-label">Plant Contact Name</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantContact"<? echo (isset($sd['plant_contact_name']) ? ' value="'.$sd['plant_contact_name'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="pph" class="col-sm-2 control-label">Pound Per Hour</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="pph" placeholder="XX.XX"<? echo (isset($sd['pph']) ? ' value="'.$sd['pph'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="area" class="col-sm-2 control-label">Area</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="area" placeholder="Boiler Room"<? echo (isset($sd['area']) ? ' value="'.$sd['area'].'"' : '') ?>> </div> </div> <hr> <div class="form-group"> <label for="testDate" class="col-sm-2 control-label">Tested Date</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6 input-append date" id="dp2" name="testDate" data-date="02-12-2014" data-date-format="mm-dd-yyyy"> </div> </div> <!-- <div class="form-group"> <label for="direction" class="col-sm-2 control-label">Direction</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="direction"> <option value="N">N</option> <option value="NE">NE</option> <option value="NW">NW</option> <option value="S">S</option> <option value="SE">SE</option> <option value="SW">SW</option> <option value="E">E</option> <option value="W">W</option> </select> </div> </div> --> <div class="form-group"> <label for="location" class="col-sm-2 control-label">Location</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="location" placeholder=" 'Detailed as possible'"> </div> </div> <div class="form-group"> <label for="flrLevel" class="col-sm-2 control-label">Floor Level</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="flrLevel"> <option value="GROUND">Ground</option> <option value="1st">1st</option> <option value="2nd">2nd</option> <option value="3rd">3rd</option> <option value="4th">4th</option> <option value="5th">5th</option> <option value="6th">6th</option> <option value="7th">7th</option> <option value="8th">8th</option> <option value="9th">9th</option> <option value="10th">10th</option> <option value="11th">11th</option> <option value="12th">12th</option> <option value="13th">13th</option> <option value="14th">14th</option> <option value="15th">15th</option> </select> </div> </div> <div class="form-group"> <label for="elevation" class="col-sm-2 control-label">Elevation</label> <div class="col-sm-6"> <input type="number" class="form-control col-sm-6" name="elevation" placeholder="in feet"> </div> </div> <div class="form-group"> <label for="tagNum" class="col-sm-2 control-label">Tag Number</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="tagNum"> </div> </div> <div class="form-group"> <label for="manufacturer" class="col-sm-2 control-label">Manufacturer</label> <? /* <input type="text" name="mmn" size="30"> */ ?> <div class="col-sm-6"> <select name="manufacturer" class="depend col-sm-6 form-control" id="manufacturer"> <option value="" selected="selected" disabled="disabled">Select Manufacturer</option> </select> </div> <div id="status"></div> </div> <div class="form-group"> <label for="model" class="col-sm-2 control-label">Model Number</label> <div class="col-sm-6"> <select name="model" class="depend col-sm-6 form-control" id="model"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="size" class="col-sm-2 control-label">Size</label> <div class="col-sm-6"> <select name="size" class="depend col-sm-6 form-control" id="size"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="pressure" class="col-sm-2 control-label">Pressure</label> <div class="col-sm-6"> <select name="pressure" id="pressure" class="col-sm-6 form-control"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="service" class="col-sm-2 control-label">Service</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="service" name="service"> <option value="TRACER">TRACER</option> <option value="HEATER">HEATER</option> <option value="PROCESS">PROCESS</option> <option value="DRIP">DRIP</option> </select> </div> </div> <div class="form-group"> <label for="trapCond" class="col-sm-2 control-label">Trap Conditions</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="trapCond"> <option value="OK">OK</option> <option value="BT">BT</option> <option value="CP">CP</option> <option value="VO">VO</option> <option value="RCL">RCL</option> </select> </div> </div> <p></p> <div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <? if(isset($surveyID)) { echo '<input type="hidden" name="surveyID" value="'.intval($_GET['survey']).'">'; } ?> <!-- <? if(isset($areaID)) { echo '<input type="hidden" name="areaID" value="'.intval($_GET['area']).'">'; } ?> --> <button class="btn btn-default btn-lg" type="submit" name="submit" value="add">Add Trap</button> <button class="btn btn-primary btn-lg" type="submit" name="submit" value="add_area">Submit Area</button> <button class="btn btn-danger btn-lg" type="submit" name="submit" value="submit">Submit Survey</button> </div> </div> </fieldset> </form> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <!-- <script src="../script/js/script.js"></script> --> <script src="../script/js/live.js"></script> <script src="../script/js/bootstrap-datepicker.js"></script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#dp1').datepicker({ dateFormat : 'dd-mm-yy' }); }); jQuery(document).ready(function() { jQuery('#dp2').datepicker({ dateFormat : 'dd-mm-yy' }); }); </script> </body> </html> <!-- #content --> </div><!-- #primary --> <?php get_sidebar( 'content' ); ?> </div><!-- #main-content --> <?php get_sidebar(); get_footer(); ?> <?php require("../test/base.php"); if(isset($_POST['submit'])) { $url = '../test/form'; // path to form.php if(!isset($_POST['manufacturer'])) { $_POST['manufacturer'] = NULL; } if(!isset($_POST['model_number'])) { $_POST['model_number'] = NULL; } if(!isset($_POST['size'])) { $_POST['size'] = NULL; } if(!isset($_POST['pressure'])) { $_POST['pressure'] = NULL; } $data = prep($_POST); if($data['submit'] == 'add') { if(!isset($data['surveyID'])) { $surveyID = save_survey($data); } else { $surveyID = $data['surveyID']; } save_survey_details($surveyID, $data); if($surveyID) { header('Location: '.$url.'?survey='.$surveyID); } } if($data['submit'] == 'add_area') { if(!isset($data['areaID'])) { $areaID = save_survey($data); } else { $areaID = $data['areaID']; } save_survey_details($areaID, $data); if($areaID) { header('Location: '.$url.'?survey='.$areaID); } } elseif($data['submit'] == 'submit') { if(isset($data['surveyID'])) { save_survey_details($data['surveyID'], $data); } else { $surveyID = save_survey($data); save_survey_details($surveyID, $data); } header('Location: '.$url); } } function prep($input) { $data = array(); if(is_array($input)) { foreach ($input as $key => $val) { $data[$key] = mysql_real_escape_string($val); } } return $data; } function format_date($date = '') { if(isset($date) && $date) { $tmp = explode('-', $date); $d = $tmp[2].'-'.$tmp[0].'-'.$tmp[1]; } else { $d = NULL; } return $d; } function save_survey($data) { $result = mysql_query("INSERT INTO surveys (date, plant_name, plant_location, plant_contact_name, pph, area) VALUES('".format_date($data['dateSurvey'])."','".$data['plantName']."','".$data['plantLoc']."','".$data['plantContact']."','".$data['pph']."','".$data['area']."')") or die('Error: ' . mysql_error()); $result = mysql_query("INSERT INTO area (date, plant_name, plant_location, plant_contact_name, pph, area) VALUES('".format_date($data['dateSurvey'])."','".$data['plantName']."','".$data['plantLoc']."','".$data['plantContact']."','".$data['pph']."','".$data['area']."')") or die('Error: ' . mysql_error()); return mysql_insert_id(); } function save_survey_details($surveyID, $data) { $result = mysql_query("INSERT INTO survey_details (survey_id, tested_date, direction, location, floor_level, elevation, tag_number, manufacturer, model_number, size, pressure, service, trap_conditions) VALUES($surveyID, '".format_date($data['testDate'])."','".$data['direction']."','".$data['location']."','".$data['flrLevel']."','".$data['elevation']."','".$data['tagNum']."','".$data['manufacturer']."','".$data['model']."','".$data['size']."','".$data['pressure']."','".$data['service']."','".$data['trapCond']."')"); $result = mysql_query("INSERT INTO area_details (survey_id, tested_date, direction, location, floor_level, elevation, tag_number, manufacturer, model_number, size, pressure, service, trap_conditions) VALUES($surveyID, '".format_date($data['testDate'])."','".$data['direction']."','".$data['location']."','".$data['flrLevel']."','".$data['elevation']."','".$data['tagNum']."','".$data['manufacturer']."','".$data['model']."','".$data['size']."','".$data['pressure']."','".$data['service']."','".$data['trapCond']."')"); //or die('Error: ' . mysql_error()); } ?>
  22. I am using WPSQT plugin in my blog site .I code some files in PHP also.how to add that files in plugin files.
  23. Hi, I have a cron job that executes this script every 2 minutes: <?php // LOAD WP-LOAD.PHP require('/opt/bitnami/apps/wordpress/htdocs/wp-load.php'); // INCLUDE AND EXECUTE SCHEDULER.PHP include('/opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/scheduler.php'); ?> When I try to include; /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/scheduler.php: <?php // EXPLODE AND PARSE WP-CONTENT; FUNCTIONS.PHP $parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content', $_SERVER['SCRIPT_FILENAME'] ); // LOAD WP-LOAD.PHP require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' ); // LOAD TEMPLATE FUNCTION CheckFunction(); ?> I get the output: ): failed to open stream: No such file or directory in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php on line 5 PHP Warning: include(): Failed opening '<?php //PLEASE do NOT move me around. I get cranky when I get moved around //get the wp-load in for the wordpress functions $parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content', $_SERVER['SCRIPT_FILENAME'] ); require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' ); //now try calling template function CheckFunction(); ?>' for inclusion (include_path='.:/opt/bitnami/php/lib/php:/opt/bitnami/frameworks/smarty/libs') in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php Any ideas on how to execute this file. Any help would be appreciated.
  24. Good morning I'm trying to add a widget to a WordPress template using PHP. It works, but the problem is that the widget ends up on a new line in the header instead of next to the logo as I want it. The code looks like this: <div class="branding_wrap"> <?php pagelines_main_logo(); ?> <?php pagelines_register_hook( 'pagelines_before_branding_icons', 'branding' ); // Hook ?> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('header-1') ) : ?> <?php endif; ?> I've attached a screenshot of the current header to this post. Can anyone tell me what I'm doing wrong? I'm pretty new at PHP. Thank you!
  25. I am trying to force home landing page text onto this wordpress themes (weblizar Enigma) standard page (which doesnt seem to allow for this even with settings/reading/static/home page option selected wordpress settings) The landing page just seems to be wigitised. In a nutshell, I want to have a "page" of text on home page below banner slider and instead of "BLOG" and blog text. Hope this makes sense. Not getting help from theme author and I have been pointed towards .phpfreaks This is the website below.... http://www.cloudchasing.co.uk Thankyou in advance guys
  • 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.