samedi 9 mai 2015

Wordpress website mobilw-menu main points doesn't link to sites

I have a problem with the mobile menu on my wordpress website. It's this site: http://ift.tt/1zSZ4mu

If you make your viewport smaller, so that the mobile navigation button shows up, you can click it and the mobile menu shows up.

My problem is following: If I click on the main points in the navigation (like IT-Service, Reparatur or Unternehmen) nothing happens. But I would this main points like to open the sites, which are liked to them. In the Desktop Navigation it works perfect. If I click on "Reparatur", http://ift.tt/1EXv7Ar this links opens, if I click on IT-Service, http://ift.tt/1zSZ4mw this link opens, and so on... On mobile nothing happens if I click them.

I modified the navigation like to display all of the links of the navigation at the same time. Prior the sublinks showed up in a dropdown, if i clicked on one of the mainpoints, but i didn't want this "feature".

So I know, that there is a javascript, that handles that but I don't know which one it is or what I have to change to make the main points link to their pages.

Maybe one of you guys can help me?

Greetings, Linda

issue with WP-API authentication

I have a wordpress page from which I am trying to create a post using the WP AJAX REST API. My expectation is that if the user is already logged in the auth cookie will be in place and I'll be able to do the AJAX POST with the user's context. Yet I'm getting an error that the user is not authorized. What am I missing? Thanks

How to get specific entries from a custom taxonomy? [on hold]

Using a wordpress based website, I have a custom taxonomy "authors" in which I enter the names of publications authors. In this field I usually enter multiple authors' names such as "Mark Twain, Isabelle Lagard, Sandra Cruize".

What I need exactly is:

  1. PHP code by which I can display only the first author in one place at the front end. This means that i need to show the first author (e.g. Mark Twain) only without the tow others.
  2. PHP code by which I can display only the second author in another place at the front end.This means that i need to show the second author (e.g. Isabelle Lagard) only without the tow others.
  3. PHP code by which I can display only the first author in another place at the front end.This means that i need to show the third author (e.g. Sandra Cruize) only without the tow others. etc...

So, what do I have to do please?

How to move Wordpress comments only from one domain to another?

