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

tools4toni on "Embed Box.com widget?"

$
0
0

I am trying to embed a file-sharing widget from Box.com. It is just access to a publicly shared folder of documents from my Box.com account. (I have the widget on a WP.com blog, and I have used it on a non-WP.org site.)

I have read the "WP Embeds" and searched for plugins. But I do not know what I am looking for. It's not a video or a URL.

here is the embed:

<embed src="?widgetHash=pu256kyq9k0zfngpfw8f&cl=0" width="190" height="345" wmode="transparent" type="application/x-shockwave-flash"></embed>

Thank you


mfjfsdpk on "Trackback Spam"

$
0
0

Hi There,

I have my website pakentertainer.com. The problem I'm facing is spam comments and trackbacks.

For comment spam, I have disabled the default one and currently using Facebook Commenting system. But for Trackbacks spam, I'm helpless.

Can someone with experience help me out here?

Cheers!

pete_398 on "Renaming wp-config.php ??"

$
0
0

The last few months, we are getting many attempts to view wp-config.php

For example this one ..

/blog/wp-admin/admin-ajax.php?action=revslider_show_image&img=../wp-config.php

I see there is mention at http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php , on how to 'secure' the file by moving it to another path.

What about renaming wp-config.php ? I ran a search on where the file is used ..

/wp-load.php
/wp-admin/options-general.php
/wp-admin/setup-config.php
/wp-admin/network.php

Any problems with renaming it, apart from it will have to be redone at each update ?

almahdiyouth on "WP Hacked | NO ACCESS!!!"

$
0
0

hi,

http://www.almahdiyouth.org

i have a youth association website which i have been keep getting emails form WP, saying certain user has created an account and then finally my site had been hacked and everything i clicked it would redirect to someone else, some online drug store which the domain is bought in china, also i can t access my admin and i can't even reset password it doesn't recognised anything, I've deleted my htaccess in file manager on the hosting, now i need to get access to my account ??? how :( its been hacked all-open-24.com

thanks everyone,

pocockn on "Using Bootstrap Carousel with custom post types"

$
0
0

I am attempting to use bootstraps carousel on my wordpress site. I want to use it on posts. I have created a custom post type called images and then made sure its visible in my case posts which is where i want to use the carousel. I have then uploaded the individual images into each post in the images field that has been created. I then try to create an array with the images in and then loop through them, I am getting the images into my array but no output when i try to loop through them in the carousel code..

Here is my code.

<?php
get_header();
?>

<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => 'any',
'post_parent' => $post->ID,
'exclude' => get_post_thumbnail_id()
);

$attachments = get_posts($args);

$imageURL = array();

?>

<div class="row">
    <div class="col-md-3">
        <div id="page_title">Case Studies</div>
    </div>
    <div class="col-md-9">
        <div id="page_excerpt">
            <div class="vertical_align_centre">
                <?php the_excerpt();?>
            </div>
        </div>
    </div>
</div>

<!-- Content -->

        <div class="row carousel-row hidden-xs">
            <div class="col-md-12">
                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                    <!-- Indicators -->
                    <ol class="carousel-indicators">
                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
					</ol>

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner">
                        <?php $i=0; foreach ($attachments as $imageURL) { ?>
                        <div class="item <?php if ($i == 0) { echo 'active'; } ?>" style="background-size:cover; background:url('<?php echo $imageURL->guid; ?>') no-repeat center;">
                            <div class="carousel-caption">
                                <h4><?php echo $imageURL->post_excerpt;?></h4>
                            </div>
                        </div>
                        <?php $i++; } ?>
                    </div>
                    <!-- Controls -->
                    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left"></span>
                    </a>
                    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                </div>
              </div>
            </div>
            <!-- end of col 12 -->
        </div>

Radsterdriver on "Adding comments to multiple pages? using"

$
0
0

HI,

I am using this code to add a comments to one of my pages. Do I need to add all lines of code for each new page that requires comments or is there a way to specify multiple pages within these lines of code.
Thanks!!!

<?php
if (is_page(183)) {
?>
<div class="et_pb_row">
<?php
comments_template( '', true );
}
?>
</div>

