Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

emptyvessal on "Site Hacked by Fattch3.^ need help please."

$
0
0

Hi there would like some help please :) my site was recently hacked by some one calling them selves Fattch3.^ this hack made my website play music and show different home page now I have deleted the site and uploaded a back up and the hack has gone from my site except when i search google my site appears but with some text above it saying Hacked by Fattch3.^ . Does this mean my site still has some dodgy code in it? or is google just not updated how my sit appears on the web yet?

this is my website http://www.vitalherbs.co.uk

Any help would be greatly appreaciated.


c_cav on "Modifying post type - using the registered_post_type hook"

$
0
0

Actually this turned out to be a lot easier than I thought it would be, but since I could find NO documentation on this hook anywhere, figured I'd add something here.

In my case, there is a post type from another plugin that I simply do not want to display as it only confuses the end user...

Accomplishing this cleanly was rather easy using 2 action hooks. Code sample follows:

We'll call the target post_type "foo"

add_action('registered_post_type', 'my_registered_post_type_handler', 10, 2);
function my_registered_post_type_handler($post_type, $args) {
  do_action("my_registered_{$post_type}_post_type", $post_type, $args);
}

add_action('my_registered_foo_post_type', 'my_registered_foo_post_type_handler', 10, 2);
function my_registered_foo_post_type_handler($post_type, $args) {
  remove_action(current_filter(), __FUNCTION__, 10, 2);  // only run once
  // change your args here
  $args['show_ui'] = false;
  // re-register
  register_post_type($post_type, $args); // will call this hook again if it exists, so we removed it above.
}

And we are done.

nhoullet on "Comment images to jQuery modal gallery"

$
0
0

I am making a plugin available for comments as well.The plugin grabs images and displays them in a modal gallery.
The code below is a function that grabs the images from posts and pages and sends the correct data to the jquery plugin.I added two "if" statements for comments but the plugin does not grab all those comment images.It transmits the correct image ID to each of them to the jquery plugin though.The same thing does not work for the "a data postid" attribute though.

function content($content)  {
    global $post;
    $children = &get_children(array('post_parent' => $post->ID, 'post_status' => 'inherit',
                                    'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC',
                                    'orderby' => 'menu_order ID'));
    if (empty($children)) {
     if (substr(get_post_mime_type($post->ID), 0, 5) == 'image') {
      $children = &get_posts(array('post_type' => 'attachment',
                                   'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID',
                                   'include' => $post->ID));
     }
    }
    $images = array();
    foreach ($children as $key => $val) {
     $images[$this->href(wp_get_attachment_link($key, 'full'))] =
     array('post_id' => $key, 'id' => $key, 'data' => $val,
           'permalink' => get_permalink($post->ID).'#'.$key);

     if ($comment){

      $children = &get_children(array('post_parent' => $comment_ID->ID, 'post_status' => 'inherit',
                                      'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC',
                                      'orderby' => 'menu_order ID'));

      $images = array();
      foreach ($children as $key => $val) {
       $images[$this->href(wp_get_attachment_link($key, 'full'))] =
       array('comment_ID' => $key, 'id' => $key, 'data' => $val,
             'permalink' => get_permalink($post->ID).'#'.$key);
      }
     }
    }

    $links = $this->links($content);
    $upload_dir = wp_upload_dir();
    $media = $upload_dir['baseurl'];
    $wpp_post = array();
    foreach ($links as $link) {
     if (is ($comment_text)){$wpp_post= $comment->content->images;}
     if (strpos($link, 'data-postid') === false) {
      $href = $this->href($link);
      if (!array_key_exists($href, $images) && $this->startswith($href, $media)) {
        $id = $this->get_attachment_id_from_src($href);
       if ($id != NULL) {
        $photos = &get_posts(array('post_type' => 'attachment',
                                   'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID',
                                   'include' => $id));
        if (count($photos) > 0) {
         $wpp_post[$href] = array('post_id' => $id, 'id' => $id, 'data' => $photos[0],
                                  'permalink' => get_permalink($id).'#0');
        }
       }
      } else if (array_key_exists($href, $images)) {
       $wpp_post[$href] = $images[$href];
      }
      if (array_key_exists($href, $wpp_post)) {
       $tmp = str_replace('<a ', '<a data-postid="wpp_post_'.$post->ID. '" data-imgid="'.$wpp_post[$href]['id'].'" ', $link);
       $content = str_replace($link, $tmp, $content);
      }
      if ($comment){$get_comment_meta($comment_ID);$BD=$comment_ID->ID;$tmp = str_replace('<a ', '<a data-postid="wpp_post_'.$BD. '" data-imgid="'.$wpp_post[$href]['id'].'" ', $link);
       $content = str_replace($link, $tmp, $content);}
     }
    }
    $this->append_json('wpp_post_'.$post->ID, $wpp_post);
    return $content;
   }