We have a bit of situation here. We have a website (let's say it is www.oldsite.com) where we had more than 2000 posts. There arose a need whereby we had to move some 60-70 posts from this oldsite.com to another domain of ours (www.newsite.com)

So, here is what we did:

  1. Move those 60-70 posts manually from oldsite.com to newsite.com Did a 301 redirect of each of those 60-70 posts from oldsite.com to newsite.com. Google has now started to rank the posts from the newsite.com for this. That's all good till now.
  2. Now, here comes the situation. We also want to move the comments from some of those posts from oldsite.com (some 10-12 posts out of those 60-70) to the respective posts of newsite.com.

How do we do that? Do note that we are pretty comfortable with databases and to some extent PHP. Please help.

Thanks.

Note: We did ask this question on a couple of other forums as well and on WP @ SO but were not able to get any help

Shalin

Show different home page based on user role in WordPress

I've got three home pages: 1. home 2. home-student 3. home-teacher

Based on their custom user role (student, teacher or not logged in) I would like to show a different homepage. My knowledge of PHP is pretty basic, so I'm hoping for an easy answer (or line of code I could paste in my child theme). Many thanks!

Malwares and worms on wordpress

I have CentOS 6 64bit server. I always found a lots of worms and malwares on hosted wordpress websites. I dont know where they are coming.

Examples of worms and malwares:

Php.Trojan.StopPost
Php.Malware.Mailbot

I run scan with ClamAV and remove the codes or the files and they always back.

Please help me, Thank you!

Choosing the right web hosting service

I need some help with choosing the right type of hosting service.

I want to run a WordPress site with about 5000 articles and over 50 authors. The site is expected to be visited by more than 40 000 people a day.

Are the following parameters of hosting enough?:

Max. number od PHP proccesses: 5;
MySQL size: 1 GB;
PHP memory_limit: 128 MB;
PHP upload_max_filesize: 32 MB;
PHP post_max_size: 32 MB

I definitely need the site to work without problems, with no one experiencing 503 or such.

Thank you for helping

iOS Safari Whitepage

I've some problem with a Wordpress (4.2.2) page on multiple iOS devices and I don't know how to troubleshoot it without a debugging tool...

If I load a new site via a link, it loads a white page... Then, after reopen safari and reload the page, it is displayed correctly (only reloading doesn't help).

What I tried: - disable all caching pluging / cleared browser-cache - checked chrome's debugging console... no errors - disable permalinks - disable all plugins

I think it's a JS problem, but I don't know how to localize this problem... Someone has an idea? Many thanks!

Regards,

archive-{post_type}.php breaking when slug is changed

So I have a custom post type called 'events' which is all working fine provided that the slug is the same as the custom post type name. i.e. http://ift.tt/1RnRsh1. Wordpress leverages the archive-events.php nicely

The problem however is if I change the page hierarchy to http://ift.tt/1ciAlNb . Now Wordpress no longer uses the archive-events.php

Could the issue be in the re-write rules? I've tried several changes but nothing seems to resolve this. Here's the code:

//* Add Events post type...
$event_labels = array( 
    'name'                  => _x( 'Events', 'Post Type General Name', 'events' ),
    'singular_name'         => _x( 'Event', 'Post Type Singular Name', 'events' ),
    'all_items'             => __( 'All Events', 'events' ),
    'add_new'               => __( 'Add New', 'events' ),
    'add_new_item'          => __( 'Add New Event', 'events' ),
    'edit_item'             => __( 'Edit Event', 'events' ),
    'new_item'              => __( 'New Event', 'events' ),
    'view_item'             => __( 'View Event', 'events' ),
    'search_items'          => __( 'Search Events', 'events' ),
    'not_found'             => __( 'No Event found', 'events' ),
    'not_found_in_trash'    => __( 'No Events found in Trash', 'events' ),
    'parent_item_colon'     => __( 'Parent Event:', 'events' ),
    'menu_name'             => __( 'Events', 'events' ),
);

$event_args = array( 
    'labels'                => $event_labels,
    'hierarchical'          => false,
    'description'           => 'Events.',
    'supports'              => array( 'title', 'editor', 'thumbnail' ),
    'public'                => true,
    'show_ui'               => true,
    'show_in_menu'          => true,
    'menu_icon'             => 'dashicons-calendar',
    'menu_position'         => 5,
    'show_in_nav_menus'     => true,
    'publicly_queryable'    => true,
    'exclude_from_search'   => false,
    'has_archive'           => true,
    'query_var'             => 'events',
    'can_export'            => true,
    'rewrite'               => array( 
        'slug'              => 'news/events', 
        'with_front'        => true,
        'feeds'             => true,
        'pages'             => true
    ),
    'capability_type' => 'post'
);

register_post_type( 'events', $event_args );

Any suggestions would be appreciated!!

Is this a plugin ? " Follow Insta "

how're you ? I just wanted to know if follow insta in the footer is a plugin or kind of codes ?

My Cheers bye :3

Sticky div to top of screen when scrolled

I have a Wordpress site with a Jumbotron, inside is a div 'sticky' which is positioned:absolute to the bottom. The jumbotron has a fixed height and I would like the div to 'stick' to the top of the screen when scrolled to.

I have seen multiple threads/examples on the subject but none seem to work for me (most not written in a format that works with/for Wordpress)

What is the best approach to making it work in WP (using function.php, etc)

HTML

<div class="row col-md-12">
 <div class="jumbotron">
    <div class="sticky"><p>CURRENT WORK</p></div>
 </div>
</div><!-- /row -->

CSS

.jumbotron {
  margin: 0;
  width: 100%;
  height: 400px;
  background-color: #fff;
}

.sticky {
  position: absolute;
  bottom: 0; right: 0;
  background-color: red;
  padding: 0 5px;
  width: 200px;
  text-align: center;
}

Insert empty values to wordpress database

I have my form like this:

<div id="titlewrap">
    <label class="" id="title-prompt-text" for="title">Enter title here</label>
    <input type="text" name="title" size="30" value="" id="title" autocomplete="off">
</div>
<br class="clear">
<?php
    $mva_content = '';
    $editor_id = 'editor';
    $settings = array('media_buttons' => false);
    wp_editor($mva_content, $editor_id, $settings);
?>

If I show html source code with CTRL+U it looks like this:

<form action="admin.php?page=list" method="post">
    <div id="poststuff">
        <div id="post-body">
            <div id="post-body-content">
                <div id="titlediv">
                    <div id="titlewrap">
                        <label class="" id="title-prompt-text" for="title">Enter title here</label>
                        <input type="text" name="title" size="30" value="" id="title" autocomplete="off">
                    </div>
                    <br class="clear">
                    <div id="wp-editor-wrap" class="wp-core-ui wp-editor-wrap html-active"><link rel='stylesheet' id='editor-buttons-css'  href='http://localhost/plug/wp-includes/css/editor.min.css?ver=4.0.5' type='text/css' media='all' />
<div id="wp-editor-editor-tools" class="wp-editor-tools hide-if-no-js"><div class="wp-editor-tabs"><a id="editor-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">Text</a>
<a id="editor-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">Visual</a>
</div>
</div>
<div id="wp-editor-editor-container" class="wp-editor-container"><textarea class="wp-editor-area" rows="20" autocomplete="off" cols="40" name="editor" id="editor"></textarea></div>
</div>

                    <p class="submit">
                        <input type="submit" name="create" id="create" class="button button-primary" value="Add New Video Ad">
                    </p>
                </div>
            </div>
        </div>
    </div>
</form>

I want to save to my wordpress database after click on a save button:

global $wpdb;
$title = $_POST["title"];
$content = $_POST["editor"];
$wpdb->insert("mytable", array(
   "title" => $title,
   "content" => $content,
)); 

I see that in the database there is a row with incremented id but empty value in title and content columns.

i have tried to put Strings instead of $_POST variables and it works perfectly!

Is there an error with my code?

Wordpress Post Thumbnail Issue

I can see that in my uploads folder all the images I have uploaded into posts have the 4 different sizes.

I have no featured image set for posts but I want to get the thumbnail size to display on my front page.

I have tried putting the_post_thumbnail(); in the loop but nothing is displayed.

Am I missing something? Is there another way to grab a thumbnail size of an image that has been put inside of the post?

Currently I use a catch the image function to grab the first image in the post and display it on the front page with this code, can this be edited to get that thumbnail image?

function catch_that_image() {
    global $post, $posts;
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    $first_img = $matches [1] [0];
    //$first_img = substr($first_img, 0, -4);  

    if(empty($first_img)){ //Defines a default image
    $first_img = bloginfo('template_directory');
    $first_img .= "/images/default.png";
    }
     return $first_img;
}

Thanks

Full Array Being Displayed instead of just data in WP_List_Table

I am getting the following error

Fatal error: Call to undefined function do_meta_boxes() in C:\wordpress\apps\wordpress\htdocs\wp-content\plugins\realtyna\realtyna-plugin.php on line 230

I am using xamp as you can see from error is their anything in xamp i need to set to use this function ?. I am trying to add a simple meta box to display add new form.

add_meta_box('persons_form_meta_box', 'Person data', 'custom_table_example_persons_form_meta_box_handler', 'person', 'normal', 'default');

 <div class="wrap">
    <div class="icon32 icon32-posts-post" id="icon-edit"><br></div>


    <form id="form" method="POST">
         <?php /* NOTICE: here we storing id to determine will be item added or updated */ ?>
        <input type="hidden" name="id" value="<?php echo $item['id'] ?>"/>

        <div class="metabox-holder" id="poststuff">
            <div id="post-body">
                <div id="post-body-content">
                    <?php /* And here we call our custom meta box */ ?>
                    <?php do_meta_boxes('person', 'normal', $item); ?>
                    <input type="submit" value="<?php _e('Save', 'custom_table_example')?>" id="submit" class="button-primary" name="submit">
                </div>
            </div>
        </div>
    </form>
</div>

Strict Standards: Non-static method RCCWP_Options::Get()

I am getting this error in wordpress after migration.

Strict Standards: Non-static method RCCWP_Options::Get() should not be called statically in subdomains/ie/httpdocs/wp-content/plugins/magic-fields/Main.php on line 183

Any idea on how to resolve this error?

New post outside wordpress via XML-RPC with "Send Trackback To" field

I want to create new post on my wordpress blog via XML-RPC.

Problem: I want to send Trackback URLs along with new post, just like we put URLs in wordpress panel (space separated) in Send Trackback to input box:

enter image description here

My code until now is:

$content = array( 
    'title'=>$title, 
    'description'=>$body, 
    'mt_allow_comments'=>0, // 1 to allow comments 
    'mt_allow_pings'=>0, // 1 to allow trackbacks 
    'post_type'=>'post', 
    'mt_keywords'=>$keywords, 
    'categories'=>array($category),
    'wp_post_thumbnail' =>  $thumbnail_id 
); 

Woocommerce(wordpress) email type displaying 'plain/text' instead of 'text/html'

The Woocommerce email settings for all the orders are showing 'Plain text' as Email type, it should show HTML/Multipart too, but it is restricting or overriding to Plain Text. How can we have the options of HTML/Multipart.

I have added a function below to functions.php

function wps_set_content_type(){ return "text/html";enter code here } add_filter( 'wp_mail_content_type','wps_set_content_type' );

but this does not works

WordPress: Can I batch upload lots of files (e.g. via a custom field) which will appear on my website as a list of downloadable files?

TL;DR: Can I upload hundreds of files via WordPress (vanilla or with free/premium plugins) which will appear on my website as downloadable files, or would another CMS be better suited to this task?

More info: I'm building a site to replace an old WordPress MU site. My (non-technical) client needs to be able to create a single profile page for each of their employees. Each employee page must include some or all of:

  • A header image
  • A text intro
  • A photo gallery
  • A list of links
  • Multiple audio embeds
  • Multiple video embeds
  • A list of ~1000 downloadable files, mostly pdf/jpg, divided into subgroups

Ideally the last point would be achieved something like this:

  1. Client adds a custom field and must name it
  2. Client drags any number (realistically 1-100) of files onto the field, or uploads via "add files" function
  3. Files are saved in the backend to a folder named after the custom field
  4. File order is editable by client
  5. The field is output to the HTML page like this:
<h1>Custom Field Name</h1>
<ul>
  <li><a>file1.pdf</a></li>
  <li><a>file2.jpg</a></li>
  ...~100
</ul>

Employee A is totally separate from Employee B, C, etc. All employees' pages will be managed by a single user. Their files should exist separately in the backend. The paths to their files will ideally include their name, but only the filename itself needs to be printed to the page. A file system like this would be perfect:

/EmployeeFirstName-EmployeeLastName/Media/YYYY/Filename.xxx

I believe WP's default media file save directories can be customised via plugins.

I'm trying to do this in WP because it's what I've used in the past and it's what my client is familiar with. A friend recommended the Advanced Custom Fields plugin for WP, which I am looking into. I'm an experienced designer but a beginner developer. I accept my naïveté and I'm keen to learn.

Possible structures:

  • A single WP install with a Page per employee
  • A Multisite WP install with a Site per employee
  • Other?

After much searching I'm beginning to think WP might not be a suitable platform for long and busy pages (~80 video embeds per page, added via ACF) with this type of file management requirement. The admin page for my test page is already very slow to update and I haven't even started the file list part.

Since the key feature of this page template will be the ability to list hundreds of downloadable files, it seems logical to me to pick a CMS based on that requirement, rather than pick a familiar CMS and try to force it to do what I want.

Thanks for reading!

How to Get query vars for an special permalink in wordpress

Hi how can i retrieve query_vars from a permalink without sending user to that page.

actually i need to get query vars for an special permalink while i am in another page or post.

prase_request(); or ... ?>

What function is in charge of keeping wordpress shortcodes between switching views?

I changed core files (until I find the way to re-define the functions with some sort of plugin) to render divs instead of DL's for captions in TinyMCE's js file "wpeditimage.js" and now when I switch back from visual to text view, the image is taken out the caption shortcode. The caption is put after the image every time I switch views.

I thought it would be some selector or regex still looking for a dl, and not finding it… but I don't even know what function is in charge of that matching/syncing.

I changed successfully the php code to render the front end code, but here I'm trying to accomplish the editor to render different code, in the editor (which uses JS, not PHP)

Thanks.

Fetch several rss feeds from other blogs in one page

I am trying to make a function which take an rss fedd URL and fetches the most recent 2 posts. I have tried to remake the snippet from here to a full function in funtions.php as following. I don't want to use a plugin for this since the plugins I have looked at have been close to impossible to style with my own html...

function fetch_feed_from_blogg($path) {
$rss = fetch_feed($path);

if (!is_wp_error( $rss ) ) : 

    $maxitems = $rss->get_item_quantity(2); 
    $rss_items = $rss->get_items(0, $maxitems); 
endif;

function get_first_image_url($html)
    {
      if (preg_match('/<img.+?src="(.+?)"/', $html, $matches)) {
      return $matches[1];
      }
    }

function shorten($string, $length) 
{
    $suffix = '&hellip;';

    $short_desc = trim(str_replace(array("/r", "/n", "/t"), ' ', strip_tags($string)));
        $desc = trim(substr($short_desc, 0, $length));
        $lastchar = substr($desc, -1, 1);
          if ($lastchar == '.' || $lastchar == '!' || $lastchar == '?') $suffix='';
              $desc .= $suffix;
        return $desc;
}

    if ($maxitems == 0) echo '<li>No items.</li>';
    else 
    foreach ( $rss_items as $item ) :

$html = '<ul class="rss-items" id="wow-feed"> <li class="item"> <span class="rss-image"><img src="' .get_first_image_url($item->get_content()). '"/></span>
        <span class="data"><h5><a href="' . esc_url( $item->get_permalink() ) . '" title="' . esc_html( $item->get_title() ) . '"' . esc_html( $item->get_title() ) . '</a></h5></li></ul>';

   return $html;
}

I am also trying to make it so that it can be used several times on a single page.

How to display most viewed posts in custom post type

I'm using keremiya theme for wordpress. I was trying to display my most viewed post in my custom post type if "most_viewed" option is on. The name of my custom post type is watch. How can i do this with my current code? I am also using a plugin called wp-post views to display the views in my sidebar. Here is my query.

    <?php if(get_option('most_viewed') == 'On'): ?>
    <div class="sidebar-right">
    <h2><?php echo get_option('my_title'); ?></h2>
    <div class="fimanaortala">
    <?php $tavsayi = get_option('keremiya_tavsiyesayi'); $tavkat = get_option('keremiya_tavsiyekat');?>
    <?php query_posts('showposts='.$tavsayi.'&v_orderby=desc&cat='.$tavkat.'') ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="filmana">
        <div class="filmsol">
        <?php keremiya_resim('80px', '70px', 'izlenen-resim'); ?>
        </div>
        <div class="filmsag">
            <div class="filmsagbaslik">
            <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
            </div>
            <div class="filmsagicerik">
            <?php if(function_exists('the_views')) { the_views(); echo " "; } ?>
            <p><?php nezaman_yazildi(); ?></p>
            </div>
            <div class="filmizleme">
            <a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_directory'); ?>/images/filmizle.png" alt="film izle" height="21" width="61" /></a>
            </div>
        </div>
    </div>
    <?php endwhile; else: ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    </div>
</div>

register js for more than one predefined by id pages in script-calls.php

I have this js code (saved as shomz.js file)

var shown = true;
var parent = document.querySelector('.parent');
var child = document.querySelector('.child');

parent.addEventListener('mouseenter', function(){
  child.style.opacity = shown ? 0 : 1;
  shown = !shown;
});

The js is related to the following css

* {
  margin: 0;
  padding: 0;
}

.parent {
  width: 100%;
  margin: 10px auto;
  position: relative;
}

.child {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  transition: opacity 0.5s linear;
}


p {
  padding: 1em;
}

and html:

<div class="parent">
<img src="http://ift.tt/1aOoXsp" alt="" width="500px" height="auto" />

<div class="child">
<img src="http://ift.tt/1HWhQs8" alt="" width="500px" height="auto" />

Starting from the below js register procedure (made by Robin) in script-calls.php for a single page by ID, I was wondering what is the best way to tweak the code, in order to define more than one page (2,3,N) also by ID, applying the above shomz.js code. I am not interested to find a global rule that will affect the whole site pages, but only the defined by ID pages;

// Main Scripts
function register_js() {

    if (!is_admin()) {
        $url_prefix = is_ssl() ? 'https:' : 'http:';

        /* Get id of current page*/
        $page_id     = get_queried_object_id();
        /* Compare the desired page's id with the current page's id, if       they match, enqueue shomz*/
        if(YOUR_ID == $page_id){
            wp_register_script('shomz', THB_THEME_ROOT . '/assets/js/plugins/shomz.js', 'jquery', null, TRUE);
            wp_enqueue_script('shomz');
        }
        wp_localize_script( 'app', 'themeajax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );
    }
}  

Responsive logo - goes under menu bar

i need your help. When site width is resized between 782 to 0 then the logo is removing from it's initial place - under the sticky menu and creates a black line. My site http://goo.gl/uFZydO

Call to undefined function wp_email()

I have a custom product form inquiry create and all of its data are sent through AJAX. The problem is although I included the wp-load.php file for wp functions and pluggable.phpfile for wp_email function, it still show an error:

Fatal Error: Call to undefined function wp_email()

This is my code for inquire.php inside a folder that sends the email inquiry:

require('../wp-load.php');

require('../wp-includes/pluggable.php');

$to = 'email@email.com';
$subject = 'Product Inquiries';
$message = '
    <table width="99%" cellspacing="0" cellpadding="1" border="0" bgcolor="#eaeaea">
        <tbody>
            <tr>
                <td>
                    <table width="100%" cellspacing="0" cellpadding="5" border="0" bgcolor="#ffffff"><tbody>
                        <tr bgcolor="#eaf2fa">
                            <td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Name</strong></font></td>
                        </tr>
                        <tr bgcolor="#ffffff">
                            <td width="20">&nbsp;</td>
                            <td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$your_name.'</font> </td>
                        </tr>
                        <tr bgcolor="#eaf2fa">
                            <td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Email Address</strong></font></td>
                        </tr>
                        <tr bgcolor="#ffffff">
                            <td width="20">&nbsp;</td>
                            <td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><a target="_blank" href="mailto:'.$your_email.'">'.$your_email.'</a></font> 
                            </td>
                        </tr>
                        <tr bgcolor="#eaf2fa">
                            <td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Phone</strong></font></td>
                        </tr>
                        <tr bgcolor="#ffffff">
                            <td width="20">&nbsp;</td>
                            <td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$your_phone.'</font> </td></tr>
                            <tr bgcolor="#eaf2fa">
                                <td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Product Link</strong></font></td>
                            </tr>
                            <tr bgcolor="#ffffff">
                                <td width="20">&nbsp;</td>
                                <td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><a target="_blank" href="'.$prod_link.'">'.$prod_name.'</a></font></td>
                            </tr>
                            <tr bgcolor="#eaf2fa">
                                <td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Message</strong></font></td>
                            </tr>
                            <tr bgcolor="#ffffff">
                                <td width="20">&nbsp;</td>
                                <td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$your_message.'</font> 
                                </td>
                            </tr>
                            <tr bgcolor="#eaf2fa">
                                <td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Referred By:</strong></font></td>
                            </tr>
                            <tr bgcolor="#ffffff">
                                <td width="20">&nbsp;</td>
                                <td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$referred_by.'</font> 
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>';
wp_email($to,$subject,$message);

Please help guys.. thanks..

Sending multiple input values with PHP and WordPress

OK, so here is my slightly complicated question for you guys.

I have a WordPress site where user can add products to category, there is functionality which displays sorted products in one page. Here is pretty much code of single product:

<td><input class="cbx" type="checkbox" name="product" value="product">    </td>
<td class="bright"><?php the_title(); ?> <input class="ptitle" type="hidden" name="ptitle" value="<?php the_title(); ?>"></td>
            <td class="bright">box</td>
            <td class="bright">height</td>
            <td class="bright">price</td>
            <td> <input class="count" type="text" name="<?php echo $post->ID; ?>count" maxlength="4"></td>
</tr>

This code is looped and displays in form tags on other archive.php . On archive.php i have jquery script which sends data from form to mail.php pasted below (i stripped it a bit for better visibility):

    <?php
// Fetching Values from URL.
$email = $_POST['email'];
$place = $_POST['place'] ;
$street = $_POST['street'] ;
$code = $_POST['code'] ;
$email = filter_var($email, FILTER_SANITIZE_EMAIL); 
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$subject = 'new message';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:' . $email. "\r\n";
$template = '<div><br><b>Adress:</b><br> '.$street.'<br>'. $code.'     '.$place.'<br>'. '<br><b>Email:</b> ' . $email . '<br>'
$sendmessage = "<div>" . $template . "</div>";
$sendmessage = wordwrap($sendmessage, 70);
mail("test@test.com", $subject, $sendmessage, $headers);
echo "success.";
} else {
echo "<span>*incorrect email*</span>";
}

What i need is a function which will check if product is checked, get its name, gets number which is provided through input and sends it through my email function.

I have no problem sending predefined inputs, but when i get some dynamic data (there are multiple products), i don't know how to handle this. All i have in mind is creating array and foreach loop.

I will appreciate any tips how to deal with this :)

how to display country name with wordpress posts instead of category?

Dear all I have a wordpress website with the name of www.elections.af. Now the problem here it is that in the home page I want to display the country name of that specific user who posted a post in the website. I already provided a country select option when the user is going to publish the post. But when the user select the country it doesn't appear along with the post. Can somebody show me the way how to do this or which plugin to use this.

Note: I am already using wordpress creation kit pro for custom fields and metaboxes.

WordPress | Sortby & filter - Archive page

My code:

<?php
$the_key = 'upsidedate';  // The meta key to sort on
$args = array(
   'meta_key' => $the_key,
   'orderby' => 'meta_value',
   'order' => 'ASC',
);
global $wp_query;
query_posts(
    array_merge(
        $wp_query->query,
        $args
    )
);
?>
<?php 
if (have_posts()) : while (have_posts()) : the_post() ;

get_template_part('post', 'archive');
endwhile;

else :
    get_template_part('post', 'noresults');
endif; 

get_template_part('navigation');
?>

What is doing now? its order by the custom field "upsidedate".

I want to order by the custom field "upsidedate" and filter by the custom field "done", I mean only if the value on "done" is "no" - it will show the post on archive.

Should be something like that:

$the_query = new WP_Query( array( 'meta_key' => 'done', 'meta_value' => 'no' ) ); 

But I cant use meta_key twice. How can I do that?

Wordpress on Image click change shortcode

I wonder if this can be done at all. But here it goes.

A the top of a wordpress page I have a shortcode which displays a slider.

Then under that I have some thumbnail images.

I would like to be able to display a different slider each time I click in a different thumbnail.

For example:

If I have 2 sliders ... each will have it's own shortcode.

Say I create Slider1 and Slider2 and 2 thumbnails TH1 and TH2

At the top of the page I would have [slider1] ...if I then clicked in TH2 [slider2] slider would show.

Is this sort of thing possible? I know I could use JQuery to change the shortcode text but would it reload the slider at runtime?

Any advice of this?

Pass the current row value of aid from form using ajax

I am working in wordpress and I want to fetch the updated value of aid field from form each time a submit button is pressed. There are two submit buttons and I want the id as per the clicked row

HTML Form(it is shown dynamically with php code)

foreach( $results as $result ) {
$form.= '<form id="voteform" action="" method="post">';
$form.= "<input id='aid' name='aid' type='text' value='$result->aid'>";

$form.=" <input class='star' class='star' id='star5'  type='submit'  name='star5' value='5'>";
$form.=" <input class='star' class='star' id='star6'  type='submit'  name='star5' value='5'></form";

jQuery

$(document).on("click",".star", function(e) {
    e.preventDefault();
var aidd = jQuery("#aid").val();
sentdata =({

            action: 'star',
            aid:aidd,

        })
$.post(yes.ajaxurl, sentdata, function (res) { //start of funciton
         alert(aid);
            $("#myresult").html(res);

            return false;
        } //end of function
        ,
        'json');    }); //end inner function
}); //end main function