fotoflarephotography on "Account has been suspended - No access to wp"

$
0
0

My site is one of many being served on someone's account. One of the sites was hacked and therefore no one can access their sites or files. Since I can't gain access to the cpanel or wp dashboard, is it all lost? From what I understand, the person hosting the sites did not complete any backups. Is there another way in or am I out of luck?

slowflow on "Multiple tmp tables shutting down large wordpress site"

$
0
0

Hello,
I run a large wordpress site with over 100,000 posts and about 200,000 comments. We have been experiencing extremely high load averages recently which have been shutting down the website.
These high loads are due to a high number of mySQL tmp tables being written

-----
| 81019491 | infora_db1 | localhost | infora_db1 | Query | 26 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019494 | infora_db1 | localhost | infora_db1 | Query | 2 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019502 | infora_db1 | localhost | infora_db1 | Query | 36 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019515 | infora_db1 | localhost | infora_db1 | Query | 0 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019565 | infora_db1 | localhost | infora_db1 | Query | 0 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81019577 | infora_db1 | localhost | infora_db1 | Query | 36 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020187 | infora_db1 | localhost | infora_db1 | Query | 1 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020206 | infora_db1 | localhost | infora_db1 | Query | 11 | Copying to tmp table | SELECT
| 81020219 | infora_db1 | localhost | infora_db1 | Query | 3 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020233 | infora_db1 | localhost | infora_db1 | Query | 3 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020246 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020282 | infora_db1 | localhost | infora_db1 | Query | 8 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020351 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relat |
| 81020364 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020410 | infora_db1 | localhost | infora_db1 | Query | 4 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020412 | infora_db1 | localhost | infora_db1 | Query | 5 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020435 | infora_db1 | localhost | infora_db1 | Query | 2 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 81020448 | infora_db1 | localhost | infora_db1 | Query | 2 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
-----

I would like to know if there is any way to improve the efficiency of these queries and hopefully avoid the creation of tmp tables
Also, I read that SQL_CALC_FOUND_ROWS is not so great on large databases, I would also like to know if there is a way I can get rid of it (no_found_rows=true) without breaking pagination.
I would be eagerly awaiting feedback.
Thanks a lot.


StyledThemes on "Conditionals in functions from customizer"

$
0
0

Is there a way to create a conditional in the functions.php to load something if a particular option setting is set from the WP Customizer? This one has got me puzzled beyond belief on how to achieve this.

Basically I want to enqueue a script for the blog home page based on a theme option setting.

sohinc on "WP Custom Update - Want to update post automatically"

$
0
0

Hi guys, So i have this plugin that i had got developed a year ago called WP Custom Update(code below). What this does is if you enter your post id in the plugin it will simply update that post every 10, 20 or 30 minutes. So its basically refreshing your post like if you were to manually go into your post edit and hit the update button. I would like to change the functionality of this and instead of having to enter the post id i would like all post that gets published to the site to be updated automatically as if i just opened the post and hit update button. I also would like this update to only happen once instead of happening over and over again. Thanks

Wp Custom Update (code)

<?php
/*
Plugin Name: WP Custom Update
Plugin URI: mailto:lampfreaks@gmail.com
Description: A plugin will update a set of post ids in a particular interval.
Author: Thamizhchelvan
Version: 1.0
Author URI: http://thamizhchelvan.com/
*/

//################### START OF ADMIN SETTINGS ################################################/

function wpcu_menuitems(){
	add_submenu_page('options-general.php', 'Custom Update', 'Custom Update Settings', 8, 'wpcu_custom_settings', 'wpcu_custom_settings');
}

add_action('admin_menu', 'wpcu_menuitems');

