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

jesseslam on "Category Featured Image With Custom External URL"

$
0
0

Hi,

I am trying to add category featured images that I can add a custom external url to for the purposes of this site we are working on http://www.chalkmedia.co.uk/railpro/category/railpro-magazine. This is their existing site http://www.railpro.co.uk/magazine/ which works in the way we want if you click the years and months the cover changes.

Basically when you click on any of the years or months for the magazine archives we want to show the cover image and link to the image to an issue.com online version. I want them to be able to set the featured image for the category in the category edit screen and attach the link at the same time. Can anyone let me know how to do this?

I have installed this plugin https://wordpress.org/plugins/category-featured-images/ which works well but you can't add a custom external url to them.

Thanks,

Jim Isles


Guido on "Custom field (get_post_meta) issue"

$
0
0

Hi,

I'm having trouble to display the value of a custom select field in frontend of my website.

1) I have added this custom select field in backend:

woocommerce_wp_select(
array(
	'id'      => 'myfieldname',
	'label'   => __( 'My Select Field', 'woocommerce' ),
	'options' => array(
		'one'   => __( 'Option 1', 'woocommerce' ),
		'two'   => __( 'Option 2', 'woocommerce' ),
		'three' => __( 'Option 3', 'woocommerce' )
		)
	)
);

2) I save value like this:

update_post_meta( $post_id, 'myfieldname', esc_attr( $_POST['myfieldname'] ) );

3) Display it on frontend:

echo get_post_meta(get_the_ID(), 'myfieldname', true );

BUT, after I select for example 'option 2' in backend, this is displayed in frontend like this: 'two'

So part 'Option 2' is not displayed. Guess something's wrong with code of step 3?

Guido

Sarief on "check_admin_referer( 'import-upload' ); - what is this?"

$
0
0

Hello, this is my second day of working with plugins. It may be an obvious question, but I can't seem to find the answer to it.

I've been deconstructing "wordpress-importer" plugin (tools-import-import wordpress) to learn how this all works. At the same time I tried to build my version of import that would update one meta field based on the other meta field (for example if meta_id == 56 then meta_price == 1000).
but following steps "wordpress-import" took i can't understand what the code means.

so, what is check_admin_referer( 'import-upload' ); ? I know what admin referer does but I can't seem to grasp what 'import-upload' points to.

As of now I'm getting 'ERROR: The wordpress importer is invalid or is not installed.'.

I hope for answers or any pointers since I'm stuck without any pointer as to what the problem is about. Hopefully, thanks.

sunnyshark on "How to disable "wpautop" ONLY TO PAGE? (and not to posts?)"

$
0
0

I find this useful to add in functions.php to disable "wpautop".

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

But, I would like to have it process ONLY PAGES, AND NOT TO POSTS.

How is that possible?

wephotoboothyou on "No front page template"

$
0
0

Hello,

When trying to create a new page I am unable to select a front page template under page attributes. My only options are 'Default Template', 'Full-Width Page' and 'Page With Left Sidebar'.

I am using enigma theme 1.7.1. I know it is not the latest version but there is an issue with the latest version not displaying all setting correctly in theme options.

Thanks,

nwp_developer on "Wp_customize_image_control Use Add Media"

$
0
0

Is there a way to use the Add Media in the wp_customize_image_control for Theme Customizations? The default image_control is very bare bones and only allows uploading of an image. There's no selection from the library or editing options.

nwp_developer on "Theme Customizer Menu Item Order"

$
0
0

How are the menu items inside the Theme Customizer ordered? There's a priority setting in add_section for the menu categories. However, I'm not clear on how the individual items are ordered.

I assumed the order is by the add_control order and maybe the add_setting, but that doesn't seem to be the case. Well...that was the logic when I had 4 or less menu items and now with 8 the order is a little jumbled up.

KeithAdv on "Beginner needs PHP help on arrays"

$
0
0

I'm using a theme that creates a custom post type with the name "Events."

Here's the code that creates it from the theme's functions.php:

add_action('init', 'create_event');