So to say my if($comment) thing does not work.The html output has the correct img ID for every image, but the post_id doesn't adapt to comments ( so the function could grab groups of images from every comment as well - like they were common posts ).Every thumbnail in comments opens the same,first image ever posted in the comments.The plugin should grab images and create jquery modal galleries for each comment that has an image or images.
The plugin does not rely on shortcodes and it must rely on the php code to find images.
Can you help ? thank you.

johncastlegate on "How to remove "Add Media" button in WP 3.5?"

$
0
0

In previous versions of WordPress, I could remove the media upload button with something like:

function z_remove_media_controls($context) {
    return;
}

add_action('media_buttons_context', 'z_remove_media_controls');

However, this does not seem to work in WordPress 3.5. How can I remove or hide the button now?

shihabmalayil on "wp_editor not saving data, and text area showing html tags."

$
0
0

This is my custom meta box, here text area showing html tags.i used tinymc textaea editor. and i try to use wp_editor also. but data not saving.if it saved, i don't know how to call it.
please help me find solution


add_action("admin_init", "admin_init");
	add_action('save_post', 'save_points');
	function admin_init(){
	add_meta_box("productInfo-meta", "Product Details", "product_meta_options", "product", "normal", "low");}

	function product_meta_options(){
		global $post;
		$custom = get_post_custom($post->ID);
		$category = $custom["category"][0];
		$brand = $custom["brand"][0];
		$features = $custom["features"][0];
		$holds = $custom["holds"][0];
?>
<table>
	<tr>
		<td>Category</td>
		<td> <input type="text" size="100" name="category" value="<?php echo $category; ?>" /> </td>
	</tr>
	<tr>
		<td>Brand</td>
		<td> <input type="text" size="100" name="brand" value="<?php echo $brand; ?>" /> </td>
	</tr>
	<tr>
		<td>Features</td>
		<td><textarea rows="20" cols="100" name="features"><?php echo $features; ?></textarea></td>
	</tr>
	<tr>
		<td></td>
		<td>
		<?php wp_editor( $content, 'test_content', $settings = array('textarea_name'=>'test_content','textarea_rows'=>20) );?>
		</td>
	</tr>
	<tr>
		<td>Holds</td>
		<td><textarea rows="20" cols="100" name="holds"><?php echo $holds; ?></textarea></td>
	</tr>
</table>

<?php
}

function save_points(){
	global $post;
	update_post_meta($post->ID, "category", $_POST["category"]);
	update_post_meta($post->ID, "brand", $_POST["brand"]);
	update_post_meta($post->ID, "features", $_POST["features"]);
	update_post_meta($post->ID, "holds", $_POST["holds"]);
}?>


-Thank You-

shihabmalayil on "post per page and offset not working"

$
0
0

Hi,
this is my code. here posts_per_page = > 3 & offset => 3 not working.
help me to fix this issue.
Thanks


<?php
$myquery['tax_query'] = array(
	'relation' => 'OR',
	'posts_per_page' => 3,
	'offset' => 3,
	array(
		'taxonomy' => 'brands',
		'terms' => array('iHOME'),
		'field' => 'slug',
		));
query_posts($myquery);?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<b><?php the_title();?></b>
<p><?php echo excerpt(25); ?></p>
<?php echo esc_html( get_post_meta( get_the_ID(), 'category', true ) ); ?>
<?php endwhile; else: ?>
<?php endif; ?>	


xszdsa on "Comment images to jQuery modal gallery"

$
0
0

Acquire I70 east in order to SR 1 north, switch eastern on US Thirty six in order to Oh 121 north in order to Greenville. celine bags onlineThe actual Garst Museum is actually available Mondy by way of Saturday. Look into the memorial internet site with regard to instances as well as entry charges.

tnoguchi on "Get Previous/Next Post ID for Posts in Same Category for AJAX Modal Popup"

$
0
0

I want to dynamically retrieve the post thumbnail in a modal pop-up using custom prev/next navigation. I need to retrieve the next and previous Post ID based on whatever Post is currently showing.

Even though I supply the current post ID, my function produces the following error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Custom_Work_Portfolio' does not have a method 'adjacent_post_where' in /Users/tak/Sites/lauraterry/wp-includes/plugin.php on line 173
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Custom_Work_Portfolio' does not have a method 'adjacent_post_sort' in /Users/tak/Sites/lauraterry/wp-includes/plugin.php on line 173