php code

add_action( 'wp_ajax_star', 'star' );
add_action( 'wp_ajax_nopriv_star', 'star');


function star()
{

    $aid = $_POST['aid'];
echo json_encode($aid);
die();
}

WP_List_Table No Data being displayed

I am trying to use wp_list table to display my data in the plugin however its showing no data i am using the following. There is def test data is their any php editor that lest u debug like visual studio btw.

class TT_Example_List_Table extends WP_List_Table {



  function __construct(){
    global $status, $page;

    //Set parent defaults
    parent::__construct( array(
        'singular'  => 'realtyna',     //singular name of the listed records
        'plural'    => 'realtyna',    //plural name of the listed records
        'ajax'      => false        //does this table support ajax?
    ) );

}

 function prepare_items() {
        global $wpdb; //This is used only if making any database queries
        $per_page = 5;
        $columns = $this->get_columns();
        $hidden = array();
        $sortable = $this->get_sortable_columns();
        $columns = $this->get_columns();
        $data = $wpdb->get_results("SELECT * FROM realtyna");
        $hidden = array();
        $sortable = $this->get_sortable_columns();
        $this->_column_headers = array($columns, $hidden, $sortable);
        $data = array_slice($data,(($current_page-1)*$per_page),$per_page);             
        $current_page = $this->get_pagenum();
        $this->items = $data;




            /**
         * REQUIRED. We also have to register our pagination options & calculations.
         */
        $this->set_pagination_args( array(
            'total_items' => $total_items,                  //WE have to calculate the total number of items
            'per_page'    => $per_page,                     //WE have to determine how many items to show on a page
            'total_pages' => ceil($total_items/$per_page)   //WE have to calculate the total number of pages
        ) );
 }