function create_event() {
    	$event_args = array(
        	'label' => __('Events', 'jollytheme' ),
        	'singular_label' => __('Event Item', 'jollytheme' ),
        	'public' => true,
        	'show_ui' => true,
        	'capability_type' => 'post',
        	'hierarchical' => false,
        	'rewrite' => array('slug' => __('event', 'jollytheme' )) ,
        	'supports' => array('title', 'editor', 'thumbnail','comments'),
			'taxonomies' => array('post_tag')
        );
    	register_post_type('event',$event_args);
	}

This is the line I'm concerned with:

'rewrite' => array('slug' => __('event', 'jollytheme' )) ,

It turns out that naming the slug "event" here conflicts with a plugin on that site. I'm not actually using this post type and don't plan to. Luckily, I found out that I can simply change the name of the slug on this line and everything will work fine. So, I'm OK with this kludgy solution.

Unless, of course, the theme updates. That's why I always try to do my changes in child themes.

So, that leads to my question. Is there code I can put in my child theme's functions.php that will make that change, so I can leave the theme's actual functions.php untouched? I've already discovered that I can't just take the above code and replicate it there because it causes a "cannot redeclare" error.

Grateful for all suggestions...


alifs on "add category in page"

$
0
0

hi
I wrote code like this adds tabs. Now, I also want him to be classified. What should I do?

// teach post type
	$labelsTeach = array(
		'name' => 'آموزش',
		'add_new' => 'افزودن مطلب',
		'add_new_item' => 'افزودن مطلب',
		'edit_item' => 'ویرایش مطلب',
		'new_item' => 'مطلب جدید ',
		'view_item' => 'نمایش مطلب',
		'search_items' => 'جستجوی مطلب',
		'not_found' => 'مطلب یافت نشد',
		'not_found_in_trash' => 'مطلب در زباله‌دان یافت نشد',
		'menu_name' => 'آموزش',
	);
	$argsTeach = array(
		'labels' => $labelsTeach ,
		'label' => 'مطالب ',
		'hierarchical' => false,
		'description' => 'آموزش',
		'supports' => array( 'title', 'editor' ) ,
		'public' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'menu_position' => 5,
		//'menu_icon' => get_template_directory_uri() . "/images/news.png",
		'show_in_nav_menus' => true,
		'publicly_queryable' => true,
		'exclude_from_search' => true,
		'has_archive' => true,
		'query_var' => true,
		'can_export' => true,
		'rewrite' => array('slug' => 'teach'),
		'_builtin' => false,
		'capability_type' => 'post'
	);

	register_post_type( 'teach', $argsTeach );

jobvacanciesinng on "Phishing"

$
0
0

My site jobvacanciesinng.com was phishing. Although unknown to me but my host suspended my account and asked to rectify. But I changed the host because since joining them I have lost about 800 of my posts cause of hackers. But upon pointing my site to new host, it redirects me to another site not mine and when I checked my whois info, it hasn't changed still with my old host after 24hrs. Any solution pls.

DillonGlasser on "making a script into a plugin"

$
0
0

Hello,

I'm trying to call up my .js file in my php file. I added both files into the plugin directory in a folder and wordpress recognizes the plugin. But I must have done something wrong because the .js file is said to be inactive and does not work.

I'm inexperienced with this, can anyone point out my error? Or point me in the right direction?

<?php
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
function wpb_adding_scripts() {
	wp_register_script( 'downloadimagescript', plugins_url() . '/js/downloadimagescript.js', array('jquery'));
	wp_enqueue_scripts('downloadimagescript');
}
?>

Thanks

dwest100 on "referring URL question"

$
0
0

Hi,
I need to capture a referring URL and keep it for reference later.
I'm new to programming.
I know I can capture the referring URL with
$orig_post_url = wp_get_referer();

The particular PHP page is a product page and updates when someone adds an option to their cart...a message indicates that the item has been added upon updating. However the referring URL then is that page. I need the original url to NOT be overwritten.

How can I accommodate that?

Travis on "Proper way to add_filter with shortcode"

