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

RobotHero on "Making custom admin page for use in Thickbox?"

$
0
0

Is there an established method for making a custom page for use in a Thickbox iframe?

Or if not specifically for Thickbox, then an admin page that displays without the side menus and footer and header, etc etc.


herka on "Custom post type and page with same name mixup"

$
0
0

Anyone maybe knows how to avoid problem if you have a custom post type with slug 'medical-treatments' and then i create a default page named 'medical-treatments' in pages and then the problem with the regular page showing up appears ... any way to sort this out?

so
http://example.com/medical-treatments/some-treatment-category/single_treatment works - triggers single-medical-treatments.php
http://example.com/medical-treatments doesnt work - aka triggers index.php every time and not page.php

p.s. i can't change the slug and i can't change the page name - the urls needs to be like that ...

Sabinooo on "Child themes: change just a part without giving up on theme updates"

$
0
0

Hello!

I discovered the existence of this issue with the Hueman theme, however this is a much more generic question. Following a suggestion from WpJyogi, I'm coming here to ask.

Here's the deal : if we want to make changes to a wordpress theme, we need to create a child theme and store in there the php files that we have modified, our modified child theme files will override the "official" theme's files so that our changes are kept.
BUT that also means we're giving up on every following update to those theme files in the future, including potential (who knows!) important security updates.
Random example: imagine a severe security flaw is found in Hueman's index.php default file, this flaw will be quickly fixed in all the blogs with the Hueman theme... except in the blogs whose admin is using a child theme of Hueman in which there is a modified, even for a super minuscule edit, version of the index.php file.

That made me suddenly think... « hey... isn't that weird ? That we must replace EVERYTHING, even when we only want to do a minor change ?
Wouldn't there be a way to keep the official theme (with all the benefits of having a theme updated when it is necessary!), but tell that theme that a slight part of its code must be amended ?
»

Please, would YOU know if there's a way, any way, to achieve this ?
This "flaw" in the child theme system looks so huge I can't imagine there's no workaround...
It would be a seriously huge value added to wordpress, and I sure would welcome it as far as I am concerned :)

Thanks if you have your thoughts on this :)

MattIzzy on "How can I make category listing coding to three lists?"

$
0
0

Hello, I am using the following code to display list of categories and icons,

foreach(get_categories("orderby=name&order=ASC") as $category) {
echo "<a href='http://alborjcamp.info/?cat=" .$category->cat_ID . "'>".get_cat_icon("echo=false&cat=".$category->cat_ID)."</a><br/><a href='http://alborjcamp.info/?cat=" .$category->cat_ID . "'>".$category->cat_name."</a>";
}

but I want to divide this listing to three, to show them into three columns, lets I want to display 10 categories into each column if the total of categories is 30. How can I do this?

Vinceszy on "Changing title display while sharing a category page on Facebook"

$
0
0

Hi everyone!

There is a category on my website which I like to share with the category link instead of sharing the individual posts.

While posting the link http://sourcingrecruitment.info/category/fun/ to Facebook the default title is:
"Fun Archives - Sourcing & Recruitment Info"

I would like to remove or alter the word "Archives", since I do not really find it engaging. I can do this on Facebook, but it's very unlikely that other people sharing my site would care about changing the text.

Do you know about a simple plugin (not colliding with Yoast SEO) or code hack which could help?

Many thanks!

OrbiTorbi on "Filter video after upload via url"

$
0
0

Hello,

im looking for a filter that allow me to prevent the insert of videos in the editor. I found the "media_send_to_editor" filter, that filter works great for images but it doesn't work for url videos.

thanks in advance

rcampoamor on "wordfence .htaccess file have been hacked"

$
0
0

looks like this happened a few hours ago:

Modified plugin file: wp-content/plugins/wordfence/tmp/.htaccess
Filename: wp-content/plugins/wordfence/tmp/.htaccess
File type: Plugin
Issue first detected: 7 mins ago.
Severity: Warning
Status New
This file belongs to plugin "Wordfence Security" version "5.3.6" and has been modified from the file that is distributed by WordPress.org for this version. Please use the link to see how the file has changed. If you have modified this file yourself, you can safely ignore this warning. If you see a lot of changed files in a plugin that have been made by the author, then try uninstalling and reinstalling the plugin to force an upgrade. Doing this is a workaround for plugin authors who don't manage their code correctly. [See our FAQ on http://www.wordfence.com for more info]

THe usual russian hackage:

The Original Version of the file

[hacked site code removed]

NomNom99 on "Precautions for plugin conflicts."

$
0
0

I have made my own theme for my website.
I use 2 plugins :

  • Shortcode Ultimate
  • Userpro social login