Any insights or suggestions would be greatly appreciated, thank you!

// Uses get_previous_post to retrieve post ID see:
       //http://stackoverflow.com/questions/6324421/getting-next-previous-post-id-using-current-post-id-in-wordpress
           /**
         * Function to call the content loaded for logged-in and anonymous users
        */
        public function load_ajax_content ( $post_id ) {
            $post_id = $_POST[ 'post_id' ];

            global $post;
            $post = get_post($post_id);
            $next_post = get_next_post(true, '1');
            $prev_post = get_previous_post(true, '1');

            if (has_post_thumbnail($post_id)) {
                $sketch_id = get_post_thumbnail_id($post_id);
                $attachment = get_post( $sketch_id );
                $caption = $attachment->post_excerpt;
                $response = '<figure>'. get_the_post_thumbnail($post_id, 'large-sketch') .'<figcaption><p>'. $caption .'</p></figcaption></figure><nav><ul><li class="prev"><a href="#" class="button radius previous-sketch secondary" data-id="'. $next_post->ID .'">Previous</a></li>
            <li class="next"><a href="#" class="button radius next-sketch secondary" data-id="'.  $prev_post->ID  .'">Next</a></li></ul></nav>';
                echo $response;
            }

            die(1);
         }

public function __construct() {
        add_action( 'wp_ajax_load-content', array($this, 'load_ajax_content' ));
        add_action( 'wp_ajax_nopriv_load-content', array($this, 'load_ajax_content' ));
    }

sketchbook_ajax.js

(function($) {

$.fn.displayPost = function() {

    event.preventDefault();

    var post_id = $(this).data("id");
    var id = "#" + post_id;

    // Check if the reveal modal for the specific post id doesn't already exist by checking for it's length
    if($(id).length == 0 ) {
        // We'll add an ID to the new reveal modal; we'll use that same ID to check if it exists in the future.
        var modal = $('<div>').attr('id', post_id ).addClass('reveal-modal').appendTo('body');
        var ajaxURL = MyAjax.ajaxurl;
         $.ajax({
            type: 'POST',
            url: ajaxURL,
            data: {"action": "load-content", post_id: post_id },
            success: function(response) {
                modal.empty().html(response).append('<a class="close-reveal-modal">×</a>').foundation('reveal', 'open');
                modal.bind('opened', function() {
                    // Reset visibility to hidden and set display: none on closed reveal-modal divs, for some reason not working by default when reveal close is triggered on .secondary links
                    $(".reveal-modal:not('.reveal-modal.open')").css({'visibility': 'hidden', 'display' : 'none'})
                    // Trigger resize
                    $(window).trigger('resize');
                return false;
                });
            }
        });
    }
     //If the div with the ID already exists just open it.
     else {
         $(id).foundation('reveal', 'open');
     }

     // Recalculate left margin on window resize to allow for absolute centering of variable width elements
     $(window).resize(function(){
         var left;
            left = Math.max($(window).width() - $(id).outerWidth(), 0) / 2;
            $(id).css({
                left:left + $(window).scrollLeft()
            });
     });
}

})(jQuery);

// Apply the function when we click on the .reveal link
   jQuery(document).on("click", ".reveal,.secondary", function() {
jQuery(this).displayPost();

});

// Open new modals on secondary paging links in open modal window
jQuery(document).on("click", ".secondary", function() {
    var id = jQuery(this).closest("div").attr("id");
       jQuery(id).foundation('reveal', 'close');
});

Template excerpt

<ul id="sketchbook-container" class="large-block-grid-4">
            <?php 

            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $args = array(
              'category_name' => 'sketchbook-2',
              'orderby' => 'date',
              'order' =>  'ASC',
              'posts_per_page' => 8,
              'paged'=> $paged
              );

              $loop = new WP_Query($args);
              while($loop->have_posts()) : $loop->the_post(); ?>

              <?php 

                if( has_post_thumbnail() ) :
                  $sketch = get_post_thumbnail_id($post->ID);
                  $large_image = get_attachment_link( $sketch );
                   ?>

                  <li class="sketch-leaf">
                    <figure class="sketch-thumb">

                      <a href="<?php echo $large_image; ?>" data-id="<?php the_ID(); ?>"  class="reveal" >
                      <?php echo get_the_post_thumbnail($post->ID, 'medium-sketch'); ?>
                      </a>
                      <figcaption>

                      </figcaption>

                      </figure>

                  </li>
                <?php endif; ?>

            <?php endwhile; ?>

          </ul>