function wpcu_custom_settings(){
	if(isset($_POST['wpcu_thirty'])){

		update_option('wpcu_thirty',$_POST['wpcu_thirty']);
		update_option('wpcu_twenty',$_POST['wpcu_twenty']);
		update_option('wpcu_ten',$_POST['wpcu_ten']);
	}

	?>
<div class="icon32" id="icon-options-general"><br/></div>
<h2>Custom Product Updates</h2>
<BR />
<center>
<form method="post">
<table width="100%">

<tr><td>Post/Page IDs - 30 Minutes Interval</td><td><input class="regular-text" value="<?php echo get_option('wpcu_thirty');?>" type="text" name="wpcu_thirty" />[Enter seperated by comma] Example:1,3,45,67</td></tr>

<tr><td>Post/Page IDs - 20 Minutes Interval</td><td><input class="regular-text" value="<?php echo get_option('wpcu_twenty');?>" type="text" name="wpcu_twenty" /></td></tr>

<tr><td>Post/Page IDs - 10 Minutes Interval</td><td><input class="regular-text" value="<?php echo get_option('wpcu_ten');?>" type="text" name="wpcu_ten" /></td></tr>

<tr><td></td>&nbsp;<td><input type="submit" value="Save" /></td></tr>
</table>
</form>
</center>

	<?php
}

//################### END OF ADMIN SETTINGS ################################################/
add_filter( 'cron_schedules', 'wpcu_corn_schedules');
function wpcu_corn_schedules(){
	return array(
		'in_per_ten_minute' => array(
			'interval' => 60 * 10,
			'display' => 'In every Ten Mintues'
		),
		'in_per_twenty_minute' => array(
			'interval' => 60 * 20,
			'display' => 'In every Twenty Mintues'
		),
		'in_per_thirty_minute' => array(
			'interval' => 60 * 30,
			'display' => 'In every Thirty Mintues'
		)

	);
}

if(!wp_next_scheduled('wpcu_ten_minute_event' )){
	wp_schedule_event( time(), 'in_per_ten_minute', 'wpcu_ten_minute_event' );
}

if(!wp_next_scheduled('wpcu_twenty_minute_event' )){
	wp_schedule_event( time(), 'in_per_twenty_minute', 'wpcu_twenty_minute_event' );
}

if(!wp_next_scheduled('wpcu_thirty_minute_event' )){
	wp_schedule_event( time(), 'in_per_thirty_minute', 'wpcu_thirty_minute_event' );
}

add_action('wpcu_ten_minute_event', 'wpcu_update_ten');
add_action('wpcu_twenty_minute_event', 'wpcu_update_twenty');
add_action('wpcu_thirty_minute_event', 'wpcu_update_thirty');

function wpcu_update_ten(){
	wpcu_update_postids('wpcu_ten');
}

function wpcu_update_twenty(){
	wpcu_update_postids('wpcu_twenty');
}

function wpcu_update_thirty(){
	wpcu_update_postids('wpcu_thirty');
}
function wpcu_update_postids($interval){
	$post_ids = get_option($interval);
	if($post_ids != ''){
		$postids = explode(",",$post_ids);
		foreach($postids as $pid){
			$postid = trim($pid);
			$update_post = array();
			$update_post['ID'] = $postid;
			wp_update_post($update_post);
			MPT_backoffice::create_thumb($postid);
		}
	}
}
?>

PEBKACfr on "show an image when clicking on datepicker"

$
0
0

Hi,

I would like to show an image depending of a date choosen on datepicker.

First step i have added in functions.php of my theme:
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');

Then in page.php of my theme i have added the function below:

<script type="text/javascript">

jQuery(document).ready(function() {
jQuery('#MyDate').datepicker({
dateFormat : 'DD, d MM, yy',
numberOfMonths: 2,
inline: true,
minDate : -7,
maxDate : +30,
altField: '#MyDate_value',
onSelect: function(){
var day1 = $("#MyDate").datepicker('getDate').getDate();
var month1 = $("#MyDate").datepicker('getDate').getMonth() + 1;
var year1 = $("#MyDate").datepicker('getDate').getFullYear();
var fullDate = year1 + "-" + month1 + "-" + day1;
var str_sortie = "<img src=\"http://www.adress.com/" + fullDate +".jpg\">";
image_sortie.innerHTML = str_sortie;

}
});

});

</script>

3) In a wordpress page i have added

<!-- Datepicker -->

<div id="MyDate"></div>

<p>Image selected of the date <input type="text" id="MyDate_value" /></p>

<div id="image_sortie" style="text-align:center; margin-top:10px; margin-bottom:20px;"></div>