$
0
0

Greetings,

My plugin RSS Retriever, located here: https://wordpress.org/plugins/wp-rss-retriever/ is a simple shortcode plugin which fetchs and displays an RSS feed.

I've had a few requests to add support for using the shortcode inside a text widget. The following filter will do this:

add_filter( 'widget_text', 'do_shortcode' );

However, I'm not sure what would be the proper, or WordPress way, of doing this. Should I just add another attribute to the shortcode, something like "widget=true" or is there a more recommended way of doing this? I don't want to clutter the shortcode with too many attributes...

Thanks for any help!
- Travis

Aboibrahim on "need a plugin that show notification by a certain function"

$
0
0

I made a shortcodes im my wordpress site and it works prefectly

in my shortcode I need to write an any function that will work when a problem occur to notify the admins about the problem

Example about what I need in the short code function

if ($var1 == '') {
    functionname();
} else {
    $var2 = $var1;
}
return $var2;

this is only a simple example

I want the functionname(); to notify the admins about the problem

Thanx

MonkeyFern on "Link added to header"

$
0
0

Hello, My client's website seems to have been hacked. A text link has been added in the header which can't be seen when logged into admin.
How do I remove it?

http://www.danielsumegi.com/


Amit Kvint on "Widget Text for widget content"

$
0
0

I am trying to do that:

public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
$content = apply_filters( 'widget_text', $instance['content'] );

Using apply_filters( 'widget_text' (http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text)

Thing is only the 'title' works but the 'content' does not seem to work. The documentation is very un clear it says 'May also apply to some third party widgets as well'

Does anyone have an idea / experience with the 'widget_text' filter?

Cheers!

Please Add Screenshots on "How would I automatically append/suffix the post title with post ID"

$
0
0

How would I automatically append/suffix the post title with post ID?

e.g.
If I publish my post with the title "How to make a widget" when I use the <?php the_title(); ?> tag, the post title is displayed as "How to make a widget - 34" (assuming the post ID is 34.

Rob on "get_permalink post id outside loop"

$
0
0

Hi,

I've been struggling with this question for a while and altho there's some topics regarding this subject I'm not sure how to implement it. It's regarding social buttons on homepage sharingthe articles clicked on.

I have to use <script type="text/javascript" charset="utf-8" >var bShareOpt = {url: "<?php echo get_permalink(); ?>"};</script> which shows the permalink of the last ID instead of the link clicked on. If I add the post_id number <?php echo get_permalink(2926); ?> it shows the correct post.

Now this is because it happens outside the loop.

Other topics regarding getting post id outside the loop:
get-a-posts-id
wordpress-get-the-page-id-outside-the-loop
accessing-post-id-outside-of-the-loop-for-listing-child-pages

Using get_queried_object_id or get_queried_object is apparently another option to do so.

But unfortunately my PHP knowledge is very limited in order to glue the pieces together. I appreciate any help!

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

$
0
0

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

SuperStu on "Parse Error: Sytax Error"

$
0
0

Parse error: syntax error, unexpected '<' in /home/content/40/7587340/html/wp-content/themes/thesis_182/custom/custom_functions.php on line 23

THIS IS WHAT THE INFORMATION THAT WAS EDITED:

function top_links1 () {?>
<div class= "toplinks1"> sales@StewartEnterprisesinc.com</div>
<?php
}

add_action ('thesis_hook_header' , 'top_links1');

function top_links2 () {?>
<div class= "toplinks2"> <img src="http://www.pdamarketing.net/Clients/Stewart/wp-content/uploads/2012/08/facebook2.png" alt="facebook"><img src="http://www.pdamarketing.net/Clients/Stewart/wp-content/uploads/2012/08/leadsafe2.png" alt="lead safe epa"><img src="http://www.pdamarketing.net/Clients/Stewart/wp-content/uploads/2012/08/angieslist.png" alt="angies list"></div>
<?php
}

add_action ('thesis_hook_header' , 'top_links2');

function services () {?>

Viewing all 8245 articles
Browse latest View live




Latest Images