breebrouwer on "Wysija Newsletters: centering"

$
0
0

Hey, everyone,

I'm trying to center my Wysija sign-up form on this page:
http://geekmylife.net/free-ebook-superhero-drinks

I cannot for the life of me get this centered. The form won't center when I use the Wordpress page editor to center the form and text around it. The text will center, but the form won't.

I tried this fix to my theme's style.css file that others said worked for them to center the submit button (at the very least):

.form-valid-sub input[type="submit"] {
	margin-left:auto;
	margin-right:auto;
}

But this didn't do anything.

Any suggestions? If you provide me css coding please tell me exactly which file to put it in if you want me to put it in a Wysija stylesheet as opposed to my theme's style.css file.

Thanks!

Tien Nguyen on "Special Characters for Wordpress Comment"

$
0
0

Dear,

I am designing a website that's allow people insert math formula into their comment.

All formulas are ok, but, only <=> is error. When I input <=>, Wordpress display < =>, so, it make my formula become wrong.

Have any filter or action for comment text that allow me input <=> in my comment?

Thank you very much,
Tien Nguyen

Tinwetari on "Mobile: horizontal swiping for category queries"

$
0
0

Hi everyone,

Knowledge background: I'm well versed in HTML/CSS, and quickly growing proficient in PHP within the past year. I've been working with Wordpress for a year now.

Problem: I have a page that queries posts from a specific category. This page will only be used as a web view in the mobile app we are creating. This page displays our magazine archive, where each post in the category is a published issue.

Example:
Post 1: January 2013 issue
Post 2: February 2013 issue
Post 3: March 2013 issue

Instead of listing them in a standard vertical list, I want only one magazine issue to appear on the screen at a time until the user decides to swipe sideways.

Is there coding out there that can help me create these swiping capabilities? I want to avoid installing another plugin.

Collizo4sky on "How di i add a custom message for subscribers in dashboard"

$
0
0

Hi all, am working on a client site, i want to implement a feature where i can set a custom message in the dashboard for the users to see.

For examole, i want a user(subscriber) to see a message when we confirm they have successfully paid for registration. pls help

erikstainsby on "Add submenu item for custom post type"

$
0
0

I'm looking for a way to add a submenu item to my own menu which will load the CPT UI as normal. I understand how to add the CPT menu as it's own admin menu entry but I want it placed into an existing menu of my own. It organizes the workflow better this way. However I am drawing a blank trying to find a method to load the edit UI for my post type. Clues anyone ?

TIA
Erik

mostofa62 on "Read a Directory or Folder List"

$
0
0

hello
i wanted to read the folder list of theme in a plugin
but i cant write how the directory syntax will be,
my code here:

<?php
/**
 * @package Sevendays
 */
/*
Plugin Name: Sevendays
Plugin URI: http://www.mostofa.freeoda.com/Sevendays/
Description: a plugin for switch theme for 7 days
Version: 1.0
Author: Mostofa
Author URI: http://www.mostofa.freeoda.com
*/
add_action('admin_menu','seven_days');

function seven_days()
{
//add_options_page('Seven Days Option','Seven Days','manage_options','seven-days-theme','seven_days_option');
add_options_page('Seven Days Option','Seven Days','manage_options','seven-days','seven_days_option');
}

function seven_days_option()
{
?>
<div id="theme-options-wrap">
<div class="icon32" id="icon-tools">
</div> <h2>Seven Days Option</h2>
<form method="post" action="settingpage.php">
<p class="submit">
<input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
</p>
</form>
</div>
<?php
//here is the directory listing code
$dir=get_theme_root();
//$dir="./";
echo $dir;
$dh=opendir($dir);
$files=array(5);
$i=0;
while(false !== ($filename = readdir($dh)))
{

if(is_dir($filename))
{
if($filename =='.' or $filename=='..') continue;
//$files= $filename;
$files[$i]=$filename;
}
$i++;
}

print_r($files);
closedir($dh);

}
?>