As a result on the page:
- i have the datepicker calendar for 2 months
- when i click on a date i have this date showed on the date picker box
- but i haven't got the image selected shown. My link is good because if i write <img src="http://www.adress.com/2014-10-01.jpg" /> for exemple for the picture of the 1st of octobre, i have got the picture showed.

I try to search but i don't find anything. If somebody understand in wich line the problem could be, could you exmplain me what to do ?

Thank you a lot and excuse me for my english.

absdigital on "Creating a custom search form - using custom fields and custom post type"

$
0
0

Here is what I'm trying to achieve.

I have the HTML for the form there but how to implement it into WordPress is driving me nuts. Make, Model and Price are all custom fields entered for each vehicle (each vehicle is a custom post type).

I need all the available Makes to show in the drop down list and when one is selected have it function as searching for posts with the same Make. And obviously the same for the Model.

The price I'll worry about after!! This is doing my head in big time, any help would be massively appreciated!!

abtx on "HTML5 Video in WordPress"

$
0
0
<video width="100%" height="100%">
<source src="<?php echo $video_mp4; ?>" type="video/mp4">
</video>

Hi,
Above code outputs url as html value instead of rendering actual media file. $video is media file url fetched from custom field. it's a correct url leading to the file and the file plays in the browser.
Why is Wordpress ignoring video tags?

Thanks

Mondope on "Making the subscription button more noticeable"

$
0
0

Hello!
I just got my blog up and running so I'm naturally going to have questions. My main one is how do I get the subscription button to be featured more prominently?
I don't want it to be glaring as if to be annoying, but it'd be nice if it wasn't tucked away in a corner.
Maybe there's some way to alter the placement of it or something? I don't know.

Pondscumcomic.com <---that's the blog for reference so you know what I'm talking about.
Thank you deeply to anyone that takes the time to read this!

newward on "WP_User_Query and conditional checkbox array"

$
0
0

I am in the process of creating a user search form and would like to have the users have the ability to search for multiple check box conditions.

Here is what I currently have for the checkbox on the form

<input type="checkbox" class="textbox" name="services[]" id="services" value="ministryPlanning" /> Ministry Planning <br />
	<input name="services[]" type="checkbox" id="services" value="visionAnalysis" /> Vision Analysis <br />
	<input name="services[]" type="checkbox" id="services" value="buildingCommittee" /> Forming Planning/Building Committee <br />
	<input name="services[]" type="checkbox" id="services" value="selectionConsultants" /> Selection of Other Consultants <br />
	<input name="services[]" type="checkbox" id="services" value="educationProcess" /> Include Liturgical Education Process <br />
	<input name="services[]" type="checkbox" id="services" value="largeGroup" /> Large Group Facilitation <br />
	<input name="services[]" type="checkbox" id="services" value="smallGroup" /> Small Group Facilitation <br />
	<input name="services[]" type="checkbox" id="services" value="spaceProgramming" /> Liturgical Space Programming <br />
	<input name="services[]" type="checkbox" id="services" value="artConsulting" /> Liturgical Art Consulting <br />
	<input name="services[]" type="checkbox" id="services" value="designsFunishing" /> Designs Liturgical Furnishings <br />
	<input name="services[]" type="checkbox" id="services" value="furshinhingConsulting" /> Liturgical Furnishings Consulting <br />
	<input name="services[]" type="checkbox" id="services" value="sacredArt" /> Designs/Fabricates/Installs Sacred Art or Furnishings <br />
	<input name="services[]" type="checkbox" id="services" value="ritualPlanning" /> Ritual Planning <br />
	<input name="services[]" type="checkbox" id="services" value="trainingMinisters" /> Training for Liturgical Ministers';

and here is the form processing

if(!empty($_GET['services'])) {
		$arr =	array('relation' => 'OR');
		$i = 0;
		foreach($_GET['services'] as $service) {
				$arr[$i] =  array(
						'key'     => 'services',
						'value'   => $service,
						'compare' => 'LIKE'
					);
			$i = $i + 1;
    	}
	$the_user_query =  array('meta_query' => array($arr));

	}
$the_users = new WP_User_Query( $the_user_query );

