Jump to content

Search the Community

Showing results for tags 'wordpress'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Here is an image of my comment format: http://oi40.tinypic.com/8w07jt.jpg The hyperlink to each individual comment is the date and time with the url in the format of, for example: /nottingham/#comment-184 After going through my comment templates I found that these two functions do the following, get_comments_link : Retrieves the link to the current post comments AND comments_link: Displays the link to the current post comments The problem is I have no idea where to include these functions so it creates a hyperlink to every comment within every comment. Once this link has been created I'd also like to assign a div to it so I can format it to be in the bottom right corner of each comment. My final goal is to manipulate the link so rather than the comment link itself it will automatically work in the facebook.com/sharer.php which I feel I can do myself once I figure out the previous part. Essentially it will be a share on facebook button, but I have found no plugins which do this yet and thought describing it as a hyperlink would be an easier way to explain what I'm trying to do. Elsewhere I've been told the following: but not sure how to implement this... I hope I've made the question clear, please ask if I haven't. Thanks in advance!
  2. Having installed the 'filter by comments' plugin which "Adds query vars (comment_count, comment_count_compare, orderby_last_comment, orderby_last_activity) for filtering posts by comments". Then adding- <?php query_posts( 'orderby_last_activity=1&paged=' . $paged); ?> -to the top of my index page, all of my posts are now being displayed exactly how I want them to be. ie whichever is most recently updated comes to the front. However when a tag is clicked, the results page is obviously the archive page, which this plugin doesn't appear to work on, leaving posts being shown in order they were published rather than updated. When the above line of code is applied to the archive.php file, it simply pulls every post from the blog and displays them as if its the index, nothing is filtered but they are displaying correctly. Is there a way I can hack that code to sort just the archive results? Looking through the archive.php file, the only I think I should be looking at is - <?php if (have_posts()) : while (have_posts()) : the_post(); ?> -as it comes directly after the filtering code and directly before the article. I am not a complete novice with php, I'm learning fast, this one is just beyond me. How about the query.php file? I'm terrified of that one but my solution may well be in there. Any sort of response appreciated.
  3. Hi Guys Struggling to get this working. This code appears on my page-blog.php When the links are clicked the url changes to /page/2/ etc but the posts themselves don’t change. I have some very similar code in my single.php and its working fine. My code is below, what am I doing wrong? <section role="main"> <?php $page = get_page_by_title('the blog'); $content = apply_filters('the_content', $page->post_content); echo $content; ?> <?php $blog_posts = new WP_Query(); $blog_posts->query('showposts=5'); if ( $blog_posts->have_posts() ) : while ( $blog_posts->have_posts() ) : $blog_posts->the_post(); ?> <article> <?php the_title(); ?> </article> <?php endwhile; ?> <nav id="post-nav"> <span class="prev"><?php next_posts_link( '← View Older Posts', $blog_posts->max_num_pages ); ?></span> <?php previous_posts_link('<span class="next">' .( 'View more Recent Posts →' ). '</span>'); ?> </nav> <?php else: ?> <p>Sorry it looks like you need to add some posts to this blog!</p> <?php endif; wp_reset_query(); ?> </section>
  4. Fairly new to PHP and this is my first post on the site. Just wondered if anyone could help with a piece of code I am trying to get working. It sits inside a Wordpress loop and pulls your 10 latest thumbnails except for the most recent one (as I set the current latest post in an extra large header at the top of the page). The code is doing the job but I am having difficulty sizing the thumbnails: <?php query_posts('posts_per_page=10&offset=1'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php echo $the_query->the_post_thumbnail; ?> <?php if ( has_post_thumbnail($post->ID) ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail($post->ID); } ?> I also have this in my functions.php if ( function_exists( 'add_image_size' ) ) { add_image_size( 'posts-thumb', 220, 170 ); } When I replace ($post->ID) at the bottom of the first script with ( 'posts-thumb' ) the code works as it should and the thumbnails are re-sized but I am losing the ID information attached to the image. Is there a way to put the ( 'posts-thumb' ) snippet in without deleting any of the original code? Thanks.
  5. We have a website with around 1k pages inside it. They all end in .html.. We spent about a year marketing and advertising specific pages of our website all over the net. We are in a process of updating our website, and wish to implement blogs(wordpress) and other useful tools like comments, ratings, etc.. Many of these scripts(widgets) require that the page end in .php in order to make these scripts work. I am trying to keep everything consistent to our advertisement. My question is, is it possible to rename all .HTML files to .PHP and still keep the advertising links? Without having to go to all of our advertising pages and change links..? If so, what would this process be called.. I heard of sync linking and meta refresh, but not sure if this is what we need.
  6. The following serialized string is being pulled from the meta data of a Woocommerce product. a:2:{s:17:"set_51fb76f97cc57";a:6:{s:15:"conditions_type";s:3:"all";s:10:"conditions";a:1:{i:1;a:2:{s:4:"type";s:8:"apply_to";s:4:"args";a:2:{s:10:"applies_to";s:5:"roles";s:5:"roles";a:1:{i:0;s:14:"trade_customer";}}}}s:9:"collector";a:1:{s:4:"type";s:7:"product";}s:4:"mode";s:5:"block";s:5:"rules";a:1:{i:1;a:4:{s:4:"from";s:0:"";s:2:"to";s:0:"";s:4:"type";s:14:"price_discount";s:6:"amount";s:0:"";}}s:10:"blockrules";a:1:{i:1;a:5:{s:4:"from";s:1:"*";s:6:"adjust";s:1:"1";s:4:"type";s:16:"fixed_adjustment";s:6:"amount";s:4:"8.37";s:9:"repeating";s:3:"yes";}}}s:17:"set_51fb76f97d6a2";a:6:{s:15:"conditions_type";s:3:"all";s:10:"conditions";a:1:{i:1;a:2:{s:4:"type";s:8:"apply_to";s:4:"args";a:2:{s:10:"applies_to";s:5:"roles";s:5:"roles";a:1:{i:0;s:19:"bulk_trade_customer";}}}}s:9:"collector";a:1:{s:4:"type";s:7:"product";}s:4:"mode";s:5:"block";s:5:"rules";a:1:{i:1;a:4:{s:4:"from";s:0:"";s:2:"to";s:0:"";s:4:"type";s:14:"price_discount";s:6:"amount";s:0:"";}}s:10:"blockrules";a:1:{i:1;a:5:{s:4:"from";s:1:"*";s:6:"adjust";s:1:"1";s:4:"type";s:16:"fixed_adjustment";s:6:"amount";s:5:"9.428";s:9:"repeating";s:3:"yes";}}}} I also have this function which I am writing in order to pull out the variable product data and display it on the site: function mi_price_adjust(){ global $post, $current_user, $user_roles; $meta = get_post_meta($post->ID); $curPrice = (float)$meta['_regular_price'][0]; $variations = unserialize($meta['_pricing_rules'][0]); $user_roles = $current_user->roles; $theRoll = ''; $thePrice = $curPrice; foreach($user_roles as $miroll){ if(in_array($miroll, $user_roles)){ $theRoll = $miroll; } } if($theRoll != ''){ foreach($variations as $curvar){ $var_roll = $curvar['conditions'][1]['args']['roles'][0]; $var_cost = (float)$curvar['blockrules'][1]['amount']; if($var_roll == $theRoll){ $thePrice = $curPrice - $var_cost; } } } if($thePrice != $curPrice){ return "<strike>".$curPrice."</strike><br /><span class=\"youpayText\">You pay £$thePrice</span>"; }else{ return $thePrice; } } Everything is working fine apart from one thing. I am getting the following error: Invalid argument supplied for foreach The line in question is foreach($variations as $curvar){ And the $variations variable is being populated using this: $variations = unserialize($meta['_pricing_rules'][0]); Which returns the serialized string at the top of this post. Can anyone shed any light on why this might be happening and what we might be able to do to either fix it or circumvent it?
  7. Hello: Any PHP MYSQL experts out there willing to help? I would greatly appreciate it. I built a web directory using WordPress Platform and I am trying to PULL data from my database and display it on the home page. I have the following code: $sql = "SELECT * FROM `agents` LIMIT 0, 30 "; I know this isn't much to work with but I am happy to answer any question related to my tables. Regards, John.
  8. Browser Issues : Safari and FireFox not displaying correctly Safari – Not displaying at all Firefox – ALignment issues? Can someone please help? http://tinyurl.com/ltth2sa
  9. Hi, I'm new at this forum, so I hope I'm posting my question in the correct category - otherwise please correct me. The situation is that I need to customize the plugin "Events manager" for WordPress a little bit, but I'm not a coding guru, so I need a little advise or two. I have the following code from the file (attendeespendinglist.php): <?php /* @var $EM_Event EM_Event */ $people = array(); $EM_Bookings = $EM_Event->get_bookings(); if( count($EM_Bookings->bookings) > 0 ){ ?> <ul class="event-attendees"> <?php $guest_bookings = get_option('dbem_bookings_registration_disable'); $guest_booking_user = get_option('dbem_bookings_registration_user'); foreach( $EM_Bookings as $EM_Booking){ if($EM_Booking->status == 0 && !in_array($EM_Booking->get_person()->ID, $people) ){ $people[] = $EM_Booking->get_person()->ID; echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>'; }elseif($EM_Booking->status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){ echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>'; } } ?> </ul> <?php } This will generate a list with people who have a pending booking. I need to divide the list into two. The first list containing the first 20 pending bookings and the second list containing the rest. So it would be something like this: List 1: 1. name1 2. name2 ... 20. name20 List 2: 21. name21 22.name22 .... etc. Is it possible to do this - and in that case how? I really hope you are able to help me solving this question. Thanks in advance! Best regards, Frederik
  10. Hello everybody, I'm working on a back-end system where WordPress is brought in using an iFrame. The iFrame itself is responsive but the editor within the iFrame that wordpress is bringing in isn't responsive. What I'm trying to achieve is an editor (WYSIWYG) that will be responsive for mobile device's. How can I implement an editor that will fulfill these requirements? I'm fairly new to Wordpress but I've worked with PHP and WYSIWYG editors before. I want it to be a safe operation of changing over the editors so that I don't break anything in the application. Any replies and advice would be greatly appreciated Adam
  11. Hello everyone! I've been at this WordPress AJAX functionality for almost 2 weeks and I've had it working in a basic state for about 2 days. However passing along geolocation data WITH the $.ajax data is ruining my life. Here's what's going on: // click "trigger" function $("#searchsubmit").click(function(e){ e.preventDefault(); // data: object data = { action:'wpa56343_search', latitude: $('input#latitude').attr('value'), longitude: $('input#longitude').attr('value') }; _do_ajax(data); }); // end click func function _do_ajax(obj) { console.log(obj); $.ajax({ type:"POST", url: My_Obj.ajaxurl, // the request is sent to admin-ajax.php data: data, dataType: 'json', success: function( response ){ loops and stuff } WordPress is very specific as to the ways you can do AJAX requests. If you're not familiar with them: The above queries a wp_ajax_ACTION in functions.php. My action function is called wpa56343_search. This function is where I need to include post variables for use within the query it performs. The way it is working now logs Object {action: "wpa56343_search", latitude: "42.041261299999995", longitude: "-70.9414206"} Now why can't I get these through traditional methods such as: $latitude = $_POST['latitude']; $longitude = $_POST['longitude']; // to use within the query function function my_ajax_search($latitude, $longitude){ query here }
  12. I find this website is very good for downloading PHP + MySQL, HTML5 + CSS, WordPress, Magento document and video tutorial. I am happy to share with you, guys, Have a nice day. http://dvdit.org/
  13. Hi I am trying to make some images with links. The code works fine in my localhost in single html page(i use appsrv) . But when i add it to my Wordpress Page , it have some problems. Here is the view in my local host . Here is the view in my Wordpress page. i want to remove the white border around the image and the width of transparent image behind the text is too big. Here is the code <style> .image_sha { -moz-box-shadow:4px 3px 4px #000; -webkit-box-shadow: 3px 3px 4px #000; box-shadow: 3px 4px 4px grey; } div.description{ bottombottom:0px; /* position will be on bottom */ margin-top:-61px; width:250px; height:7%; /* styling bellow */ background-color:white; font-family: 'tahoma'; font-size:15px; font-weight:bold; color:black; opacity:0.6; /* transparency */ filter:alpha(opacity=60); /* IE transparency */ } p.description_content{ padding:10px; color:red; margin:0px; } </style> <html> <div> <div style="float: left;"> <div style="padding-right: 10px;"> <a href="http://www.garioninaval.com/companyprofile/"> <img class='image_sha' src="http://www.garioninaval.com/wpress/wp-content/uploads/2013/07/company-profile.jpg" alt="" /></a> <div class='description'> <p class='description_content'>Company Profile</p> </div> </div> </div> <div style="float: left; margin-left:50px;"> <div style="padding-left: 10px;"> <a href="http://www.garioninaval.com/download/depliantbrochure/"> <img class='image_sha' src="http://www.garioninaval.com/wpress/wp-content/uploads/2013/07/depliant-brochure.jpg" alt="" /></a> <div class='description'> <p class='description_content'>Depliant Brochure</p> </div> </div> </div> </div> <div style="clear:both;"> </div> <div style="margin-top:80px;"> <div style="float: left;"> <div style="padding-right: 10px;"> <a href="http://www.garioninaval.com/garioni-naval-newsletter/"> <img class='image_sha' src="http://www.garioninaval.com/wpress/wp-content/uploads/2013/07/garioni-naval-newsletter.jpg" alt="" /></a> <div class='description'> <p class='description_content'>GarioniNaval Newsletter</p> </div> </div> </div> <div style="float: left; margin-left:50px;"> <div style="padding-left: 10px;"> <a href="http://www.garioninaval.com/download-prodotti/"> <img class='image_sha' src="http://www.garioninaval.com/wpress/wp-content/uploads/2013/07/prodotti.jpg" alt="" /></a> <div class='description'> <p class='description_content'>Prodotti</p> </div> </div> </div> </div> </html> Need help. Thx in advance
  14. I am currently using the plugin WP-CommentNavi for comments pagination but whenever a page is clicked it goes to the highest comments page (oldest comments). My comments are purposely displayed newest first and therefore I need the default pagination page to be 1 whenever a link is clicked. I notice there is the same default for other pagination plugins too whereby the highest pagination page (ie if there are 5 pages) page 5 is displayed. At the moment when I load page tellhi####.com/newcastle the page that will be loaded is tellhi####.com/newcastle/comment-page-2/ whereas I want tellhi####.com/newcastle/comment-page-1/ to be loaded I can't be sure this is the relevant code to what I am trying to achieve but I feel the answer might lie in here (below). If not, please tell me and disregard this code. ### Function: Comment Navigation: Boxed Style Paging function wp_commentnavi($before = '', $after = '') { global $wp_query; $comments_per_page = intval(get_query_var('comments_per_page')); $paged = intval(get_query_var('cpage')); $commentnavi_options = get_option('commentnavi_options'); $numcomments = intval($wp_query->comment_count); $max_page = intval($wp_query->max_num_comment_pages); if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = intval($commentnavi_options['num_pages']); $pages_to_show_minus_1 = $pages_to_show-1; $half_page_start = floor($pages_to_show_minus_1/2); $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } if($max_page > 1 || intval($commentnavi_options['always_show']) == 1) { $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $commentnavi_options['pages_text']); $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text); echo $before.'<div class="wp-commentnavi">'."\n"; switch(intval($commentnavi_options['style'])) { case 1: if(!empty($pages_text)) { echo '<span class="pages">'.$pages_text.'</span>'; } if ($start_page >= 2 && $pages_to_show < $max_page) { $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['first_text']); echo '<a href="'.clean_url(get_comments_pagenum_link()).'" class="first" title="'.$first_page_text.'">'.$first_page_text.'</a>'; if(!empty($commentnavi_options['dotleft_text'])) { echo '<span class="extend">'.$commentnavi_options['dotleft_text'].'</span>'; } } previous_comments_link($commentnavi_options['prev_text']); for($i = $start_page; $i <= $end_page; $i++) { if($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']); echo '<span class="current">'.$current_page_text.'</span>'; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']); echo '<a href="'.clean_url(get_comments_pagenum_link($i)).'" class="page" title="'.$page_text.'">'.$page_text.'</a>'; } } next_comments_link($commentnavi_options['next_text'], $max_page); if ($end_page < $max_page) { if(!empty($commentnavi_options['dotright_text'])) { echo '<span class="extend">'.$commentnavi_options['dotright_text'].'</span>'; } $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['last_text']); echo '<a href="'.clean_url(get_comments_pagenum_link($max_page)).'" class="last" title="'.$last_page_text.'">'.$last_page_text.'</a>'; } break; case 2; echo '<form action="'.admin_url('admin.php?page='.plugin_basename(__FILE__)).'" method="get">'."\n"; echo '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n"; for($i = 1; $i <= $max_page; $i++) { $page_num = $i; if($page_num == 1) { $page_num = 0; } if($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']); echo '<option value="'.clean_url(get_comments_pagenum_link($page_num)).'" selected="selected" class="current">'.$current_page_text."</option>\n"; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']); echo '<option value="'.clean_url(get_comments_pagenum_link($page_num)).'">'.$page_text."</option>\n"; } } echo "</select>\n"; echo "</form>\n"; break; } echo '</div>'.$after."\n"; } } In short I need, anytime a page is clicked, for the comments pagination to be on page 1, not the highest page available. Just so you know I have tried the discussion settings on the wordpress dashboard. Nothing on google either! Failing a full answer, does anyone know the actual php code that determines what pagination page is loaded by default? I received this response via an e-mail but due to my PHP knowledge am unable to implement it, any ideas? ... Just reverse the loop. That'll fix it. Here's the relevant part: http://pastie.org/8166399 You need to go back, i.e. use $i-- Hope I have been clear in my question! Thanks in advance, Paul
  15. I am building a WordPress website where I want profiles to be displayed directly on the Home page from the Database as members add their profiles. What I have so far is this: If anyone register through the website, their info is stored in a database and their profiles are displayed in a result page. For example: if you use the search form and search for specific member they will display in: http://www.website.com/results/URL (Where results is the page that always display results. Here is the code I have that works just fine: <style> .person_name { font-size:13px; text-align:center; text-transform:uppercase; padding-top:8px; } .person_image { padding:4.2px; border:1px solid #aaa; width:125px; } </style> <?php $state=$_GET['state']; $county=$_GET['county']; $city=$_GET['city']; $zip=$_GET['zip']; /**/ // Make a MySQL Connection mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("user") or die(mysql_error()); // Retrieve all the data from the "example" table $result = mysql_query("SELECT * FROM persons WHERE city='".$city."' OR zip='".$zip."' ORDER BY name") or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<div style='display:inline-block;margin-right:15px;cursor:pointer;' onclick='location=\"http://www.website.com/profile/?id=".str_replace(' ','_',$row["name"])."\"'>"; echo "<div class='person_image'><img src='http://www.website.com/wp-content/uploads/".$row['photo']."' style='' width='125px' /></div>"; echo "<div class='person_name'>".$row['name']."</div>"; echo "</div>"; } /**/ //echo "page for: ".$state." ".$county." ".$city." ".$zip; ?> On my home page and where I want the data to be displayed other than the result page is kinda tricky. I want to be able to only display 6 profiles. I also want to mention that I am using the Execute PHP plugin that helped me display the php in pages. Here is some of my home page code where I want to display those profiles: if ( is_active_sidebar( 'Our Newest Members' ) ) { echo '<div class="Our Newest Members">'; echo '<h4>' . __( 'Our Newest Members', 'themename' ) . '</h4>'; dynamic_sidebar( 'Our Newest Members' ); echo '</div><!-- end .OurNewestMembers -->'; } I am not a code savvy person but always willing to learn and I am also more than happy to answer any follow up questions. Thank you so much for all your help,!!!! John
  16. I have a pinboard theme installed wherein users register from front-end. There is a dropdown in their profile which they select to change language. Right now it has only English. Is it possible to add multilanguage support for users in the front-end. So that they can pin in their own language ??
  17. Greetings all! I have simple question to do with a youtube plugin i use on my wordpress site. The plugin grabs the last digits of a Youtube webaddess and puts the youtube embed code into my wordpress Post area otherwise known as "post_inner_wrapper".... I have the code here supplied i simply wish to change were the PHP embed code will go, instead i want it to go to "Video_container" a Div i created in CSS. In the following code it uses "jf_yfvp_video_token" and / or "$video_token" to grab the video and embed the code so search Ctrl+f for "jf_yfvp_video_token" or "$video_token"... Any help would be apprecaatied as i am very newb at php and stil llearning. Thanks! <?php /* Plugin Name: YouTube Favorite Video Posts Description: Checks your YouTube favorite videos RSS feed and creates new posts in a custom post type. Version: 1.1 License: GPL2 */ /* Copyright 2011-2012 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Youtube_Favorite_Video_Posts_Foghlaim { public function __construct() { /* Things happen when we activate and deactivate the plugin of course. */ register_activation_hook( __FILE__, array( $this, 'activate_plugin' ) ); register_deactivation_hook( __FILE__, array( $this, 'deactivate_plugin' ) ); /* Make a pretty link for settings under the plugin information. */ add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 2 ); /* Add our custom settings to the admin menu. */ add_action( 'admin_head', array( $this, 'edit_admin_icon' ) ); add_action( 'admin_menu', array( $this, 'add_settings' ) ); add_action( 'admin_init', array( $this, 'register_settings' ) ); add_action( 'admin_init', array( $this, 'add_languages' ) ); /* Register the jf_yfvp_youtube custom post type */ add_action( 'init', array( $this, 'create_content_type' ) ); /* Our hook added when we schedule a WP Cron event */ add_action( 'jf_yfvp_process_feed', array( $this, 'process_feed' ) ); } /** * When activating the plugin, register our custom post type and flush the rewrite * rules if the option to use our custom post type has been selected. */ public function activate_plugin(){ /* Create the custom post type upon activation. */ $this->create_content_type(); $current_options = get_option( 'jf_yfvp_options', array() ); $valid_fetch_intervals = wp_get_schedules(); /* If the custom post type provided by this plugin is selected, flush the rewrite * rules so that the URLs can be pretty */ if ( isset( $current_options['post_type'] ) && 'jf_yfvp_youtube' === $current_options['post_type'] ) flush_rewrite_rules( false ); /* If a fetch interval has previously been selected, use that. Otherwise, we'll not schedule the event until settings save. */ if ( isset( $current_options['fetch_interval'] ) && in_array( $current_options['fetch_interval'], $valid_fetch_intervals ) ) wp_schedule_event( ( time() + 120 ) , $current_options['fetch_interval'], 'jf_yfvp_process_feed' ); } /** * When the plugin is deactivated, we want to make sure that the WP Cron event * we have scheduled is cleared. */ public function deactivate_plugin(){ wp_clear_scheduled_hook( 'jf_yfvp_process_feed' ); } /** * Add the text domain for plugin translation */ public function add_languages() { load_plugin_textdomain( 'youtube-favorite-video-posts', false, basename( dirname( __FILE__ ) ) . '/lang' ); } /** * Add a link for the plugin settings page when viewing the general plugins display. * * Function gratefully borrowed from Pippin Williamson's WPMods article: * http://www.wpmods.com/adding-plugin-action-links/ * * @param $links array Current array of links to be displayed under the plugin * @param $file string The current plugin file being processed * @return array New array of links to be displayed under the plugin */ public function add_plugin_action_links( $links, $file ){ static $this_plugin; if ( ! $this_plugin ) $this_plugin = plugin_basename( __FILE__ ); if ( $file == $this_plugin ) { $settings_link = '<a href="' . site_url( '/wp-admin/options-general.php?page=youtube-favorite-video-posts-settings' ) . '">' . __( 'Settings', 'youtube-favorite-video-posts' ) . '</a>'; array_unshift( $links, $settings_link ); } return $links; } /** * Add some style to the plugin with a YouTube icon at the top of the page. */ public function edit_admin_icon(){ global $post_type; if ( 'jf_yfvp_youtube' === $post_type ) echo '<style>#icon-edit { background: url("' . plugins_url( 'images/youtube-icon-32.png', __FILE__ ) . '") no-repeat; background-size: 32px 32px; }</style>'; } /** * Add the sub-menu item under the Settings top-level menu. */ public function add_settings(){ add_options_page( __('YouTube Favorites', 'youtube-favorite-video-posts' ), __('YouTube Favorites', 'youtube-favorite-video-posts'), 'manage_options', 'youtube-favorite-video-posts-settings', array( $this, 'view_settings' ) ); } /** * Display the main settings view for Youtube Favorite Video Posts */ public function view_settings(){ ?> <div class="wrap"> <div class="icon32" id="icon-options-general"></div> <h2><?php _e( 'YouTube Favorite Video Posts', 'youtube-favorite-video-posts' ); ?></h2> <h3><?php _e( 'Overview', 'youtube-favorite-video-posts' ); ?>:</h3> <p style="margin-left:12px; max-width:640px;"><?php _e( 'The settings below will help determine where to check for your favorite YouTube videos, how often to look for them, and how they should be stored once new items are found.', 'youtube-favorite-video-posts' ); ?></p> <p style="margin-left:12px; max-width:640px;"><?php _e( 'The most important part of this process will be to determine the RSS feed for your favorite YouTube videos. To do this, your username <strong>must</strong> be filled out below. This can usually be found in the upper right hand corner of <a href="http://www.youtube.com">YouTube.com</a>.', 'youtube-favorite-video-posts' ); ?></p> <ol style="margin-left:36px;"> <li><?php _e( 'Username must be filled in below. Email address will not work.', 'youtube-favorite-video-posts' ); ?></li> <li><?php _e( 'The embed width and height settings will be applied to the iframe in your post content.', 'youtube-favorite-video-posts' ); ?></li> <li><?php _e( 'If you would like to change the content or title before the new content is saved, you may be interested in the <a href="http://jeremyfelt.com/wordpress/2012/05/12/filters-in-youtube-favorite-video-posts/">available filters</a>.', 'youtube-favorite-video-posts' ); ?></li> </ol> <form method="POST" action="options.php"> <?php settings_fields( 'jf_yfvp_options' ); do_settings_sections( 'jf_yfvp' ); ?> <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'youtube-favorite-video-posts' ); ?>" /></p> </form> </div> <?php } /** * Register the settings, sections, and fields that we want made available for * the plugin. */ public function register_settings(){ register_setting( 'jf_yfvp_options', 'jf_yfvp_options', array( $this, 'validate_options' ) ); add_settings_section( 'jf_yfvp_section_main', '', array( $this, 'main_section_text' ), 'jf_yfvp' ); add_settings_section( 'jf_yfvp_section_post_type', '', array( $this, 'post_type_section_text' ), 'jf_yfvp' ); add_settings_section( 'jf_yfvp_section_interval', '', array( $this, 'interval_section_text' ), 'jf_yfvp' ); add_settings_field( 'jf_yfvp_youtube_rss_feed', 'YouTube Username:', array( $this, 'youtube_user_text' ), 'jf_yfvp', 'jf_yfvp_section_main' ); add_settings_field( 'jf_yfvp_embed_width', 'Default Embed Width:', array( $this, 'embed_width_text' ), 'jf_yfvp', 'jf_yfvp_section_main' ); add_settings_field( 'jf_yfvp_embed_height', 'Default Embed Height:', array( $this, 'embed_height_text' ), 'jf_yfvp', 'jf_yfvp_section_main' ); add_settings_field( 'jf_yfvp_max_fetch_items', 'Max Items To Fetch:', array( $this, 'max_fetch_items_text' ), 'jf_yfvp', 'jf_yfvp_section_main' ); add_settings_field( 'jf_yfvp_post_type', 'Post Type:', array( $this, 'post_type_selection_text' ), 'jf_yfvp', 'jf_yfvp_section_post_type' ); add_settings_field( 'jf_yfvp_post_status', __( 'Default Post Status:', 'youtube-favorite-video-posts' ) , array( $this, 'post_status_selection_text' ), 'jf_yfvp', 'jf_yfvp_section_post_type' ); add_settings_field( 'jf_yfvp_fetch_interval', 'Feed Fetch Interval: ', array( $this, 'fetch_interval_selection_text' ), 'jf_yfvp', 'jf_yfvp_section_interval' ); } /** * Always seems weird to have to include this. */ public function main_section_text() { } /** * Describe the selection of a post type for the plugin to use. */ public function post_type_section_text() { ?> <h3>Custom Or Default Post Type</h3> <p style="margin-left:12px; max-width: 640px;"><?php _e( 'A new custom post type that adds an \'youtube\' slug to new items has been added and selected by default. You can change this to any other available post type if you would like.', 'youtube-favorite-video-posts' ); ?></p> <?php } /** * Describe the selection of the WP Cron interval we'll use */ public function interval_section_text() { $next_scheduled_time = wp_next_scheduled( 'jf_yfvp_process_feed' ); if ( $next_scheduled_time ) { $next_scheduled_time = $next_scheduled_time + ( get_option( 'gmt_offset' ) * 3600 ); $user_current_time = time() + ( get_option( 'gmt_offset' ) * 3600 ); $time_till_cron = human_time_diff( $user_current_time, $next_scheduled_time ); $next_cron_date = date( 'g:i:sa', $next_scheduled_time ); ?> <h3>RSS Fetch Frequency</h3> <p style="margin-left:12px; max-width: 630px;"><?php _e( 'This plugin currently depends on WP Cron operating fully as expected. In most cases, you should be able to select one of the intervals below and things will work. If not, please let <a href="http://www.jeremyfelt.com">me</a> know. By default, we check for new items on an hourly basis.', 'youtube-favorite-video-posts' ); ?></p> <p style="margin-left:12px; max-width: 630px;"><?php printf( __( 'Your Youtube favorites feed is scheduled to be loaded next in %1$s, at %2$s.', 'youtube-favorite-video-posts' ), $time_till_cron, $next_cron_date ); ?></p> <?php } else { ?> <h3>RSS Fetch Frequency</h3> <p style="margin-left:12px; max-width: 630px;"><?php _e( 'An interval has not yet been saved. Please select the frequency with which you would like this plugin to check your favorite video feed. The default of Once Hourly will be used if you do not change the interval before saving.', 'youtube-favorite-video-posts' ); ?></p> <?php } } /** * Provide an input for the embed width */ public function embed_width_text() { $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); if ( ! isset( $jf_yfvp_options['embed_width'] ) ) $jf_yfvp_options['embed_width'] = 330; ?> <input style="width: 100px;" type="text" id="jf_yfvp_embed_width" name="jf_yfvp_options[embed_width]" value="<?php echo esc_attr( $jf_yfvp_options['embed_width'] ); ?>" /> <?php } /** * Provide in input for the embed height */ public function embed_height_text() { $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); if ( ! isset( $jf_yfvp_options['embed_height'] ) ) $jf_yfvp_options['embed_height'] = 270; ?> <input style="width: 100px;" type="text" id="jf_yfvp_embed_height" name="jf_yfvp_options[embed_height]" value="<?php echo esc_attr( $jf_yfvp_options['embed_height'] ); ?>" /> <?php } /** * Provide an input for the Youtube username */ public function youtube_user_text() { $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); /* If options have been saved before, but no name specified, toss up a warning */ if ( ! empty( $jf_yfvp_options ) && empty( $jf_yfvp_options['youtube_rss_feed'] ) ) { ?> <div class="error" style="width: 615px;padding: 10px;"><?php _e( 'It looks like a Youtube username has not yet been entered, even though other options have been saved. Please note that we are unable to fetch your favorite videos until a username is provided.', 'youtube-favorite-video-posts' ); ?></div> <?php } if ( ! isset( $jf_yfvp_options['youtube_rss_feed'] ) ) $jf_yfvp_options['youtube_rss_feed'] = ''; ?> <input style="width: 200px;" type="text" id="jf_yfvp_youtube_rss_feed" name="jf_yfvp_options[youtube_rss_feed]" value="<?php echo esc_attr( $jf_yfvp_options['youtube_rss_feed'] ); ?>" /> <?php } /** * Provide an input for the selection of post types */ public function post_type_selection_text() { $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); if ( ! isset( $jf_yfvp_options['post_type'] ) ) $jf_yfvp_options['post_type'] = 'jf_yfvp_youtube'; $post_types = array_merge( get_post_types( array( '_builtin' => false ) ), array( 'post', 'link' ) ); echo '<select id="jf_yfvp_post_type" name="jf_yfvp_options[post_type]">'; foreach( $post_types as $pt ){ echo '<option value="' . esc_attr( $pt ) . '" ' . selected( $jf_yfvp_options['post_type'], $pt, false ) . '>' . esc_html( $pt ) . '</option>'; } echo '</select>'; } /** * Provide an input for the selection of post status */ public function post_status_selection_text() { $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); if ( ! isset( $jf_yfvp_options['post_status'] ) ) $jf_yfvp_options['post_status'] = 'publish'; $post_statii = array( 'draft', 'publish', 'private' ); echo '<select id="jf_yfvp_post_status" name="jf_yfvp_options[post_status]">'; foreach( $post_statii as $ps ) { echo '<option value="' . esc_attr( $ps ) . '" ' . selected( $jf_yfvp_options['post_status'], $ps, false ) . '>' . esc_html( $ps ) . '</option>'; } echo '</select>'; } /** * Provide an input to select the WP Cron interval to schedule the hook with */ public function fetch_interval_selection_text() { $intervals = wp_get_schedules(); $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); if ( ! isset( $jf_yfvp_options['fetch_interval'] ) ) $jf_yfvp_options['fetch_interval'] = 'hourly'; echo '<select id="jf_yfvp_fetch_interval" name="jf_yfvp_options[fetch_interval]">'; foreach( $intervals as $i => $v ){ echo '<option value="' . esc_attr( $i ) . '" ' . selected( $jf_yfvp_options['fetch_interval'], $i, false ) . '>' . esc_html( $v['display'] ) . '</option>'; } echo '</select>'; } /** * Provide an input for the max number of items to fetch */ public function max_fetch_items_text() { $jf_yfvp_options = get_option( 'jf_yfvp_options', array() ); if ( ! isset( $jf_yfvp_options['max_fetch_items'] ) ) $jf_yfvp_options['max_fetch_items'] = 5; ?> <input type="text" id="jf_yfvp_max_fetch_items" name="jf_yfvp_options[max_fetch_items]" value="<?php echo esc_attr( $jf_yfvp_options['max_fetch_items'] ); ?>" /> <?php } /** * Validate the options being saved for the plugin * * @param $input array New values that the user is attempting to save * @return array Validated values that we pass on */ public function validate_options( $input ) { $valid_post_status_options = array( 'draft', 'publish', 'private' ); $valid_fetch_interval_options = wp_get_schedules(); $valid_post_type_options = array_merge( get_post_types( array( '_builtin' => false ) ), array( 'post', 'link' ) ); if( ! in_array( $input['post_status'], $valid_post_status_options ) ) $input['post_status'] = 'publish'; if( ! in_array( $input['post_type'], $valid_post_type_options ) ) $input['post_type'] = 'jf_yfvp_youtube'; if( ! array_key_exists( $input['fetch_interval'], $valid_fetch_interval_options ) ) $input['fetch_interval'] = 'hourly'; /* It is possible the user just switched back to using our custom post type, so we should flush the rewrite rules */ if ( 'jf_yfvp_youtube' === $input['post_type'] ) flush_rewrite_rules( false ); /* This seems to be the only place we can reset the scheduled Cron if the frequency is changed, so here goes. */ wp_clear_scheduled_hook( 'jf_yfvp_process_feed' ); wp_schedule_event( ( time() + 30 ) , $input['fetch_interval'], 'jf_yfvp_process_feed' ); $input['max_fetch_items'] = absint( $input['max_fetch_items'] ); $input['embed_width'] = absint( $input['embed_width'] ); $input['embed_height'] = absint( $input['embed_height'] ); return $input; } /** * Register our custom post type - jf_yfvp_youtube - for possible use with the plugin */ public function create_content_type() { register_post_type( 'jf_yfvp_youtube', array( 'labels' => array( 'name' => __( 'YouTube', 'youtube-favorite-video-posts' ), 'singular_name' => __( 'YouTube Favorite', 'youtube-favorite-video-posts' ), 'all_items' => __( 'All YouTube Favorites', 'youtube-favorite-video-posts' ), 'add_new_item' => __( 'Add YouTube Favorite', 'youtube-favorite-video-posts' ), 'edit_item' => __( 'Edit YouTube Favorite', 'youtube-favorite-video-posts' ), 'new_item' => __( 'New YouTube Favorite', 'youtube-favorite-video-posts' ), 'view_item' => __( 'View YouTube Favorite', 'youtube-favorite-video-posts' ), 'search_items' => __( 'Search YouTube Favorites', 'youtube-favorite-video-posts' ), 'not_found' => __( 'No YouTube Favorites found', 'youtube-favorite-video-posts' ), 'not_found_in_trash' => __( 'No YouTube Favorites found in trash', 'youtube-favorite-video-posts' ), ), 'description' => __( 'YouTube posts created by the YouTube Favorite Video Posts plugin.', 'youtube-favorite-video-posts' ), 'public' => true, 'menu_icon' => plugins_url( '/images/youtube-icon-16.png', __FILE__ ), 'menu_position' => 5, 'hierarchical' => false, 'supports' => array ( 'title', 'editor', 'author', 'custom-fields', 'comments', 'revisions', ), 'has_archive' => true, 'rewrite' => array( 'slug' => 'youtube', 'with_front' => false ), ) ); } /** * The default SimplePie cache lifetime is 12 hours. We really do want to update more * frequently, so we'll make it 30 seconds during our update. * * @return int Number of seconds for the SimplePie cache to last */ public function modify_simplepie_cache_lifetime() { return 30; } /** * Grab the configured YouTube favorites RSS feed and create new posts based on that. * * @return mixed Only returns if leaving the function */ public function process_feed() { /* Go get some options! */ $youtube_options = get_option( 'jf_yfvp_options', array() ); /* No username, no feed. No feed, no work. */ if ( empty( $youtube_options['youtube_rss_feed'] ) ) return; /* The feed URL we'll be grabbing. */ $youtube_feed_url = 'http://gdata.youtube.com/feeds/base/users/' . esc_attr( $youtube_options['youtube_rss_feed'] ) . '/favorites?alt=rss'; if ( isset( $youtube_options['post_type'] ) ) $post_type = $youtube_options['post_type']; else $post_type = 'jf_yfvp_youtube'; if ( isset( $youtube_options['post_status'] ) ) $post_status = $youtube_options['post_status']; else $post_status = 'publish'; if ( isset( $youtube_options['max_fetch_items'] ) ) $max_fetch_items = absint( $youtube_options['max_fetch_items'] ); else $max_fetch_items = 5; /* Now fetch with the WordPress SimplePie function. */ add_filter( 'wp_feed_cache_transient_lifetime', array( $this, 'modify_simplepie_cache_lifetime' ) ); $youtube_feed = fetch_feed( $youtube_feed_url ); remove_filter( 'wp_feed_cache_transient_lifetime', array( $this, 'modify_simplepie_cache_lifetime' ) ); if ( ! is_wp_error( $youtube_feed ) ) { $max_items = $youtube_feed->get_item_quantity( $max_fetch_items ); $youtube_items = $youtube_feed->get_items( 0, $max_items ); foreach( $youtube_items as $item ) { // Hash the guid element from the RSS feed to determine uniqueness, since yeah... guid. $video_guid = md5( $item->get_id() ); $video_token = substr( $item->get_id(), 43 ); $old_item_hash = md5( $video_token ); $video_embed_code = '<iframe width=\"' . absint( $youtube_options['embed_width'] ) . '\" height=\"' . absint( $youtube_options['embed_height'] ) . '\" src=\"http://www.youtube.com/embed/' . esc_attr( $video_token ) . '\" frameborder=\"0\" allowfullscreen></iframe>'; /* Allow other plugins or themes to alter or replace the post content before storing */ $video_embed_code = apply_filters( 'yfvp_new_video_embed_code', $video_embed_code, $video_token ); /* Allow other plugins or themes to alter or replace the post title before storing. * Also, we're disabling the kses filters below, so we need to clean up the title as * YouTube allows " and the like. */ $original_item_title = $item->get_title(); $item_title = esc_html( apply_filters( 'yfvp_new_video_item_title', $original_item_title ) ); /** * Our previous hash management was ugly, so now we need to check for the * existence of the old hash before checking the existence of the new hash. * If we do happen to find an old hash, we'll update it immediately with * the newer hash so that we can get rid of this code in the next release. */ $existing_old_item = get_posts( array( 'post_type' => $post_type, 'numberposts' => 1, 'post_status' => array( 'publish', 'draft', 'private' ), 'meta_query' => array( array( 'key' => 'jf_yfvp_hash', 'value' => $old_item_hash, ), ), )); if ( ! empty( $existing_old_item ) ) { update_post_meta( $existing_old_item[0]->ID, 'jf_yfvp_hash', $video_guid ); $existing_items = $existing_old_item; } else { $existing_items = get_posts( array( 'post_type' => $post_type, 'numberposts' => 1, 'post_status' => array( 'publish', 'draft', 'private' ), 'meta_query' => array( array( 'key' => 'jf_yfvp_hash', 'value' => $video_guid, ), ), )); } // If we come back empty on our meta query, we should be ok to insert the video as normal if ( empty ( $existing_items ) ) { $youtube_post = array( 'post_title' => $item_title, 'post_content' => $video_embed_code, 'post_author' => 1, 'post_status' => $post_status, 'post_type' => $post_type, 'filter' => true, ); kses_remove_filters(); $item_post_id = wp_insert_post( $youtube_post ); kses_init_filters(); add_post_meta( $item_post_id, 'jf_yfvp_hash', $video_guid, true ); add_post_meta( $item_post_id, 'jf_yfvp_video_token', $video_token, true ); add_post_meta( $item_post_id, 'jf_yfvp_original_title', sanitize_title( $original_item_title ), true ); } else { $original_meta_title = get_post_meta( $existing_items[0]->ID, 'jf_yfvp_original_title', true ); /* * If the current item's original title does not match the matched post's original title, * update it with the current filtered version of the new item title. *whew* */ if ( $original_item_title !== $original_meta_title ) { wp_update_post( array( 'ID' => $existing_items[0]->ID, 'post_title' => $item_title ) ); update_post_meta( $existing_items[0]->ID, 'jf_yfvp_original_title', $original_item_title ); } } } } } } new Youtube_Favorite_Video_Posts_Foghlaim();
  18. I am currently working off of a Wordpress template from Gavick. Here is the website: earthcharterfest.com/wordpress Within the homepage of the site, there is a widget that displays five circular containers under the header "Venues". The containers hold images that move one by one from the right to the left every few seconds or so. The content within the containers is determined by Wordpress "posts" within the Widget. So for every post I create, a new container is also created. What I would like to do is, instead of having the containers move left to right one by one, to make them move five containers at a time. This way I can have images all related to a single venue, and have other sets of images for various venues. I was told that in order to do this that these files must be edited: /wp-content/themes/Fest/gavern/widget.speakers.php is the file that generates content, /wp-content/themes/Fest/js/widgets/speakers.js is a jQuery file that creates animation. However, I have very little experience with both Javascript and PHP. Can anyone be of assistance? Below are the two files that deal with the Circular Container Widget. Gavick calls this widget the Speakers Widget. Website: earthcharterfest.com/wordpress /wp-content/themes/Fest/js/widgets/speakers.js: // // GK Speakers Widget // jQuery(window).load(function(){ jQuery(document).find('.widget_gk_speakers').each(function(i, widget) { new GK_Speakers(jQuery(widget)); }); }); function GK_Speakers(widget) { this.$G = null; this.current_offset = 0; this.anim_interval = 0; this.current = 0; this.total = 0; this.items = []; this.availableItems = null; this.hover = false; this.$G = { 'animation_speed': 500, 'animation_interval': 5000, }; this.current_offset = 0; this.anim_interval = this.$G['animation_interval']; this.current = 4; this.total = widget.find('.gkw-rest-speakers .gkw-speaker').length; // if there is more than 5 slides if(this.total > 5) { // prepare handlers this.items[0] = widget.find('.gkw-speakers-small-left .gkw-speaker-small').first(); this.items[1] = widget.find('.gkw-speakers-small-left .gkw-speaker-small').first().next(); this.items[2] = widget.find('.gkw-speakers .gkw-speaker-big').first(); this.items[3] = widget.find('.gkw-speakers-small-right .gkw-speaker-small').first(); this.items[4] = widget.find('.gkw-speakers-small-right .gkw-speaker-small').first().next(); // this.availableItems = widget.find('.gkw-rest-speakers .gkw-speaker'); // var $this = this; // jQuery(this.items).each(function(i, el) { jQuery(el).removeClass('speaker-hide'); }); // run the animation setTimeout(function() { $this.gkChangeSpeakers(); }, this.anim_interval + 400); jQuery(this.items).each(function(i, el) { jQuery(el).mouseenter(function() { $this.hover = true; }); jQuery(el).mouseleave(function() { $this.hover = false; }); }); } } GK_Speakers.prototype.gkChangeSpeakers = function() { // var $this = this; // if(!this.hover) { // hide speakers jQuery(this.items).each(function(i, el) { jQuery(el).addClass('speaker-hide'); }); if(this.current < this.total - 1) { this.current += 1; } else { this.current = 0; } setTimeout(function() { var IDs = [0, 0, 0, 0, 0]; IDs[4] = $this.current; totalOffset = $this.total; IDs[3] = ($this.current - 1 < 0) ? --totalOffset : $this.current - 1; IDs[2] = ($this.current - 2 < 0) ? --totalOffset : $this.current - 2; IDs[1] = ($this.current - 3 < 0) ? --totalOffset : $this.current - 3; IDs[0] = ($this.current - 4 < 0) ? --totalOffset : $this.current - 4; jQuery($this.items[0]).html(jQuery($this.availableItems[IDs[0]]).html()); jQuery($this.items[1]).html(jQuery($this.availableItems[IDs[1]]).html()); jQuery($this.items[2]).html(jQuery($this.availableItems[IDs[2]]).html()); jQuery($this.items[3]).html(jQuery($this.availableItems[IDs[3]]).html()); jQuery($this.items[4]).html(jQuery($this.availableItems[IDs[4]]).html()); }, 600); // show speakers setTimeout(function() { jQuery($this.items).each(function(i, el) { jQuery(el).removeClass('speaker-hide'); }); }, 750); } // setTimeout(function() { $this.gkChangeSpeakers(); }, this.anim_interval + 800); }; /wp-content/themes/Fest/gavern/widget.speakers.php: <?php /** * * GK Speakers Widget class * **/ class GK_Speakers_Widget extends WP_Widget { /** * * Constructor * * @return void * **/ function GK_Speakers_Widget() { $this->WP_Widget( 'widget_gk_speakers', __( 'GK Speakers', GKTPLNAME ), array( 'classname' => 'widget_gk_speakers', 'description' => __( 'Use this widget to show rotator with speakers', GKTPLNAME) ) ); $this->alt_option_name = 'widget_gk_speakers'; add_action( 'save_post', array(&$this, 'refresh_cache' ) ); add_action( 'delete_post', array(&$this, 'refresh_cache' ) ); add_action('wp_enqueue_scripts', array('GK_Speakers_Widget', 'add_scripts')); } static function add_scripts() { wp_register_script( 'gk-speakers', get_template_directory_uri() . '/js/widgets/speakers.js', array('jquery')); wp_enqueue_script('gk-speakers'); } /** * * Outputs the HTML code of this widget. * * @param array An array of standard parameters for widgets in this theme * @param array An array of settings for this widget instance * @return void * **/ function widget($args, $instance) { $cache = get_transient(md5($this->id)); // the part with the title and widget wrappers cannot be cached! // in order to avoid problems with the calculating columns // extract($args, EXTR_SKIP); $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Speakers', GKTPLNAME ) : $instance['title'], $instance, $this->id_base); echo $before_widget; echo $before_title; echo $title; echo $after_title; if($cache) { echo $cache; echo $after_widget; return; } ob_start(); // $category = empty($instance['category']) ? '' : $instance['category']; $anim_speed = empty($instance['anim_speed']) ? 500 : $instance['anim_speed']; $anim_interval = empty($instance['anim_interval']) ? 5000 : $instance['anim_interval']; // $gk_loop = new WP_Query( 'category_name=' . $category . '&post_type=gavern_speakers'); $speakers = array(); while($gk_loop->have_posts()) { $gk_loop->the_post(); array_push($speakers, array( 'title' => get_the_title(), 'img' => wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) ), 'url' => get_permalink() )); } wp_reset_postdata(); if (count($speakers)) { if(count($speakers) >= 5) { echo '<div class="gkw-speakers"> <div class="gkw-speaker-big speaker-hide"> <div> <a href="'.$speakers[2]['url'].'"> <img src="'.$speakers[2]['img'].'" alt="'.$speakers[2]['title'].'" /> </a> </div> <h4> <a href="'.$speakers[2]['url'].'" title="'.$speakers[2]['title'].'">'.$speakers[2]['title'].'</a> </h4> </div> <div class="gkw-speakers-small-left"> <div class="gkw-speaker-small speaker-hide"> <div> <a href="'.$speakers[0]['url'].'"> <img src="'.$speakers[0]['img'].'" alt="'.$speakers[0]['title'].'" /> </a> </div> <h4> <a href="'.$speakers[0]['url'].'" title="'.$speakers[0]['title'].'">'.$speakers[0]['title'].'</a> </h4> </div> <div class="gkw-speaker-small speaker-hide"> <div> <a href="'.$speakers[1]['url'].'"> <img src="'.$speakers[1]['img'].'" alt="'.$speakers[1]['title'].'" /> </a> </div> <h4> <a href="'.$speakers[1]['url'].'" title="'.$speakers[1]['title'].'">'.$speakers[1]['title'].'</a> </h4> </div> </div> <div class="gkw-speakers-small-right"> <div class="gkw-speaker-small speaker-hide"> <div> <a href="'.$speakers[3]['url'].'"> <img src="'.$speakers[3]['img'].'" alt="'.$speakers[3]['title'].'" /> </a> </div> <h4> <a href="'.$speakers[3]['url'].'" title="'.$speakers[3]['title'].'">'.$speakers[3]['title'].'</a> </h4> </div> <div class="gkw-speaker-small speaker-hide"> <div> <a href="'.$speakers[4]['url'].'"> <img src="'.$speakers[4]['img'].'" alt="'.$speakers[4]['title'].'" /> </a> </div> <h4> <a href="'.$speakers[4]['url'].'" title="'.$speakers[4]['title'].'">'.$speakers[4]['title'].'</a> </h4> </div> </div> </div> <div class="gkw-rest-speakers">'; for($i = 0; $i < count($speakers); $i++) { echo '<div class="gkw-speaker"> <div> <a href="'.$speakers[$i]['url'].'"> <img src="'.$speakers[$i]['img'].'" alt="'.$speakers[$i]['title'].'" /> </a> </div> <h4> <a href="'.$speakers[$i]['url'].'" title="'.$speakers[$i]['title'].'">'.$speakers[$i]['title'].'</a> </h4> </div>'; } echo '</div>'; } } // save the cache results $cache_output = ob_get_flush(); set_transient(md5($this->id) , $cache_output, 3 * 60 * 60); // echo $after_widget; } /** * * Used in the back-end to update the module options * * @param array new instance of the widget settings * @param array old instance of the widget settings * @return updated instance of the widget settings * **/ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['category'] = strip_tags( $new_instance['category'] ); $instance['anim_speed'] = strip_tags( $new_instance['anim_speed'] ); $instance['anim_interval'] = strip_tags( $new_instance['anim_interval'] ); $this->refresh_cache(); $alloptions = wp_cache_get('alloptions', 'options'); if(isset($alloptions['widget_gk_speakers'])) { delete_option( 'widget_gk_speakers' ); } return $instance; } /** * * Refreshes the widget cache data * * @return void * **/ function refresh_cache() { delete_transient(md5($this->id)); } /** * * Limits the comment text to specified words amount * * @param string input text * @param int amount of words * @return string the cutted text * **/ function comment_text($input, $amount = 20) { $output = ''; $input = strip_tags($input); $input = explode(' ', $input); for($i = 0; $i < $amount; $i++) { $output .= $input[$i] . ' '; } return $output; } /** * * Outputs the HTML code of the widget in the back-end * * @param array instance of the widget settings * @return void - HTML output * **/ function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $category = isset($instance['category']) ? esc_attr($instance['category']) : ''; $anim_speed = isset($instance['anim_speed']) ? esc_attr($instance['anim_speed']) : ''; $anim_interval = isset($instance['anim_interval']) ? esc_attr($instance['anim_interval']) : ''; ?> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', GKTPLNAME ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php _e( 'Category slug:', GKTPLNAME ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>" type="text" value="<?php echo esc_attr( $category ); ?>" /> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'anim_speed' ) ); ?>"><?php _e( 'Animation speed (in ms):', GKTPLNAME ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'anim_speed' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'anim_speed' ) ); ?>" type="text" value="<?php echo esc_attr( $anim_speed ); ?>" /> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'anim_interval' ) ); ?>"><?php _e( 'Animation interval (in ms):', GKTPLNAME ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'anim_interval' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'anim_interval' ) ); ?>" type="text" value="<?php echo esc_attr( $anim_interval ); ?>" /> </p> <?php } } // EOF
  19. I posted this in another part but I think it was the wrong forum, mods could you close the other as I'm this should be here please? I'm hoping someone can help, I'm currently working on adding some features to a Wordpress theme used on a local radio station. My query is with regards to displaying the current live show title, I have a written a php file that when processed by the title update form, updates a table in my db with the current show title (captured from the HTML form) but also captures the user id of whoever triggered the form, it then proceeds to update the Shoutcast server with the show title. The idea behind this is to allow me to display dynamic wordpress content related to the current live DJ on the site - this works and has no issues, but what id like to do now is create a page that will check if the output of the Shoutcast server title matches the table in the db, if it does, then I'd like it to echo this output, if it is different I'd like it to use the output from the SC title instead. I currently have 2 separate scripts that can output this info separately depending which is triggered but I need to combine these, (using an if / else command I'm assuming?) this is my current attempt but at the moment it doesn't seem to output the db fields and will only output the SC title from the server, regardless of the db title, it's almost as if it doesn't even acknowledge it and each time just outputs the shoutcast server info; <?php require_once('../../wp-config.php'); // open connection to WPdb require_once('sc-config.php'); // open connection to Shoutcast Server $query = "SELECT title, userID FROM sc_options where id = '0'"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $onAir_Title = $row[0]; $onAir_IMG = $row[1]; } $open = fsockopen("$ip","$port"); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode(",",$read); $text = $text[6]; } else { $text="connection refused."; } $scast = $text; $scdb = $onAir_Title; if ($scdb == $scast) { echo $onAir_Title; echo get_avatar( $onAir_IMG, 96); } else { echo $text; } ?> These are the original files, they work exactly as they should apart, but for the life of me I cannot get them to work as one Shoutcast <?php $open = fsockopen("198.154.106.116","6002"); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode(",",$read); $text = $text[6]; } else { $text="connection refused."; } ?> <?php echo $text; ?> Wordpress db output <?php require_once('../../wp-config.php'); // open connection to WP $query = "SELECT title, userID FROM sc_options where id= '0'"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $onAir_Title = $row[0]; $onAir_IMG = $row[1]; // output echo $onAir_Title; echo get_avatar( $onAir_IMG, 96); } ?> Just to sum it up, would I'd like to happen, is have the file load, check the title in the database row, if that matches the title being displayed by shoutcast, echo the data from the table, if the output from shoutcast is different, then echo the output from shoutcast instead, the reason being when our Live DJ's are off air, our auto dj runs which populates the server directly, so my logic is if the Shoutcast server is different from the db, it must be Auto DJ running..
  20. I'm hoping someone can help, I'm currently working on adding some features to a Wordpress theme used on a local radio station. My query is with regards to displaying the current live show title, I have a written a php file that when processed by the title update form, updates a table in my db with the current show title (captured from the HTML form) but also captures the user id of whoever triggered the form, it then proceeds to update the Shoutcast server with the show title. The idea behind this is to allow me to display dynamic wordpress content related to the current live DJ on the site - this works and has no issues, but what id like to do now is create a page that will check if the output of the Shoutcast server title matches the table in the db, if it does, then I'd like it to echo this output, if it is different I'd like it to use the output from the SC title instead. I currently have 2 separate scripts that can output this info separately depending which is triggered but I need to combine these, (using an if / else command I'm assuming?) this is my current attempt but at the moment it doesn't seem to output the db fields and will only output the SC title from the server, regardless of the db title, it's almost as if it doesn't even acknowledge it and each time just outputs the shoutcast server info; <?php require_once('../../wp-config.php'); // open connection to WPdb require_once('sc-config.php'); // open connection to Shoutcast Server $query = "SELECT title, userID FROM sc_options where id = '0'"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $onAir_Title = $row[0]; $onAir_IMG = $row[1]; } $open = fsockopen("$ip","$port"); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode(",",$read); $text = $text[6]; } else { $text="connection refused."; } $scast = $text; $scdb = $onAir_Title; if ($scdb == $scast) { echo $onAir_Title; echo get_avatar( $onAir_IMG, 96); } else { echo $text; } ?> These are the original files, they work exactly as they should apart, but for the life of me I cannot get them to work as one Shoutcast <div style="Visibility: Hidden; Position: Absolute;"> <?php $open = fsockopen("198.154.106.116","6002"); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode(",",$read); $text = $text[6]; } else { $text="connection refused."; } ?> </div> <?php echo $text; ?> Wordpress db output <?php require_once('../../wp-config.php'); // open connection to WP $query = "SELECT title, userID FROM sc_options where id= '0'"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $onAir_Title = $row[0]; $onAir_IMG = $row[1]; // output echo $onAir_Title; echo get_avatar( $onAir_IMG, 96); } ?> Just to sum it up, would I'd like to happen, is have the file load, check the title in the database row, if that matches the title being displayed by shoutcast, echo the data from the table, if the output from shoutcast is different, then echo the output from shoutcast instead.
  21. Hi There, My WordPress header.php is giving me some grief. It was working just fine until I went into theme options and tried to specify a new page to appear on the main menu. Then the main menu broke! I get this error message: Warning: implode() [function.implode]: Invalid arguments passed in/nfs/c05/h04/mnt/83132/domains/gwrobinson.com/html/wp/wp-content/themes/gwr/header.php on line 54 Can any of you far superior php experts out there help me figure out how to fix this error message?? Thank you!!! The line of code in question is as follows: <?php $top_pages = get_pages('sort_column=menu_order&include=' . implode(',', get_option('top_navigation', array()))); ?> [/code} The whole header.php file is [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?>: Energy Efficient homes for sale in Garison Way & Turnberry Lake</title> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_head(); ?> <!--[if lte IE 6]> <style type="text/css" media="screen"> #featured-home .holder .box { background-image: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php bloginfo('stylesheet_directory'); ?>/images/featured-home-box.png', sizingMethod='scale'); bottom: -1px; /* height: 250px; /* emulate max-height in ie6 */ } </style> <script type="text/javascript" charset="utf-8"> var isIE6 = true; </script> <![endif]--> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/cufon-yui.js" type="text/javascript" charset="utf-8"></script> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/Trajan_Pro_400.font.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> jQuery(function ($) { Cufon.replace('h2, h3, h4'); Cufon.replace('h3 .featuredtitle'); Cufon.replace('span.hthree'); if (typeof isIE6 != "undefined") { var slides_box = $('#featured-home .holder .box'); if ($(slides_box).height() > 250) { $(slides_box).height(250); } var innerpagebox = $('.innerpagebox'); if ($(innerpagebox).height() < 188) { $(innerpagebox ).height(188); } } }); </script> </head> <body <?php body_class(); ?>> <div class="shell"> <div id="header"> <h1 id="logo" class="fl notext"><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1> <div class="header-right"> <?php $top_pages = get_pages('sort_column=menu_order&include=' . implode(',', get_option('top_navigation', array()))); ?> <div id="social"> <div id="facebook"><a href="http://www.facebook.com/pages/GW-Robinson-homes/344500372268786" rel="nofollow" title="Become our fan on Facebook!" onClick="window.open(this.href); return false"></a></div> <div id="twitter"><a href="https://twitter.com/#!/GWRobinsonHomes" rel="nofollow" title="Follow us on Twitter!" onClick="window.open(this.href); return false"></a></div> </div> <p> <?php $i = 1; foreach ($top_pages as $_p): ?> <a href="<?php echo get_permalink($_p->ID); ?>"><?php echo apply_filters('the_title', $_p->post_title); ?></a> <?php if ($i!==count($top_pages)): ?> | <?php endif ?> <?php $i++; endforeach ?> </p> <div id="navigation"> <ul> <?php wp_list_pages('title_li=&sort_column=menu_order&link_before=<span>&link_after=</span>&include=' . implode(',', get_option('header_navigation', array()))) ?> </ul> </div> </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-40896628-1', 'gwrobinson.com'); ga('send', 'pageview'); </script> <div id="content">
  22. Hi all, i am new on here, and it appears i may need to stick around, I am having a massive headache creating custom widgets for a site i am building in-house. Essentially i require 6 custom widgets per page as illustrated in the attachement. The boxes beneath the large slider. I want the widgets to be managed from the widget section (sidebar widget) and moveable around the site . site testing is live http://mediacrisp.byethost3.com/ i am working through this page by page, but need to get the widgets for the first page up and running tonight (next 12 hours) could anyone advise me how to build them and what to code and where to code, once i have my head around the first page it should be very simple from there... diagram of aim https://www.dropbox.com/s/t0phe9el7ypommr/example%20small.jpg
  23. Hi Guys i am getting the following error when trying to install a theme in my wordpress. "Parse error: syntax error, unexpected '}' in /home/partypor/rightawayprinting.com/wp-content/themes/daisho/framework/admin/background-menu.php on line 1" This is the code for the background-menu.php. Can someone please help me find whats wrong. Thanks! <?php add_action( 'admin_init', 'backgroundmenuregs' ); add_action( 'wp_head', 'add_bg_changerstyle' ); function backgroundmenuregs(){ wp_enqueue_script('jquery'); wp_register_style( 'FlowTypographyMainStylesheet', WP_PLUGIN_URL . '/typography/js/colorpicker/css/colorpicker.css' ); wp_register_style( 'FlowTypographyLayoutStylesheet', WP_PLUGIN_URL . '/typography/js/colorpicker/css/layout.css' ); wp_register_script('jquery_colorpicker_script', WP_PLUGIN_URL . '/typography/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0' ); wp_enqueue_style( 'FlowTypographyMainStylesheet' ); wp_enqueue_style( 'FlowTypographyLayoutStylesheet' ); wp_enqueue_script('jquery_colorpicker_script'); } function add_bg_menu(){ //must check that the user has the required capability if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.') ); } echo '<div class="wrap">'; echo "<h2>" . __( 'Styling', 'menu-test' ) . "</h2>"; if($_POST['bg_submit_h'] && $_POST['bg_submit_h'] == "Y"){ $bgrepeat = array("repeat"=>"repeat","repeatx"=>"repeat-x","repeaty"=>"repeat-y","norepeat"=>"no-repeat"); update_option("bgchanger_color", $_POST['bc']); update_option("bgchanger_imgsrc", $_POST['bi']); if($_POST['bpx'] == "left" || $_POST['bpx'] == "center" || $_POST['bpx'] == "right"){ update_option("bgchanger_posx", $_POST['bpx']); } if($_POST['bpy'] == "top" || $_POST['bpy'] == "center" || $_POST['bpy'] == "bottom"){ update_option("bgchanger_posy", $_POST['bpy']); } if($_POST['ba'] == "fixed" || $_POST['ba'] == "scroll"){ update_option("bgchanger_attach", $_POST['ba']); } if(array_key_exists($_POST['br'], $bgrepeat)){ update_option("bgchanger_repeat", $bgrepeat[$_POST['br']]); } ?> <div class="updated"><p><strong><?php _e('settings saved.', 'menu-test' ); ?></strong></p></div> <?php } $bgcval_bc = get_option("bgchanger_color"); $bgcval_bi = get_option("bgchanger_imgsrc"); $bgcval_bpx = get_option("bgchanger_posx"); $bgcval_bpy = get_option("bgchanger_posy"); $bgcval_ba = get_option("bgchanger_attach"); $bgcval_br = get_option("bgchanger_repeat"); ?> <script type="text/javascript">jQuery(document).ready(function(){jQuery(".attcolorpicker").each(function(){jQuery(this).ColorPicker({onShow:function(cp){jQuery(cp).fadeIn(500);return false;},onHide:function(cp){jQuery(cp).fadeOut(500);return false;},onChange:function(hsb, hex, rgb){jQuery(this).parent().find('.attcolorpicker').val('#'+hex);jQuery(this).parent().find('.colorSelector div').css('backgroundColor', '#'+hex);jQuery(this).parent().find('.colorSelector').ColorPickerSetColor(hex);}});jQuery(this).parent().find('.colorSelector').ColorPicker({onShow:function(cp){jQuery(cp).fadeIn(500);return false;},onHide:function(cp){jQuery(cp).fadeOut(500);return false;},onChange:function(hsb, hex, rgb){jQuery(this).parent().find('.attcolorpicker').val('#'+hex);jQuery(this).parent().find('.colorSelector div').css('backgroundColor', '#'+hex);jQuery(this).parent().find('.attcolorpicker').ColorPickerSetColor(hex);}});});});</script> <form method="post" action=""> <table class="form-table"> <tr><th>Background color</th><td> <input type="text" class="attcolorpicker" name="bc" value="<?php if($bgcval_bc) print($bgcval_bc); ?>"> <div class="colorSelector"><div<?php if($bgcval_bc) print(" style=\"background-color:".$bgcval_bc.";\""); ?>></div></div> </td></tr> <tr><th>Background image</th><td><input type="text" name="bi" value="<?php if($bgcval_bi) print($bgcval_bi); ?>"><span href="#" title="" class="briskuploader button">Upload</span><br/><div class="briskuploader_preview"></div></td></tr> <tr><th>Background position</th><td><select name="bpx"><option value="left"<?php if($bgcval_bpx=="left") print(" selected=\"selected\""); ?>>left</option><option value="center"<?php if($bgcval_bpx=="center") print(" selected=\"selected\""); ?>>center</option><option value="right"<?php if($bgcval_bpx=="right") print(" selected=\"selected\""); ?>>right</option></select><select name="bpy"><option value="top"<?php if($bgcval_bpy=="top") print(" selected=\"selected\""); ?>>top</option><option value="center"<?php if($bgcval_bpy=="center") print(" selected=\"selected\""); ?>>center</option><option value="bottom"<?php if($bgcval_bpy=="bottom") print(" selected=\"selected\""); ?>>bottom</option></select></td></tr> <tr><th>Background attachment</th><td><select name="ba"><option value="scroll"<?php if($bgcval_ba=="scroll") print(" selected=\"selected\""); ?>>Scroll</option><option value="fixed"<?php if($bgcval_ba=="fixed") print(" selected=\"selected\""); ?>>Fixed</option></select></td></tr> <tr><th>Background repeat</th><td><select name="br"><option value="repeat"<?php if($bgcval_br=="repeat") print(" selected=\"selected\""); ?>>repeat</option><option value="repeatx"<?php if($bgcval_br=="repeat-x") print(" selected=\"selected\""); ?>>repeat-x</option><option value="repeaty"<?php if($bgcval_br=="repeat-y") print(" selected=\"selected\""); ?>>repeat-y</option><option value="norepeat"<?php if($bgcval_br=="no-repeat") print(" selected=\"selected\""); ?>>no-repeat</option></td></tr> </table> <p class="submit"> <input type="hidden" name="bg_submit_h" value="Y"> <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> </p> </form> </div> <?php } function add_bg_changerstyle(){ $bgcval_bc = get_option("bgchanger_color"); $bgcval_bi = get_option("bgchanger_imgsrc"); if($bgcval_bc || $bgcval_bi){ print("<style type=\"text/css\"> body{ "); if($bgcval_bc){ print("background-color:".$bgcval_bc.";"); } if($bgcval_bi){ if($bgcval_bi == "none"){ print("background-image:none;"); }else{ print("background-image:url(".$bgcval_bi.");"); $bgcval_bpx = get_option("bgchanger_posx"); $bgcval_bpy = get_option("bgchanger_posy"); $bgcval_ba = get_option("bgchanger_attach"); $bgcval_br = get_option("bgchanger_repeat"); if($bgcval_bpx == "left" || $bgcval_bpx == "center" || $bgcval_bpx == "right"){ if($bgcval_bpy == "top" || $bgcval_bpy == "center" || $bgcval_bpy == "bottom"){ print("background-position:".$bgcval_bpx." ".$bgcval_bpy.";"); } } if($bgcval_ba == "fixed" || $bgcval_ba == "scroll"){ print("background-attachment:".$bgcval_ba.";"); } if($bgcval_br == "repeat" || $bgcval_br == "repeat-x" || $bgcval_br == "repeat-y" || $bgcval_br == "no-repeat"){ print("background-repeat:".$bgcval_br.";"); } } } print(" } </style>"); } } ?>
  24. I have a wordpress website but I am getting too much spam from the website in the form of comments. Initially form from website was also sending too much messages but than I installed a eye verification there so that part is good. But now when I login to admin panel I can see 1000s of comments which I have to delete manually. What are the best ways to stop this on any wordpress websites? I know I can buy akismet but do not want to spend any more. Any free ways?
  25. Hello, I tried many WP plugins to create automatic alt tags site-wide. None of the available plugins seem to work (I Tried SEO Friendly Images, Wordpress SEO Images, WP Image SEO) even with the default theme... Any other plugins anyone can suggest, please? Anyway, I found this code that's supposed to go into the functions.php of the theme, but it doesn't seem to work... It's supposed to check for images without an alt tag and fill in the post title - can anyone here please help me with making this code to change ALL alt tags by putting the post title in them and making this code work in the first place..? function add_alt_tags($content) { global $post; preg_match_all('/<img (.*?)\/>/', $content, $images); if(!is_null($images)) { foreach($images[1] as $index => $value) { if(!preg_match('/alt=/', $value)) { $new_img = str_replace('<img', '<img alt="'.$post->post_title.'"', $images[0][$index]); $content = str_replace($images[0][$index], $new_img, $content); } } } return $content; } add_filter('the_content', 'add_alt_tags', 99999); Thank you very much!
×
×
  • 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.