Whenever I deactivate social login, Shortcode Ultimate works correctly but both of them don't work correctly together.
Is there any precautionary measures that need to be taken while building a theme?

The plugins work fine together in the default TwentlyTwelve theme.
What am I missing?


GromBeestje on "Query doesn't work in WPDB but works in phpmyadmin"

$
0
0

Hello,

I am having a problem with database access using the WPDB class.
When I print the query to the output and run it in phpmyadmin, the query gives the expected result. However, WPDB does not provide the results. Also, there is no error message. The error logs show an database error, but without error message.

$wpdb->show_errors();
$testQuery = $wpdb->prepare("SELECT * FROM $table_name
                             WHERE service_id = %d
                             AND   token = %s" , $service_id, $token);
$testResult = $wpdb->get_results($testQuery,ARRAY_A);

echo "<pre>testQuery\n$testQuery\n";
echo "testResult: "; print_r($testResult);
echo "db error:" . $wpdb->last_error;
echo "</pre>";

Can anyone give their thoughts about this issue?

MtN on "How to display limit text (code)?"

$
0
0

Hi
i'm trying to use this function in my theme to display 5 related posts in single.php
and it's work good! but i need to add something to make it display limit text from the first of each post.

function my_related_posts() {
if (is_single()) {
	global $post;
	$current_post = $post->ID;
	$categories = get_the_category();
foreach ($categories as $category) :
	?>
<div class="content-loop">
<h4>Related Posts</h4>
<ul>
<?php
$posts = get_posts('numberposts=5&category='. $category->term_id . '&exclude=' . $current_post);
foreach($posts as $post) :
?>
<li class="hentry">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail('entry-thumb', array('class' => 'entry-thumb','alt' => get_the_title(),'title' => get_the_title())); ?></a>
<h2 ><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<div class="entry-excerpt">
    <?php /* here i want function get limit text from first of content*/ ?>
    <a href="<?php the_permalink(); ?>" class="read-more">read more...</a>
</div>

</li>
<?php endforeach; ?><?php endforeach; ?>
</ul>
</div>
<?php
		}
	wp_reset_query();
}
add_action('thesis_hook_after_post','my_related_posts');

please help
thanks

DuncanClarke on "wp_insert_post, Jetpack publicize and images"

$
0
0

Hi, I think I may be asking too much here but let's try anyway.

I have written a plugin that pulls data from YouTube and Vimeo, downloads a thumbnail, writes a post (back dated to when the video was posted on Vimeo/Youtube) then attaches the thumbnail. This works great but as I want it to appear on Facebook, I am using the Jetpack publicize feature.

That also works but only rarely does it attach the image to the Facebook post. Occasionally it does but not often. I have tried re-ordering so the post is created in draft, the image attached, then the post is amended to published. This did not improve the situation and only resulted in adding two entries per post into the database.

I am thinking that the problem is that it's happening too fast. Is there any way to programatically delay the publicizing of the post by a few seconds, minutes etc after publishing?

Alternatively is there a way to schedule a post to the blog and also back-date it when it gets on there?

Blog site: http://rollingmedia.net
Facebook: https://www.facebook.com/RollingMediaFeed

bananarama on "Date by season / quarter"

$
0
0

Instead of the normal date / time, I want to display the season in which a post was made. So for instance, march-may = spring (03-05).

I found this topic, but the plugin is no longer accessible.

I know it should be really simple to do, but I just can't hack it. I've tried:

<?php if ( '3' == date('n') ) : ?>
     <p>It's March</p>
<?php else: ?>
     <p>Not February</p>
<?php endif; ?>

Which detects the current month, rather than the post month. But when I try to combine with the post date it doesn't go:

<?php if ($post_date( '3' == date('n') ) ) : ?>
     <p>It's March</p>
<?php else: ?>
     <p>Not February</p>
<?php endif; ?>

alainroger on "How to add a post container on admin side ?"

$
0
0

Hi,

i'm currently working on my first plugin and i was thinking to create a new post container on admin side like those "Excerpt, Discussion, Comments,..." as you can see on http://prntscr.com/6dkm4y

How can i do that ?
thx.

sivakanmani on "how to çreate arcĥive for custom post type"

$
0
0

how to çreate arcĥive for custom post type?

samjolley on "Custom Fields to Populate Custom Post Type"

$
0
0

I'm using WordPress 4.1.1, Genesis 2.1.2, and the Magazine Pro Child Theme. Here's the site.

Here's a product post type example I'm working on.

Right now I'm using 2/3 and 1/3 divs to create an "image column" and "content column". Is there any way to use custom fields and css to auto-populate the post?

Maybe add multiple featured images that get output into the 2/3 "featured images" div, and then a custom field for the product info that gets output into the 1/3 "product info" div.

So I'd need featured images/fields for the product images (scrollable column), product category, title, price, and content.

Here's the post editor content I'm using right now:

<div class="two-thirds first">
Insert Large Images Here
</div>

<div class="one-third"><a href="insert category url here" target="_blank">Category</a>
<h1>Product Title</h1>
<h3>Price</h3>
Product Info.
<strong>Call for details (734) 516-9166</strong></div>

Here's a full screenshot of the product post type: Full screenshot


ecros on "P2 Theme Anonymous Posting"

$
0
0

How can I use the P2 theme to let anyone post anonymously? It only shows the input )top) field to a registered user. I would like anyone to be able to see it and post without having to register. Thank you.

