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

mynameisanton on "Download var"

$
0
0

Hi

I am writing a plugin and I need some help.
I want the user to be able to download text which is in a php variable.
How can I make this variable downloadable?

Thanks in advance :D

-Anton


msny36 on "Successfully enqueue script, but no effect."

$
0
0

Finally got my custom_script.js to enqueue. So now if I search for it in the developers console, I'm able to see it in my resources (so I can see it's the proper code), and able to see the script listed in my elements towards the bottom of the elements.

Even though it seems to be coming through okay, the script doesn't take any effect. Here is some test code to make it fire an alert so I can see if the script is working.

jQuery(document).ready(function($){
   $(function(){
    var hasBeenTrigged = false;
    $(window).scroll(function() {
        if ($(this).scrollTop() >= 100 && !hasBeenTrigged) { // if scroll is greater/equal then 100 and hasBeenTrigged is set to false.
            alert("You've scrolled 100 pixels.");
            hasBeenTrigged = true;
        }
    });
});
});

No alert pops up and I haven't been able to get the script to trigger. When I look in the elements I do see that the script is listed a few lines before the /js/jquery/ui/core.min.js script following it. I've wondering if i messed up on the script enqueue, and maybe I'm loading the script before jQuery is loading.

This is how I'm adding it in my Child Theme functions.php file

/**
* Make Header Shrink on Page Scroll
**/
 add_action( 'wp_enqueue_scripts', 'scroll_enqueue_script',10 );

function scroll_enqueue_script() {

	wp_register_script('scroll_custom_script', get_stylesheet_directory_uri() . '/js/custom_script.js', array('jquery'), '4.3.1', true);

	wp_enqueue_script('scroll_custom_script');
	}

Jess Boctor on "Change Variable to object for get_the_title()p"

$
0
0

Okay, I have been beating my head against this for awhile now.

I am using the Advanced Custom Fields plugin to create custom fields for some custom post types I created. A lot of information needs to pass from one custom post type to the next. What I am working on right now is creating a title from a combination of two other post titles which the user selects in the custom fields.

IE: Select 1 - Select 2 Title

I have the code to do this, and I can even easily pull the post ID of the posts to be used in creating the titles. Here is where I am having a problem, and it may just be that I am too new at php. I want to use get_the_title(); to display the two titles. Currently, my code looks like this:

<?php
$sa_customer_id = the_field('sa_customer'); /* Sets variable to post ID number, ie echo $da_customer_id writes 130*/
$sa_site_id = the_field('sa_site');

get_the_title($sa_customer_id) . " - " . get_the_title($sa_site_id) . " Audit"; ?>

The title displays correctly when I manually place in the post ID's, but defaults when I use the variables. I realize now, I need to create an object for the variables, but I am at a loss for how to do this. Any help or suggestions would be greatly appreciated!

OwsAli on "Login or sign up then register links on a page"

$
0
0

Hi guys, I want to add a sign up and login option in a page (not in the header) and after a user sign up he can see a registration form and other details on the same or any other page (allowed for subscribers only) with several fields that I want. Also a user can edit the registration form, save changes, but can submit it any time when he/she wants. Which plugin or plugins will be best?

Mitchell Bennis on "WP-Login Tweak to Stop Unauthorized Access and Keep Hackers Out"

$
0
0

Would love some feedback on this tweak that disallows general access to the login.php page. It requires that a PIN be passed to the login page. No PIN, no access, goodbye. Sick of the bad guys pounding on my websites.

// WordPress Tweak - Stop Unauthorized Access - Keep Hackers Out
// Author: email redacted - rev 11.30.15
// 1) Add this snippet to the top of the WordPress wp-login.php file, right after the bootstrap line.
// 2) Create a PIN and update the constant
// 3) Pass the PIN thru the login URL in order to access the page: /wp-login.php?eePIN=xxxx
// ... Otherwise you get redirect away and never see the login form. So long bad guys...

// The page access PIN
define('eePIN', 'xxxxx'); // Set to whatever your heart desires.