When I display the users that were selected it is always giving me back all of the users. But if I change the code to and hard code the selection it works.

$the_user_query = array(
			'meta_query' => array(
				'relation' => 'OR',
				0 => array(
					'key'     => 'services',
					'value'   => 'ministryPlanning',
					'compare' => 'LIKE'
				),
				1 => array(
					'key'     => 'services',
					'value'   => 'visionAnalysis',
					'compare' => 'LIKE'
				)
			)
		 );

I am not sure what is different between the 2.

Here is the page for this site
http://liturgical-consultants.org/wp/find-a-member/


upstairstudios on "code line 29"

$
0
0

I am getting this error.

Is it a hack? If so, how can i change this?

gzdecode(): data error in /home/upstairs/public_html/wp-config.php(1) : runtime-created function(1) : eval()'d code on line 29

Scott Buehler on "Adding CSS HTML Class for Attributes Order Menu_Order"

$
0
0

Hey guys and gals! I've searched high and low for this and I just can't find a solution.

I'm trying to find a functions.php code that will print the "Attributes" Order number I assign to a custom post type or page to the article HTML classes I can then style with CSS.

<article itemtype="http://schema.org/CreativeWork" itemscope="itemscope"
class="post-39 custom-post-type-example type-custom-post-type-example status-publish format-standard entry odd">

In the above example CPT "Custom Post Type Example" if I assign a post with Attribute 4, I need it to add a class rank4 or similar.

I figured out how to add odd/even to this (as bolded) through searching here:

//* Add Odd/Even Class to WordPress Posts
add_filter ( 'post_class' , 'oddeven_post_class' );
	global $current_class;
	$current_class = 'odd';

function oddeven_post_class ( $classes ) {
   global $current_class;
   $classes[] = $current_class;
   $current_class = ($current_class == 'odd') ? 'even' : 'odd';
   return $classes;
}

Any way to add the attribute order as well? This will take my design to the next level. Thank you.

misterzik on "Wordpress Media Upload Plugin 3.5 JS PHP"

$
0
0

I have a small issue creating a small plugin. I am trying to achieve a gallery meta box using Media Upload 3.5.

At this point I am able to upload images, but when trying to update the image. I wont get the same Post->ID as the Attachments (I strongly believe this is where the issue is at.) Perhaps I am doing something wrong with the shortcode api snippet or the way I'm passing my data.

Above is the code for the js and some functions. If it helps I used "shibashake" Wordpress Media Manager as a Starting Point.

function media_view_settings( $settings, $post ) {

    $shortcode = '[gallery ';
    $ids = get_post_meta( $post->ID, 'gallery_ids', TRUE );
    $ids = array(0);
    if ( is_array( $ids ) ) {

        $shortcode .= 'ids="' . implode( ',', $ids ) . '"]';

    } else {

        $shortcode .= 'id="' . $post->ID . '"]';

    }

    $settings['Gallery'] = array('shortcode' => $shortcode);
    return $settings;
}

function metabox( $post ) {
    global $post;

    wp_nonce_field( 'gallery', 'gallery_nonce');

    $gallery = get_post_meta( $post->ID);

    echo '<div id="gallery-container">';
        echo '<p>' . do_shortcode( '[gallery ids="' . $gallery[ 'gallery_ids' ][0] . '" link="none"]' ) . '</p>';
        echo '<p><a href="#" id="open-media" class="button button-primary" title="' . esc_attr__( 'Add Media', 'gallery-meta-box' ) . '">' . __( 'Add Media', 'gallery-meta-box' ) . '</a></p>';
        echo '<p><input type="hidden" id="gallery_ids" value="' . $gallery[ 'gallery_ids' ]. '" /></p>';
    echo '</div>';

}

    public function save_content( $post_id ) {

    // Checks save status
    $is_autosave = wp_is_post_autosave( $post_id );
    $is_revision = wp_is_post_revision( $post_id );
    $is_valid_nonce = ( isset( $_POST[ 'gallery_nonce' ] ) && wp_verify_nonce( $_POST[ 'gallery_nonce' ], 'gallery' ) ) ? 'true' : 'false';

    // Exits script depending on save status
    if ( $is_autosave || $is_revision || !$is_valid_nonce ) {
        return;
    }

    // Checks for input and sanitizes/saves if needed
    if( isset( $_POST[ 'gallery_ids' ] ) ) {
        update_post_meta( $post_id, 'gallery_ids', sanitize_text_field( $_POST[ 'gallery_ids' ] ) );
    }
}