tampadave on "Source Code Mapping"

$
0
0

Hello to all, this is my first posting on WP, and I've looked for this all over the place, but I still haven't found what I'm looking for. :-)

I am new to wordpress, but not developing. I took a five year break from it, between 2008 and 2013, due to job restrictions, but I'm back, and ready to go.

I code on Ubuntu 12.04lts, localhost >> LAMP. emacs is my favorite editor, but I am entirely flexible. OOP presents its own needs.

My current problem is that I need to develop a plugin that adds SKU regex'd pricing policy within woocommerce and the compatible theme responsive, from cyberchimps(sp?).

My trouble with this problem is that reading code does nothing but put me into a maze of twisty little includes, all alike.

Just to see, I tallied up an estimate of how many pages of code were involved with the post "hello world." and it was about 1500. Ouch!

How do I emphatically determine which hooks to use to include my own functions, and what the variable names are on which to operate?

I am not even sure of the source file that renders any given page.

Are there any debuggers, gnu's ddd for php5/wordpress? I sense a conspiracy against the ability to read and follow code....

Thanks in advance!

Also, any feedback on bluefish and/or eclipse and/or phpdbg?

David, Tampa, Florida.

aniee6 on "How insert infinite Scroll of Related Posts in Posts ? :/"

sunflyer on "user menu, not admin menu How ?"

$
0
0

How can I make a user menu for logged in wordpress users to edit certain information that is being used in my custom plugin ?

Thanks

Pepe Huerta on "Embed the new Google Maps without a plugin or shortcode"

$
0
0

Hi,

There are a lot of tutorials about embedding Google Maps in your posts, but after a long and painful research, I notice that every single tutorial was about embedding **THE OLD** Google Maps platform... the one with the url scheme 'maps.google.com'.

**THE NEW** Google Maps scheme (https://www.google.com/maps/place/) is completely different, and there almost no documentation on how to make it work in WordPress.

So, here is a quick tutorial on how to embed **THE NEW** Google Maps in WordPress posts without a plugin and just pasting the map url in the post body:

1. First, you need an API Key from Google. Follow the instructions at https://developers.google.com/maps/documentation/embed/guide#api_key.

2. Once you have your API Key, we can get into the code. In your favorite theme, open functions.php and add:

<?php
wp_embed_register_handler( 'googlemapsv1', '#https?://www.google.com/maps/place/(.*?)/#i', 'wpgm_embed_handler_googlemapsv1' );
function wpgm_embed_handler_googlemapsv1( $matches, $attr, $url, $rawattr ) {
	if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
		$width  = (int) $rawattr['width'];
		$height = (int) $rawattr['height'];
	} else {
		list( $width, $height ) = wp_expand_dimensions( 425, 326, $attr['width'], $attr['height'] );
	}
	return apply_filters( 'embed_googlemapsv1', "<iframe width='{$width}' height='{$height}' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://www.google.com/maps/embed/v1/place?q=" . esc_attr($matches[1]) . "&key=***YOUR-API-KEY***'></iframe>" );
};
?>

Be sure to replace ***YOUR-API-KEY*** with your KEY. Save & close.

3. Test the new code by adding a new post and just pasting a google maps url like this one from The White House:

https://www.google.com/maps/place/The+White+House/@38.896278,-77.0306687,17z/data=!3m1!4b1!4m2!3m1!1s0x89b7b7bcdecbb1df:0x715969d86d0b76bf

That works the same way as just using:
https://www.google.com/maps/place/The+White+House/

The RegEx can be tweaked to allow different URL schemes for the four new modes, detailed here: https://developers.google.com/maps/documentation/embed/guide#modes.

This method only works for 'place' mode, but reading the documentation will get you on track to make the 'directions', 'search' and other modes working.

That's it. I hope it works for you guys (and excuse my english). Any contributions for the code will be appreciated.

Viewing all 8245 articles
Browse latest View live




Latest Images