 function column_default($item, $column_name){
        switch($column_name){
            case 'name':
            case 'phone':
                return $item[$column_name];
            default:
                return print_r($item,true); //Show the whole array for troubleshooting purposes
        }
    }
    function get_columns(){
        $columns = array(
            'name'     => 'name',
            'email'    => 'email',
            'phone'  => 'phone'
        );
        return $columns;
    }

    function get_sortable_columns() {
        $sortable_columns = array(
            'name'     => array('name',false),     //true means it's already sorted
            'email'    => array('email',false),
            'phone'  => array('phone',false)
        );
        return $sortable_columns;
    }

}

admin panel php file hooking and activating

Hi there ive recently been creating a wordpress ticket system plugin. I am currently working on creating the admin panel/dashboard for it so that admins can view and edit all of the tickets.

the php file that i have created for the panel/dashboard is seperate from the main file and i am not sure on how you go about activating the seperate file inside of the main php file.

I have found some information stating about the include-once and require-once commands, i have been told that i need to hook the php file aswell

Uncaught TypeError: $(...).flexslider is not a function

Hi Guyz I am facing this error with all slider plugins if I change the flexslider to coin Slider than it will show $(...).coinslider is not a function ....... Uncaught TypeError: $(...).flexslider is not a functionmetaslider_105 @ (index):111 timer_metaslider_105 @ (index):126 setTimeout (async)timer_metaslider_105 @ (index):126 (anonymous function) @ (index):128