// The Redirect URL
define ('eeAWAY', 'http://elementengage.com/welcome-hackers/'); // Same same, but you can leave it like this.

if(@$_POST['log'] OR (@$_GET['action'] == 'logout' AND check_admin_referer('log-out'))) { // Login or Logout
	// Proceed normally

} elseif(@$_GET['loggedout']) {  // Logged out

	header('Location: http://' . $_SERVER['HTTP_HOST']);
	exit;

} else {

	// This PIN must be passed in order to access this page
	$thePIN = @$_GET['eePIN'];
	if($thePIN != eePIN) {
		header('Location: ' . $eeAway);
		exit;
	}
}

netboy78 on "how to change link available on all post_content?"

$
0
0

how to change link on all post_content like :
domain.com/12345-ebook-guitar to domain.com/12345
domain.com/454545-ebook-piano to domain.com/454545
domain.com/78910-cook-book to domain.com/78910

how to remove anythng after domain.com/12345 remove---->-ebook-guitar

how to do this?

Please help me..

fariss49 on "Add a button to change the post permalink"

$
0
0

Hello
I need help to custom the admin area, my need is to go to the posts and select some posts and click a button that i need to add after that the action is to change the permalink for the selected posts (add 1 in the the end of the permalink) and change the published date to today date
Thank you

chardon nicholas on "Make post sticky based on user role"

$
0
0

I need a way to make post sticky by user role (the role is named Unlimited)
What files do I edit and what changes should I make? Please help if you know how to do this


megafreechips on "Calypso on Self-Hosted Site."

$
0
0

Anyone already running Calypso with a self-hosted site?
Nice to hear some insights if anyone tried that out...
Would be also awesome to see major plugins like ACF & Yoast adapt to this major change.
Cheers.

Scott Smith on "Minor bug discovered on line 1158 in category-template.php"

$
0
0

Hi everyone,

First post, so please be nice. I'm getting the following warning

Warning: array_map(): Argument #2 should be an array in /home/xxxxxxxxx/public_html/wp-includes/category-template.php on line 1158

Commenting out the following line in category-template.php seems to correct the issue:

$terms = array_map( 'get_term', $terms );

Kindest regards
Scott Smith.

monovabona on "Admin hierarchy and top-admin protection"

$
0
0

Hi,

Can any user with full admin privileges (ALL capabilities turned on) be hidden from other users with admin privileges (with comparatively lesser capabilities turned on) in the 'Users' area (list_users)? I want to create a sort of hierarchy of administrator roles and users, where the user with the top admin role with ALL capabilities should be hidden (or at least undeletable, unremovable and uneditable) from other users with lesser admin roles and capabilities - in the 'Users' area. Is this possible? Is there any plugin for this, and if not, is there any other way to achieve this?

Regards.

nlegler on "Allowing User Submitted Tags"

$
0
0

I have a site that is acting as a directory that is utilizing WP Job Manger and I'd like the ability like on here were the submitting user would be able to put in their own tags. If they have been used before awesome they would select it but if it has not been it would be added to the overall sites tags.

vspef on "WooCommerce: add shipping adress field to #order_review"

$
0
0

Hello,

Summary:
Which woo templates should be edited, to add custom field to #order_review, shipping methods. Field should appear, when default woo shipping methods chosen.

In details:
I use additional shipping methods plugins. When this custom plugin is picked in #order_review, additional fields appear there. See screenshot:
https://www.dropbox.com/s/a0ngvy8bj70wmps/woo.png?dl=0
I want to add adress fields, which currently are in #billing_fields, to the same place of #order_review for default woo shipping methods, and remove them from #shipping_fields and #billing_fields (already done), to much one style for all shipping methods. Because, for this moment its looks not fine, that different shipping methods fields appear in different places of checkout page. I want to organise them to appear only in one place. But since i'm new with woo, I can't find which template and in which way I need to edit to make this.

wrimomatt on "display custom meta data on any theme?"

$
0
0

I'm new to plugin development and have created a simple plugin that creates:

  1. a custom post type
  2. a couple of taxonomies for the post type
  3. custom boxes to collect additional post meta data