[Please post code or markup between backticks or use the code button. Or better still - use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum's parser.]

it show only path ,because i echo them
but not the directory list

kerelberel on "Looking for a comment/note system just like in Notism and Google Drive"

$
0
0

Notism is a tool which lets you place notes on images. Inside a note more comments can be made by various people. This can create a discussion and is therefor useful for graphic design students who are looking for feedback for their work.

There is no Notism plugin for Wordpress, but I've noticed Google Drive has the same comment/note function. Is it possible to somehow include Google Drive images in a Wordpress site and have people place comments on it? Or is there a plugin for Wordpress which can do the same?


iragless on "Pages displaying custom post type by custom taxonomy"

$
0
0

Hi All

Need a bit of help, hope someone can point me in the right direction. Been through the forums and haven't quite found what I'm looking for.

I'm creating a site that has four product/service types. It's an optometrist so the product types are lenses, frames, contact lenses and optometry.

My thoughts were to have a custom post type called 'products' with a custom taxonomy 'producttype'. This would make it easy for the customer to add a new product and select a producttype from the dashboard.

In the menu I'd like a page that displays all products (I'm ok with this i.e. archive-products.php) but I'd also like pages for each of the producttypes i.e. lenses, frames, contact lenses and optometry. This is where I'm stuck or even if it's possible.

I was thinking that perhaps I could create a page template(s) that calls the taxonomy of the custom post type. Would that work? Could it select the producttype from the page slug or similar?

Ideally I'd like to make it flexible so they could add additional product types later without too much re-coding.

Am I on the right track? Is there a better way?

Any thoughts or ideas would be appreciated.
Ian

McGuive7 on "Creating a shortcode inside a widget"

$
0
0

Hi there,

I've created a shortcode I'd like to use in a widget, however it's behaving a bit wonky and I can't figure it out. Here's the code in functions.php:

function related_content( $atts ) {
	return get_the_ID();
}
add_shortcode('related-content', 'related_content');

The problem is that if I embed this shortcode in a page, it does indeed spit out the correct ID of that page. However if I embed the code in a sidebar widget, it spits out a different ID entirely (it happens to be the ID of my blog page in this case). Any thoughts on why this is happening? Is there something about the context in which the shortcode is being called inside a widget? Any ideas?

Thanks!
- Mickey

julien.gatt on "mysql featured image category"

$
0
0

Hi, I would like to grab the featured images from the categories and not from all posts.
for now I got this, how can I filter this response to get only a specific category, let's say category id= 5 ?
thanks for any help

SELECT
	p1.*,
	wm2.meta_value
FROM
	wp_posts p1
LEFT JOIN
	wp_postmeta wm1
	ON (
		wm1.post_id = p1.id
		AND wm1.meta_value IS NOT NULL
		AND wm1.meta_key = "_thumbnail_id"
	)
LEFT JOIN
	wp_postmeta wm2
	ON (
		wm1.meta_value = wm2.post_id
		AND wm2.meta_key = "_wp_attached_file"
		AND wm2.meta_value IS NOT NULL
	)
WHERE
	p1.post_status="publish"
	AND p1.post_type="post"
ORDER BY
	p1.post_date DESC

mmbalaa on "Autocomplete Tag option For post"

$
0
0

This is my first topic in WP. I created one page "post" for user post and added the below code in that page [in theme]. Using this code i got post title, content and category section. But i dont get any idea for tag autocomplete like admin section. What is the solution for this?
post.php

<?php
    $content='text';
    $editor_id='tinymce';
        wp_enqueue_script('jquery.autocomplete.pack');
        wp_enqueue_script('jquery-ui-autocomplete');
        get_header();
?>
<div>
<input type="text" name="post_title" id="post_title" size="30" value="New Post" id="title" autocomplete="off" />
<br /><br />
<?php wp_editor( $content, $editor_id, $settings = array('editor_class'=>'user-post-editor','') ); ?>
</div>
<div style="
    display: inline-block;
    margin-left: 5%;">
<?php $args = array(
	'orderby'            => 'ID',
	'order'              => 'ASC',
	'hide_empty'         => 0,
); ?>
<h3>Category</h3>
 <?php wp_dropdown_categories( $args ); ?>
 <br /><br />
<h3>Tag</h3>
Need Tag Input
</div>

<?php get_footer(); ?>

jesseslam on "Adding HTML to Page Title Field"

$
0
0

Hi,

My client has a property website we set up http://www.domansresidential.co.uk/property-to-rent/hutton-rd-shenfieldtwo-bed-flat-to-rent-770pcm and would like the wording 'Now Let' in the title to be a different colour both on the property detail and category view pages in order to stand out. The simplest thing to do is add <span> tags around these words and add some CSS to change the colour. This does work on the property detail view but breaks on the category page. Does anyone know of a way to do this?

I have searched Google and various forums for plugins or hacks to allow HTML code in the page title field but can't find anything.

Thanks,

Jim Isles

Viewing all 8245 articles
Browse latest View live




Latest Images