Thanks in Advance for Help

International Buddypress social network

I'm building a social network using buddypress. I'd like this social network to be international

I'm using Xprofile plugin to create buddypress fields. I want every new user when register, to be able to choose their country, and depending of the country, that an multi selector dropdown appear with the states from this country so that they can choose to add.

( For example I want someone from USA to be able to choose Utah + California. Or if someone is from France, I want him to be able to select 2 french states ).

I guess I need to use conditionnal field plugin to do that.

The problem is that then, I want those states to appear in the profile page. I know I need to add

" " to the member-header.php.

The problem is that this data field is gonna be different for every country. I don't know how to do that.

Any help ?

Tracking WordPress page visits by editor?

Most page visit counters count page visits on the page.

How could a WordPress counter count by user (the user who wrote the post).

Further, WP seems to make a record of the person who edits and clicks "publish" on a post. How could a counter count by the people who clicked "publish"?

Thanks

How to hook a php function to after wordpress div tag

I need to add php code after my wordpress site logo. <div class="logo">....</div> I can't edit header.php on my child theme. I want to know how to use wordpress hook for it. Thanks.

how to make the search result posts to be like the single post (style) in wordpress

in my wordpress post i have some text and i added a link for this text using the post editor. i mean, like this the problem is that the link enable only in the single post and not in the search result posts. in the search result posts its show the text, but without the edits.

