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

simon76 on "Tablepress responsive setting"

$
0
0

Hi everyone

Thanks to all the developers for their hardwork in making Wordpress such a pleasure to work with :)

I have a contact form on this site http://mortonheights.apps-1and1.net/contact-us but it doesn't resize itself on tablets/mobiles. Ive tried everything but just can't get it to work!!

Can anyone help me please?

Thanks
Simon


poloko88 on "Multiple queries on one page dont work"

$
0
0

Hello, I would really appretiate any assistance with my issue please.

In my templete pages I have a page that lists posts of a certain category then when one is clicked I have it display the post and post meta content using a longer version of this code

$this_post_id = $post->ID;

if(empty($this_post_id)) {

	$page = get_page($post->ID);
	$this_post_id = $page->ID;

}

$wp_cover_image = esc_attr(get_post_meta($post->ID, 'wp_cover_image',true));
$wp_fullname = esc_attr(get_post_meta($post->ID, 'wp_fullname',true));

wp_reset_query();

What I would like to achieve is then right after that find the logged in user's id and query an attachment posted by the current user using folowing code

$current_user = get_current_user_id();

$query = new WP_Query(array('post_type' => 'attachment', 'posts_per_page' =>'1', 'post_status' => 'publish, draft, pending', 'author' => $current_user) );

For some reason this query doesnt supply me with the correct infomation when I run a loop on it. I conclude that its not query the right thing I think.

if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();

Basically I would like to run another query for the logged in user to get their attachments, after I get the current viewed post data.

Any assistance will be highly appreciated!

Thank you in advance!

rasimrias on "xmlrpc wordpress php integration"

$
0
0

I have integrated xmlrpc in php , now i can able to post in word-press through php xmlrpc API , I have installed the custom post plugin & created the custom posts in wordpress, When i try to post in the custom posts, i am getting the error as invalid post type. The custom post slug name is custompost. is it possible to create the custom post in XmlRPc php?

dahayeser on "Problem coding AJAX in Wordpress Plugin"

$
0
0

Hi guy's, banging my head against a wall here trying to get AJAX to work in a wordpress plugin that I am writing. Any help would be massively appreciated!

Thanks in advance,
Sean

Here is where I am at -

Below is an excerpt from my main plugin file where I register the JavaScript file I use to make the ajax call and set up my ajax handle. My understanding is the wp_localize_script should pull the PHP file I use to process the ajax request in to the wordpress fold and allow it access all the Wordpress functions. This is where I think my issue lies.

add_action( 'wp_enqueue_scripts', 'so_enqueue_scripts' );

function so_enqueue_scripts(){
   wp_register_script( 'ajaxHandle', plugins_url() . '/custom-registration/js/call_ajax.js', array('jquery'), false, true );
   wp_enqueue_script( 'ajaxHandle' );
   // Localise the PHP script that will handle the AJAX request
   wp_localize_script( 'ajaxHandle', 'ajax_object', array( 'ajaxurl' => plugins_url( 'custom-registration/process-ajax.php' ) ) );
 }

Below is the JS file that makes the call -
/custom-registration/js/call_ajax.js

