PHP - Wordpress Auto Retrieve Meta Keyword
Hallo all,
I am running a coupon website which will promote some website using coupons. I am using wordpress CMS. I would like to ask if somebody here could give me some enlightenment. I am using wordpress now and I would like everytime I post a coupon for a website like www example1. com it will automatically retrieve meta keywords value <meta name="keywords" content="perfume, fragrances, aftershave cosmetics, skin care, body, bath, beauty, products, moisturisers" /> examples. the script will automatic retrieve content from meta keywords and post it as a tag value on my posting. could anyone help me? thanks Similar TutorialsHello Every one Please see my code <?php include ("includes/config.php"); $afurl = $_SERVER['REQUEST_URI']; $afurl = preg_replace('/\/+/', '', $afurl); $afurl = preg_replace('/\;+/', '', $afurl); $afurl = preg_replace('/\&+/', '', $afurl); $afurl = preg_replace('/\#+/', '', $afurl); $afurl = preg_replace('/\|+/', '', $afurl); $afurl = preg_replace('/\@+/', '', $afurl); $afurl = preg_replace('/\%5B+/', '', $afurl); $afurl = preg_replace('/\%5D+/', '', $afurl); $afurl = preg_replace('/\%27+/', '', $afurl); $afurl = preg_replace('/\%C2+/', '', $afurl); $afurl = preg_replace('/\%BB+/', '', $afurl); $afurl = preg_replace('/quot+/', '', $afurl); $afurl = preg_replace('/\%E2+/', '', $afurl); $afurl = preg_replace('/\%80+/', '', $afurl); $afurl = preg_replace('/\%93+/', '', $afurl); $afurl = preg_replace('/\$+/', 'c', $afurl); $afurl = preg_replace('/\"+/', '', $afurl); $afurl = preg_replace('/\?+/', '', $afurl); $afurl = preg_replace('/\.html+/', '', $afurl); $afurl = preg_replace('/\-+/', ' ', $afurl); $queryArray = explode(" ", $afurl); for ($i=0; $i< count($queryArray); $i++) { $keyworddd = mysql_real_escape_string($queryArray[$i]).","; echo $keyworddd; } ?>I Want Set $keyworddd at he <meta name="keywords" content="$keyworddd"> Can anyone tell me how to do this please? On the index page of http://www.sportskevesti.co i have the meta tags of Title, Description, Keyword.... and other element, but it is necessary to show them in name of the other pages, socer, basketbal, handbal, tennis...., and there fore news spetial. in this moment, i have this meta tag double. for example: www.sportskevesti.co/index.php Quote <meta name="title" content="Sportske Vesti"> <meta name="description" content="Najnovije sportske vesti iz Srbije i ostatka sveta. Sve na jednom mestu."> <meta name="keywords" content="sport, vesti, fudbal, tenis, kosarka, odbojka, rukomet, auto, moto, trke"> http://sportskevesti.co/index.php?opcija=vest&vest_id=60067 Quote <meta name="title" content="Sportske Vesti"> <meta name="description" content="Najnovije sportske vesti iz Srbije i ostatka sveta. Sve na jednom mestu."> <meta name="keywords" content="sport, vesti, fudbal, tenis, kosarka, odbojka, rukomet, auto, moto, trke"> <meta name="title" content="Danas je derbi!" /> <meta name="description" content="Na stadionu Crvene zvezde danas se igra ..." /> <meta name="keywords" content="danas, derbi, "/> Since I assume that this is not good for SEO optimization, how to avoid this and show only one meta per page ? Hi Everyone, I need some help which I think should not take long to figure out but I need help with it regardless. This is through wordpress. My issue is that my navigation has categories. Like Web design, Web Marketing, and Graphic design. I downloaded All in one SEO pack and everything is great up to the point where I can't add a title to the categories. When you click on the categories in the navigation the title doesn't change to what I set it to. But the description and all other meta tags are fine. I do have: Code: [Select] <head profile="http://gmpg.org/xfn/11"> <link rel="shortcut icon" href="http://www.newmediasources.ca/images/pt-logo.png"/> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <?php wp_head(); ?> <link href="<?php bloginfo('template_directory'); ?>/style.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/ddsmoothmenu.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/prettyPhoto.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_directory'); ?>/css/nivo-slider.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.form.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/ddsmoothmenu.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.nivo.slider.pack.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.prettyPhoto.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/custom.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/cufon-yui.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/Museo_Slab_500_400.font.js"></script> <!-- Cufon init --> <script type="text/javascript"> <?php if(get_option('boldy_cufon')!="no"):?> Cufon.replace('h1',{hover: true})('h2',{hover: true})('h3')('.reply',{hover:true})('.more-link'); <?php endif ?> </script> <script type="text/javascript"> $(document).ready(function(){ $('#quickContactForm').ajaxForm(function(data) { if (data==1){ $('#success').fadeIn("slow"); $('#bademail').fadeOut("slow"); $('#badserver').fadeOut("slow"); $('#contact').resetForm(); } else if (data==2){ $('#badserver').fadeIn("slow"); } else if (data==3) { $('#bademail').fadeIn("slow"); } }); }); </script> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_get_archives('type=monthly&format=link'); ?> <?php //comments_popup_script(); // off by default ?> </head> in header.php so it should be okay. I tried removing the title tag thinking it will add it itself but it didn't. Any ideas? Thank you for your time. 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"> Currently I can use php snoopy class to auto login in wordpress, but when I try to use the same method to post some articles in wordpress. It does not work. Any one has any ideas? I have tried to use httpwatch to monitor the post data and cookies. It seems I have include everything, but still doesn't work. thanks very much. This really driving me crazy. <?php include "Snoopy.class.php"; $snoopy = new Snoopy; //login part $submit_url = "http://localhost/wordpress/wp-login.php"; $submit_vars["log"] = "baibai"; //username $submit_vars["pwd"] = "123456"; //password $submit_vars["rememberme"] = "forever"; $submit_vars["redirect_to"] = "http://localhost/wordpress/wp-admin/"; $submit_vars["testcookie"] = "1"; $submit_vars["wp_sumbit"] = "submit"; $snoopy->submit($submit_url,$submit_vars); print $snoopy->results; $snoopy->setcookies(); $cookies = $snoopy->cookies; print_r ($cookies); //above part runs perfectly //post $snoopy->fetchform("http://localhost/wordpress/wp-admin/press-this.php"); print $snoopy->results; preg_match('/name=\"_wpnonce\" value=\"([0-9a-z]+)/',$snoopy->results,$matches); print $submit_vars1["_wpnonce"] = $matches[1]; $submit_vars1["autosave"] = ""; $submit_vars1["newtag[post_tag]"] = ""; $submit_vars1["tax_input[post_tag]"] = ""; $submit_vars1["autosave"] = ""; $submit_vars1["title"] = "title"; $submit_vars1["content"] = "content this is what i want post in wordpress"; $submit_vars1["original_post_status"] = "draft"; $submit_vars1["prev_status"] = "draft"; $submit_vars1["post_type"] = "text"; $submit_vars1["publish"] = "发布"; $submit_vars1["_wp_http_referer"] = "/wordpress/wp-admin/press-this.php?u=http%3A%2F%2Flocalhost%2Fwordpress%2Fwp-admin%2Ftools.php&t=%E5%B7%A5%E5%85%B7%20%E2%80%B9%20ekeyvision%20%E2%80%94%20WordPress&s=&v=4"; $submit_url1 = "http://localhost/wordpress/wp-admin/press-this.php?action=post"; $snoopy->submit($submit_url1,$submit_vars1); print $snoopy->results; ?> Also I do not want to use XML-RPC to solve this issue, since xml-rpc are not available is some settings. thanks I have a php tutorial that I followed for creating, inserting, selecting and updating a MySQL database with php. Everything works fine so I wanted to put it into Wordpress. I took the code and placed it into the wordpress page and everything worked just fine except the update function. Here is the tutorial I used. http://www.phpsimple.net/mysql_insert_record.html It is also the part I am having trouble with. I am able to create a record and I am also able to select a record but when I choose "update" the form doesn't load the data. It will outside the website but not inside wordpress. I am hoping this is not vague but because of my inexperience I am not sure what else to say. I will be more than happy to provide any other information you need. Please can someone explain to me what the keyword as mean in the context of: foreach ($row as $attribute) I am new to php and some things just need a little explaining please. So a project I have simply to learn how it is done is to make an auto updating sitemap with a auto submitter. I have been doing a little research on sitemaps but haven't found much in the way of a tutorial or white paper or similar, anyway I was wondering if I am on the right track or not. What I was thinking for the auto-updating sitemap is since site maps are XML, when an article is published using my custom CMS/Blogging system, I make it rewrite the sitemap appending the new URL that will be generated. Then for the auto-submit, I can either make it a cron job or just manual press, but it would go though a for list of URLs, replacing the end part with my site map url. I think that is how it would be done. If you have a better idea, or can point out an article so I can understand a lot more with sitemaps, I will appreciate it, I am trying to learn as much as possible, I have gone to the offical website (sitemaps.org) but it doesn't have what I am looking for. Thanks, James //php code <?php include_once('con.php'); if(!empty($_GET['search'])) { $search = $connect->prepare('SELECT * FROM posts WHERE title LIKE :search'); $search->bindValue(':search', '%'.$_GET['search'].'%', PDO::PARAM_STR); $search->execute(); ?> <?php while($row = $search->fetch()) {?> <li class="result" onClick="searchValue('<?php echo $row['title'];?>')"><?php echo $row['title'];?></li> <?php } ?> <?php } ?> //ajax $('#inputsch').keyup(function(){ $.ajax({ type: 'GET', url: 'fetch.php', data:'search='+$(this).val(), success: function(data){ $('#box').show(); $('#box').html(data); } }); }); }); function searchValue(val) { $('#inputsch').val(val); $('#box').hide(); } //search box <form action="search.php"> <input id="inputsch" type="text" name="search" placeholder="search..." autocomplete="off" autofocus> <button type="submit" value="search" >search</button> </form> <div id="box"></div> //the problem here is when i click the result is only added to input, but i want it to autosubmit
Hi Everyone, I'm trying to set up a system for my PHP MYSQL search that allows the user to type keywords. I've been doing this with one very long if statement, is there a better way? For example, I want to user to search for "chair" and have the thing return everything with a item number stating with 555. The length of the item number can vary between 10 and 12 numbers and that has slowed me down a bit. Cheers, Rob It's a function=> Code: [Select] function _wp_call_all_hook($args) { global $wp_filter; //var_dump($wp_filter); //exit(); reset( $wp_filter['all'] ); do { foreach( (array) current($wp_filter['all']) as $the_ ) if ( !is_null($the_['function']) ) call_user_func_array($the_['function'], $args); } while ( next($wp_filter['all']) !== false ); } Why is $wp_filter variable declared as global ? Was $wp_filter assigned before ? Code: [Select] if($keyword == ""){}else{ $get = mysql_query("SELECT * FROM domains, domains_keywords, keywords WHERE domains_keywords_domain=domains_id AND domains_keywords_keyword=keywords_id AND keywords_keyword='$keyword'"); } so i have a textbox at the mo that you can put one keyword in and get results based on this one keyword. how can I change this to a textarea and if say someone enters two keywords.. it will find results based on them having both keywords. thanks in advance I am having an error here with my code/script. I try and call sanitizeData($data) from functions.php class in createUser.php class. I end up with an expected 'new' T_NEW error. createUser.php file <?php require('dbcon/dbcon.php'); include('fileUpload.php'); include('functions.php'); class createUser { public $functionsClassInstance = new helperFunctions(); public $avatar; public $bio; public $video_count; public $c_status; public $usernameI; public $username; public $password; public $email; public $doc; public $last_logged_in; public function addUser(PDO $pdo) { // add user info to db $avatar = "/soapbox/assets/soap.jpg"; $usernameI = $_POST['username']; $username = $functionsClassInstance->sanitizeData($usernameI); //$username = strip_tags(trim($_POST['username'];)) $password = password_hash($_POST['password'], PASSWORD_DEFAULT); $bio = $_POST['bio']; $email = $_POST['email']; $c_status = 0; date_default_timezone_set('UTC'); $doc = date("Y-m-d h:i:s"); // account date last seen/logged in // add account age $query = $pdo->prepare("INSERT into profiles001 (username, password, email, c_status, bio, doc, avatar) VALUES (:username, :password, :email, :cstat, :bio, :doc, :avatar)"); $query->bindValue(':username', $username); $query->bindValue(':password', $password); $query->bindValue(':email', $email); $query->bindValue(':doc', $doc); $query->bindValue(':bio', $bio); $query->bindValue(':cstat', $c_status); $query->bindValue(':avatar', $avatar); // if user uploads file, add path and file to database and server, if not revert to default. if ($_FILES["avatar"]["error"] == 4) { $query->execute(); } elseif ($_FILES["avatar"]["error"] != 4) { $file = new fileUpload(); $file->processFile(); $avatar = "/soapbox/uploads/" . $_FILES["avatar"]["name"]; $query = $pdo->prepare("INSERT into profiles001 (username, password, email, c_status, bio, doc, avatar) VALUES (:username, :password, :email, :cstat, :bio, :doc, :avatar)"); $query->bindValue(':username', $username); $query->bindValue(':password', $password); $query->bindValue(':email', $email); $query->bindValue(':doc', $doc); $query->bindValue(':bio', $bio); $query->bindValue(':cstat', $c_status); $query->bindValue(':avatar', $avatar); $query->execute(); } // create variables // initialize variables // bind values of variables being entered into database } } // this file is responsible for creating the users ?> functions.php class <?php // Functions are stored here // Any code that is repeated more than once is put into a function to make my life easier // The start of going from procedural to OOP // checks if user is logged in or not, limits access to certain pages in/on site. class helperFunctions { function sanitizeData($data) { strip_tags($data); trim($data); return $data; } } ?>
Hi All, Just a couple of things with my site search, I am having trouble getting the search results to pickup any and all keywords. For example, if keywords for a search result are listed in the keywords column of my db as 'one, two, three' a search query for 'one two' is fine but a search for 'one three' will not display the search result. Instead of treating the keywords seperately it is treating all keywords as a whole phrase. How can I make the search results pickup any keyword regardless of order. Secondly I'm having trouble getting the search results to display by keyword relevance, any help is greatly appreciated. Thanks. Code: [Select] function search() { parent::Controller(); $this->load->model('Templating'); $this->load->model('Company'); } function index() { $this->load->view('search'); } function search_redirect() { if ($_POST['keyword'] == '') $_POST['keyword'] = 'Keyword'; redirect('search/showlist/'. urlencode(underscore($_POST['location'])).'/'. urlencode(underscore($_POST['category'])).'/'. urlencode(underscore($_POST['keyword']))); } function showlist($location = 'any', $category = 'any', $keyword = 'keyword', $offset = '0') { /* get results */ $data['companies'] = $this->Company->search($keyword, $category, $location, $offset, $name); /* paginate results */ $row = $data['companies']->row(); if($keyword == 'keyword' and $category=='any' ) { $data['categoryList'] = $this->buildCategoryList($location); } elseif(isset($row->categoryId)) { $categoryId = $row->categoryId; $data['linkList'] = $this->buildRefineList($categoryId); } $this->load->library('pagination'); $config['base_url'] = site_url().'search/showlist/'.$location.'/'.$category.'/'.$keyword.'/'; $config['total_rows'] = $this->Company->total_companies; $config['per_page'] = $this->Company->per_page; $config['num_links'] = 3; $config['uri_segment'] = $this->uri->total_segments(); $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $data['logged_in'] = $this->session->userdata('logged_in'); $data['company_id'] = $this->session->userdata('company_id'); $data['search_category'] = $category; $data['search_location'] = $location; if ($this->session->userdata('admin') != ''){ $data['admin'] = $this->session->userdata('admin'); } /* initialise template settings */ $center = 'center/list_companies'; $this->load->vars($data); $this->Templating->show($center); } I am desperatly seeking some help. I want to build a page that pulls in feeds from 3 different sites, but i would like them to be filtered by some keywords. I'm not entirely sure about the best way to do this. If there's any one who knows about Magpie, and how to incorporate this feature, that would be great. Curretnly in my magpie rss fetch script I have: $keywords = array ("keyword1","keyword2","keyword3") function has_keyword($haystack, $wordlist) { $found = false; foreach ($wordlist as $w) { if (stripos($w, $haystack) !== 0) { $found = true; } } return $found; } $rss = simplexml_load_file("http://www.mywebsite.com/my/rss/feed/"); foreach ($rss->channel->item as $i) { if ( has_keywords($i->title, $keywords) || has_keywords($i->description, $keywords) || has_keywords($i->category) ) { $news[] = array ( "title" => $i->title, "description" => $i->description, "link" => $i->link ); } } Problem: I'm trying to build a junction table for a many to many relationship. Table A contains a title string that contains in it names that are stored in Table B. Both tables have nearly a million rows. Bad solution: The method I'm using right now is using PHP I fetch and store one table into an associative array. I then do a mysql_fetch loop on the second table and run this code to populate an array that is used to build the multi-insert SQL. $title = preg_replace ($names, $keys, $title); if (preg_match_all ('/(\d+)/', $title, $matches)) foreach ($matches[1] as $m) $inserts[$row['id'].'-'.$m] = 1; This works, but I'm looking for possibly a less cpu/memory intensive method. My remote server can't handle it, and we're talking hours and hours on a local server. It seems the bottleneck is with the preg_replace. I've also tried str_replace, which is only slightly faster. So, a method where I wouldn't have to pass around such large arrays, or an entirely different approach is what I'm looking for. Any ideas? This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317963.0 I'm trying to create a search form where members of a site can search other members whose user information is stored in a mysql database. One of the search parameters is gender which searches for records from a column in the database called gender where members can either have the value "man" or "woman". The user can choose between 3 options from a pull down menu named gender (man, woman, both). Then I'm thinking about using a select query to search the database upon submission of the form, which goes something like this: Code: [Select] $sql= SELECT* FROM members WHERE gender ='{$_POST['gender']}' ; Now I can easily assign the value "man" for the option man in the pull down menu and "woman for the option woman, to match their corresponding names in the database. The problem lies with the "both" option which has to be either man or woman. I'm thinking about assigning it the value "man OR woman" so that when the form is submitted, the query would read: SELECT*FROM members WHERE gender ='{$_POST[man OR woman']}; I just don't know if this would be a right usage of the OR keyword and if such a query would work. Before trying it out, I'd like to know if this makes any sense and if not, what's an alternative way to work around this? Hi all, I have a simple mysql table of articles with one Keyword field which can hold an indeterminate number of comma-separated strings per article. I want to create a tag cloud of these keywords and score them according to how many times they appear overall. My question is two-fold. First, I have elected to do this by pulling all the keywords out into an associative array, but I'm not sure how to go about counting the number of times each string appears. Any suggestions? Second. Is this the most efficient way to do this or would it be better to keep another table of keywords and a count field? I guess it wouldn't be much more efficient as I still have to run through all the keywords in the article table to look for new entries and update the keyword table with new words and/ or counter increments. Any suggestions would be much appreciated. |