My question: is there a way to add that collected post meta data to a theme's existing templates, say an archive? It's super easy to display in a custom theme, but I want it to work on any theme.

utnalove on "Rich snippets for articles - how to?"

$
0
0

Hi, anybody has any idea on how to well implement Rich snippets for articles on Wordpress?

I can see google is asking since 1-3 months the thumbnails to be marked in a specific way: https://developers.google.com/structured-data/rich-snippets/articles

For example in my sites I am having now this kind of errors (from google snippets validator):

image:	https://mysite.com/myimage.jpg
author:	missing and required
name:	missing and required
publisher:	missing and required
mainEntityOfPage:	missing and recommended

Is there a way or a plugin that allows me to choose an author, publisher, etc for the thumbnails?
This is to meet the new google guidelines for articles snippets


lorddemos90 on "Need To Display Subcategories On Category Page and Hide Them From Main Page"

$
0
0

So I need to do two things with my wordpress page. I have a custom categories page that lists all the categories as a thumbnail grid. If clicked, it goes to that category page and shows all posts in that category as a list. I realized that there are too many items and that I need to break them up into subcategories.

1st thing I need to do is have it so ONLY the parent categories are displayed on the category listing page.

2nd thing I need to do is on the actual category page, I need it to display ONLY the subcategories if the category has subcategories OR show the posts if there are no subcategories. If there are BOTH subcategories AND posts in the parent category, I need it to display the subcategories FOLLOWED by the posts in the parent category.

I'm not very good at coding and I know the very basics of WordPress integration, so I'm going to need help with this. Here are both codes.

MAIN CATEGORY LISTING PAGE

<?php /* Template Name: Product Catalog */ ?>

<?php get_header(); ?>

<div id="pagecontent">

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

<h1><?php the_title(); ?></h1>

<ul class="categorylist">

<?php
$args=array(
  'orderby' => 'name',
  'order' => 'ASC',
   'exclude' => '63,14,4,5,1',
)
?>
 <?php foreach (get_categories( $args ) as $cat) : ?>

<li><a>term_id); ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /></a>
<a>term_id); ?>"><?php echo $cat->cat_name; ?></a></li>
 <?php endforeach; ?>

<?php endwhile; ?>

<?php endif; ?>

</div>

<?php get_footer(); ?>

CATEGORY LISTING PAGE

<?php get_header(); ?>

<div id="pagecontent">

<h1><?php single_cat_title(''); ?></h1>

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

 <div class="searchitem"> <a>"><?php the_post_thumbnail( array(150,150) ); ?></a>
      <h2><a>"><?php the_title(); ?></a></h2>
      <strong>Part Number</strong>: <?php the_field('part_number'); ?>
      <?php the_excerpt(); ?>
        <strong><a>">[<?php the_field('bottomlinktitle'); ?>]</a></strong>
         <?php the_tags( '<strong>Crosses To:</strong> ', ', ', '' ); ?>
    </div>

<div class="category-entry">

 </div>
<?php endwhile; ?>

<div class="navigation" style="margin-top: 20px;">

<?php wp_pagenavi(); ?>

</div>

<?php endif; ?>

</div>

<?php get_footer(); ?>

Mago7891 on "Schema.org on Woocommerce"

$
0
0

I am inserting microdata on the free products of my website.

The problem is about price. When I test microdata on this link https://developers.google.com/structured-data, Google show me this error:

<p itemprop="price" class="price"><span class="amount">Gratis!</span></p>

I have got italian version of WordPress and "Gratis!" means "For free!".

The system accepts only "0" value, but not "For free!".

How can I change this value without show on my website "0" ?
I am a PHP beginner. If you got a good walk-through or a good tutorial about this, I would be thankful.

milosczv on "Unable to remove footer"

$
0
0

Hello, I would really appreciate it if someone could help me with footer removing from the theme (Garage).

Here is the code from footer:

<?php global $SMTheme;?>

    </div>
    </div>