jQuery(document).ready( function($){
	$('form.billing-form').submit(function(event) {

	event.preventDefault();
	var data = {
	    action:  'my_ajax_action',
	    name:    'my name',
	    message: 'my message'
	}

	$.ajax({
		url: ajax_object.ajaxurl,
		type:"POST",
		data: data,
		success: function( data ) {
			alert( 'AJAX Success');
		},
		error: function( ) {
			alert( 'AJAX failed');
		}
	})
});

Here is my PHP file that should process the request -
/custom-registration/process-ajax.php

add_action('wp_ajax_my_ajax_action', 'my_ajax_action_callback');
function my_ajax_action_callback() {
    echo 'It works!';
    wp_die();
}

The PHP file gets hit but a fatal error is thrown because -

PHP LOG

Call to undefined function add_action()

add_action() is a wordpress function and my process-ajax.php mustn't be wired up correctly to access the WP functionality.

fets83 on "ad slider between posts on homepage"

$
0
0

Hi Guys,

I would like to add some ad image sliders with link from our sponsors between every 5 posts on the landing page. http://www.icgt.nl/nieuws.

If possible 3 or 4 different sliders because we have many sponsors.

I have tried to search the forums but all I can find is code for adsense. And I want to put my own ads in!

I am working with a child theme of interface pro.

Thanks in advance

michel1991 on "How to hide the excerpt/intro in wp-admin cpt overview?"

$
0
0

I have created a custom post type and i want to hide the intro at the wp-admin/edit.php?post-type=faq page.

i dont know the exact name. I dont think its a realy excerpt and cant find something useful on the internet.

llprice on "add_image_size question"

$
0
0

Please help.
I want to add a custom image "catalog-size," for all users, as an alternate thumb-size post insert.
I want this custom size to work like all the others in the Fancybox jQuery expander.
The following code is already in Functions.php.

add_theme_support( 'post-thumbnails' );

This is my custom size request --

add_image_size( 'catalog-size', 460, 230, true );

I've read some help pages, but I'm still not sure where to insert add_image_size() -- in Media.php, Functions.php, or in the loop?

Where would I add margin or padding if needed?

usernamenumber on "Disable version check during plugin dev?"

$
0
0

I am surprised that I can't find anything on this, so apologies if I've just missed something.

When writing a wordpress plugin, is there a way to disable the version check, so my upload always overwrites what was there before, regardless of version, or do I have to increment the patch number in the version every time I upload a new version for testing? I think there must be some trick I've missed. Any help would be appreciated!


javierap on "Redirecting to a Russian site"

$
0
0

I need help solving this problem:

When I log in to make some edits to our site, the dashboard looks normal. Then, when I click the "All Pages" tab under "Pages," instead of showing me all my pages list, it takes me to this site: [redacted].

I think something has been done to the "internal coding" which I'm not supposed to touch, but, what can I do to solve this problem?

Any and all help will be greatly appreciated. THANKS!!!!

monty1951 on "Bootstrap themes affecting shortcode"

$
0
0

I have been having problems with a plugin I have been writing when it is used with themes based on Bootstrap.

To test out the situation I have deleted all existing plugins and installed a single Bootstrap based theme and created a simple plugin consisting of a single file:

function example() {
	echo 'Testing';
}

function test_shortcode() {
	ob_start();
	example ();
	return ob_get_clean();
}

add_shortcode( 'testing_example', 'test_shortcode' );

I created a page containing the shortcode
[testing_example]

When I view this page using the Bootstrap theme the text 'Testing' appears in a red in a bordered shaded box.

Viewing the page source shows:

<p><code class=" language-undefined">Testing</code></p>

The text styling comes from the Bootstrap style sheet.

code {
    padding: 2px 4px;
    color: #d14;
    background-color: #f7f7f9;
    border: 1px solid #e1e1e8;
}

Any clues if I have made a mistake?
If not how can I reset the 'Bootstrap code styling' from my plugin ?

I have checked this using different Bootstrap themes and get the same 'styled output'.

Thanks

linzgroves on "Query by Custom Post Type and Category"

$
0
0

I have a Custom Post Type called 'Endpoints' and each new endpoint has one of nine categories that it falls under. There are nine pages that correspond to one of these categories and I'm wanting to display any endpoint posts that are assigned to that category on each of these pages.

From what I've read so far, I'm a little unsure of how to combine an if statement, query for the CPT and category, and then the loop for how to output these posts for each different category page. Could someone clarify if it's possible to create separate loops that check for the name of the page and then run a query that checks the endpoint CPT and finds any posts that fall under a specific category? I'm feeling like I have to create 9 different sections of code, but wondering if there's clearly a better way of going about this (apart from creating page templates for each category page)?

arthos455 on "Site hacked and no idea what to do."

$
0
0

Let me start by saying i am a complete novice at wordpress and this is my first time ever working with a site builder and having a "major" site.

So ive been working on a site for some time for my local community center and it recently has got hacked. Before now i have never had any access to the actual host site and its files so i could never back it up or actually look at my files. I've done this all through Wordpress. I have absolutely no idea what im looking for or how to fix it. From what ive been told, "The site was hacked as part of a Bitcoin Exchange scam. Evidently, it was redirecting traffic by posing a a pharmaceutical company generating pass through traffic." said by the actual basically owns the site. The host is Network Solutions which i've heard some bad things about them but was basically forced to work with it.

My first attempt was to actually gain access to our files so i can snoop around. So i asked for access and got it. Then i setup a FTP with filezilla and have now downloaded all the folders in the root. This is where im lost. Id like to find a index.html page, a home page, or just any page that i had created so i can at least salvage the info i had written. Doing a search gives me a few html files that are blank. So first off what should i be looking for to find the written info that was placed on the site itself? Or can i even view my site offline? Currently the site is locked down by Network Solutions with a "This site is temporarily unavailable" and i have yet to find a way to actually get into the site to view it.

Next question. What should i be looking through to find the hack and how do i test to see if i have it cleaned? Would it be best to just restart the entire site all over and build it from scratch?

Thanks for any help.

jahmansoldat on "/* Template page */ navigation show same posts on every page"

$
0
0

Hi everyone,
I'm stuck with this problem for 3 days, and everything I've found on internet don't seems to help me, so I'm totally lost.

I've created a template page, and I've defined a category (namely : 'events') for posts in this page. My loop for them works fine, I've defined a maximum posts per page (5) and it's also working great.

But anyway, when it's time to create my navigation to go through page to page (in order to see the 5 nexts/previous posts), things messed up, and honestly I don't know what and why. I can see the /page/2/, /page/3/... (etc) added in the URL but WordPress don't load other posts than the 5 on the first page.

HTML version of the site is here so you can understand what I'm trying to achieve.

I want to reach the exact same result but in WordPress (as you guess)...

Here is my code:

<?php
/*
Template Name: Évènements
*/
?>
<?php get_header(); ?>

<body>
    <?php include 'nav.php' ?>
    <div id="banner" class="events">
        <header>
            <h1>Evenements</h1>
        </header>
    </div>
    <div class="container">
        <section id="subtitle">
            <img src="<?php echo get_template_directory_uri(); ?>/img/bg-cd.png" class="cd">
            <span class="the-subtitle">La Brique organise</span>
        </section>
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">

        <?php
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $args['paged'] = $paged;
            query_posts($args);
        ?>
    <?php query_posts( array ( 'category_name' =>'events', 'posts_per_page' => '5')); ?>
        <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
            <div class="panel panel-default">
                <div class="panel-heading" role="tab">
                    <h4 class="panel-title">
                        <a role="button" data-toggle="collapse" data-parent="#accordion" aria-expanded="false">
                            <img src="<?php echo get_field('flyers'); ?>" alt="La Brique <?php the_title(); ?>">
                        </a>
                    </h4>
                    <div class="arrow-up"></div>
                </div>
                <div class="panel-collapse collapse" role="tabpanel">
                    <div class="panel-body">
                        <div class="text-event no-padding col-lg-6 col-md-6 col-sm-6 col-xs-12">
                            <section class="night-title">
                                <img src="<?php echo get_template_directory_uri(); ?>/img/icon-night.svg" alt="flyers labrique" class="icon-night this-night visible-lg">
                                <hr class="between-line">
                                <span class="night-subtitle centered">ce soir-la</span>
                            </section>
                            <?php the_content(); ?>
                        </div>
                        <div class="no-padding youtube-video col-lg-6 col-md-12 col-sm-12 col-xs-12">
                            <section class="night-title">
                                <img src="<?php echo get_template_directory_uri(); ?>/img/icon-play.svg" class="icon-night">
                                <hr class="between-line">
                                <span class="night-subtitle">Video</span>
                            </section>
                            <div class="youtube-container">
                                <div class="youtube-player" data-id="<?php echo get_field('teaser'); ?>">
                                </div>
                            </div>
                        </div>
                        <div class="no-padding more-infos col-lg-12 col-md-6 col-sm-6 col-xs-12">
                            <div class="no-padding col-lg-4 col-md-12 col-sm-12 col-xs-12">
                                <section class="night-title">
                                    <img src="<?php echo get_template_directory_uri(); ?>/img/icon-clock.svg" class="icon-night centered">
                                    <hr class="between-line centered">
                                </section>
                                <p class="the-info"><?php echo get_field('date_et_heure'); ?></p>
                            </div>
                            <div class="no-padding-lg col-lg-4 col-md-12 col-sm-12 col-xs-12">
                                <section class="night-title">
                                    <img src="<?php echo get_template_directory_uri(); ?>/img/icon-map.svg" class="icon-night centered">
                                    <hr class="between-line centered">
                                </section>
                                <p class="the-info"><?php echo get_field('lieu'); ?></p>
                            </div>
                            <div class="no-padding col-lg-4 col-md-12 col-sm-12 col-xs-12">
                                <section class="night-title">
                                    <img src="<?php echo get_template_directory_uri(); ?>/img/icon-dollar.svg" class="icon-night centered">
                                    <hr class="between-line centered">
                                </section>
                                <p class="the-info"><?php echo get_field('prix'); ?></p>
                            </div>
                        </div>
                    </div>
                    <a class="close-btn red" role="button" data-toggle="collapse" data-parent="#accordion" aria-expanded="false">
                        <span class="first"></span>
                        <span class="second"></span>
                    </a>
                </div>
            </div>
        <?php endwhile; ?>
            <div class="col-lg-6" style="text-align:left; margin-top:25px;">
                    <?php if( get_next_posts_link() ) :
                      next_posts_link( '« Prev' );
                    endif; ?>
            </div>
            <div class="col-lg-6" style="text-align:right; margin-top:25px;">
                    <?php if( get_previous_posts_link() ) :
                        previous_posts_link( 'Next »' );
                    endif; ?>
            </div>
        <?php endif; ?>

        </div>
        <div id="nav-pages" class="hidden">
            <div class="into-nav-pages">
            </div>
        </div>
    </div>
    <?php get_footer(); ?>
    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery-1.12.0.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/bootstrap.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/tweenmax.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/main.js"></script>
    <script>
        $(document).ready(function(){
            $('footer').addClass('events');
            $('.panel-collapse').collapse({
                toggle: false
            });
            $('#nav-pages a').addClass('box-into')
        });
    </script>
</body>

</html>

I think it's matter to tell you that I'm using "advanced custom field" plug-in (this why you have so many "echo get_field('name_of_the_field')"), and I've modified everything on the "content.php" file to have the artists articles posts as I wish -- it's an other category, if you navigate through the website I gave you in the intro, you will understand what I'm talking about.

Thanks in advance, bye bye ladies and gentleman's.

PS: sorry for my bad english, I've done the best I could.

E-MAILiT on "Plugin translation"

Demokrit on "New image size 'medium_large' not generated on upload"

$
0
0

I'm currently refactoring my Bootstrap based theme for the new responsive image attributes. It's working fine for all my standard sizes (thumbnail, medium, large, post_thumbnail). From the (rather poor) documentation of the new features I've learned, that there should be another image size 'medium_large', which is auto-generated on new uploads, but is not available thru the editor. Bon. So I guess, that it could be used as a smaller version of another image size in the 'sizes' and 'srcset' settings. To enforce a reasonable size, I use this code in my theme:

/*
 * Enforce images sizes matching large device Bootstrap cols on theme switch
 *
 */
add_action( 'switch_theme', 'bootstrapped_enforce_image_size_options' );
function bootstrapped_enforce_image_size_options() {
	update_option( 'thumbnail_size_w', 155 );
	update_option( 'thumbnail_size_h', 0 );
	update_option( 'thumbnail_crop', 0 );
	update_option( 'medium_size_w', 220 );
	update_option( 'medium_size_h', 0 );
	update_option( 'medium_large_size_w', 460 );
	update_option( 'medium_large_size_h', 0 );
	update_option( 'large_size_w', 350 );
	update_option( 'large_size_h', 0 );
}

/*
 * Revert any possible administrator overrides of media settings
 */
add_filter( 'pre_update_option_thumbnail_size_w', 'bootstrapped_filter_thumbnail_size_w' );
function bootstrapped_filter_thumbnail_size_w( $newvalue ) {
	return 155;
}
add_filter( 'pre_update_option_thumbnail_size_h', 'bootstrapped_filter_thumbnail_size_h' );
function bootstrapped_filter_thumbnail_size_h( $newvalue ) {
	return 9999;
}
add_filter( 'pre_update_option_thumbnail_crop', 'bootstrapped_filter_thumbnail_crop' );
function bootstrapped_filter_thumbnail_crop( $newvalue ) {
	return 0;
}
add_filter( 'pre_update_option_medium_size_w', 'bootstrapped_filter_medium_size_w' );
function bootstrapped_filter_medium_size_w( $newvalue ) {
	return 220;
}
add_filter( 'pre_update_option_medium_size_h', 'bootstrapped_filter_medium_size_h' );
function bootstrapped_filter_medium_size_h( $newvalue ) {
	return 9999;
}
add_filter( 'pre_update_option_large_size_w', 'bootstrapped_filter_large_size_w' );
function bootstrapped_filter_large_size_w( $newvalue ) {
	return 350;
}
add_filter( 'pre_update_option_large_size_h', 'bootstrapped_filter_large_size_h' );
function bootstrapped_filter_large_size_h( $newvalue ) {
	return 9999;
}

I'm not quite sure, if this code is OK (xxx_size_h = 0 in first codeblock ??, 9999 in second ??)

When I upload a new image, all sizes are generated fine - except medium_large. Neither as factory default size (768px x 9999), nor as my custom size (460px x 9999). The 'srcset', where I would expect 'medium_large' as well, shows only the other, working, image sizes and the original image.

Can anyone share a light on 'medium_large'?

Edit: Forgot to mention that I switched the theme before the image upload.

var_dump( get_intermediate_image_sizes()
array(5) { [0]=> string(9) "thumbnail" [1]=> string(6) "medium" [2]=> string(12) "medium_large" [3]=> string(5) "large" [4]=> string(14) "post-thumbnail" }

So it's "kind of there"


atom8bit on "Modifying SQL for get_calendar"

$
0
0

Hello,

Looking to modify the SQL in get_calendar() to only return one category - in this case, category ID 1. SQL isn't my strong point, can someone help guide me on what I'd add change in this function?

autox420 on "[Request] Redirect if x members views this page"

$
0
0

If 10 members views a specific page then all those members will be redirected to a new page like http://www.google.com

1 members viewing this page.
2 members viewing this page.
Etc..
10 members viewing the page. Redirecting all viewers to http://www.google.com in 10 seconds.

This should be as live as possible or with some delay.

arvidbux on "Set Post Title and Slug using Custom Fields"

$
0
0

Hi there,

trying to use custom fields to set Post Title and Slug.

I have three custom fields;
- Year
- Number
- Type

And when a Custom Post is saved, I want to use these three custom fields (they are required fields) to set the title;
- type - Year - Number

Custom Post and Custom Fields ahve been generated by Toolset by WP Types.

I have the following code in post.php when in functions.php, WP stops working all toghether. But for now, even in post.php it doesn't work.

function set_issue_title( $data , $postarr ) {
  if($data['post_type'] == 'Issue') {
    $issue_number = get_post_meta($postarr['ID'],'wpcf[number]',true);
    $issue_type = get_post_meta($postarr['ID'], 'wpcf[type]' , true);
    $issue_year = get_post_meta($postarr['ID'], 'wpcf[year]' , true);
    $issue_title = $issue_type . ' - ' . $issue_year . ' - ' . $issue_number;
    $post_slug = sanitize_title_with_dashes ($issue_title,'','save');
    $post_slugsan = sanitize_title($post_slug);

    $data['post_title'] = $issue_title;
    $data['post_name'] = $post_slugsan;
  }
  return $data;
}
add_filter( 'wp_insert_post_data' , 'set_issue_title' , '99', 3 );

Any suggestions on whether the above code is correct and whether the location is an issue.

jbalazs8178 on "Looking to edit a form field size in WooCommerce Product Add-ons..."

$
0
0

Hi, I am looking to edit a specific form field (a text input area) in the plugin WooCommerce Product Add-ons. I am posting this here because I don't think that Woocommerce provide's any customization support (as far as telling you how to customize something, I emailed them just in case).

The site is willoughbywildcats.com

An example of what I mean is on the page:

http://willoughbywildcats.com/product/wildcats-t-shirt/

Where it says "Add a number", I'd like to make that text box smaller, big enough for just two characters.

Mark_02660 on "hacking user table in db"

$
0
0

Hi,

I am looking to use WP for a club membership site that will be ported from an old PosstNuke site.

My problem is the paid membership system they have now has some taters that I can not find in any other.

The way it was done on the Post Nuke site was they added extra fields to the user data base table that the membership system used.
Specifically:
* a member ID (not always unique family's have the same ID)
* Expiration Date
* Admin notes
New members were also created by admins via custom form that did a direct add to the db (with site functions).

This with all the existing user data allows PayPal's IPN to do the rest with a lot of custom back PHP admin files stuck in the PostNuke permission system.

So my question is can I / should I do it with WP?
I know building a plugin is better, but would doing this cause any big problems with updates or?

Thanks

Viewing all 8245 articles
Browse latest View live




Latest Images