the search result post.php:

<?php
/**
* The template for displaying Search Results pages
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/

get_header(); ?>

<section id="primary" class="site-content">
    <div id="content" role="main">

    <?php if ( have_posts() ) : ?>

        <header class="page-header">
            <h1 class="page-title"><?php printf( __( 'Search Results for:    %s', 'twentytwelve' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
        </header>

        <?php twentytwelve_content_nav( 'nav-above' ); ?>

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>

        <?php twentytwelve_content_nav( 'nav-below' ); ?>

    <?php else : ?>

        <article id="post-0" class="post no-results not-found">
            <header class="entry-header">
                <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
            </header>

            <div class="entry-content">
                <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentytwelve' ); ?></p>
                <?php get_search_fom(); ?>
            </div><!-- .entry-content -->
        </article><!-- #post-0 -->

    <?php endif; ?>

    </div><!-- #content -->
</section><!-- #primary -->

the single post.php:

<?php
/**
* The Template for displaying all single posts
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/

get_header(); ?>

<div id="primary" class="site-content">
    <div id="content" role="main">

        <?php while ( have_posts() ) : the_post(); ?>

            <?php get_template_part( 'content', get_post_format() ); ?>

            <nav class="nav-single">
                <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
                <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span>
                <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span>
            </nav><!-- .nav-single -->

            <?php comments_template( '', true ); ?>

        <?php endwhile; // end of the loop. ?>

    </div><!-- #content -->
</div><!-- #primary -->

thanks for everyone :)

Updated value of form item fetched with ajax

I am working in wordpress and I am using an ajax call to return aid field. I have a form in for loop and there are multiple submit buttons. I want the updated value of aidd field returned. aidd always return the first clicked value

jQuery(function ($) {
        $(document).on("click",".star", function(e) {
        e.preventDefault();

        var aid = jQuery("#aid").val();


        //////////////////////////////////
       alert(aidd);
             var sentdata =({

                action: 'star',
                    id:aid
            })
    var element = $(this);
     $.post(yes.ajaxurl, sentdata, function (res) { //start of funciton
    alert(id);
                $(element).siblings("#hero").html(res);
            } //end of function
            ,
            'json');    }); //end inner function
    });

php (just pasting the form php code )

$form.= '<form id="voteform" action="" method="post">';
    $form.='<div>';

    $form.= "<input id='aid' name='aid' type='text' value='$result->aid'>";
     ///////////////
    $form.="<input class='star' id='star1' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='1' style='border:0px!important;'>";
    $form.="<input class='star' id='star2' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='2' style='border:0px!important;'>";
    $form.="<input class='star' id='star3' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='3' style='border:0px!important;'>";
    $form.="<input class='star' id='star4' type='image' type='submit' name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='4' style='border:0px!important;'>";
    $form.="<input class='star' class='star' id='star5'  type='image' type='submit'  name='star5' src='http://localhost:8080/test/wp-content/uploads/2015/05/star0.png' value='5' style='border:0px!important;'>";

    $form.='<input class="star" name="star5" src="http://localhost:8080/test/wp-content/uploads/2015/05/star0.png" type="image" type="submit" value="6" /></form>';

Resulting php function

add_action( 'wp_ajax_star', 'star' );
add_action( 'wp_ajax_nopriv_star', 'star');


function star()
{


    $aid = $_POST['id'];
    echo json_encode ($aid);
    die();
}

Insert link/edit link not highlighting in WordPress blog theme

I have newly created a free WordPress blog account and started writing my first post. What I notice is that the insert link/edit link never gets highlighted, which means none of the external links can be inserted. I tried changing several themes and the result is the same.

I have attached a snap shot of the editing page to give an idea of the issue. Is this something to do with my browser or WordPress issue? Any possible solution?

Editing page of WordPress blog

SEO and single page website in Wordpress

I am developing single page website in Wordpress nad I run into a problem. I will try to explain it as best as I can.

The website is http://ift.tt/1F5dUq0

Currently, when you hover menu item Kosmetika, you can see there is link http://ift.tt/1Ktq3F0 - that is how visitor is redirected to the section Kosmetika on the page. But this is bad for SEO, I need URL to be http://ift.tt/1F5dVud so it is indexed by Google. That is my first problem.

Now, second problem for me is that when I create page in Wordpress administration, it automatically creates URL for that page - so for example for Kosmetika, there exists URL http://ift.tt/1F5dVud. Although no visitor will get to that page through my website, it exists therefore Google will index it - and that's why anyone can get to that page through Google. Yes I can disable indexing of http://ift.tt/1F5dVud in robots.txt, but that doesn't solve my problem - I want URL http://ift.tt/1F5dVud to be indexed, but on the homepage for section with id kosmetika.

So basically, I need this:

1, Actual page http://ift.tt/1F5dVud to be removed (or Wordpress not to create URL for pages)

2, Every section on front-page to have its own indexable URL, so http://ift.tt/1Ktq3F0 to be http://ift.tt/1F5dVud and I need this to be indexed by google

I searched a lot and unfortunately I haven't found anyone dealing with this specific problem. I'd be glad if you could help me somehow. Thank you very much!

And sorry for links not being active in my post, I don't have enough reputation here to post more than 2 links..

how to retrieve query_vars by sending custom url to Wordpress by Ajax

i am working on a new wordpress theme that will convert a wordpress site to a SPA (single page application) .

This theme works by JSON REST API and Backbone.Marionette.

I use backbone.Marionette and jquery for client-side action. but i have a problem by wordpress links (pages ,posts , custom links in post contents)

how can i setup a structure on my theme to convert all links to query_vars without sending links by http to server .

must i use

$wp_rewrite->rewrite_rules;

and use the rules for my Appliction.AppRouter.

thanks a lot

Woocommerce hide out of stock variations based on category

Looking for ways to hide out of stock product variations from options menus on Product page where the product is in a specific category. Eg If product variation is in category 'Leotards' do not show if that particular variation is out of stock.

All ideas gratefully received.

John

Add different version of class for mobile browsers

I was editing a Wordpress theme and I added a content box to Bootstrap's <div class="well">. I had to remove the content box's padding-bottom and margin-bottom because while on desktop there was a lot of space in the contentbox after the content box was displayed. While the removal of padding and margin works well on desktop, it overflows on mobile. The image as follows:- enter image description here

On PC, it looks like this :- enter image description here

Anyways, this is the content box that comes inside <div class='well'>

.site-content article {
word-wrap: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
padding-bottom:auto;
margin-bottom:auto;

}

wordpress sort post by recent comment and new post

Based on this answered question: Ordering Wordpress posts by most recent comment

I want to sort wordpress post by recent comment and new post. I need to put this in my themes function but I always get "Page not found". Anybody can help to fix this code?

function intercept_query_clauses( $pieces ) {
global $wpdb;

$pieces['fields'] = "wp_posts.*,
  coalesce(
  (
      select max(comment_date)
      from " . $wpdb->comments ." wpc
      where wpc.comment_post_id = wp_posts.id AND wpc.comment_approved = 1
  ), 
  wp_posts.post_date 
  ) as mcomment_date
  from " . $wpdb->posts . " wp_posts
  where post_type = 'post' 
  and post_status = 'publish'";
$pieces['orderby'] = "mcomment_date desc limit 10";

return $pieces;
}
add_filter( 'posts_clauses', 'intercept_query_clauses', 20, 1 );

Any help and guide really appreciate.. Thank you.

vendredi 8 mai 2015

Woocommerce place order using curl?

I need to place order using curl in wordpress woocommerce. i already tried this but its not working. My error

{"result":"failure","messages":"  \n\t\t\t
    We were unable to process your order, please try again.<\/li>\n\t<\/ul>\n","refresh":"true","reload":"false"}

My code is given below

    $datas = "billing_country=IN&billing_first_name=renuka&billing_last_name=fg&billing_company=fsdfgdf&billing_address_1
    =dsfdsfsd+fdfsdf&billing_address_2=fsdfsdfsdf&billing_city=madurai&billing_state=BR&billing_postcode
    =6334535&billing_email=renuka%40osiztechnologies.com&billing_phone=2343546&shipping_country=IN&shipping_first_name
    =renuka&shipping_last_name=fg&shipping_company=fsdfgdf&shipping_address_1=dsfdsfsd+fdfsdf&shipping_address_2
    =fsdfsdfsdf&shipping_city=madurai&shipping_state=BR&shipping_postcode=6334535&order_comments=&shipping_method
    %5B0%5D=free_shipping&payment_method=braintree&braintree-card-expiry-month=10&braintree-card-expiry-year
    =2032&_wpnonce=a5dbf257ca&_wp_http_referer=%2Fprojects%2Ftutor%2Fwp-admin%2Fadmin-ajax.php";

    $ch = curl_init('http://localhost/project/wp-admin/admin-ajax.php?action=woocommerce_checkout');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $datas);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);

wordpress travel photohgraphy theme

I'm looking for a theme in wordpress for develop a website of travel photography. I checked hundreds of themes and I the one I would like is no longer available. Someone knows something similar? I would like to have a map in the main page with the links in all the places I've visited. Thank you so much.

http://ift.tt/1Jxnguj

Pls Help Me To Create This Widget

i need show my last news on special category

<?php
    $my_query = new WP_Query('showposts='. dynamic_sidebar( 'lastnews' ) .'&cat=1');
    $active = NULL;
    while ($my_query->have_posts()):
        $my_query->the_post();
        $thumbnail_id = get_post_thumbnail_id();
        $thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
        $do_not_duplicate = $post->ID;
        if( $active == NULL ){ $active = "active"; }else{ $active = deactive ; }
            ?>
                <div class="item <?php echo $active; ?>">
                    <img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title(); ?>">
                    <div class="carousel-caption transition">
                        <h3 class="text-white"><?php the_title(); ?></h3>
                        <div class="text-center">
                            <p><?php the_excerpt(); ?></p>
                            <a class="btn btn-danger" href="<?php the_permalink() ?>"  target="_blank" > <span class="glyphicon glyphicon-sunglasses"></span> مشاهده </a>
                        </div>
                    </div>
            </div>

<?php endwhile; ?>

But dynamic_sidebar( 'lastnews-right' ) Dosent Work on lane 2. I Create Widget With This Style.

function create_lastnews( $name, $id, $description ) {

register_sidebar(array(
    'name' => __( $name ),
    'id' => $id,
    'description' => __( $description ),
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => ''
));
}

create_lastnews( 'Last News Category', 'lastnews', 'Enter Id Of Your Category To Show News' );

Pls Help Me I Can Make This News With An Other Work ?

SBM.net not re-direct to payment page

I am using SBM.net payment method. when ever customers going to purchase anything then after checkout, it does not redirect to payment gateway. that's the issue.

I Enable SBM.net Payment Module.

I am newbie to wordpress. please help

Call a Wordpress shortcode with AJAX

I have a shortcode in Wordpress which I want to call it with jQuery with the click of a button. I read a few websites and tutorials, but I cannot figure exactly what happen.

I put this on function.php:

add_action( 'init', function() { 
  ps_register_shortcode_ajax( 'ps_get_survey_form', 'ps_get_survey_form' ); 
} );

function ps_register_shortcode_ajax( $callable, $action ) {

  if ( empty( $_POST['action'] ) || $_POST['action'] != $action )
    return;

  call_user_func( $callable );
}

function ps_get_survey_form() {
    echo do_shortcode( '[dopbsp id=6 lang=el]' );
    die(); 
} 

And this on the page-template.php I use:

<button id="testonclick" onclick="test()"></button>

<div id="testresults"></div>

<script>

function test() {
    jQuery.ajax({
        url: "http://localhost/myweb" + "/wp-admin/admin-ajax.php",
        data : {action: 'ps_get_survey_form'},
        success: function(results){
            jQuery("#testresults").html(results)
        },
        error: function(errorThrown){console.log(errorThrown);}
    });// end of ajax
}
</script>

However, the results is 0. Any idea what happened wrong?

Assigning Wordpress post information to PHP array and assign the php array value to javascript array FOR THIS REASON

PHP to Javascript with values from Wordpress

I hope the following code explains what i want.

    <?php
    $title = array();
    $i=0;
    if ( have_posts() ) : while ( have_posts() ) : the_post(); 
    $title[i]=the_title();
    $link[i]=the_permalink();
    $i++;
    endwhile; else:  

    $title[0]="Welcome to my website.";
    $link[0]="/index.php";

    endif; 

    ?> 

    <script>

    var list=new Array();
    list[0]='<a href="<?php echo $link[0] ?>"><?php echo $title[0] ?></a>';
    list[1]='<a href="<?php echo $link[1] ?>"><?php echo $title[1] ?></a>';
    list[2]='<a href="<?php echo $link[2] ?>"><?php echo $title[2] ?></a>';
    list[3]='<a href="<?php echo $link[3] ?>"><?php echo $title[3] ?></a>';
    list[4]='<a href="<?php echo $link[4] ?>"><?php echo $title[4] ?></a>';

    </script>

My need is to

  • get the latest/popular 5 post title and its permalink
  • then assign it to the javascript variable like in the above code or better

Why I need this

Iam creating a simple & working news website wordpress template. And I used a javascript code(got from the web) that will display any text i put inside a specific array variable like a scrolling text( in a flash news/breaking news style).

Now I want the scrolling text to be dynamically updated with the latest blog/news post instead being static like now.

    ...
    var list=new Array();
    list[0]='<a href="This is manually typed news one.';
    list[1]='<a href="This is manually typed news two.';
    list[2]='This is manually typed news three.';
    list[3]='This is manually typed news four.';
    list[4]='This is manually typed news five.';
    ...

Reference

The website iam creating currently is temporarily available on this address

http://ift.tt/1H4RQLw.

Look at the Flash News section - that is what iam talking about.

I got the complete javascript code from http://ift.tt/1dTuOxI

In short, The Output Iam expecting is

To display the latest 5 or 10 blog posts in a scrolling text style without manually updating.

[Sorry for any wrong communication on my side. Hope you people understand my question. ]

Thanks. :)