</div>
<?php
if ($SMTheme->get( 'social', 'showsocial')) {
	$SMTheme->block_social();
}
?>
<div id='content-bottom' class='container'></div>
<div id='footer'><div class='footer-inner'>

		<div class='container clearfix'>
		<?php if ($SMTheme->get("layout","footerwidgets")) { ?>
		<div class='footer-widgets-container'><div class='footer-widgets'>
			<div class='widgetf'>
				<?php if ( !function_exists("dynamic_sidebar") || !dynamic_sidebar("footer_1") ) : ?>
				<?php
					$SMTheme->go_func("footer_1");
				?>
				<?php endif; ?>
			</div>

			<div class='widgetf'>
				<?php if ( !function_exists("dynamic_sidebar") || !dynamic_sidebar("footer_2") ) : ?>
				<?php
					$SMTheme->go_func("footer_2");
				?>
				<?php endif; ?>
			</div>

			<div class='widgetf widgetf_last'>
				<?php if ( !function_exists("dynamic_sidebar") || !dynamic_sidebar("footer_3") ) : ?>
				<?php
					$SMTheme->go_func("footer_3");
				?>
				<?php endif; ?>
			</div>
		</div></div>
		<?php } ?>

		</div>

<?php wp_footer(); ?>
</div> <?php //footer-inner ?>
<div class='footer_txt'><div class='container'>
			<?php
                    if ($SMTheme->get( "layout","footertext" )) {
                        echo $SMTheme->get( "layout","footertext" );
                    } else {
                        ?>Copyright &copy; <?php echo date("Y"); ?>  <a href="<?php echo home_url(); ?>"><?php bloginfo("name"); ?></a><?php
						echo (get_bloginfo('description'))?' - '.get_bloginfo('description'):'';
                    }
                ?>
				<?php /*
					All links in the tag <div class='smthemes'> are attribution of the theme developers and should remain intact.
					It's protected by Creative Commons License (http://creativecommons.org/licenses/by/3.0/).
					Warning! Your site will not be able to work if these links are edited or deleted.
					You can buy this theme without footer links online at http://smthemes.com/buy/garage/
				*/ ?>
				<div class='smthemes'>Designed by <a href='http://motorcademag.com/' target='_blank'>r4</a>, thanks to: <a href='http://couldihavemadeit.com/' target='_blank'>r4 3ds</a>, <a href='http://votreblogue.com/' target='_blank'>Votre blog</a> and <a href='http://yahoovictims.com/' target='_blank'>HCG Injections Diet</a></div>
		</div></div>
</div> <?php //footer ?>
</div> <?php //all ?>
<?php
	echo $SMTheme->get( "integration","footercode" );
?>
</body>
</html>

And here you can check whats happening (red line at the bottom) when I remove the DIV code that contain "Designed by..." text from the footer:
http://kljucservisnovisad.ml/

Thanks a lot!!

caylean on "Change header.php Title Tag Problem"

$
0
0

Hello together,

I have A LOT of old Layouts that were working with the old Display method for the Title. By now I had it in a way that seemed pretty nice for me and it worked.

Now 4.4 came and kicked me in the balls :)

My old Title-Tag was empty and a second one created below .... or the second one was there all along, but as the first one was still working i never realized it.

Be it as it is... I need a little help.

I have used this for my Title Tag Display:
<title><?php wp_title( '|', true, 'right' ); ?></title>
<meta name="DC.Title" content="<?php wp_title( '|', true, 'right' ); ?>">
<meta property="og:site_name" content="<?php wp_title( '|', true, 'right' ); ?>">
<meta property="og:title" content="<?php wp_title( '|', true, 'right' ); ?>">

Now with this new Version I do get ONLY
<title>NEW TITLE</title>

How can I add the three other ones WITHOUT Plugins and shit?

Kind regards

Palani Velayudam on "adding same details in another table of wp_posts post type attachment"

$
0
0

hi guys,
while uploading new media it will insert in wp_posts as attachment.

i want to add a the some details like id, filename, .. to the another table.. how can i add the same details to the other table.?

thanku :)

Viewing all 8245 articles
Browse latest View live




Latest Images