JS

jQuery(document).ready(function(){ wp.media.GalleryMetabox = {

    frame: function() {
        if ( this._frame )
            return this._frame;

        var selection = this.select();
        this._frame = wp.media({
            id:         'my-frame',
            frame:      'post',
            state:      'gallery-edit',
            title:      wp.media.view.l10n.editGalleryTitle,
            editing:    true,
            multiple:   true,
            selection: selection,
        });

        this._frame.on( 'update', function() {
            var controller = wp.media.GalleryMetabox._frame.states.get('gallery-edit');
            var library = controller.get('library');
            // Need to get all the attachment ids for gallery
            var ids = library.pluck('id');

            // AJAX send (isn't currently working)
            wp.media.post( 'GalleryMetabox-update', {
                nonce:      wp.media.view.settings.post.nonce,
                html:       wp.media.GalleryMetabox.link,
                post_id:    wp.media.view.settings.post.id,
                ids:        ids
            }).done( function() {
                window.location = wp.media.GalleryMetabox.link;
            });

            /*
            // Turn off refreshContent callback so we do not throw a null error
            controller.off('reset');
            */

            // Send the attachment URL to our custom input field via jQuery.
            jQuery('#gallery_ids').val( ids );

        });
        return this._frame;
    },

    // Gets initial gallery-edit images. Function modified from wp.media.gallery.edit:513
    // in wp-includes/js/media-editor.js.source.html
    select: function() {
        var shortcode = wp.shortcode.next( 'gallery', wp.media.view.settings.Gallery.shortcode ),
            defaultPostId = wp.media.gallery.defaults.id,
            attachments, selection, state;

        // Bail if we didn't match the shortcode.
        if ( ! shortcode )
            return;

        // Ignore the rest of the match object.
        shortcode = shortcode.shortcode;

        if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) {
            shortcode.set( 'id', defaultPostId );
        }

        attachments = wp.media.gallery.attachments( shortcode );

        //console.log(attachments.models);

        selection = new wp.media.model.Selection( attachments.models, {
            props:    attachments.props.toJSON(),
            multiple: true
        });

        selection.gallery = attachments.gallery;

        // Fetch the query's attachments, and then break ties from the
        // query to allow for sorting.
        selection.more().done( function() {
            // Break ties with the query.
            selection.props.set({ query: false });
            selection.unmirror();
            selection.props.unset('orderby');
        });

        return selection;
    },

    init: function() {
        jQuery('#open-media').click( function( event ) {
            event.preventDefault();

            wp.media.GalleryMetabox.frame().open([0]);

        });
    }
};

jQuery(document).ready(function(){
    jQuery( wp.media.GalleryMetabox.init );
});

Thanks

totallytech on "Displaying posts as a news feed?"

$
0
0

Hey All,

I've got a website using wordpress as a CMS, I'm struggling to show posts on one page.

I've set up a news page and I'm writing posts as news articles.

How can I get it to show the 5 newest posts with full content displayed?

Is there a simple plugin, or do I need to write my own template for this?

Any help would be brilliant thank you :)

asadpygmy on "People seeing viagra links on our site -- not visible to us"

$
0
0

Hi there,

Recently we've had two people (the site gets 10,000+ visitors a month) email us saying they're seeing viagra links on our website. One person I'm corresponding with today actually has had a co-worker see the same links on a separate computer, and she's also seeing the links when browsing to the page on her phone. I've used both a Mac and a PC, Firefox, IE, Chrome, as well as Chrome/Safari on my phone, and I cannot see the links she's pointing out. All of my co-workers cannot see them either. I originally thought this was perhaps some malware installed on her browser but I'm more worried now that she's seeing it on different devices. I'm unsure of the next step to take, as we cannot actually see the problem, but any help would be much appreciated.

Viewing all 8245 articles
Browse latest View live




Latest Images